v8  3.11.10(node0.8.26)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
v8.h
Go to the documentation of this file.
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
38 #ifndef V8_H_
39 #define V8_H_
40 
41 #include "v8stdint.h"
42 
43 #ifdef _WIN32
44 
45 // Setup for Windows DLL export/import. When building the V8 DLL the
46 // BUILDING_V8_SHARED needs to be defined. When building a program which uses
47 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
48 // static library or building a program which uses the V8 static library neither
49 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
50 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
51 #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
52  build configuration to ensure that at most one of these is set
53 #endif
54 
55 #ifdef BUILDING_V8_SHARED
56 #define V8EXPORT __declspec(dllexport)
57 #elif USING_V8_SHARED
58 #define V8EXPORT __declspec(dllimport)
59 #else
60 #define V8EXPORT
61 #endif // BUILDING_V8_SHARED
62 
63 #else // _WIN32
64 
65 // Setup for Linux shared library export.
66 #if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED)
67 #ifdef BUILDING_V8_SHARED
68 #define V8EXPORT __attribute__ ((visibility("default")))
69 #else
70 #define V8EXPORT
71 #endif
72 #else // defined(__GNUC__) && (__GNUC__ >= 4)
73 #define V8EXPORT
74 #endif // defined(__GNUC__) && (__GNUC__ >= 4)
75 
76 #endif // _WIN32
77 
81 namespace v8 {
82 
83 class Context;
84 class String;
85 class StringObject;
86 class Value;
87 class Utils;
88 class Number;
89 class NumberObject;
90 class Object;
91 class Array;
92 class Int32;
93 class Uint32;
94 class External;
95 class Primitive;
96 class Boolean;
97 class BooleanObject;
98 class Integer;
99 class Function;
100 class Date;
101 class ImplementationUtilities;
102 class Signature;
103 class AccessorSignature;
104 template <class T> class Handle;
105 template <class T> class Local;
106 template <class T> class Persistent;
107 class FunctionTemplate;
108 class ObjectTemplate;
109 class Data;
110 class AccessorInfo;
111 class StackTrace;
112 class StackFrame;
113 class Isolate;
114 
115 namespace internal {
116 
117 class Arguments;
118 class Object;
119 class Heap;
120 class HeapObject;
121 class Isolate;
122 }
123 
124 
125 // --- Weak Handles ---
126 
127 
138  void* parameter);
139 
140 
141 // --- Handles ---
142 
143 #define TYPE_CHECK(T, S) \
144  while (false) { \
145  *(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
146  }
147 
173 template <class T> class Handle {
174  public:
178  inline Handle() : val_(0) {}
179 
183  inline explicit Handle(T* val) : val_(val) {}
184 
195  template <class S> inline Handle(Handle<S> that)
196  : val_(reinterpret_cast<T*>(*that)) {
202  TYPE_CHECK(T, S);
203  }
204 
208  inline bool IsEmpty() const { return val_ == 0; }
209 
213  inline void Clear() { val_ = 0; }
214 
215  inline T* operator->() const { return val_; }
216 
217  inline T* operator*() const { return val_; }
218 
225  template <class S> inline bool operator==(Handle<S> that) const {
226  internal::Object** a = reinterpret_cast<internal::Object**>(**this);
227  internal::Object** b = reinterpret_cast<internal::Object**>(*that);
228  if (a == 0) return b == 0;
229  if (b == 0) return false;
230  return *a == *b;
231  }
232 
239  template <class S> inline bool operator!=(Handle<S> that) const {
240  return !operator==(that);
241  }
242 
243  template <class S> static inline Handle<T> Cast(Handle<S> that) {
244 #ifdef V8_ENABLE_CHECKS
245  // If we're going to perform the type check then we have to check
246  // that the handle isn't empty before doing the checked cast.
247  if (that.IsEmpty()) return Handle<T>();
248 #endif
249  return Handle<T>(T::Cast(*that));
250  }
251 
252  template <class S> inline Handle<S> As() {
253  return Handle<S>::Cast(*this);
254  }
255 
256  private:
257  T* val_;
258 };
259 
260 
268 template <class T> class Local : public Handle<T> {
269  public:
270  inline Local();
271  template <class S> inline Local(Local<S> that)
272  : Handle<T>(reinterpret_cast<T*>(*that)) {
278  TYPE_CHECK(T, S);
279  }
280  template <class S> inline Local(S* that) : Handle<T>(that) { }
281  template <class S> static inline Local<T> Cast(Local<S> that) {
282 #ifdef V8_ENABLE_CHECKS
283  // If we're going to perform the type check then we have to check
284  // that the handle isn't empty before doing the checked cast.
285  if (that.IsEmpty()) return Local<T>();
286 #endif
287  return Local<T>(T::Cast(*that));
288  }
289 
290  template <class S> inline Local<S> As() {
291  return Local<S>::Cast(*this);
292  }
293 
298  inline static Local<T> New(Handle<T> that);
299 };
300 
301 
319 template <class T> class Persistent : public Handle<T> {
320  public:
325  inline Persistent();
326 
338  template <class S> inline Persistent(Persistent<S> that)
339  : Handle<T>(reinterpret_cast<T*>(*that)) {
345  TYPE_CHECK(T, S);
346  }
347 
348  template <class S> inline Persistent(S* that) : Handle<T>(that) { }
349 
354  template <class S> explicit inline Persistent(Handle<S> that)
355  : Handle<T>(*that) { }
356 
357  template <class S> static inline Persistent<T> Cast(Persistent<S> that) {
358 #ifdef V8_ENABLE_CHECKS
359  // If we're going to perform the type check then we have to check
360  // that the handle isn't empty before doing the checked cast.
361  if (that.IsEmpty()) return Persistent<T>();
362 #endif
363  return Persistent<T>(T::Cast(*that));
364  }
365 
366  template <class S> inline Persistent<S> As() {
367  return Persistent<S>::Cast(*this);
368  }
369 
374  inline static Persistent<T> New(Handle<T> that);
375 
382  inline void Dispose();
383 
390  inline void MakeWeak(void* parameters, WeakReferenceCallback callback);
391 
393  inline void ClearWeak();
394 
402  inline void MarkIndependent();
403 
407  inline bool IsNearDeath() const;
408 
412  inline bool IsWeak() const;
413 
418  inline void SetWrapperClassId(uint16_t class_id);
419 
420  private:
422  friend class ObjectTemplate;
423 };
424 
425 
441  public:
442  HandleScope();
443 
444  ~HandleScope();
445 
450  template <class T> Local<T> Close(Handle<T> value);
451 
455  static int NumberOfHandles();
456 
460  static internal::Object** CreateHandle(internal::Object* value);
461  // Faster version, uses HeapObject to obtain the current Isolate.
462  static internal::Object** CreateHandle(internal::HeapObject* value);
463 
464  private:
465  // Make it impossible to create heap-allocated or illegal handle
466  // scopes by disallowing certain operations.
467  HandleScope(const HandleScope&);
468  void operator=(const HandleScope&);
469  void* operator new(size_t size);
470  void operator delete(void*, size_t);
471 
472  // This Data class is accessible internally as HandleScopeData through a
473  // typedef in the ImplementationUtilities class.
474  class V8EXPORT Data {
475  public:
476  internal::Object** next;
477  internal::Object** limit;
478  int level;
479  inline void Initialize() {
480  next = limit = NULL;
481  level = 0;
482  }
483  };
484 
485  void Leave();
486 
487  internal::Isolate* isolate_;
488  internal::Object** prev_next_;
489  internal::Object** prev_limit_;
490 
491  // Allow for the active closing of HandleScopes which allows to pass a handle
492  // from the HandleScope being closed to the next top most HandleScope.
493  bool is_closed_;
494  internal::Object** RawClose(internal::Object** value);
495 
497 };
498 
499 
500 // --- Special objects ---
501 
502 
506 class V8EXPORT Data {
507  private:
508  Data();
509 };
510 
511 
518 class V8EXPORT ScriptData { // NOLINT
519  public:
520  virtual ~ScriptData() { }
521 
528  static ScriptData* PreCompile(const char* input, int length);
529 
538  static ScriptData* PreCompile(Handle<String> source);
539 
547  static ScriptData* New(const char* data, int length);
548 
552  virtual int Length() = 0;
553 
558  virtual const char* Data() = 0;
559 
563  virtual bool HasError() = 0;
564 };
565 
566 
571  public:
572  inline ScriptOrigin(
573  Handle<Value> resource_name,
574  Handle<Integer> resource_line_offset = Handle<Integer>(),
575  Handle<Integer> resource_column_offset = Handle<Integer>())
576  : resource_name_(resource_name),
577  resource_line_offset_(resource_line_offset),
578  resource_column_offset_(resource_column_offset) { }
579  inline Handle<Value> ResourceName() const;
580  inline Handle<Integer> ResourceLineOffset() const;
581  inline Handle<Integer> ResourceColumnOffset() const;
582  private:
583  Handle<Value> resource_name_;
584  Handle<Integer> resource_line_offset_;
585  Handle<Integer> resource_column_offset_;
586 };
587 
588 
593  public:
609  static Local<Script> New(Handle<String> source,
610  ScriptOrigin* origin = NULL,
611  ScriptData* pre_data = NULL,
612  Handle<String> script_data = Handle<String>());
613 
624  static Local<Script> New(Handle<String> source,
625  Handle<Value> file_name);
626 
643  static Local<Script> Compile(Handle<String> source,
644  ScriptOrigin* origin = NULL,
645  ScriptData* pre_data = NULL,
646  Handle<String> script_data = Handle<String>());
647 
661  static Local<Script> Compile(Handle<String> source,
662  Handle<Value> file_name,
663  Handle<String> script_data = Handle<String>());
664 
672  Local<Value> Run();
673 
677  Local<Value> Id();
678 
684  void SetData(Handle<String> data);
685 };
686 
687 
692  public:
693  Local<String> Get() const;
694  Local<String> GetSourceLine() const;
695 
700  Handle<Value> GetScriptResourceName() const;
701 
706  Handle<Value> GetScriptData() const;
707 
713  Handle<StackTrace> GetStackTrace() const;
714 
718  int GetLineNumber() const;
719 
724  int GetStartPosition() const;
725 
730  int GetEndPosition() const;
731 
736  int GetStartColumn() const;
737 
742  int GetEndColumn() const;
743 
744  // TODO(1245381): Print to a string instead of on a FILE.
745  static void PrintCurrentStackTrace(FILE* out);
746 
747  static const int kNoLineNumberInfo = 0;
748  static const int kNoColumnInfo = 0;
749 };
750 
751 
758  public:
764  kLineNumber = 1,
765  kColumnOffset = 1 << 1 | kLineNumber,
766  kScriptName = 1 << 2,
767  kFunctionName = 1 << 3,
768  kIsEval = 1 << 4,
769  kIsConstructor = 1 << 5,
770  kScriptNameOrSourceURL = 1 << 6,
771  kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName,
772  kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
773  };
774 
778  Local<StackFrame> GetFrame(uint32_t index) const;
779 
783  int GetFrameCount() const;
784 
788  Local<Array> AsArray();
789 
797  static Local<StackTrace> CurrentStackTrace(
798  int frame_limit,
799  StackTraceOptions options = kOverview);
800 };
801 
802 
807  public:
814  int GetLineNumber() const;
815 
823  int GetColumn() const;
824 
829  Local<String> GetScriptName() const;
830 
836  Local<String> GetScriptNameOrSourceURL() const;
837 
841  Local<String> GetFunctionName() const;
842 
847  bool IsEval() const;
848 
853  bool IsConstructor() const;
854 };
855 
856 
857 // --- Value ---
858 
859 
863 class Value : public Data {
864  public:
869  inline bool IsUndefined() const;
870 
875  inline bool IsNull() const;
876 
880  V8EXPORT bool IsTrue() const;
881 
885  V8EXPORT bool IsFalse() const;
886 
891  inline bool IsString() const;
892 
896  V8EXPORT bool IsFunction() const;
897 
901  V8EXPORT bool IsArray() const;
902 
906  V8EXPORT bool IsObject() const;
907 
911  V8EXPORT bool IsBoolean() const;
912 
916  V8EXPORT bool IsNumber() const;
917 
921  V8EXPORT bool IsExternal() const;
922 
926  V8EXPORT bool IsInt32() const;
927 
931  V8EXPORT bool IsUint32() const;
932 
936  V8EXPORT bool IsDate() const;
937 
941  V8EXPORT bool IsBooleanObject() const;
942 
946  V8EXPORT bool IsNumberObject() const;
947 
951  V8EXPORT bool IsStringObject() const;
952 
956  V8EXPORT bool IsNativeError() const;
957 
961  V8EXPORT bool IsRegExp() const;
962 
970  V8EXPORT Local<Int32> ToInt32() const;
971 
977 
978  V8EXPORT bool BooleanValue() const;
979  V8EXPORT double NumberValue() const;
980  V8EXPORT int64_t IntegerValue() const;
981  V8EXPORT uint32_t Uint32Value() const;
982  V8EXPORT int32_t Int32Value() const;
983 
985  V8EXPORT bool Equals(Handle<Value> that) const;
986  V8EXPORT bool StrictEquals(Handle<Value> that) const;
987 
988  private:
989  inline bool QuickIsUndefined() const;
990  inline bool QuickIsNull() const;
991  inline bool QuickIsString() const;
992  V8EXPORT bool FullIsUndefined() const;
993  V8EXPORT bool FullIsNull() const;
994  V8EXPORT bool FullIsString() const;
995 };
996 
997 
1001 class Primitive : public Value { };
1002 
1003 
1008 class Boolean : public Primitive {
1009  public:
1010  V8EXPORT bool Value() const;
1011  static inline Handle<Boolean> New(bool value);
1012 };
1013 
1014 
1018 class String : public Primitive {
1019  public:
1023  V8EXPORT int Length() const;
1024 
1029  V8EXPORT int Utf8Length() const;
1030 
1037  V8EXPORT bool MayContainNonAscii() const;
1038 
1068  };
1069 
1070  // 16-bit character codes.
1071  V8EXPORT int Write(uint16_t* buffer,
1072  int start = 0,
1073  int length = -1,
1074  int options = NO_OPTIONS) const;
1075  // ASCII characters.
1076  V8EXPORT int WriteAscii(char* buffer,
1077  int start = 0,
1078  int length = -1,
1079  int options = NO_OPTIONS) const;
1080  // UTF-8 encoded characters.
1081  V8EXPORT int WriteUtf8(char* buffer,
1082  int length = -1,
1083  int* nchars_ref = NULL,
1084  int options = NO_OPTIONS) const;
1085 
1090  inline static v8::Local<v8::String> Empty(Isolate* isolate);
1091 
1095  V8EXPORT bool IsExternal() const;
1096 
1100  V8EXPORT bool IsExternalAscii() const;
1101 
1103  public:
1105 
1106  protected:
1108 
1115  virtual void Dispose() { delete this; }
1116 
1117  private:
1118  // Disallow copying and assigning.
1120  void operator=(const ExternalStringResourceBase&);
1121 
1122  friend class v8::internal::Heap;
1123  };
1124 
1132  : public ExternalStringResourceBase {
1133  public:
1139 
1143  virtual const uint16_t* data() const = 0;
1144 
1148  virtual size_t length() const = 0;
1149 
1150  protected:
1152  };
1153 
1166  : public ExternalStringResourceBase {
1167  public:
1174  virtual const char* data() const = 0;
1176  virtual size_t length() const = 0;
1177  protected:
1179  };
1180 
1185  inline ExternalStringResource* GetExternalStringResource() const;
1186 
1191  V8EXPORT const ExternalAsciiStringResource* GetExternalAsciiStringResource()
1192  const;
1193 
1194  static inline String* Cast(v8::Value* obj);
1195 
1205  V8EXPORT static Local<String> New(const char* data, int length = -1);
1206 
1208  V8EXPORT static Local<String> New(const uint16_t* data, int length = -1);
1209 
1211  V8EXPORT static Local<String> NewSymbol(const char* data, int length = -1);
1212 
1218  Handle<String> right);
1219 
1228  V8EXPORT static Local<String> NewExternal(ExternalStringResource* resource);
1229 
1239  V8EXPORT bool MakeExternal(ExternalStringResource* resource);
1249  ExternalAsciiStringResource* resource);
1250 
1260  V8EXPORT bool MakeExternal(ExternalAsciiStringResource* resource);
1261 
1265  V8EXPORT bool CanMakeExternal();
1266 
1268  V8EXPORT static Local<String> NewUndetectable(const char* data,
1269  int length = -1);
1270 
1272  V8EXPORT static Local<String> NewUndetectable(const uint16_t* data,
1273  int length = -1);
1274 
1283  public:
1284  explicit Utf8Value(Handle<v8::Value> obj);
1285  ~Utf8Value();
1286  char* operator*() { return str_; }
1287  const char* operator*() const { return str_; }
1288  int length() const { return length_; }
1289  private:
1290  char* str_;
1291  int length_;
1292 
1293  // Disallow copying and assigning.
1294  Utf8Value(const Utf8Value&);
1295  void operator=(const Utf8Value&);
1296  };
1297 
1306  public:
1307  explicit AsciiValue(Handle<v8::Value> obj);
1308  ~AsciiValue();
1309  char* operator*() { return str_; }
1310  const char* operator*() const { return str_; }
1311  int length() const { return length_; }
1312  private:
1313  char* str_;
1314  int length_;
1315 
1316  // Disallow copying and assigning.
1317  AsciiValue(const AsciiValue&);
1318  void operator=(const AsciiValue&);
1319  };
1320 
1327  class V8EXPORT Value {
1328  public:
1329  explicit Value(Handle<v8::Value> obj);
1330  ~Value();
1331  uint16_t* operator*() { return str_; }
1332  const uint16_t* operator*() const { return str_; }
1333  int length() const { return length_; }
1334  private:
1335  uint16_t* str_;
1336  int length_;
1337 
1338  // Disallow copying and assigning.
1339  Value(const Value&);
1340  void operator=(const Value&);
1341  };
1342 
1343  private:
1344  V8EXPORT void VerifyExternalStringResource(ExternalStringResource* val) const;
1345  V8EXPORT static void CheckCast(v8::Value* obj);
1346 };
1347 
1348 
1352 class Number : public Primitive {
1353  public:
1354  V8EXPORT double Value() const;
1355  V8EXPORT static Local<Number> New(double value);
1356  static inline Number* Cast(v8::Value* obj);
1357  private:
1358  V8EXPORT Number();
1359  V8EXPORT static void CheckCast(v8::Value* obj);
1360 };
1361 
1362 
1366 class Integer : public Number {
1367  public:
1368  V8EXPORT static Local<Integer> New(int32_t value);
1369  V8EXPORT static Local<Integer> NewFromUnsigned(uint32_t value);
1370  V8EXPORT int64_t Value() const;
1371  static inline Integer* Cast(v8::Value* obj);
1372  private:
1373  V8EXPORT Integer();
1374  V8EXPORT static void CheckCast(v8::Value* obj);
1375 };
1376 
1377 
1381 class Int32 : public Integer {
1382  public:
1383  V8EXPORT int32_t Value() const;
1384  private:
1385  V8EXPORT Int32();
1386 };
1387 
1388 
1392 class Uint32 : public Integer {
1393  public:
1394  V8EXPORT uint32_t Value() const;
1395  private:
1396  V8EXPORT Uint32();
1397 };
1398 
1399 
1401  None = 0,
1402  ReadOnly = 1 << 0,
1403  DontEnum = 1 << 1,
1404  DontDelete = 1 << 2
1405 };
1406 
1417 };
1418 
1424 typedef Handle<Value> (*AccessorGetter)(Local<String> property,
1425  const AccessorInfo& info);
1426 
1427 
1428 typedef void (*AccessorSetter)(Local<String> property,
1429  Local<Value> value,
1430  const AccessorInfo& info);
1431 
1432 
1447  DEFAULT = 0,
1449  ALL_CAN_WRITE = 1 << 1,
1451 };
1452 
1453 
1457 class Object : public Value {
1458  public:
1459  V8EXPORT bool Set(Handle<Value> key,
1460  Handle<Value> value,
1461  PropertyAttribute attribs = None);
1462 
1463  V8EXPORT bool Set(uint32_t index,
1464  Handle<Value> value);
1465 
1466  // Sets a local property on this object bypassing interceptors and
1467  // overriding accessors or read-only properties.
1468  //
1469  // Note that if the object has an interceptor the property will be set
1470  // locally, but since the interceptor takes precedence the local property
1471  // will only be returned if the interceptor doesn't return a value.
1472  //
1473  // Note also that this only works for named properties.
1474  V8EXPORT bool ForceSet(Handle<Value> key,
1475  Handle<Value> value,
1476  PropertyAttribute attribs = None);
1477 
1479 
1480  V8EXPORT Local<Value> Get(uint32_t index);
1481 
1488 
1489  // TODO(1245389): Replace the type-specific versions of these
1490  // functions with generic ones that accept a Handle<Value> key.
1491  V8EXPORT bool Has(Handle<String> key);
1492 
1493  V8EXPORT bool Delete(Handle<String> key);
1494 
1495  // Delete a property on this object bypassing interceptors and
1496  // ignoring dont-delete attributes.
1498 
1499  V8EXPORT bool Has(uint32_t index);
1500 
1501  V8EXPORT bool Delete(uint32_t index);
1502 
1504  AccessorGetter getter,
1505  AccessorSetter setter = 0,
1506  Handle<Value> data = Handle<Value>(),
1507  AccessControl settings = DEFAULT,
1508  PropertyAttribute attribute = None);
1509 
1517 
1524 
1531 
1537  V8EXPORT bool SetPrototype(Handle<Value> prototype);
1538 
1545 
1552 
1557 
1561  inline Local<Value> GetInternalField(int index);
1563  V8EXPORT void SetInternalField(int index, Handle<Value> value);
1564 
1566  inline void* GetPointerFromInternalField(int index);
1567 
1569  V8EXPORT void SetPointerInInternalField(int index, void* value);
1570 
1571  // Testers for local properties.
1574  V8EXPORT bool HasRealIndexedProperty(uint32_t index);
1576 
1582  Handle<String> key);
1583 
1590 
1593 
1596 
1602  V8EXPORT void TurnOnAccessCheck();
1603 
1611  V8EXPORT int GetIdentityHash();
1612 
1622 
1630  V8EXPORT bool IsDirty();
1631 
1637 
1642 
1650  V8EXPORT void SetIndexedPropertiesToPixelData(uint8_t* data, int length);
1654 
1663  void* data,
1664  ExternalArrayType array_type,
1665  int number_of_elements);
1670 
1676  V8EXPORT bool IsCallable();
1677 
1683  int argc,
1684  Handle<Value> argv[]);
1685 
1692  Handle<Value> argv[]);
1693 
1694  V8EXPORT static Local<Object> New();
1695  static inline Object* Cast(Value* obj);
1696 
1697  private:
1698  V8EXPORT Object();
1699  V8EXPORT static void CheckCast(Value* obj);
1700  V8EXPORT Local<Value> CheckedGetInternalField(int index);
1701  V8EXPORT void* SlowGetPointerFromInternalField(int index);
1702 
1707  inline Local<Value> UncheckedGetInternalField(int index);
1708 };
1709 
1710 
1714 class Array : public Object {
1715  public:
1716  V8EXPORT uint32_t Length() const;
1717 
1722  V8EXPORT Local<Object> CloneElementAt(uint32_t index);
1723 
1728  V8EXPORT static Local<Array> New(int length = 0);
1729 
1730  static inline Array* Cast(Value* obj);
1731  private:
1732  V8EXPORT Array();
1733  V8EXPORT static void CheckCast(Value* obj);
1734 };
1735 
1736 
1740 class Function : public Object {
1741  public:
1743  V8EXPORT Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
1745  int argc,
1746  Handle<Value> argv[]);
1748  V8EXPORT Handle<Value> GetName() const;
1749 
1757 
1762  V8EXPORT int GetScriptLineNumber() const;
1767  V8EXPORT int GetScriptColumnNumber() const;
1770  static inline Function* Cast(Value* obj);
1771  V8EXPORT static const int kLineOffsetNotFound;
1772 
1773  private:
1774  V8EXPORT Function();
1775  V8EXPORT static void CheckCast(Value* obj);
1776 };
1777 
1778 
1782 class Date : public Object {
1783  public:
1784  V8EXPORT static Local<Value> New(double time);
1785 
1790  V8EXPORT double NumberValue() const;
1791 
1792  static inline Date* Cast(v8::Value* obj);
1793 
1807 
1808  private:
1809  V8EXPORT static void CheckCast(v8::Value* obj);
1810 };
1811 
1812 
1816 class NumberObject : public Object {
1817  public:
1818  V8EXPORT static Local<Value> New(double value);
1819 
1823  V8EXPORT double NumberValue() const;
1824 
1825  static inline NumberObject* Cast(v8::Value* obj);
1826 
1827  private:
1828  V8EXPORT static void CheckCast(v8::Value* obj);
1829 };
1830 
1831 
1835 class BooleanObject : public Object {
1836  public:
1837  V8EXPORT static Local<Value> New(bool value);
1838 
1842  V8EXPORT bool BooleanValue() const;
1843 
1844  static inline BooleanObject* Cast(v8::Value* obj);
1845 
1846  private:
1847  V8EXPORT static void CheckCast(v8::Value* obj);
1848 };
1849 
1850 
1854 class StringObject : public Object {
1855  public:
1856  V8EXPORT static Local<Value> New(Handle<String> value);
1857 
1862 
1863  static inline StringObject* Cast(v8::Value* obj);
1864 
1865  private:
1866  V8EXPORT static void CheckCast(v8::Value* obj);
1867 };
1868 
1869 
1873 class RegExp : public Object {
1874  public:
1879  enum Flags {
1880  kNone = 0,
1881  kGlobal = 1,
1884  };
1885 
1896  V8EXPORT static Local<RegExp> New(Handle<String> pattern,
1897  Flags flags);
1898 
1904 
1908  V8EXPORT Flags GetFlags() const;
1909 
1910  static inline RegExp* Cast(v8::Value* obj);
1911 
1912  private:
1913  V8EXPORT static void CheckCast(v8::Value* obj);
1914 };
1915 
1916 
1928 class External : public Value {
1929  public:
1930  V8EXPORT static Local<Value> Wrap(void* data);
1931  static inline void* Unwrap(Handle<Value> obj);
1932 
1933  V8EXPORT static Local<External> New(void* value);
1934  static inline External* Cast(Value* obj);
1935  V8EXPORT void* Value() const;
1936  private:
1937  V8EXPORT External();
1938  V8EXPORT static void CheckCast(v8::Value* obj);
1939  static inline void* QuickUnwrap(Handle<v8::Value> obj);
1940  V8EXPORT static void* FullUnwrap(Handle<v8::Value> obj);
1941 };
1942 
1943 
1944 // --- Templates ---
1945 
1946 
1950 class V8EXPORT Template : public Data {
1951  public:
1953  void Set(Handle<String> name, Handle<Data> value,
1954  PropertyAttribute attributes = None);
1955  inline void Set(const char* name, Handle<Data> value);
1956  private:
1957  Template();
1958 
1959  friend class ObjectTemplate;
1960  friend class FunctionTemplate;
1961 };
1962 
1963 
1970 class Arguments {
1971  public:
1972  inline int Length() const;
1973  inline Local<Value> operator[](int i) const;
1974  inline Local<Function> Callee() const;
1975  inline Local<Object> This() const;
1976  inline Local<Object> Holder() const;
1977  inline bool IsConstructCall() const;
1978  inline Local<Value> Data() const;
1979  inline Isolate* GetIsolate() const;
1980 
1981  private:
1982  static const int kIsolateIndex = 0;
1983  static const int kDataIndex = -1;
1984  static const int kCalleeIndex = -2;
1985  static const int kHolderIndex = -3;
1986 
1988  inline Arguments(internal::Object** implicit_args,
1989  internal::Object** values,
1990  int length,
1991  bool is_construct_call);
1992  internal::Object** implicit_args_;
1993  internal::Object** values_;
1994  int length_;
1995  bool is_construct_call_;
1996 };
1997 
1998 
2004  public:
2006  : args_(args) { }
2007  inline Isolate* GetIsolate() const;
2008  inline Local<Value> Data() const;
2009  inline Local<Object> This() const;
2010  inline Local<Object> Holder() const;
2011 
2012  private:
2013  internal::Object** args_;
2014 };
2015 
2016 
2017 typedef Handle<Value> (*InvocationCallback)(const Arguments& args);
2018 
2023 typedef Handle<Value> (*NamedPropertyGetter)(Local<String> property,
2024  const AccessorInfo& info);
2025 
2026 
2031 typedef Handle<Value> (*NamedPropertySetter)(Local<String> property,
2032  Local<Value> value,
2033  const AccessorInfo& info);
2034 
2040 typedef Handle<Integer> (*NamedPropertyQuery)(Local<String> property,
2041  const AccessorInfo& info);
2042 
2043 
2049 typedef Handle<Boolean> (*NamedPropertyDeleter)(Local<String> property,
2050  const AccessorInfo& info);
2051 
2056 typedef Handle<Array> (*NamedPropertyEnumerator)(const AccessorInfo& info);
2057 
2058 
2063 typedef Handle<Value> (*IndexedPropertyGetter)(uint32_t index,
2064  const AccessorInfo& info);
2065 
2066 
2071 typedef Handle<Value> (*IndexedPropertySetter)(uint32_t index,
2072  Local<Value> value,
2073  const AccessorInfo& info);
2074 
2075 
2080 typedef Handle<Integer> (*IndexedPropertyQuery)(uint32_t index,
2081  const AccessorInfo& info);
2082 
2088 typedef Handle<Boolean> (*IndexedPropertyDeleter)(uint32_t index,
2089  const AccessorInfo& info);
2090 
2095 typedef Handle<Array> (*IndexedPropertyEnumerator)(const AccessorInfo& info);
2096 
2097 
2107 };
2108 
2109 
2115  Local<Value> key,
2116  AccessType type,
2117  Local<Value> data);
2118 
2119 
2125  uint32_t index,
2126  AccessType type,
2127  Local<Value> data);
2128 
2129 
2223  public:
2225  static Local<FunctionTemplate> New(
2226  InvocationCallback callback = 0,
2227  Handle<Value> data = Handle<Value>(),
2228  Handle<Signature> signature = Handle<Signature>());
2230  Local<Function> GetFunction();
2231 
2237  void SetCallHandler(InvocationCallback callback,
2238  Handle<Value> data = Handle<Value>());
2239 
2241  Local<ObjectTemplate> InstanceTemplate();
2242 
2244  void Inherit(Handle<FunctionTemplate> parent);
2245 
2250  Local<ObjectTemplate> PrototypeTemplate();
2251 
2252 
2258  void SetClassName(Handle<String> name);
2259 
2272  void SetHiddenPrototype(bool value);
2273 
2278  void ReadOnlyPrototype();
2279 
2284  bool HasInstance(Handle<Value> object);
2285 
2286  private:
2287  FunctionTemplate();
2288  void AddInstancePropertyAccessor(Handle<String> name,
2289  AccessorGetter getter,
2290  AccessorSetter setter,
2291  Handle<Value> data,
2292  AccessControl settings,
2293  PropertyAttribute attributes,
2294  Handle<AccessorSignature> signature);
2295  void SetNamedInstancePropertyHandler(NamedPropertyGetter getter,
2296  NamedPropertySetter setter,
2297  NamedPropertyQuery query,
2298  NamedPropertyDeleter remover,
2299  NamedPropertyEnumerator enumerator,
2300  Handle<Value> data);
2301  void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter,
2302  IndexedPropertySetter setter,
2303  IndexedPropertyQuery query,
2304  IndexedPropertyDeleter remover,
2305  IndexedPropertyEnumerator enumerator,
2306  Handle<Value> data);
2307  void SetInstanceCallAsFunctionHandler(InvocationCallback callback,
2308  Handle<Value> data);
2309 
2310  friend class Context;
2311  friend class ObjectTemplate;
2312 };
2313 
2314 
2322  public:
2324  static Local<ObjectTemplate> New();
2325 
2327  Local<Object> NewInstance();
2328 
2359  AccessorGetter getter,
2360  AccessorSetter setter = 0,
2361  Handle<Value> data = Handle<Value>(),
2362  AccessControl settings = DEFAULT,
2363  PropertyAttribute attribute = None,
2364  Handle<AccessorSignature> signature =
2366 
2384  void SetNamedPropertyHandler(NamedPropertyGetter getter,
2385  NamedPropertySetter setter = 0,
2386  NamedPropertyQuery query = 0,
2387  NamedPropertyDeleter deleter = 0,
2388  NamedPropertyEnumerator enumerator = 0,
2389  Handle<Value> data = Handle<Value>());
2390 
2407  void SetIndexedPropertyHandler(IndexedPropertyGetter getter,
2408  IndexedPropertySetter setter = 0,
2409  IndexedPropertyQuery query = 0,
2410  IndexedPropertyDeleter deleter = 0,
2411  IndexedPropertyEnumerator enumerator = 0,
2412  Handle<Value> data = Handle<Value>());
2413 
2420  void SetCallAsFunctionHandler(InvocationCallback callback,
2421  Handle<Value> data = Handle<Value>());
2422 
2431  void MarkAsUndetectable();
2432 
2444  void SetAccessCheckCallbacks(NamedSecurityCallback named_handler,
2445  IndexedSecurityCallback indexed_handler,
2446  Handle<Value> data = Handle<Value>(),
2447  bool turned_on_by_default = true);
2448 
2453  int InternalFieldCount();
2454 
2459  void SetInternalFieldCount(int value);
2460 
2461  private:
2462  ObjectTemplate();
2463  static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor);
2464  friend class FunctionTemplate;
2465 };
2466 
2467 
2472 class V8EXPORT Signature : public Data {
2473  public:
2474  static Local<Signature> New(Handle<FunctionTemplate> receiver =
2476  int argc = 0,
2477  Handle<FunctionTemplate> argv[] = 0);
2478  private:
2479  Signature();
2480 };
2481 
2482 
2488  public:
2491  private:
2493 };
2494 
2495 
2500 class V8EXPORT TypeSwitch : public Data {
2501  public:
2503  static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]);
2504  int match(Handle<Value> value);
2505  private:
2506  TypeSwitch();
2507 };
2508 
2509 
2510 // --- Extensions ---
2511 
2514  public:
2515  ExternalAsciiStringResourceImpl() : data_(0), length_(0) {}
2516  ExternalAsciiStringResourceImpl(const char* data, size_t length)
2517  : data_(data), length_(length) {}
2518  const char* data() const { return data_; }
2519  size_t length() const { return length_; }
2520 
2521  private:
2522  const char* data_;
2523  size_t length_;
2524 };
2525 
2529 class V8EXPORT Extension { // NOLINT
2530  public:
2531  // Note that the strings passed into this constructor must live as long
2532  // as the Extension itself.
2533  Extension(const char* name,
2534  const char* source = 0,
2535  int dep_count = 0,
2536  const char** deps = 0,
2537  int source_length = -1);
2538  virtual ~Extension() { }
2542  }
2543 
2544  const char* name() const { return name_; }
2545  size_t source_length() const { return source_length_; }
2547  return &source_; }
2548  int dependency_count() { return dep_count_; }
2549  const char** dependencies() { return deps_; }
2550  void set_auto_enable(bool value) { auto_enable_ = value; }
2551  bool auto_enable() { return auto_enable_; }
2552 
2553  private:
2554  const char* name_;
2555  size_t source_length_; // expected to initialize before source_
2557  int dep_count_;
2558  const char** deps_;
2559  bool auto_enable_;
2560 
2561  // Disallow copying and assigning.
2562  Extension(const Extension&);
2563  void operator=(const Extension&);
2564 };
2565 
2566 
2567 void V8EXPORT RegisterExtension(Extension* extension);
2568 
2569 
2574  public:
2575  inline DeclareExtension(Extension* extension) {
2576  RegisterExtension(extension);
2577  }
2578 };
2579 
2580 
2581 // --- Statics ---
2582 
2583 
2584 Handle<Primitive> V8EXPORT Undefined();
2585 Handle<Primitive> V8EXPORT Null();
2586 Handle<Boolean> V8EXPORT True();
2587 Handle<Boolean> V8EXPORT False();
2588 
2589 inline Handle<Primitive> Undefined(Isolate* isolate);
2590 inline Handle<Primitive> Null(Isolate* isolate);
2591 inline Handle<Boolean> True(Isolate* isolate);
2592 inline Handle<Boolean> False(Isolate* isolate);
2593 
2594 
2605  public:
2607  int max_young_space_size() const { return max_young_space_size_; }
2608  void set_max_young_space_size(int value) { max_young_space_size_ = value; }
2609  int max_old_space_size() const { return max_old_space_size_; }
2610  void set_max_old_space_size(int value) { max_old_space_size_ = value; }
2611  int max_executable_size() { return max_executable_size_; }
2612  void set_max_executable_size(int value) { max_executable_size_ = value; }
2613  uint32_t* stack_limit() const { return stack_limit_; }
2614  // Sets an address beyond which the VM's stack may not grow.
2615  void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
2616  private:
2617  int max_young_space_size_;
2618  int max_old_space_size_;
2619  int max_executable_size_;
2620  uint32_t* stack_limit_;
2621 };
2622 
2623 
2624 bool V8EXPORT SetResourceConstraints(ResourceConstraints* constraints);
2625 
2626 
2627 // --- Exceptions ---
2628 
2629 
2630 typedef void (*FatalErrorCallback)(const char* location, const char* message);
2631 
2632 
2633 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> data);
2634 
2635 
2643 
2649  public:
2650  static Local<Value> RangeError(Handle<String> message);
2651  static Local<Value> ReferenceError(Handle<String> message);
2652  static Local<Value> SyntaxError(Handle<String> message);
2653  static Local<Value> TypeError(Handle<String> message);
2654  static Local<Value> Error(Handle<String> message);
2655 };
2656 
2657 
2658 // --- Counters Callbacks ---
2659 
2660 typedef int* (*CounterLookupCallback)(const char* name);
2661 
2662 typedef void* (*CreateHistogramCallback)(const char* name,
2663  int min,
2664  int max,
2665  size_t buckets);
2666 
2667 typedef void (*AddHistogramSampleCallback)(void* histogram, int sample);
2668 
2669 // --- Memory Allocation Callback ---
2677 
2681  };
2682 
2687  };
2688 
2690  AllocationAction action,
2691  int size);
2692 
2693 // --- Leave Script Callback ---
2694 typedef void (*CallCompletedCallback)();
2695 
2696 // --- Failed Access Check Callback ---
2698  AccessType type,
2699  Local<Value> data);
2700 
2701 // --- AllowCodeGenerationFromStrings callbacks ---
2702 
2708 
2709 // --- Garbage Collection Callbacks ---
2710 
2718 enum GCType {
2722 };
2723 
2727 };
2728 
2731 
2732 typedef void (*GCCallback)();
2733 
2734 
2742  public:
2743  HeapStatistics();
2744  size_t total_heap_size() { return total_heap_size_; }
2745  size_t total_heap_size_executable() { return total_heap_size_executable_; }
2746  size_t used_heap_size() { return used_heap_size_; }
2747  size_t heap_size_limit() { return heap_size_limit_; }
2748 
2749  private:
2750  void set_total_heap_size(size_t size) { total_heap_size_ = size; }
2751  void set_total_heap_size_executable(size_t size) {
2752  total_heap_size_executable_ = size;
2753  }
2754  void set_used_heap_size(size_t size) { used_heap_size_ = size; }
2755  void set_heap_size_limit(size_t size) { heap_size_limit_ = size; }
2756 
2757  size_t total_heap_size_;
2758  size_t total_heap_size_executable_;
2759  size_t used_heap_size_;
2760  size_t heap_size_limit_;
2761 
2762  friend class V8;
2763 };
2764 
2765 
2766 class RetainedObjectInfo;
2767 
2778  public:
2783  class V8EXPORT Scope {
2784  public:
2785  explicit Scope(Isolate* isolate) : isolate_(isolate) {
2786  isolate->Enter();
2787  }
2788 
2789  ~Scope() { isolate_->Exit(); }
2790 
2791  private:
2792  Isolate* const isolate_;
2793 
2794  // Prevent copying of Scope objects.
2795  Scope(const Scope&);
2796  Scope& operator=(const Scope&);
2797  };
2798 
2806  static Isolate* New();
2807 
2812  static Isolate* GetCurrent();
2813 
2824  void Enter();
2825 
2833  void Exit();
2834 
2839  void Dispose();
2840 
2844  inline void SetData(void* data);
2845 
2850  inline void* GetData();
2851 
2852  private:
2853  Isolate();
2854  Isolate(const Isolate&);
2855  ~Isolate();
2856  Isolate& operator=(const Isolate&);
2857  void* operator new(size_t size);
2858  void operator delete(void*, size_t);
2859 };
2860 
2861 
2863  public:
2867  };
2868 
2869  const char* data;
2872 };
2873 
2874 
2884  public:
2886  virtual ~StartupDataDecompressor();
2887  int Decompress();
2888 
2889  protected:
2890  virtual int DecompressData(char* raw_data,
2891  int* raw_data_size,
2892  const char* compressed_data,
2893  int compressed_data_size) = 0;
2894 
2895  private:
2896  char** raw_data;
2897 };
2898 
2899 
2904 typedef bool (*EntropySource)(unsigned char* buffer, size_t length);
2905 
2906 
2917 typedef uintptr_t (*ReturnAddressLocationResolver)(
2918  uintptr_t return_addr_location);
2919 
2920 
2925  public:
2927  virtual void VisitExternalString(Handle<String> string) {}
2928 };
2929 
2930 
2934 class V8EXPORT V8 {
2935  public:
2937  static void SetFatalErrorHandler(FatalErrorCallback that);
2938 
2943  static void SetAllowCodeGenerationFromStringsCallback(
2945 
2958  static void IgnoreOutOfMemoryException();
2959 
2964  static bool IsDead();
2965 
2985  static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm();
2986  static int GetCompressedStartupDataCount();
2987  static void GetCompressedStartupData(StartupData* compressed_data);
2988  static void SetDecompressedStartupData(StartupData* decompressed_data);
2989 
2996  static bool AddMessageListener(MessageCallback that,
2997  Handle<Value> data = Handle<Value>());
2998 
3002  static void RemoveMessageListeners(MessageCallback that);
3003 
3008  static void SetCaptureStackTraceForUncaughtExceptions(
3009  bool capture,
3010  int frame_limit = 10,
3012 
3016  static void SetFlagsFromString(const char* str, int length);
3017 
3021  static void SetFlagsFromCommandLine(int* argc,
3022  char** argv,
3023  bool remove_flags);
3024 
3026  static const char* GetVersion();
3027 
3032  static void SetCounterFunction(CounterLookupCallback);
3033 
3040  static void SetCreateHistogramFunction(CreateHistogramCallback);
3041  static void SetAddHistogramSampleFunction(AddHistogramSampleCallback);
3042 
3047  static void EnableSlidingStateWindow();
3048 
3050  static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
3051 
3062  static void AddGCPrologueCallback(
3063  GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll);
3064 
3069  static void RemoveGCPrologueCallback(GCPrologueCallback callback);
3070 
3079  static void SetGlobalGCPrologueCallback(GCCallback);
3080 
3091  static void AddGCEpilogueCallback(
3092  GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll);
3093 
3098  static void RemoveGCEpilogueCallback(GCEpilogueCallback callback);
3099 
3108  static void SetGlobalGCEpilogueCallback(GCCallback);
3109 
3114  static void AddMemoryAllocationCallback(MemoryAllocationCallback callback,
3115  ObjectSpace space,
3116  AllocationAction action);
3117 
3121  static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback);
3122 
3130  static void AddCallCompletedCallback(CallCompletedCallback callback);
3131 
3135  static void RemoveCallCompletedCallback(CallCompletedCallback callback);
3136 
3146  static void AddObjectGroup(Persistent<Value>* objects,
3147  size_t length,
3148  RetainedObjectInfo* info = NULL);
3149 
3157  static void AddImplicitReferences(Persistent<Object> parent,
3158  Persistent<Value>* children,
3159  size_t length);
3160 
3166  static bool Initialize();
3167 
3172  static void SetEntropySource(EntropySource source);
3173 
3178  static void SetReturnAddressLocationResolver(
3179  ReturnAddressLocationResolver return_address_resolver);
3180 
3195  static intptr_t AdjustAmountOfExternalAllocatedMemory(
3196  intptr_t change_in_bytes);
3197 
3207  static void PauseProfiler();
3208 
3213  static void ResumeProfiler();
3214 
3218  static bool IsProfilerPaused();
3219 
3226  static int GetCurrentThreadId();
3227 
3252  static void TerminateExecution(int thread_id);
3253 
3264  static void TerminateExecution(Isolate* isolate = NULL);
3265 
3276  static bool IsExecutionTerminating(Isolate* isolate = NULL);
3277 
3287  static bool Dispose();
3288 
3292  static void GetHeapStatistics(HeapStatistics* heap_statistics);
3293 
3299  static void VisitExternalResources(ExternalResourceVisitor* visitor);
3300 
3313  static bool IdleNotification(int hint = 1000);
3314 
3319  static void LowMemoryNotification();
3320 
3327  static int ContextDisposedNotification();
3328 
3329  private:
3330  V8();
3331 
3332  static internal::Object** GlobalizeReference(internal::Object** handle);
3333  static void DisposeGlobal(internal::Object** global_handle);
3334  static void MakeWeak(internal::Object** global_handle,
3335  void* data,
3337  static void ClearWeak(internal::Object** global_handle);
3338  static void MarkIndependent(internal::Object** global_handle);
3339  static bool IsGlobalNearDeath(internal::Object** global_handle);
3340  static bool IsGlobalWeak(internal::Object** global_handle);
3341  static void SetWrapperClassId(internal::Object** global_handle,
3342  uint16_t class_id);
3343 
3344  template <class T> friend class Handle;
3345  template <class T> friend class Local;
3346  template <class T> friend class Persistent;
3347  friend class Context;
3348 };
3349 
3350 
3355  public:
3359  TryCatch();
3360 
3364  ~TryCatch();
3365 
3369  bool HasCaught() const;
3370 
3384  bool CanContinue() const;
3385 
3393  Handle<Value> ReThrow();
3394 
3401  Local<Value> Exception() const;
3402 
3407  Local<Value> StackTrace() const;
3408 
3416  Local<v8::Message> Message() const;
3417 
3427  void Reset();
3428 
3437  void SetVerbose(bool value);
3438 
3444  void SetCaptureMessage(bool value);
3445 
3446  private:
3447  v8::internal::Isolate* isolate_;
3448  void* next_;
3449  void* exception_;
3450  void* message_;
3451  bool is_verbose_ : 1;
3452  bool can_continue_ : 1;
3453  bool capture_message_ : 1;
3454  bool rethrow_ : 1;
3455 
3457 };
3458 
3459 
3460 // --- Context ---
3461 
3462 
3467  public:
3468  ExtensionConfiguration(int name_count, const char* names[])
3469  : name_count_(name_count), names_(names) { }
3470  private:
3472  int name_count_;
3473  const char** names_;
3474 };
3475 
3476 
3482  public:
3499  Local<Object> Global();
3500 
3505  void DetachGlobal();
3506 
3517  void ReattachGlobal(Handle<Object> global_object);
3518 
3537  static Persistent<Context> New(
3538  ExtensionConfiguration* extensions = NULL,
3539  Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(),
3540  Handle<Value> global_object = Handle<Value>());
3541 
3543  static Local<Context> GetEntered();
3544 
3546  static Local<Context> GetCurrent();
3547 
3553  static Local<Context> GetCalling();
3554 
3559  void SetSecurityToken(Handle<Value> token);
3560 
3562  void UseDefaultSecurityToken();
3563 
3565  Handle<Value> GetSecurityToken();
3566 
3573  void Enter();
3574 
3579  void Exit();
3580 
3582  bool HasOutOfMemoryException();
3583 
3585  static bool InContext();
3586 
3592  void SetData(Handle<String> data);
3593  Local<Value> GetData();
3594 
3608  void AllowCodeGenerationFromStrings(bool allow);
3609 
3614  bool IsCodeGenerationFromStringsAllowed();
3615 
3620  class Scope {
3621  public:
3622  explicit inline Scope(Handle<Context> context) : context_(context) {
3623  context_->Enter();
3624  }
3625  inline ~Scope() { context_->Exit(); }
3626  private:
3627  Handle<Context> context_;
3628  };
3629 
3630  private:
3631  friend class Value;
3632  friend class Script;
3633  friend class Object;
3634  friend class Function;
3635 };
3636 
3637 
3721  public:
3725  explicit Unlocker(Isolate* isolate = NULL);
3726  ~Unlocker();
3727  private:
3728  internal::Isolate* isolate_;
3729 };
3730 
3731 
3733  public:
3737  explicit Locker(Isolate* isolate = NULL);
3738  ~Locker();
3739 
3747  static void StartPreemption(int every_n_ms);
3748 
3752  static void StopPreemption();
3753 
3758  static bool IsLocked(Isolate* isolate = NULL);
3759 
3763  static bool IsActive();
3764 
3765  private:
3766  bool has_lock_;
3767  bool top_level_;
3768  internal::Isolate* isolate_;
3769 
3770  static bool active_;
3771 
3772  // Disallow copying and assigning.
3773  Locker(const Locker&);
3774  void operator=(const Locker&);
3775 };
3776 
3777 
3781 struct HeapStatsUpdate;
3782 
3783 
3787 class V8EXPORT OutputStream { // NOLINT
3788  public:
3790  kAscii = 0 // 7-bit ASCII.
3791  };
3793  kContinue = 0,
3794  kAbort = 1
3795  };
3796  virtual ~OutputStream() {}
3798  virtual void EndOfStream() = 0;
3800  virtual int GetChunkSize() { return 1024; }
3802  virtual OutputEncoding GetOutputEncoding() { return kAscii; }
3808  virtual WriteResult WriteAsciiChunk(char* data, int size) = 0;
3815  return kAbort;
3816  };
3817 };
3818 
3819 
3824 class V8EXPORT ActivityControl { // NOLINT
3825  public:
3827  kContinue = 0,
3828  kAbort = 1
3829  };
3830  virtual ~ActivityControl() {}
3835  virtual ControlOption ReportProgressValue(int done, int total) = 0;
3836 };
3837 
3838 
3839 // --- Implementation ---
3840 
3841 
3842 namespace internal {
3843 
3844 const int kApiPointerSize = sizeof(void*); // NOLINT
3845 const int kApiIntSize = sizeof(int); // NOLINT
3846 
3847 // Tag information for HeapObject.
3848 const int kHeapObjectTag = 1;
3849 const int kHeapObjectTagSize = 2;
3850 const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1;
3851 
3852 // Tag information for Smi.
3853 const int kSmiTag = 0;
3854 const int kSmiTagSize = 1;
3855 const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
3856 
3857 template <size_t ptr_size> struct SmiTagging;
3858 
3859 // Smi constants for 32-bit systems.
3860 template <> struct SmiTagging<4> {
3861  static const int kSmiShiftSize = 0;
3862  static const int kSmiValueSize = 31;
3863  static inline int SmiToInt(internal::Object* value) {
3864  int shift_bits = kSmiTagSize + kSmiShiftSize;
3865  // Throw away top 32 bits and shift down (requires >> to be sign extending).
3866  return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> shift_bits;
3867  }
3868 
3869  // For 32-bit systems any 2 bytes aligned pointer can be encoded as smi
3870  // with a plain reinterpret_cast.
3871  static const uintptr_t kEncodablePointerMask = 0x1;
3872  static const int kPointerToSmiShift = 0;
3873 };
3874 
3875 // Smi constants for 64-bit systems.
3876 template <> struct SmiTagging<8> {
3877  static const int kSmiShiftSize = 31;
3878  static const int kSmiValueSize = 32;
3879  static inline int SmiToInt(internal::Object* value) {
3880  int shift_bits = kSmiTagSize + kSmiShiftSize;
3881  // Shift down and throw away top 32 bits.
3882  return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits);
3883  }
3884 
3885  // To maximize the range of pointers that can be encoded
3886  // in the available 32 bits, we require them to be 8 bytes aligned.
3887  // This gives 2 ^ (32 + 3) = 32G address space covered.
3888  // It might be not enough to cover stack allocated objects on some platforms.
3889  static const int kPointerAlignment = 3;
3890 
3891  static const uintptr_t kEncodablePointerMask =
3892  ~(uintptr_t(0xffffffff) << kPointerAlignment);
3893 
3894  static const int kPointerToSmiShift =
3896 };
3897 
3901 const uintptr_t kEncodablePointerMask =
3904 
3910 class Internals {
3911  public:
3912  // These values match non-compiler-dependent values defined within
3913  // the implementation of v8.
3914  static const int kHeapObjectMapOffset = 0;
3916  static const int kStringResourceOffset = 3 * kApiPointerSize;
3917 
3918  static const int kOddballKindOffset = 3 * kApiPointerSize;
3920  static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
3921  static const int kFullStringRepresentationMask = 0x07;
3922  static const int kExternalTwoByteRepresentationTag = 0x02;
3923 
3924  static const int kIsolateStateOffset = 0;
3926  static const int kIsolateRootsOffset = 3 * kApiPointerSize;
3927  static const int kUndefinedValueRootIndex = 5;
3928  static const int kNullValueRootIndex = 7;
3929  static const int kTrueValueRootIndex = 8;
3930  static const int kFalseValueRootIndex = 9;
3931  static const int kEmptySymbolRootIndex = 128;
3932 
3933  static const int kJSObjectType = 0xaa;
3934  static const int kFirstNonstringType = 0x80;
3935  static const int kOddballType = 0x82;
3936  static const int kForeignType = 0x85;
3937 
3938  static const int kUndefinedOddballKind = 5;
3939  static const int kNullOddballKind = 3;
3940 
3941  static inline bool HasHeapObjectTag(internal::Object* value) {
3942  return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
3943  kHeapObjectTag);
3944  }
3945 
3946  static inline bool HasSmiTag(internal::Object* value) {
3947  return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag);
3948  }
3949 
3950  static inline int SmiValue(internal::Object* value) {
3951  return PlatformSmiTagging::SmiToInt(value);
3952  }
3953 
3954  static inline int GetInstanceType(internal::Object* obj) {
3955  typedef internal::Object O;
3956  O* map = ReadField<O*>(obj, kHeapObjectMapOffset);
3957  return ReadField<uint8_t>(map, kMapInstanceTypeOffset);
3958  }
3959 
3960  static inline int GetOddballKind(internal::Object* obj) {
3961  typedef internal::Object O;
3962  return SmiValue(ReadField<O*>(obj, kOddballKindOffset));
3963  }
3964 
3965  static inline void* GetExternalPointerFromSmi(internal::Object* value) {
3966  const uintptr_t address = reinterpret_cast<uintptr_t>(value);
3967  return reinterpret_cast<void*>(address >> kPointerToSmiShift);
3968  }
3969 
3970  static inline void* GetExternalPointer(internal::Object* obj) {
3971  if (HasSmiTag(obj)) {
3972  return GetExternalPointerFromSmi(obj);
3973  } else if (GetInstanceType(obj) == kForeignType) {
3974  return ReadField<void*>(obj, kForeignAddressOffset);
3975  } else {
3976  return NULL;
3977  }
3978  }
3979 
3980  static inline bool IsExternalTwoByteString(int instance_type) {
3981  int representation = (instance_type & kFullStringRepresentationMask);
3982  return representation == kExternalTwoByteRepresentationTag;
3983  }
3984 
3985  static inline bool IsInitialized(v8::Isolate* isolate) {
3986  uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateStateOffset;
3987  return *reinterpret_cast<int*>(addr) == 1;
3988  }
3989 
3990  static inline void SetEmbedderData(v8::Isolate* isolate, void* data) {
3991  uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
3993  *reinterpret_cast<void**>(addr) = data;
3994  }
3995 
3996  static inline void* GetEmbedderData(v8::Isolate* isolate) {
3997  uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
3999  return *reinterpret_cast<void**>(addr);
4000  }
4001 
4002  static inline internal::Object** GetRoot(v8::Isolate* isolate, int index) {
4003  uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset;
4004  return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize);
4005  }
4006 
4007  template <typename T>
4008  static inline T ReadField(Object* ptr, int offset) {
4009  uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag;
4010  return *reinterpret_cast<T*>(addr);
4011  }
4012 
4013  static inline bool CanCastToHeapObject(void* o) { return false; }
4014  static inline bool CanCastToHeapObject(Context* o) { return true; }
4015  static inline bool CanCastToHeapObject(String* o) { return true; }
4016  static inline bool CanCastToHeapObject(Object* o) { return true; }
4017  static inline bool CanCastToHeapObject(Message* o) { return true; }
4018  static inline bool CanCastToHeapObject(StackTrace* o) { return true; }
4019  static inline bool CanCastToHeapObject(StackFrame* o) { return true; }
4020 };
4021 
4022 } // namespace internal
4023 
4024 
4025 template <class T>
4027 
4028 
4029 template <class T>
4031  if (that.IsEmpty()) return Local<T>();
4032  T* that_ptr = *that;
4033  internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr);
4035  return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(
4036  reinterpret_cast<internal::HeapObject*>(*p))));
4037  }
4038  return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(*p)));
4039 }
4040 
4041 
4042 template <class T>
4044  if (that.IsEmpty()) return Persistent<T>();
4045  internal::Object** p = reinterpret_cast<internal::Object**>(*that);
4046  return Persistent<T>(reinterpret_cast<T*>(V8::GlobalizeReference(p)));
4047 }
4048 
4049 
4050 template <class T>
4052  if (this->IsEmpty()) return false;
4053  return V8::IsGlobalNearDeath(reinterpret_cast<internal::Object**>(**this));
4054 }
4055 
4056 
4057 template <class T>
4059  if (this->IsEmpty()) return false;
4060  return V8::IsGlobalWeak(reinterpret_cast<internal::Object**>(**this));
4061 }
4062 
4063 
4064 template <class T>
4066  if (this->IsEmpty()) return;
4067  V8::DisposeGlobal(reinterpret_cast<internal::Object**>(**this));
4068 }
4069 
4070 
4071 template <class T>
4073 
4074 template <class T>
4075 void Persistent<T>::MakeWeak(void* parameters, WeakReferenceCallback callback) {
4076  V8::MakeWeak(reinterpret_cast<internal::Object**>(**this),
4077  parameters,
4078  callback);
4079 }
4080 
4081 template <class T>
4083  V8::ClearWeak(reinterpret_cast<internal::Object**>(**this));
4084 }
4085 
4086 template <class T>
4088  V8::MarkIndependent(reinterpret_cast<internal::Object**>(**this));
4089 }
4090 
4091 template <class T>
4093  V8::SetWrapperClassId(reinterpret_cast<internal::Object**>(**this), class_id);
4094 }
4095 
4096 Arguments::Arguments(internal::Object** implicit_args,
4097  internal::Object** values, int length,
4098  bool is_construct_call)
4099  : implicit_args_(implicit_args),
4100  values_(values),
4101  length_(length),
4102  is_construct_call_(is_construct_call) { }
4103 
4104 
4106  if (i < 0 || length_ <= i) return Local<Value>(*Undefined());
4107  return Local<Value>(reinterpret_cast<Value*>(values_ - i));
4108 }
4109 
4110 
4112  return Local<Function>(reinterpret_cast<Function*>(
4113  &implicit_args_[kCalleeIndex]));
4114 }
4115 
4116 
4118  return Local<Object>(reinterpret_cast<Object*>(values_ + 1));
4119 }
4120 
4121 
4123  return Local<Object>(reinterpret_cast<Object*>(
4124  &implicit_args_[kHolderIndex]));
4125 }
4126 
4127 
4129  return Local<Value>(reinterpret_cast<Value*>(&implicit_args_[kDataIndex]));
4130 }
4131 
4132 
4134  return *reinterpret_cast<Isolate**>(&implicit_args_[kIsolateIndex]);
4135 }
4136 
4137 
4139  return is_construct_call_;
4140 }
4141 
4142 
4143 int Arguments::Length() const {
4144  return length_;
4145 }
4146 
4147 
4148 template <class T>
4150  internal::Object** before = reinterpret_cast<internal::Object**>(*value);
4151  internal::Object** after = RawClose(before);
4152  return Local<T>(reinterpret_cast<T*>(after));
4153 }
4154 
4156  return resource_name_;
4157 }
4158 
4159 
4161  return resource_line_offset_;
4162 }
4163 
4164 
4166  return resource_column_offset_;
4167 }
4168 
4169 
4171  return value ? True() : False();
4172 }
4173 
4174 
4175 void Template::Set(const char* name, v8::Handle<Data> value) {
4176  Set(v8::String::New(name), value);
4177 }
4178 
4179 
4181 #ifndef V8_ENABLE_CHECKS
4182  Local<Value> quick_result = UncheckedGetInternalField(index);
4183  if (!quick_result.IsEmpty()) return quick_result;
4184 #endif
4185  return CheckedGetInternalField(index);
4186 }
4187 
4188 
4189 Local<Value> Object::UncheckedGetInternalField(int index) {
4190  typedef internal::Object O;
4191  typedef internal::Internals I;
4192  O* obj = *reinterpret_cast<O**>(this);
4193  if (I::GetInstanceType(obj) == I::kJSObjectType) {
4194  // If the object is a plain JSObject, which is the common case,
4195  // we know where to find the internal fields and can return the
4196  // value directly.
4197  int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
4198  O* value = I::ReadField<O*>(obj, offset);
4199  O** result = HandleScope::CreateHandle(value);
4200  return Local<Value>(reinterpret_cast<Value*>(result));
4201  } else {
4202  return Local<Value>();
4203  }
4204 }
4205 
4206 
4208 #ifdef V8_ENABLE_CHECKS
4209  return FullUnwrap(obj);
4210 #else
4211  return QuickUnwrap(obj);
4212 #endif
4213 }
4214 
4215 
4216 void* External::QuickUnwrap(Handle<v8::Value> wrapper) {
4217  typedef internal::Object O;
4218  O* obj = *reinterpret_cast<O**>(const_cast<v8::Value*>(*wrapper));
4220 }
4221 
4222 
4224  typedef internal::Object O;
4225  typedef internal::Internals I;
4226 
4227  O* obj = *reinterpret_cast<O**>(this);
4228 
4229  if (I::GetInstanceType(obj) == I::kJSObjectType) {
4230  // If the object is a plain JSObject, which is the common case,
4231  // we know where to find the internal fields and can return the
4232  // value directly.
4233  int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
4234  O* value = I::ReadField<O*>(obj, offset);
4235  return I::GetExternalPointer(value);
4236  }
4237 
4238  return SlowGetPointerFromInternalField(index);
4239 }
4240 
4241 
4243 #ifdef V8_ENABLE_CHECKS
4244  CheckCast(value);
4245 #endif
4246  return static_cast<String*>(value);
4247 }
4248 
4249 
4251  typedef internal::Object* S;
4252  typedef internal::Internals I;
4253  if (!I::IsInitialized(isolate)) return Empty();
4254  S* slot = I::GetRoot(isolate, I::kEmptySymbolRootIndex);
4255  return Local<String>(reinterpret_cast<String*>(slot));
4256 }
4257 
4258 
4260  typedef internal::Object O;
4261  typedef internal::Internals I;
4262  O* obj = *reinterpret_cast<O**>(const_cast<String*>(this));
4264  if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
4265  void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
4266  result = reinterpret_cast<String::ExternalStringResource*>(value);
4267  } else {
4268  result = NULL;
4269  }
4270 #ifdef V8_ENABLE_CHECKS
4271  VerifyExternalStringResource(result);
4272 #endif
4273  return result;
4274 }
4275 
4276 
4277 bool Value::IsUndefined() const {
4278 #ifdef V8_ENABLE_CHECKS
4279  return FullIsUndefined();
4280 #else
4281  return QuickIsUndefined();
4282 #endif
4283 }
4284 
4285 bool Value::QuickIsUndefined() const {
4286  typedef internal::Object O;
4287  typedef internal::Internals I;
4288  O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this));
4289  if (!I::HasHeapObjectTag(obj)) return false;
4290  if (I::GetInstanceType(obj) != I::kOddballType) return false;
4291  return (I::GetOddballKind(obj) == I::kUndefinedOddballKind);
4292 }
4293 
4294 
4295 bool Value::IsNull() const {
4296 #ifdef V8_ENABLE_CHECKS
4297  return FullIsNull();
4298 #else
4299  return QuickIsNull();
4300 #endif
4301 }
4302 
4303 bool Value::QuickIsNull() const {
4304  typedef internal::Object O;
4305  typedef internal::Internals I;
4306  O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this));
4307  if (!I::HasHeapObjectTag(obj)) return false;
4308  if (I::GetInstanceType(obj) != I::kOddballType) return false;
4309  return (I::GetOddballKind(obj) == I::kNullOddballKind);
4310 }
4311 
4312 
4313 bool Value::IsString() const {
4314 #ifdef V8_ENABLE_CHECKS
4315  return FullIsString();
4316 #else
4317  return QuickIsString();
4318 #endif
4319 }
4320 
4321 bool Value::QuickIsString() const {
4322  typedef internal::Object O;
4323  typedef internal::Internals I;
4324  O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this));
4325  if (!I::HasHeapObjectTag(obj)) return false;
4326  return (I::GetInstanceType(obj) < I::kFirstNonstringType);
4327 }
4328 
4329 
4331 #ifdef V8_ENABLE_CHECKS
4332  CheckCast(value);
4333 #endif
4334  return static_cast<Number*>(value);
4335 }
4336 
4337 
4339 #ifdef V8_ENABLE_CHECKS
4340  CheckCast(value);
4341 #endif
4342  return static_cast<Integer*>(value);
4343 }
4344 
4345 
4347 #ifdef V8_ENABLE_CHECKS
4348  CheckCast(value);
4349 #endif
4350  return static_cast<Date*>(value);
4351 }
4352 
4353 
4355 #ifdef V8_ENABLE_CHECKS
4356  CheckCast(value);
4357 #endif
4358  return static_cast<StringObject*>(value);
4359 }
4360 
4361 
4363 #ifdef V8_ENABLE_CHECKS
4364  CheckCast(value);
4365 #endif
4366  return static_cast<NumberObject*>(value);
4367 }
4368 
4369 
4371 #ifdef V8_ENABLE_CHECKS
4372  CheckCast(value);
4373 #endif
4374  return static_cast<BooleanObject*>(value);
4375 }
4376 
4377 
4379 #ifdef V8_ENABLE_CHECKS
4380  CheckCast(value);
4381 #endif
4382  return static_cast<RegExp*>(value);
4383 }
4384 
4385 
4387 #ifdef V8_ENABLE_CHECKS
4388  CheckCast(value);
4389 #endif
4390  return static_cast<Object*>(value);
4391 }
4392 
4393 
4395 #ifdef V8_ENABLE_CHECKS
4396  CheckCast(value);
4397 #endif
4398  return static_cast<Array*>(value);
4399 }
4400 
4401 
4403 #ifdef V8_ENABLE_CHECKS
4404  CheckCast(value);
4405 #endif
4406  return static_cast<Function*>(value);
4407 }
4408 
4409 
4411 #ifdef V8_ENABLE_CHECKS
4412  CheckCast(value);
4413 #endif
4414  return static_cast<External*>(value);
4415 }
4416 
4417 
4419  return *reinterpret_cast<Isolate**>(&args_[-3]);
4420 }
4421 
4422 
4424  return Local<Value>(reinterpret_cast<Value*>(&args_[-2]));
4425 }
4426 
4427 
4429  return Local<Object>(reinterpret_cast<Object*>(&args_[0]));
4430 }
4431 
4432 
4434  return Local<Object>(reinterpret_cast<Object*>(&args_[-1]));
4435 }
4436 
4437 
4439  typedef internal::Object* S;
4440  typedef internal::Internals I;
4441  if (!I::IsInitialized(isolate)) return Undefined();
4442  S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
4443  return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
4444 }
4445 
4446 
4448  typedef internal::Object* S;
4449  typedef internal::Internals I;
4450  if (!I::IsInitialized(isolate)) return Null();
4451  S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
4452  return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
4453 }
4454 
4455 
4457  typedef internal::Object* S;
4458  typedef internal::Internals I;
4459  if (!I::IsInitialized(isolate)) return True();
4460  S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
4461  return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
4462 }
4463 
4464 
4466  typedef internal::Object* S;
4467  typedef internal::Internals I;
4468  if (!I::IsInitialized(isolate)) return False();
4469  S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
4470  return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
4471 }
4472 
4473 
4474 void Isolate::SetData(void* data) {
4475  typedef internal::Internals I;
4476  I::SetEmbedderData(this, data);
4477 }
4478 
4479 
4481  typedef internal::Internals I;
4482  return I::GetEmbedderData(this);
4483 }
4484 
4485 
4498 } // namespace v8
4499 
4500 
4501 #undef V8EXPORT
4502 #undef TYPE_CHECK
4503 
4504 
4505 #endif // V8_H_
Handle< S > As()
Definition: v8.h:252
void MakeWeak(void *parameters, WeakReferenceCallback callback)
Definition: v8.h:4075
virtual v8::Handle< v8::FunctionTemplate > GetNativeFunction(v8::Handle< v8::String > name)
Definition: v8.h:2540
Local< S > As()
Definition: v8.h:290
Handle< Array >(* NamedPropertyEnumerator)(const AccessorInfo &info)
Definition: v8.h:2056
const char * operator*() const
Definition: v8.h:1310
V8EXPORT int Length() const
Definition: api.cc:3718
V8EXPORT double NumberValue() const
Definition: api.cc:2547
void(* GCCallback)()
Definition: v8.h:2732
static Object * Cast(Value *obj)
Definition: v8.h:4386
static bool IsExternalTwoByteString(int instance_type)
Definition: v8.h:3980
V8EXPORT int WriteUtf8(char *buffer, int length=-1, int *nchars_ref=NULL, int options=NO_OPTIONS) const
Definition: api.cc:3829
const intptr_t kSmiTagMask
Definition: v8.h:3855
V8EXPORT bool HasRealIndexedProperty(uint32_t index)
Definition: api.cc:3125
void(* MemoryAllocationCallback)(ObjectSpace space, AllocationAction action, int size)
Definition: v8.h:2689
void set_max_young_space_size(int value)
Definition: v8.h:2608
void Reset()
Definition: flags.cc:1446
V8EXPORT bool BooleanValue() const
Definition: api.cc:4873
V8EXPORT bool IsTrue() const
Definition: api.cc:2135
V8EXPORT uint8_t * GetIndexedPropertiesPixelData()
Definition: api.cc:3412
const char * data
Definition: v8.h:2869
char * operator*()
Definition: v8.h:1286
V8EXPORT bool DeleteHiddenValue(Handle< String > key)
Definition: api.cc:3314
Handle< Boolean > V8EXPORT True()
Definition: api.cc:566
V8EXPORT Local< String > GetSource() const
Definition: api.cc:4997
V8EXPORT const ExternalAsciiStringResource * GetExternalAsciiStringResource() const
Definition: api.cc:4058
static Date * Cast(v8::Value *obj)
Definition: v8.h:4346
void(* CallCompletedCallback)()
Definition: v8.h:2694
Handle< Value >(* NamedPropertySetter)(Local< String > property, Local< Value > value, const AccessorInfo &info)
Definition: v8.h:2031
void Dispose()
Definition: v8.h:4065
#define I(name, number_of_args, result_size)
Definition: runtime.cc:13527
const int kPointerToSmiShift
Definition: v8.h:3903
ScriptOrigin(Handle< Value > resource_name, Handle< Integer > resource_line_offset=Handle< Integer >(), Handle< Integer > resource_column_offset=Handle< Integer >())
Definition: v8.h:572
Definition: v8.h:2934
void * GetData()
Definition: v8.h:4480
static bool IsInitialized(v8::Isolate *isolate)
Definition: v8.h:3985
V8EXPORT Local< Object > CloneElementAt(uint32_t index)
Definition: api.cc:5053
Definition: v8.h:863
V8EXPORT bool StrictEquals(Handle< Value > that) const
Definition: api.cc:2703
Local< Object > Holder() const
Definition: v8.h:4122
V8EXPORT Local< Value > Get(Handle< Value > key)
Definition: api.cc:2845
bool operator!=(Handle< S > that) const
Definition: v8.h:239
static const int kOddballKindOffset
Definition: v8.h:3918
virtual ~OutputStream()
Definition: v8.h:3796
Handle< Integer > ResourceLineOffset() const
Definition: v8.h:4160
V8EXPORT bool IsNativeError() const
Definition: api.cc:2271
void V8EXPORT RegisterExtension(Extension *extension)
Definition: api.cc:525
V8EXPORT PropertyAttribute GetPropertyAttributes(Handle< Value > key)
Definition: api.cc:2872
V8EXPORT Local< Array > GetOwnPropertyNames()
Definition: api.cc:2959
StackTraceOptions
Definition: v8.h:763
value format" "after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false, "print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false, "print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false, "report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true, "garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true, "flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true, "use incremental marking") DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps") DEFINE_bool(trace_incremental_marking, false, "trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true, "Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false, "Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true, "use inline caching") DEFINE_bool(native_code_counters, false, "generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false, "Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true, "Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false, "Never perform compaction on full GC-testing only") DEFINE_bool(compact_code_space, true, "Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true, "Flush inline caches prior to mark compact collection and" "flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0, "Default seed for initializing random generator" "(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true, "allows verbose printing") DEFINE_bool(allow_natives_syntax, false, "allow natives syntax") DEFINE_bool(trace_sim, false, "Trace simulator execution") DEFINE_bool(check_icache, false, "Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8, "Stack alingment in bytes in simulator(4 or 8, 8 is default)") DEFINE_bool(trace_exception, false, "print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false, "preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true, "randomize hashes to avoid predictable hash collisions" "(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0, "Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false, "activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") DEFINE_int(testing_int_flag, 13, "testing_int_flag") DEFINE_float(testing_float_flag, 2.5, "float-flag") DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") DEFINE_string(testing_serialization_file, "/tmp/serdes", "file in which to serialize heap") DEFINE_bool(help, false, "Print usage message, including flags, on console") DEFINE_bool(dump_counters, false, "Dump counters on exit") DEFINE_string(map_counters, "", "Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT, "Pass all remaining arguments to the script.Alias for\"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#43"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2#define FLAG_MODE_DEFINE_DEFAULTS#1"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flag-definitions.h"1#define FLAG_FULL(ftype, ctype, nam, def, cmt)#define FLAG_READONLY(ftype, ctype, nam, def, cmt)#define DEFINE_implication(whenflag, thenflag)#define DEFINE_bool(nam, def, cmt)#define DEFINE_int(nam, def, cmt)#define DEFINE_float(nam, def, cmt)#define DEFINE_string(nam, def, cmt)#define DEFINE_args(nam, def, cmt)#define FLAG DEFINE_bool(use_strict, false,"enforce strict mode") DEFINE_bool(es5_readonly, false,"activate correct semantics for inheriting readonliness") DEFINE_bool(es52_globals, false,"activate new semantics for global var declarations") DEFINE_bool(harmony_typeof, false,"enable harmony semantics for typeof") DEFINE_bool(harmony_scoping, false,"enable harmony block scoping") DEFINE_bool(harmony_modules, false,"enable harmony modules (implies block scoping)") DEFINE_bool(harmony_proxies, false,"enable harmony proxies") DEFINE_bool(harmony_collections, false,"enable harmony collections (sets, maps, and weak maps)") DEFINE_bool(harmony, false,"enable all harmony features (except typeof)") DEFINE_implication(harmony, harmony_scoping) DEFINE_implication(harmony, harmony_modules) DEFINE_implication(harmony, harmony_proxies) DEFINE_implication(harmony, harmony_collections) DEFINE_implication(harmony_modules, harmony_scoping) DEFINE_bool(packed_arrays, false,"optimizes arrays that have no holes") DEFINE_bool(smi_only_arrays, true,"tracks arrays with only smi values") DEFINE_bool(clever_optimizations, true,"Optimize object size, Array shift, DOM strings and string +") DEFINE_bool(unbox_double_arrays, true,"automatically unbox arrays of doubles") DEFINE_bool(string_slices, true,"use string slices") DEFINE_bool(crankshaft, true,"use crankshaft") DEFINE_string(hydrogen_filter,"","optimization filter") DEFINE_bool(use_range, true,"use hydrogen range analysis") DEFINE_bool(eliminate_dead_phis, true,"eliminate dead phis") DEFINE_bool(use_gvn, true,"use hydrogen global value numbering") DEFINE_bool(use_canonicalizing, true,"use hydrogen instruction canonicalizing") DEFINE_bool(use_inlining, true,"use function inlining") DEFINE_int(max_inlined_source_size, 600,"maximum source size in bytes considered for a single inlining") DEFINE_int(max_inlined_nodes, 196,"maximum number of AST nodes considered for a single inlining") DEFINE_int(max_inlined_nodes_cumulative, 196,"maximum cumulative number of AST nodes considered for inlining") DEFINE_bool(loop_invariant_code_motion, true,"loop invariant code motion") DEFINE_bool(collect_megamorphic_maps_from_stub_cache, true,"crankshaft harvests type feedback from stub cache") DEFINE_bool(hydrogen_stats, false,"print statistics for hydrogen") DEFINE_bool(trace_hydrogen, false,"trace generated hydrogen to file") DEFINE_string(trace_phase,"Z","trace generated IR for specified phases") DEFINE_bool(trace_inlining, false,"trace inlining decisions") DEFINE_bool(trace_alloc, false,"trace register allocator") DEFINE_bool(trace_all_uses, false,"trace all use positions") DEFINE_bool(trace_range, false,"trace range analysis") DEFINE_bool(trace_gvn, false,"trace global value numbering") DEFINE_bool(trace_representation, false,"trace representation types") DEFINE_bool(stress_pointer_maps, false,"pointer map for every instruction") DEFINE_bool(stress_environments, false,"environment for every instruction") DEFINE_int(deopt_every_n_times, 0,"deoptimize every n times a deopt point is passed") DEFINE_bool(trap_on_deopt, false,"put a break point before deoptimizing") DEFINE_bool(deoptimize_uncommon_cases, true,"deoptimize uncommon cases") DEFINE_bool(polymorphic_inlining, true,"polymorphic inlining") DEFINE_bool(use_osr, true,"use on-stack replacement") DEFINE_bool(array_bounds_checks_elimination, false,"perform array bounds checks elimination") DEFINE_bool(array_index_dehoisting, false,"perform array index dehoisting") DEFINE_bool(trace_osr, false,"trace on-stack replacement") DEFINE_int(stress_runs, 0,"number of stress runs") DEFINE_bool(optimize_closures, true,"optimize closures") DEFINE_bool(inline_construct, true,"inline constructor calls") DEFINE_bool(inline_arguments, true,"inline functions with arguments object") DEFINE_int(loop_weight, 1,"loop weight for representation inference") DEFINE_bool(optimize_for_in, true,"optimize functions containing for-in loops") DEFINE_bool(experimental_profiler, true,"enable all profiler experiments") DEFINE_bool(watch_ic_patching, false,"profiler considers IC stability") DEFINE_int(frame_count, 1,"number of stack frames inspected by the profiler") DEFINE_bool(self_optimization, false,"primitive functions trigger their own optimization") DEFINE_bool(direct_self_opt, false,"call recompile stub directly when self-optimizing") DEFINE_bool(retry_self_opt, false,"re-try self-optimization if it failed") DEFINE_bool(count_based_interrupts, false,"trigger profiler ticks based on counting instead of timing") DEFINE_bool(interrupt_at_exit, false,"insert an interrupt check at function exit") DEFINE_bool(weighted_back_edges, false,"weight back edges by jump distance for interrupt triggering") DEFINE_int(interrupt_budget, 5900,"execution budget before interrupt is triggered") DEFINE_int(type_info_threshold, 15,"percentage of ICs that must have type info to allow optimization") DEFINE_int(self_opt_count, 130,"call count before self-optimization") DEFINE_implication(experimental_profiler, watch_ic_patching) DEFINE_implication(experimental_profiler, self_optimization) DEFINE_implication(experimental_profiler, retry_self_opt) DEFINE_implication(experimental_profiler, count_based_interrupts) DEFINE_implication(experimental_profiler, interrupt_at_exit) DEFINE_implication(experimental_profiler, weighted_back_edges) DEFINE_bool(trace_opt_verbose, false,"extra verbose compilation tracing") DEFINE_implication(trace_opt_verbose, trace_opt) DEFINE_bool(debug_code, false,"generate extra code (assertions) for debugging") DEFINE_bool(code_comments, false,"emit comments in code disassembly") DEFINE_bool(enable_sse2, true,"enable use of SSE2 instructions if available") DEFINE_bool(enable_sse3, true,"enable use of SSE3 instructions if available") DEFINE_bool(enable_sse4_1, true,"enable use of SSE4.1 instructions if available") DEFINE_bool(enable_cmov, true,"enable use of CMOV instruction if available") DEFINE_bool(enable_rdtsc, true,"enable use of RDTSC instruction if available") DEFINE_bool(enable_sahf, true,"enable use of SAHF instruction if available (X64 only)") DEFINE_bool(enable_vfp3, true,"enable use of VFP3 instructions if available - this implies ""enabling ARMv7 instructions (ARM only)") DEFINE_bool(enable_armv7, true,"enable use of ARMv7 instructions if available (ARM only)") DEFINE_bool(enable_fpu, true,"enable use of MIPS FPU instructions if available (MIPS only)") DEFINE_string(expose_natives_as, NULL,"expose natives in global object") DEFINE_string(expose_debug_as, NULL,"expose debug in global object") DEFINE_bool(expose_gc, false,"expose gc extension") DEFINE_bool(expose_externalize_string, false,"expose externalize string extension") DEFINE_int(stack_trace_limit, 10,"number of stack frames to capture") DEFINE_bool(builtins_in_stack_traces, false,"show built-in functions in stack traces") DEFINE_bool(disable_native_files, false,"disable builtin natives files") DEFINE_bool(inline_new, true,"use fast inline allocation") DEFINE_bool(stack_trace_on_abort, true,"print a stack trace if an assertion failure occurs") DEFINE_bool(trace, false,"trace function calls") DEFINE_bool(mask_constants_with_cookie, true,"use random jit cookie to mask large constants") DEFINE_bool(lazy, true,"use lazy compilation") DEFINE_bool(trace_opt, false,"trace lazy optimization") DEFINE_bool(trace_opt_stats, false,"trace lazy optimization statistics") DEFINE_bool(opt, true,"use adaptive optimizations") DEFINE_bool(always_opt, false,"always try to optimize functions") DEFINE_bool(prepare_always_opt, false,"prepare for turning on always opt") DEFINE_bool(trace_deopt, false,"trace deoptimization") DEFINE_int(min_preparse_length, 1024,"minimum length for automatic enable preparsing") DEFINE_bool(always_full_compiler, false,"try to use the dedicated run-once backend for all code") DEFINE_bool(trace_bailout, false,"print reasons for falling back to using the classic V8 backend") DEFINE_bool(compilation_cache, true,"enable compilation cache") DEFINE_bool(cache_prototype_transitions, true,"cache prototype transitions") DEFINE_bool(trace_debug_json, false,"trace debugging JSON request/response") DEFINE_bool(debugger_auto_break, true,"automatically set the debug break flag when debugger commands are ""in the queue") DEFINE_bool(enable_liveedit, true,"enable liveedit experimental feature") DEFINE_bool(break_on_abort, true,"always cause a debug break before aborting") DEFINE_int(stack_size, kPointerSize *123,"default size of stack region v8 is allowed to use (in kBytes)") DEFINE_int(max_stack_trace_source_length, 300,"maximum length of function source code printed in a stack trace.") DEFINE_bool(always_inline_smi_code, false,"always inline smi code in non-opt code") DEFINE_int(max_new_space_size, 0,"max size of the new generation (in kBytes)") DEFINE_int(max_old_space_size, 0,"max size of the old generation (in Mbytes)") DEFINE_int(max_executable_size, 0,"max size of executable memory (in Mbytes)") DEFINE_bool(gc_global, false,"always perform global GCs") DEFINE_int(gc_interval,-1,"garbage collect after <n> allocations") DEFINE_bool(trace_gc, false,"print one trace line following each garbage collection") DEFINE_bool(trace_gc_nvp, false,"print one detailed trace line in name=value format ""after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false,"print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false,"print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false,"report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true,"garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true,"flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true,"use incremental marking") DEFINE_bool(incremental_marking_steps, true,"do incremental marking steps") DEFINE_bool(trace_incremental_marking, false,"trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true,"Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false,"Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true,"use inline caching") DEFINE_bool(native_code_counters, false,"generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false,"Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true,"Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false,"Never perform compaction on full GC - testing only") DEFINE_bool(compact_code_space, true,"Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true,"Flush inline caches prior to mark compact collection and ""flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0,"Default seed for initializing random generator ""(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true,"allows verbose printing") DEFINE_bool(allow_natives_syntax, false,"allow natives syntax") DEFINE_bool(trace_sim, false,"Trace simulator execution") DEFINE_bool(check_icache, false,"Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0,"Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8,"Stack alingment in bytes in simulator (4 or 8, 8 is default)") DEFINE_bool(trace_exception, false,"print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false,"preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true,"randomize hashes to avoid predictable hash collisions ""(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0,"Fixed seed to use to hash property keys (0 means random)""(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false,"activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true,"generate optimized regexp code") DEFINE_bool(testing_bool_flag, true,"testing_bool_flag") DEFINE_int(testing_int_flag, 13,"testing_int_flag") DEFINE_float(testing_float_flag, 2.5,"float-flag") DEFINE_string(testing_string_flag,"Hello, world!","string-flag") DEFINE_int(testing_prng_seed, 42,"Seed used for threading test randomness") DEFINE_string(testing_serialization_file,"/tmp/serdes","file in which to serialize heap") DEFINE_bool(help, false,"Print usage message, including flags, on console") DEFINE_bool(dump_counters, false,"Dump counters on exit") DEFINE_string(map_counters,"","Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT,"Pass all remaining arguments to the script. Alias for \"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#47"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2 namespace{struct Flag{enum FlagType{TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_ARGS} name
Definition: flags.cc:1349
V8EXPORT bool IsBooleanObject() const
Definition: api.cc:2290
bool auto_enable()
Definition: v8.h:2551
static const int kFirstNonstringType
Definition: v8.h:3934
static const int kNullValueRootIndex
Definition: v8.h:3928
static Array * Cast(Value *obj)
Definition: v8.h:4394
static V8EXPORT Local< String > New(const char *data, int length=-1)
Definition: api.cc:4655
Local< Function > Callee() const
Definition: v8.h:4111
const int kSmiValueSize
Definition: v8.h:3900
Local< Object > This() const
Definition: v8.h:4428
V8EXPORT bool IsExternal() const
Definition: api.cc:2189
bool(* IndexedSecurityCallback)(Local< Object > host, uint32_t index, AccessType type, Local< Value > data)
Definition: v8.h:2124
static V8EXPORT Local< String > NewSymbol(const char *data, int length=-1)
Definition: api.cc:5075
V8EXPORT Local< String > GetConstructorName()
Definition: api.cc:3034
V8EXPORT Local< Int32 > ToInt32() const
Definition: api.cc:2589
size_t used_heap_size()
Definition: v8.h:2746
static bool CanCastToHeapObject(String *o)
Definition: v8.h:4015
Handle< Primitive > V8EXPORT Null()
Definition: api.cc:556
Definition: v8.h:506
V8EXPORT Local< Context > CreationContext()
Definition: api.cc:3265
WriteOptions
Definition: v8.h:1064
Flag flags[]
Definition: flags.cc:1467
int int32_t
Definition: unicode.cc:47
void * GetPointerFromInternalField(int index)
Definition: v8.h:4223
V8EXPORT bool HasRealNamedCallbackProperty(Handle< String > key)
Definition: api.cc:3133
V8EXPORT Local< Value > GetHiddenValue(Handle< String > key)
Definition: api.cc:3301
static int SmiToInt(internal::Object *value)
Definition: v8.h:3879
static Handle< T > Cast(Handle< S > that)
Definition: v8.h:243
AllocationAction
Definition: v8.h:2683
int *(* CounterLookupCallback)(const char *name)
Definition: v8.h:2660
TickSample * sample
Handle< Object > SetAccessor(Handle< JSObject > obj, Handle< AccessorInfo > info)
Definition: handles.cc:342
#define S(x)
Definition: version.cc:55
V8EXPORT Local< Array > GetPropertyNames()
Definition: api.cc:2938
V8EXPORT ExternalArrayType GetIndexedPropertiesExternalArrayDataType()
Definition: api.cc:3482
V8EXPORT Local< Value > Call(Handle< Object > recv, int argc, Handle< Value > argv[])
Definition: api.cc:3629
V8EXPORT bool IsRegExp() const
Definition: api.cc:2298
static V8EXPORT const int kLineOffsetNotFound
Definition: v8.h:1771
void(* GCPrologueCallback)(GCType type, GCCallbackFlags flags)
Definition: v8.h:2729
V8EXPORT bool MayContainNonAscii() const
Definition: api.cc:3820
V8EXPORT Local< Number > ToNumber() const
Definition: api.cc:2382
CompressionAlgorithm
Definition: v8.h:2864
void Clear()
Definition: v8.h:213
ExternalArrayType
Definition: v8.h:1407
unsigned short uint16_t
Definition: unicode.cc:46
V8EXPORT void * GetIndexedPropertiesExternalArrayData()
Definition: api.cc:3469
size_t heap_size_limit()
Definition: v8.h:2747
V8EXPORT bool IsCallable()
Definition: api.cc:3525
Local< Value > Data() const
Definition: v8.h:4128
Handle< Value > ResourceName() const
Definition: v8.h:4155
static V8EXPORT Local< Value > Wrap(void *data)
Definition: api.cc:4583
Local< Value > GetInternalField(int index)
Definition: v8.h:4180
void(* FatalErrorCallback)(const char *location, const char *message)
Definition: v8.h:2630
bool IsNearDeath() const
Definition: v8.h:4051
V8EXPORT Local< String > ToString() const
Definition: api.cc:2305
char * operator*()
Definition: v8.h:1309
const uint16_t * operator*() const
Definition: v8.h:1332
Handle< Value >(* IndexedPropertySetter)(uint32_t index, Local< Value > value, const AccessorInfo &info)
Definition: v8.h:2071
static const int kStringResourceOffset
Definition: v8.h:3916
int length() const
Definition: v8.h:1333
V8EXPORT Local< Value > CallAsConstructor(int argc, Handle< Value > argv[])
Definition: api.cc:3568
V8EXPORT bool CanMakeExternal()
Definition: api.cc:4816
V8EXPORT bool IsDirty()
Definition: api.cc:3232
void Set(Handle< String > name, Handle< Data > value, PropertyAttribute attributes=None)
Definition: api.cc:894
Local(S *that)
Definition: v8.h:280
static const int kJSObjectHeaderSize
Definition: v8.h:3920
static Function * Cast(Value *obj)
Definition: v8.h:4402
V8EXPORT Handle< Value > GetName() const
Definition: api.cc:3662
static int SmiToInt(internal::Object *value)
Definition: v8.h:3863
static V8EXPORT Local< String > NewUndetectable(const char *data, int length=-1)
Definition: api.cc:4682
static void * Unwrap(Handle< Value > obj)
Definition: v8.h:4207
V8EXPORT void SetIndexedPropertiesToExternalArrayData(void *data, ExternalArrayType array_type, int number_of_elements)
Definition: api.cc:3437
const intptr_t kHeapObjectTagMask
Definition: v8.h:3850
V8EXPORT Local< Uint32 > ToUint32() const
Definition: api.cc:2607
V8EXPORT bool Equals(Handle< Value > that) const
Definition: api.cc:2676
V8EXPORT Handle< Value > GetScriptId() const
Definition: api.cc:3710
static Number * Cast(v8::Value *obj)
Definition: v8.h:4330
void(* FailedAccessCheckCallback)(Local< Object > target, AccessType type, Local< Value > data)
Definition: v8.h:2697
ExtensionConfiguration(int name_count, const char *names[])
Definition: v8.h:3468
V8EXPORT bool IsExternal() const
Definition: api.cc:4023
V8EXPORT bool HasIndexedPropertiesInExternalArrayData()
Definition: api.cc:3460
static void * GetExternalPointer(internal::Object *obj)
Definition: v8.h:3970
V8EXPORT void SetInternalField(int index, Handle< Value > value)
Definition: api.cc:4150
V8EXPORT void SetPointerInInternalField(int index, void *value)
Definition: api.cc:4184
static V8EXPORT Local< Integer > NewFromUnsigned(uint32_t value)
Definition: api.cc:5113
Local< Object > Holder() const
Definition: v8.h:4433
Handle< Value >(* IndexedPropertyGetter)(uint32_t index, const AccessorInfo &info)
Definition: v8.h:2063
V8EXPORT Local< Value > GetRealNamedProperty(Handle< String > key)
Definition: api.cc:3198
V8EXPORT bool IsExternalAscii() const
Definition: api.cc:4033
T * operator*() const
Definition: v8.h:217
V8EXPORT bool IsStringObject() const
Definition: api.cc:2239
V8EXPORT bool MakeExternal(ExternalStringResource *resource)
Definition: api.cc:4759
V8EXPORT ScriptOrigin GetScriptOrigin() const
Definition: api.cc:3674
bool IsWeak() const
Definition: v8.h:4058
bool IsNull() const
Definition: v8.h:4295
V8EXPORT bool IsUint32() const
Definition: api.cc:2214
HANDLE HANDLE LPSTACKFRAME64 StackFrame
Persistent(S *that)
Definition: v8.h:348
V8EXPORT int InternalFieldCount()
Definition: api.cc:4121
static bool HasSmiTag(internal::Object *value)
Definition: v8.h:3946
Handle< Value >(* InvocationCallback)(const Arguments &args)
Definition: v8.h:2017
Handle< Value >(* NamedPropertyGetter)(Local< String > property, const AccessorInfo &info)
Definition: v8.h:2023
int max_old_space_size() const
Definition: v8.h:2609
V8EXPORT void * Value() const
Definition: api.cc:4638
V8EXPORT Local< String > ObjectProtoToString()
Definition: api.cc:2980
static V8EXPORT void DateTimeConfigurationChangeNotification()
Definition: api.cc:4934
void *(* CreateHistogramCallback)(const char *name, int min, int max, size_t buckets)
Definition: v8.h:2662
void set_max_old_space_size(int value)
Definition: v8.h:2610
V8EXPORT bool HasIndexedPropertiesInPixelData()
Definition: api.cc:3404
int max_young_space_size() const
Definition: v8.h:2607
static const int kIsolateStateOffset
Definition: v8.h:3924
const char * operator*() const
Definition: v8.h:1287
Handle< Integer >(* NamedPropertyQuery)(Local< String > property, const AccessorInfo &info)
Definition: v8.h:2040
static const int kMapInstanceTypeOffset
Definition: v8.h:3915
virtual int GetChunkSize()
Definition: v8.h:3800
V8EXPORT Local< Value > GetPrototype()
Definition: api.cc:2892
V8EXPORT bool ForceDelete(Handle< Value > key)
Definition: api.cc:2821
bool(* AllowCodeGenerationFromStringsCallback)(Local< Context > context)
Definition: v8.h:2707
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
int compressed_size
Definition: v8.h:2870
V8EXPORT int Utf8Length() const
Definition: api.cc:3725
bool operator==(Handle< S > that) const
Definition: v8.h:225
Handle()
Definition: v8.h:178
const int kHeapObjectTag
Definition: v8.h:3848
V8EXPORT bool HasIndexedLookupInterceptor()
Definition: api.cc:3152
Handle< Integer >(* IndexedPropertyQuery)(uint32_t index, const AccessorInfo &info)
Definition: v8.h:2080
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
Definition: v8.h:2917
int Length() const
Definition: v8.h:4143
const char * name() const
Definition: v8.h:2544
V8EXPORT int32_t Int32Value() const
Definition: api.cc:2654
void(* AccessorSetter)(Local< String > property, Local< Value > value, const AccessorInfo &info)
Definition: v8.h:1428
V8EXPORT bool IsBoolean() const
Definition: api.cc:2181
V8EXPORT Local< Object > NewInstance() const
Definition: api.cc:3605
virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate *data, int count)
Definition: v8.h:3814
int raw_size
Definition: v8.h:2871
V8EXPORT void SetIndexedPropertiesToPixelData(uint8_t *data, int length)
Definition: api.cc:3384
V8EXPORT void TurnOnAccessCheck()
Definition: api.cc:3214
#define TYPE_CHECK(T, S)
Definition: v8.h:143
static RegExp * Cast(v8::Value *obj)
Definition: v8.h:4378
V8EXPORT int GetScriptColumnNumber() const
Definition: api.cc:3701
void Enter()
Definition: api.cc:5403
GCType
Definition: v8.h:2718
V8EXPORT bool Has(Handle< String > key)
Definition: api.cc:3056
void SetWrapperClassId(uint16_t class_id)
Definition: v8.h:4092
void(* AddHistogramSampleCallback)(void *histogram, int sample)
Definition: v8.h:2667
V8EXPORT bool SetHiddenValue(Handle< String > key, Handle< Value > value)
Definition: api.cc:3286
void set_stack_limit(uint32_t *value)
Definition: v8.h:2615
static Persistent< T > New(Handle< T > that)
Definition: v8.h:4043
static void * GetEmbedderData(v8::Isolate *isolate)
Definition: v8.h:3996
static int SmiValue(internal::Object *value)
Definition: v8.h:3950
V8EXPORT Local< String > ToDetailString() const
Definition: api.cc:2325
static const int kUndefinedValueRootIndex
Definition: v8.h:3927
AccessType
Definition: v8.h:2101
static const int kOddballType
Definition: v8.h:3935
int max_executable_size()
Definition: v8.h:2611
static Local< T > New(Handle< T > that)
Definition: v8.h:4030
static String * Cast(v8::Value *obj)
Definition: v8.h:4242
V8EXPORT bool HasNamedLookupInterceptor()
Definition: api.cc:3144
Definition: v8.h:104
V8EXPORT bool BooleanValue() const
Definition: api.cc:2532
static External * Cast(Value *obj)
Definition: v8.h:4410
uint32_t * stack_limit() const
Definition: v8.h:2613
virtual ~ActivityControl()
Definition: v8.h:3830
Persistent()
Definition: v8.h:4072
V8EXPORT bool SetPrototype(Handle< Value > prototype)
Definition: api.cc:2903
static Integer * Cast(v8::Value *obj)
Definition: v8.h:4338
static void SetEmbedderData(v8::Isolate *isolate, void *data)
Definition: v8.h:3990
bool IsUndefined() const
Definition: v8.h:4277
void(* WeakReferenceCallback)(Persistent< Value > object, void *parameter)
Definition: v8.h:137
V8EXPORT bool IsFunction() const
Definition: api.cc:2147
static const int kFalseValueRootIndex
Definition: v8.h:3930
Handle< Boolean > V8EXPORT False()
Definition: api.cc:576
Definition: v8.h:592
static bool CanCastToHeapObject(Context *o)
Definition: v8.h:4014
Local()
Definition: v8.h:4026
ExternalStringResource * GetExternalStringResource() const
Definition: v8.h:4259
Local< Object > This() const
Definition: v8.h:4117
#define T(name, string, precedence)
Definition: token.cc:48
Definition: v8.h:1714
V8EXPORT int64_t IntegerValue() const
Definition: api.cc:2567
bool IsString() const
Definition: v8.h:4313
static Local< T > Cast(Local< S > that)
Definition: v8.h:281
V8EXPORT bool IsObject() const
Definition: api.cc:2169
void(* GCEpilogueCallback)(GCType type, GCCallbackFlags flags)
Definition: v8.h:2730
V8EXPORT void SetName(Handle< String > name)
Definition: api.cc:3653
Definition: v8.h:1401
V8EXPORT double Value() const
Definition: api.cc:4074
static V8EXPORT v8::Local< v8::String > Empty()
Definition: api.cc:4645
int dependency_count()
Definition: v8.h:2548
V8EXPORT Local< Value > CallAsFunction(Handle< Object > recv, int argc, Handle< Value > argv[])
Definition: api.cc:3536
const int kApiIntSize
Definition: v8.h:3845
V8EXPORT bool IsDate() const
Definition: api.cc:2231
const int kApiPointerSize
Definition: v8.h:3844
Local(Local< S > that)
Definition: v8.h:271
Handle< Integer > ResourceColumnOffset() const
Definition: v8.h:4165
AccessorInfo(internal::Object **args)
Definition: v8.h:2005
static internal::Object ** CreateHandle(internal::Object *value)
Definition: api.cc:719
V8EXPORT int GetIndexedPropertiesExternalArrayDataLength()
Definition: api.cc:3512
V8EXPORT uint32_t Uint32Value() const
Definition: api.cc:2735
DeclareExtension(Extension *extension)
Definition: v8.h:2575
virtual ~Extension()
Definition: v8.h:2538
Local< Value > operator[](int i) const
Definition: v8.h:4105
uint16_t * operator*()
Definition: v8.h:1331
static void * GetExternalPointerFromSmi(internal::Object *value)
Definition: v8.h:3965
static const int kHeapObjectMapOffset
Definition: v8.h:3914
static const int kEmptySymbolRootIndex
Definition: v8.h:3931
V8EXPORT bool IsNumber() const
Definition: api.cc:2175
int length() const
Definition: v8.h:1288
Persistent(Persistent< S > that)
Definition: v8.h:338
const String::ExternalAsciiStringResource * source() const
Definition: v8.h:2546
static T ReadField(Object *ptr, int offset)
Definition: v8.h:4008
V8EXPORT Local< String > StringValue() const
Definition: api.cc:4894
V8EXPORT bool ForceSet(Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None)
Definition: api.cc:2799
V8EXPORT bool Delete(Handle< String > key)
Definition: api.cc:3045
static bool CanCastToHeapObject(StackTrace *o)
Definition: v8.h:4018
ExternalAsciiStringResourceImpl(const char *data, size_t length)
Definition: v8.h:2516
Persistent< S > As()
Definition: v8.h:366
const intptr_t kPointerAlignment
Definition: v8globals.h:48
V8EXPORT Local< Object > Clone()
Definition: api.cc:3237
const int kSmiShiftSize
Definition: v8.h:3899
const int kSmiTagSize
Definition: v8.h:3854
V8EXPORT bool SetAccessor(Handle< String > name, AccessorGetter getter, AccessorSetter setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None)
Definition: api.cc:3085
static const int kFullStringRepresentationMask
Definition: v8.h:3921
virtual void VisitExternalString(Handle< String > string)
Definition: v8.h:2927
V8EXPORT int GetIndexedPropertiesPixelDataLength()
Definition: api.cc:3425
bool(* NamedSecurityCallback)(Local< Object > host, Local< Value > key, AccessType type, Local< Value > data)
Definition: v8.h:2114
V8EXPORT bool IsFalse() const
Definition: api.cc:2141
V8EXPORT Flags GetFlags() const
Definition: api.cc:5017
virtual ~ScriptData()
Definition: v8.h:520
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
Definition: flags.cc:274
static Persistent< T > Cast(Persistent< S > that)
Definition: v8.h:357
bool(* EntropySource)(unsigned char *buffer, size_t length)
Definition: v8.h:2904
static NumberObject * Cast(v8::Value *obj)
Definition: v8.h:4362
Definition: v8.h:1782
static V8EXPORT Local< Integer > New(int32_t value)
Definition: api.cc:5100
V8EXPORT int GetScriptLineNumber() const
Definition: api.cc:3691
void set_auto_enable(bool value)
Definition: v8.h:2550
const int kSmiTag
Definition: v8.h:3853
V8EXPORT int64_t Value() const
Definition: api.cc:4088
#define V8EXPORT
Definition: v8.h:73
void(* MessageCallback)(Handle< Message > message, Handle< Value > data)
Definition: v8.h:2633
Local< T > Close(Handle< T > value)
Definition: v8.h:4149
V8EXPORT bool IsNumberObject() const
Definition: api.cc:2247
static bool CanCastToHeapObject(void *o)
Definition: v8.h:4013
static const int kUndefinedOddballKind
Definition: v8.h:3938
V8EXPORT int WriteAscii(char *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const
Definition: api.cc:3960
static int GetOddballKind(internal::Object *obj)
Definition: v8.h:3960
Persistent(Handle< S > that)
Definition: v8.h:354
const int kHeapObjectTagSize
Definition: v8.h:3849
Handle< Primitive > V8EXPORT Undefined()
Definition: api.cc:546
V8EXPORT Local< Value > GetRealNamedPropertyInPrototypeChain(Handle< String > key)
Definition: api.cc:3183
static V8EXPORT Local< Number > New(double value)
Definition: api.cc:5087
static bool CanCastToHeapObject(Message *o)
Definition: v8.h:4017
SmiTagging< kApiPointerSize > PlatformSmiTagging
Definition: v8.h:3898
ObjectSpace
Definition: v8.h:2670
bool IsEmpty() const
Definition: v8.h:208
static V8EXPORT Local< String > Concat(Handle< String > left, Handle< String > right)
Definition: api.cc:4669
V8EXPORT double NumberValue() const
Definition: api.cc:4851
int length() const
Definition: v8.h:1311
V8EXPORT bool HasOwnProperty(Handle< String > key)
Definition: api.cc:3107
Definition: v8.h:1381
GCCallbackFlags
Definition: v8.h:2724
Isolate * GetIsolate() const
Definition: v8.h:4418
V8EXPORT Local< Object > ToObject() const
Definition: api.cc:2345
V8EXPORT bool IsArray() const
Definition: api.cc:2163
const uintptr_t kEncodablePointerMask
Definition: v8.h:3901
V8EXPORT uint32_t Length() const
Definition: api.cc:5040
const char * name_
Definition: flags.cc:1352
static int GetInstanceType(internal::Object *obj)
Definition: v8.h:3954
V8EXPORT Local< Boolean > ToBoolean() const
Definition: api.cc:2365
V8EXPORT Local< Integer > ToInteger() const
Definition: api.cc:2402
static const int kExternalTwoByteRepresentationTag
Definition: v8.h:3922
static const int kTrueValueRootIndex
Definition: v8.h:3929
static V8EXPORT Local< External > New(void *value)
Definition: api.cc:4628
Local< Value > Data() const
Definition: v8.h:4423
Handle< Boolean >(* IndexedPropertyDeleter)(uint32_t index, const AccessorInfo &info)
Definition: v8.h:2088
Isolate * GetIsolate() const
Definition: v8.h:4133
static BooleanObject * Cast(v8::Value *obj)
Definition: v8.h:4370
V8EXPORT bool IsInt32() const
Definition: api.cc:2197
V8EXPORT bool HasRealNamedProperty(Handle< String > key)
Definition: api.cc:3116
static bool HasHeapObjectTag(internal::Object *value)
Definition: v8.h:3941
static const int kForeignType
Definition: v8.h:3936
Scope(Isolate *isolate)
Definition: v8.h:2785
Scope(Handle< Context > context)
Definition: v8.h:3622
static Handle< Boolean > New(bool value)
Definition: v8.h:4170
size_t total_heap_size()
Definition: v8.h:2744
static const int kIsolateRootsOffset
Definition: v8.h:3926
static V8EXPORT Local< String > NewExternal(ExternalStringResource *resource)
Definition: api.cc:4747
bool V8EXPORT SetResourceConstraints(ResourceConstraints *constraints)
Definition: api.cc:593
V8EXPORT Handle< Value > GetInferredName() const
Definition: api.cc:3668
Handle(Handle< S > that)
Definition: v8.h:195
V8EXPORT Local< Object > FindInstanceInPrototypeChain(Handle< FunctionTemplate > tmpl)
Definition: api.cc:2920
const char * data() const
Definition: v8.h:2518
void ClearWeak()
Definition: v8.h:4082
void MarkIndependent()
Definition: v8.h:4087
size_t source_length() const
Definition: v8.h:2545
static StringObject * Cast(v8::Value *obj)
Definition: v8.h:4354
T * operator->() const
Definition: v8.h:215
Handle< Value > V8EXPORT ThrowException(Handle< Value > exception)
Definition: api.cc:485
void SetData(void *data)
Definition: v8.h:4474
Handle(T *val)
Definition: v8.h:183
const char ** dependencies()
Definition: v8.h:2549
bool IsConstructCall() const
Definition: v8.h:4138
static const int kIsolateEmbedderDataOffset
Definition: v8.h:3925
Handle< Array >(* IndexedPropertyEnumerator)(const AccessorInfo &info)
Definition: v8.h:2095
static const int kNullOddballKind
Definition: v8.h:3939
V8EXPORT int32_t Value() const
Definition: api.cc:4099
Handle< Value >(* AccessorGetter)(Local< String > property, const AccessorInfo &info)
Definition: v8.h:1424
Definition: v8.h:105
static bool CanCastToHeapObject(Object *o)
Definition: v8.h:4016
V8EXPORT int Write(uint16_t *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const
Definition: api.cc:3994
static internal::Object ** GetRoot(v8::Isolate *isolate, int index)
Definition: v8.h:4002
AccessControl
Definition: v8.h:1446
PropertyAttribute
Definition: v8.h:1400
static bool CanCastToHeapObject(StackFrame *o)
Definition: v8.h:4019
FlagType type() const
Definition: flags.cc:1358
virtual ~ExternalResourceVisitor()
Definition: v8.h:2926
size_t total_heap_size_executable()
Definition: v8.h:2745
static V8EXPORT Local< Object > New()
Definition: api.cc:4829
V8EXPORT Local< Uint32 > ToArrayIndex() const
Definition: api.cc:2625
V8EXPORT uint32_t Value() const
Definition: api.cc:4110
V8EXPORT int GetIdentityHash()
Definition: api.cc:3276
virtual OutputEncoding GetOutputEncoding()
Definition: v8.h:3802
static const int kJSObjectType
Definition: v8.h:3933
void set_max_executable_size(int value)
Definition: v8.h:2612
Handle< Boolean >(* NamedPropertyDeleter)(Local< String > property, const AccessorInfo &info)
Definition: v8.h:2049
V8EXPORT bool Value() const
Definition: api.cc:4081
V8EXPORT bool Set(Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None)
Definition: api.cc:2757
static const int kForeignAddressOffset
Definition: v8.h:3919
V8EXPORT double NumberValue() const
Definition: api.cc:4924