v8  3.25.30(node0.11.13)
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 // We reserve the V8_* prefix for macros defined in V8 public API and
44 // assume there are no name conflicts with the embedder's code.
45 
46 #ifdef V8_OS_WIN
47 
48 // Setup for Windows DLL export/import. When building the V8 DLL the
49 // BUILDING_V8_SHARED needs to be defined. When building a program which uses
50 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
51 // static library or building a program which uses the V8 static library neither
52 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
53 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
54 #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
55  build configuration to ensure that at most one of these is set
56 #endif
57 
58 #ifdef BUILDING_V8_SHARED
59 # define V8_EXPORT __declspec(dllexport)
60 #elif USING_V8_SHARED
61 # define V8_EXPORT __declspec(dllimport)
62 #else
63 # define V8_EXPORT
64 #endif // BUILDING_V8_SHARED
65 
66 #else // V8_OS_WIN
67 
68 // Setup for Linux shared library export.
69 #if V8_HAS_ATTRIBUTE_VISIBILITY && defined(V8_SHARED)
70 # ifdef BUILDING_V8_SHARED
71 # define V8_EXPORT __attribute__ ((visibility("default")))
72 # else
73 # define V8_EXPORT
74 # endif
75 #else
76 # define V8_EXPORT
77 #endif
78 
79 #endif // V8_OS_WIN
80 
84 namespace v8 {
85 
86 class AccessorSignature;
87 class Array;
88 class Boolean;
89 class BooleanObject;
90 class Context;
91 class CpuProfiler;
92 class Data;
93 class Date;
94 class DeclaredAccessorDescriptor;
95 class External;
96 class Function;
97 class FunctionTemplate;
98 class HeapProfiler;
99 class ImplementationUtilities;
100 class Int32;
101 class Integer;
102 class Isolate;
103 class Number;
104 class NumberObject;
105 class Object;
106 class ObjectOperationDescriptor;
107 class ObjectTemplate;
108 class Platform;
109 class Primitive;
110 class RawOperationDescriptor;
111 class Script;
112 class Signature;
113 class StackFrame;
114 class StackTrace;
115 class String;
116 class StringObject;
117 class Symbol;
118 class SymbolObject;
119 class Private;
120 class Uint32;
121 class Utils;
122 class Value;
123 template <class T> class Handle;
124 template <class T> class Local;
125 template <class T> class Eternal;
126 template<class T> class NonCopyablePersistentTraits;
127 template<class T> class PersistentBase;
128 template<class T,
130 template<class T> class UniquePersistent;
131 template<class K, class V, class T> class PersistentValueMap;
132 template<class T, class P> class WeakCallbackObject;
133 class FunctionTemplate;
134 class ObjectTemplate;
135 class Data;
136 template<typename T> class FunctionCallbackInfo;
137 template<typename T> class PropertyCallbackInfo;
138 class StackTrace;
139 class StackFrame;
140 class Isolate;
144 class CallHandlerHelper;
146 template<typename T> class ReturnValue;
147 
148 namespace internal {
149 class Arguments;
150 class Heap;
151 class HeapObject;
152 class Isolate;
153 class Object;
154 template<typename T> class CustomArguments;
157 class GlobalHandles;
158 }
159 
160 
164 class UniqueId {
165  public:
166  explicit UniqueId(intptr_t data)
167  : data_(data) {}
168 
169  bool operator==(const UniqueId& other) const {
170  return data_ == other.data_;
171  }
172 
173  bool operator!=(const UniqueId& other) const {
174  return data_ != other.data_;
175  }
176 
177  bool operator<(const UniqueId& other) const {
178  return data_ < other.data_;
179  }
180 
181  private:
182  intptr_t data_;
183 };
184 
185 // --- Handles ---
186 
187 #define TYPE_CHECK(T, S) \
188  while (false) { \
189  *(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
190  }
191 
192 
218 template <class T> class Handle {
219  public:
223  V8_INLINE Handle() : val_(0) {}
224 
235  template <class S> V8_INLINE Handle(Handle<S> that)
236  : val_(reinterpret_cast<T*>(*that)) {
242  TYPE_CHECK(T, S);
243  }
244 
248  V8_INLINE bool IsEmpty() const { return val_ == 0; }
249 
253  V8_INLINE void Clear() { val_ = 0; }
254 
255  V8_INLINE T* operator->() const { return val_; }
256 
257  V8_INLINE T* operator*() const { return val_; }
258 
265  template <class S> V8_INLINE bool operator==(const Handle<S>& that) const {
266  internal::Object** a = reinterpret_cast<internal::Object**>(this->val_);
267  internal::Object** b = reinterpret_cast<internal::Object**>(that.val_);
268  if (a == 0) return b == 0;
269  if (b == 0) return false;
270  return *a == *b;
271  }
272 
273  template <class S> V8_INLINE bool operator==(
274  const PersistentBase<S>& that) const {
275  internal::Object** a = reinterpret_cast<internal::Object**>(this->val_);
276  internal::Object** b = reinterpret_cast<internal::Object**>(that.val_);
277  if (a == 0) return b == 0;
278  if (b == 0) return false;
279  return *a == *b;
280  }
281 
288  template <class S> V8_INLINE bool operator!=(const Handle<S>& that) const {
289  return !operator==(that);
290  }
291 
292  template <class S> V8_INLINE bool operator!=(
293  const Persistent<S>& that) const {
294  return !operator==(that);
295  }
296 
297  template <class S> V8_INLINE static Handle<T> Cast(Handle<S> that) {
298 #ifdef V8_ENABLE_CHECKS
299  // If we're going to perform the type check then we have to check
300  // that the handle isn't empty before doing the checked cast.
301  if (that.IsEmpty()) return Handle<T>();
302 #endif
303  return Handle<T>(T::Cast(*that));
304  }
305 
306  template <class S> V8_INLINE Handle<S> As() {
307  return Handle<S>::Cast(*this);
308  }
309 
310  V8_INLINE static Handle<T> New(Isolate* isolate, Handle<T> that) {
311  return New(isolate, that.val_);
312  }
313  V8_INLINE static Handle<T> New(Isolate* isolate,
314  const PersistentBase<T>& that) {
315  return New(isolate, that.val_);
316  }
317 
318 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
319 
320  private:
321 #endif
322 
325  V8_INLINE explicit Handle(T* val) : val_(val) {}
326 
327  private:
328  friend class Utils;
329  template<class F, class M> friend class Persistent;
330  template<class F> friend class PersistentBase;
331  template<class F> friend class Handle;
332  template<class F> friend class Local;
333  template<class F> friend class FunctionCallbackInfo;
334  template<class F> friend class PropertyCallbackInfo;
335  template<class F> friend class internal::CustomArguments;
336  friend Handle<Primitive> Undefined(Isolate* isolate);
337  friend Handle<Primitive> Null(Isolate* isolate);
338  friend Handle<Boolean> True(Isolate* isolate);
339  friend Handle<Boolean> False(Isolate* isolate);
340  friend class Context;
341  friend class HandleScope;
342  friend class Object;
343  friend class Private;
344 
345  V8_INLINE static Handle<T> New(Isolate* isolate, T* that);
346 
347  T* val_;
348 };
349 
350 
358 template <class T> class Local : public Handle<T> {
359  public:
360  V8_INLINE Local();
361  template <class S> V8_INLINE Local(Local<S> that)
362  : Handle<T>(reinterpret_cast<T*>(*that)) {
368  TYPE_CHECK(T, S);
369  }
370 
371 
372  template <class S> V8_INLINE static Local<T> Cast(Local<S> that) {
373 #ifdef V8_ENABLE_CHECKS
374  // If we're going to perform the type check then we have to check
375  // that the handle isn't empty before doing the checked cast.
376  if (that.IsEmpty()) return Local<T>();
377 #endif
378  return Local<T>(T::Cast(*that));
379  }
380  template <class S> V8_INLINE Local(Handle<S> that)
381  : Handle<T>(reinterpret_cast<T*>(*that)) {
382  TYPE_CHECK(T, S);
383  }
384 
385  template <class S> V8_INLINE Local<S> As() {
386  return Local<S>::Cast(*this);
387  }
388 
394  V8_INLINE static Local<T> New(Isolate* isolate, Handle<T> that);
395  V8_INLINE static Local<T> New(Isolate* isolate,
396  const PersistentBase<T>& that);
397 
398 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
399 
400  private:
401 #endif
402  template <class S> V8_INLINE Local(S* that) : Handle<T>(that) { }
403 
404  private:
405  friend class Utils;
406  template<class F> friend class Eternal;
407  template<class F> friend class PersistentBase;
408  template<class F, class M> friend class Persistent;
409  template<class F> friend class Handle;
410  template<class F> friend class Local;
411  template<class F> friend class FunctionCallbackInfo;
412  template<class F> friend class PropertyCallbackInfo;
413  friend class String;
414  friend class Object;
415  friend class Context;
416  template<class F> friend class internal::CustomArguments;
417  friend class HandleScope;
418  friend class EscapableHandleScope;
419  template<class F1, class F2, class F3> friend class PersistentValueMap;
420 
421  V8_INLINE static Local<T> New(Isolate* isolate, T* that);
422 };
423 
424 
425 // Eternal handles are set-once handles that live for the life of the isolate.
426 template <class T> class Eternal {
427  public:
428  V8_INLINE Eternal() : index_(kInitialValue) { }
429  template<class S>
430  V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : index_(kInitialValue) {
431  Set(isolate, handle);
432  }
433  // Can only be safely called if already set.
434  V8_INLINE Local<T> Get(Isolate* isolate);
435  V8_INLINE bool IsEmpty() { return index_ == kInitialValue; }
436  template<class S> V8_INLINE void Set(Isolate* isolate, Local<S> handle);
437 
438  private:
439  static const int kInitialValue = -1;
440  int index_;
441 };
442 
443 
444 template<class T, class P>
446  public:
447  typedef void (*Callback)(const WeakCallbackData<T, P>& data);
448 
449  V8_INLINE Isolate* GetIsolate() const { return isolate_; }
450  V8_INLINE Local<T> GetValue() const { return handle_; }
451  V8_INLINE P* GetParameter() const { return parameter_; }
452 
453  private:
455  WeakCallbackData(Isolate* isolate, Local<T> handle, P* parameter)
456  : isolate_(isolate), handle_(handle), parameter_(parameter) { }
457  Isolate* isolate_;
458  Local<T> handle_;
459  P* parameter_;
460 };
461 
462 
476 template <class T> class PersistentBase {
477  public:
482  V8_INLINE void Reset();
487  template <class S>
488  V8_INLINE void Reset(Isolate* isolate, const Handle<S>& other);
489 
494  template <class S>
495  V8_INLINE void Reset(Isolate* isolate, const PersistentBase<S>& other);
496 
497  V8_INLINE bool IsEmpty() const { return val_ == 0; }
498 
499  template <class S>
500  V8_INLINE bool operator==(const PersistentBase<S>& that) const {
501  internal::Object** a = reinterpret_cast<internal::Object**>(this->val_);
502  internal::Object** b = reinterpret_cast<internal::Object**>(that.val_);
503  if (a == 0) return b == 0;
504  if (b == 0) return false;
505  return *a == *b;
506  }
507 
508  template <class S> V8_INLINE bool operator==(const Handle<S>& that) const {
509  internal::Object** a = reinterpret_cast<internal::Object**>(this->val_);
510  internal::Object** b = reinterpret_cast<internal::Object**>(that.val_);
511  if (a == 0) return b == 0;
512  if (b == 0) return false;
513  return *a == *b;
514  }
515 
516  template <class S>
517  V8_INLINE bool operator!=(const PersistentBase<S>& that) const {
518  return !operator==(that);
519  }
520 
521  template <class S> V8_INLINE bool operator!=(const Handle<S>& that) const {
522  return !operator==(that);
523  }
524 
525  template<typename P>
526  V8_INLINE void SetWeak(
527  P* parameter,
528  typename WeakCallbackData<T, P>::Callback callback);
529 
530  template<typename S, typename P>
531  V8_INLINE void SetWeak(
532  P* parameter,
533  typename WeakCallbackData<S, P>::Callback callback);
534 
535  template<typename P>
536  V8_INLINE P* ClearWeak();
537 
538  // TODO(dcarney): remove this.
539  V8_INLINE void ClearWeak() { ClearWeak<void>(); }
540 
547  V8_INLINE void MarkIndependent();
548 
558 
559  V8_INLINE bool IsIndependent() const;
560 
562  V8_INLINE bool IsNearDeath() const;
563 
565  V8_INLINE bool IsWeak() const;
566 
571  V8_INLINE void SetWrapperClassId(uint16_t class_id);
572 
578 
579  private:
580  friend class Isolate;
581  friend class Utils;
582  template<class F> friend class Handle;
583  template<class F> friend class Local;
584  template<class F1, class F2> friend class Persistent;
585  template<class F> friend class UniquePersistent;
586  template<class F> friend class PersistentBase;
587  template<class F> friend class ReturnValue;
588  template<class F1, class F2, class F3> friend class PersistentValueMap;
589  friend class Object;
590 
591  explicit V8_INLINE PersistentBase(T* val) : val_(val) {}
592  PersistentBase(PersistentBase& other); // NOLINT
593  void operator=(PersistentBase&);
594  V8_INLINE static T* New(Isolate* isolate, T* that);
595 
596  T* val_;
597 };
598 
599 
606 template<class T>
607 class NonCopyablePersistentTraits {
608  public:
610  static const bool kResetInDestructor = false;
611  template<class S, class M>
612  V8_INLINE static void Copy(const Persistent<S, M>& source,
613  NonCopyablePersistent* dest) {
614  Uncompilable<Object>();
615  }
616  // TODO(dcarney): come up with a good compile error here.
617  template<class O> V8_INLINE static void Uncompilable() {
618  TYPE_CHECK(O, Primitive);
619  }
620 };
621 
622 
627 template<class T>
630  static const bool kResetInDestructor = true;
631  template<class S, class M>
632  static V8_INLINE void Copy(const Persistent<S, M>& source,
633  CopyablePersistent* dest) {
634  // do nothing, just allow copy
635  }
636 };
637 
638 
647 template <class T, class M> class Persistent : public PersistentBase<T> {
648  public:
658  template <class S> V8_INLINE Persistent(Isolate* isolate, Handle<S> that)
659  : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) {
660  TYPE_CHECK(T, S);
661  }
667  template <class S, class M2>
669  : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) {
670  TYPE_CHECK(T, S);
671  }
679  Copy(that);
680  }
681  template <class S, class M2>
683  Copy(that);
684  }
685  V8_INLINE Persistent& operator=(const Persistent& that) { // NOLINT
686  Copy(that);
687  return *this;
688  }
689  template <class S, class M2>
691  Copy(that);
692  return *this;
693  }
700  if (M::kResetInDestructor) this->Reset();
701  }
702 
703  // TODO(dcarney): this is pretty useless, fix or remove
704  template <class S>
705  V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT
706 #ifdef V8_ENABLE_CHECKS
707  // If we're going to perform the type check then we have to check
708  // that the handle isn't empty before doing the checked cast.
709  if (!that.IsEmpty()) T::Cast(*that);
710 #endif
711  return reinterpret_cast<Persistent<T>&>(that);
712  }
713 
714  // TODO(dcarney): this is pretty useless, fix or remove
715  template <class S> V8_INLINE Persistent<S>& As() { // NOLINT
716  return Persistent<S>::Cast(*this);
717  }
718 
719  // This will be removed.
721 
722  // TODO(dcarney): remove
723 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
724 
725  private:
726 #endif
727  template <class S> V8_INLINE Persistent(S* that) : PersistentBase<T>(that) { }
728 
729  V8_INLINE T* operator*() const { return this->val_; }
730 
731  private:
732  friend class Isolate;
733  friend class Utils;
734  template<class F> friend class Handle;
735  template<class F> friend class Local;
736  template<class F1, class F2> friend class Persistent;
737  template<class F> friend class ReturnValue;
738 
739  template<class S, class M2>
740  V8_INLINE void Copy(const Persistent<S, M2>& that);
741 };
742 
743 
749 template<class T>
750 class UniquePersistent : public PersistentBase<T> {
751  struct RValue {
752  V8_INLINE explicit RValue(UniquePersistent* obj) : object(obj) {}
753  UniquePersistent* object;
754  };
755 
756  public:
766  template <class S>
768  : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) {
769  TYPE_CHECK(T, S);
770  }
776  template <class S>
778  : PersistentBase<T>(PersistentBase<T>::New(isolate, that.val_)) {
779  TYPE_CHECK(T, S);
780  }
785  : PersistentBase<T>(rvalue.object->val_) {
786  rvalue.object->val_ = 0;
787  }
792  template<class S>
794  TYPE_CHECK(T, S);
795  this->Reset();
796  this->val_ = rhs.val_;
797  rhs.val_ = 0;
798  return *this;
799  }
803  V8_INLINE operator RValue() { return RValue(this); }
807  V8_INLINE UniquePersistent Pass() { return UniquePersistent(RValue(this)); }
808 
809  private:
812 };
813 
814 
830  public:
831  HandleScope(Isolate* isolate);
832 
833  ~HandleScope();
834 
838  static int NumberOfHandles(Isolate* isolate);
839 
841  return reinterpret_cast<Isolate*>(isolate_);
842  }
843 
844  protected:
846 
847  void Initialize(Isolate* isolate);
848 
849  static internal::Object** CreateHandle(internal::Isolate* isolate,
850  internal::Object* value);
851 
852  private:
853  // Uses heap_object to obtain the current Isolate.
854  static internal::Object** CreateHandle(internal::HeapObject* heap_object,
855  internal::Object* value);
856 
857  // Make it hard to create heap-allocated or illegal handle scopes by
858  // disallowing certain operations.
859  HandleScope(const HandleScope&);
860  void operator=(const HandleScope&);
861  void* operator new(size_t size);
862  void operator delete(void*, size_t);
863 
864  internal::Isolate* isolate_;
865  internal::Object** prev_next_;
866  internal::Object** prev_limit_;
867 
868  // Local::New uses CreateHandle with an Isolate* parameter.
869  template<class F> friend class Local;
870 
871  // Object::GetInternalField and Context::GetEmbedderData use CreateHandle with
872  // a HeapObject* in their shortcuts.
873  friend class Object;
874  friend class Context;
875 };
876 
877 
883  public:
884  EscapableHandleScope(Isolate* isolate);
886 
891  template <class T>
893  internal::Object** slot =
894  Escape(reinterpret_cast<internal::Object**>(*value));
895  return Local<T>(reinterpret_cast<T*>(slot));
896  }
897 
898  private:
899  internal::Object** Escape(internal::Object** escape_value);
900 
901  // Make it hard to create heap-allocated or illegal handle scopes by
902  // disallowing certain operations.
904  void operator=(const EscapableHandleScope&);
905  void* operator new(size_t size);
906  void operator delete(void*, size_t);
907 
908  internal::Object** escape_slot_;
909 };
910 
911 
916 template<class T>
917 struct Maybe {
919  explicit Maybe(T t) : has_value(true), value(t) {}
920  Maybe(bool has, T t) : has_value(has), value(t) {}
921 
922  bool has_value;
924 };
925 
926 
927 // --- Special objects ---
928 
929 
934  private:
935  Data();
936 };
937 
938 
945 class V8_EXPORT ScriptData { // NOLINT
946  public:
947  virtual ~ScriptData() { }
948 
957  static ScriptData* PreCompile(Handle<String> source);
958 
966  static ScriptData* New(const char* data, int length);
967 
971  virtual int Length() = 0;
972 
977  virtual const char* Data() = 0;
978 
982  virtual bool HasError() = 0;
983 };
984 
985 
990  public:
992  Handle<Value> resource_name,
993  Handle<Integer> resource_line_offset = Handle<Integer>(),
994  Handle<Integer> resource_column_offset = Handle<Integer>(),
995  Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>())
996  : resource_name_(resource_name),
997  resource_line_offset_(resource_line_offset),
998  resource_column_offset_(resource_column_offset),
999  resource_is_shared_cross_origin_(resource_is_shared_cross_origin) { }
1004  private:
1005  Handle<Value> resource_name_;
1006  Handle<Integer> resource_line_offset_;
1007  Handle<Integer> resource_column_offset_;
1008  Handle<Boolean> resource_is_shared_cross_origin_;
1009 };
1010 
1011 
1016  public:
1020  Local<Script> BindToCurrentContext();
1021 
1022  int GetId();
1023  Handle<Value> GetScriptName();
1024 
1029  int GetLineNumber(int code_pos);
1030 
1031  static const int kNoScriptId = 0;
1032 };
1033 
1034 
1040  public:
1046  static Local<Script> Compile(Handle<String> source,
1047  ScriptOrigin* origin = NULL,
1048  ScriptData* script_data = NULL);
1049 
1050  // To be decprecated, use the Compile above.
1051  static Local<Script> Compile(Handle<String> source,
1052  Handle<String> file_name);
1053 
1059  Local<Value> Run();
1060 
1064  Local<UnboundScript> GetUnboundScript();
1065 
1066  // To be deprecated; use GetUnboundScript()->GetId();
1067  int GetId() {
1068  return GetUnboundScript()->GetId();
1069  }
1070 
1071  // Use GetUnboundScript()->GetId();
1072  V8_DEPRECATED("Use GetUnboundScript()->GetId()",
1073  Handle<Value> GetScriptName()) {
1074  return GetUnboundScript()->GetScriptName();
1075  }
1076 
1081  V8_DEPRECATED("Use GetUnboundScript()->GetLineNumber()",
1082  int GetLineNumber(int code_pos)) {
1083  return GetUnboundScript()->GetLineNumber(code_pos);
1084  }
1085 };
1086 
1087 
1092  public:
1103  BufferOwned
1104  };
1105 
1106  CachedData() : data(NULL), length(0), buffer_policy(BufferNotOwned) {}
1107 
1108  // If buffer_policy is BufferNotOwned, the caller keeps the ownership of
1109  // data and guarantees that it stays alive until the CachedData object is
1110  // destroyed. If the policy is BufferOwned, the given data will be deleted
1111  // (with delete[]) when the CachedData object is destroyed.
1112  CachedData(const uint8_t* data, int length,
1113  BufferPolicy buffer_policy = BufferNotOwned);
1114  ~CachedData();
1115  // TODO(marja): Async compilation; add constructors which take a callback
1116  // which will be called when V8 no longer needs the data.
1117  const uint8_t* data;
1118  int length;
1120 
1121  private:
1122  // Prevent copying. Not implemented.
1123  CachedData(const CachedData&);
1124  CachedData& operator=(const CachedData&);
1125  };
1126 
1131  class Source {
1132  public:
1133  // Source takes ownership of CachedData.
1134  V8_INLINE Source(Local<String> source_string, const ScriptOrigin& origin,
1135  CachedData* cached_data = NULL);
1136  V8_INLINE Source(Local<String> source_string,
1137  CachedData* cached_data = NULL);
1138  V8_INLINE ~Source();
1139 
1140  // Ownership of the CachedData or its buffers is *not* transferred to the
1141  // caller. The CachedData object is alive as long as the Source object is
1142  // alive.
1143  V8_INLINE const CachedData* GetCachedData() const;
1144 
1145  private:
1146  friend class ScriptCompiler;
1147  // Prevent copying. Not implemented.
1148  Source(const Source&);
1149  Source& operator=(const Source&);
1150 
1151  Local<String> source_string;
1152 
1153  // Origin information
1154  Handle<Value> resource_name;
1155  Handle<Integer> resource_line_offset;
1156  Handle<Integer> resource_column_offset;
1157  Handle<Boolean> resource_is_shared_cross_origin;
1158 
1159  // Cached data from previous compilation (if any), or generated during
1160  // compilation (if the generate_cached_data flag is passed to
1161  // ScriptCompiler).
1162  CachedData* cached_data;
1163  };
1164 
1167  kProduceDataToCache = 1 << 0
1168  };
1169 
1177  static Local<UnboundScript> CompileUnbound(
1178  Isolate* isolate, Source* source,
1179  CompileOptions options = kNoCompileOptions);
1180 
1192  static Local<Script> Compile(
1193  Isolate* isolate, Source* source,
1194  CompileOptions options = kNoCompileOptions);
1195 };
1196 
1197 
1202  public:
1203  Local<String> Get() const;
1204  Local<String> GetSourceLine() const;
1205 
1210  Handle<Value> GetScriptResourceName() const;
1211 
1216  Handle<Value> GetScriptData() const;
1217 
1223  Handle<StackTrace> GetStackTrace() const;
1224 
1228  int GetLineNumber() const;
1229 
1234  int GetStartPosition() const;
1235 
1240  int GetEndPosition() const;
1241 
1246  int GetStartColumn() const;
1247 
1252  int GetEndColumn() const;
1253 
1258  bool IsSharedCrossOrigin() const;
1259 
1260  // TODO(1245381): Print to a string instead of on a FILE.
1261  static void PrintCurrentStackTrace(Isolate* isolate, FILE* out);
1262 
1263  static const int kNoLineNumberInfo = 0;
1264  static const int kNoColumnInfo = 0;
1265  static const int kNoScriptIdInfo = 0;
1266 };
1267 
1268 
1275  public:
1281  kLineNumber = 1,
1282  kColumnOffset = 1 << 1 | kLineNumber,
1283  kScriptName = 1 << 2,
1284  kFunctionName = 1 << 3,
1285  kIsEval = 1 << 4,
1286  kIsConstructor = 1 << 5,
1287  kScriptNameOrSourceURL = 1 << 6,
1288  kScriptId = 1 << 7,
1289  kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName,
1290  kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
1291  };
1292 
1296  Local<StackFrame> GetFrame(uint32_t index) const;
1297 
1301  int GetFrameCount() const;
1302 
1306  Local<Array> AsArray();
1307 
1315  static Local<StackTrace> CurrentStackTrace(
1316  Isolate* isolate,
1317  int frame_limit,
1318  StackTraceOptions options = kOverview);
1319 };
1320 
1321 
1326  public:
1333  int GetLineNumber() const;
1334 
1342  int GetColumn() const;
1343 
1350  int GetScriptId() const;
1351 
1356  Local<String> GetScriptName() const;
1357 
1365 
1369  Local<String> GetFunctionName() const;
1370 
1375  bool IsEval() const;
1376 
1381  bool IsConstructor() const;
1382 };
1383 
1384 
1389  public:
1397  static Local<Value> Parse(Local<String> json_string);
1398 };
1399 
1400 
1401 // --- Value ---
1402 
1403 
1407 class V8_EXPORT Value : public Data {
1408  public:
1413  V8_INLINE bool IsUndefined() const;
1414 
1419  V8_INLINE bool IsNull() const;
1420 
1424  bool IsTrue() const;
1425 
1429  bool IsFalse() const;
1430 
1435  V8_INLINE bool IsString() const;
1436 
1441  bool IsSymbol() const;
1442 
1446  bool IsFunction() const;
1447 
1451  bool IsArray() const;
1452 
1456  bool IsObject() const;
1457 
1461  bool IsBoolean() const;
1462 
1466  bool IsNumber() const;
1467 
1471  bool IsExternal() const;
1472 
1476  bool IsInt32() const;
1477 
1481  bool IsUint32() const;
1482 
1486  bool IsDate() const;
1487 
1491  bool IsBooleanObject() const;
1492 
1496  bool IsNumberObject() const;
1497 
1501  bool IsStringObject() const;
1502 
1507  bool IsSymbolObject() const;
1508 
1512  bool IsNativeError() const;
1513 
1517  bool IsRegExp() const;
1518 
1523  bool IsPromise() const;
1524 
1529  bool IsArrayBuffer() const;
1530 
1535  bool IsArrayBufferView() const;
1536 
1541  bool IsTypedArray() const;
1542 
1547  bool IsUint8Array() const;
1548 
1553  bool IsUint8ClampedArray() const;
1554 
1559  bool IsInt8Array() const;
1560 
1565  bool IsUint16Array() const;
1566 
1571  bool IsInt16Array() const;
1572 
1577  bool IsUint32Array() const;
1578 
1583  bool IsInt32Array() const;
1584 
1589  bool IsFloat32Array() const;
1590 
1595  bool IsFloat64Array() const;
1596 
1601  bool IsDataView() const;
1602 
1603  Local<Boolean> ToBoolean() const;
1604  Local<Number> ToNumber() const;
1605  Local<String> ToString() const;
1606  Local<String> ToDetailString() const;
1607  Local<Object> ToObject() const;
1608  Local<Integer> ToInteger() const;
1609  Local<Uint32> ToUint32() const;
1610  Local<Int32> ToInt32() const;
1611 
1616  Local<Uint32> ToArrayIndex() const;
1617 
1618  bool BooleanValue() const;
1619  double NumberValue() const;
1620  int64_t IntegerValue() const;
1621  uint32_t Uint32Value() const;
1622  int32_t Int32Value() const;
1623 
1625  bool Equals(Handle<Value> that) const;
1626  bool StrictEquals(Handle<Value> that) const;
1627  bool SameValue(Handle<Value> that) const;
1628 
1629  template <class T> V8_INLINE static Value* Cast(T* value);
1630 
1631  private:
1632  V8_INLINE bool QuickIsUndefined() const;
1633  V8_INLINE bool QuickIsNull() const;
1634  V8_INLINE bool QuickIsString() const;
1635  bool FullIsUndefined() const;
1636  bool FullIsNull() const;
1637  bool FullIsString() const;
1638 };
1639 
1640 
1644 class V8_EXPORT Primitive : public Value { };
1645 
1646 
1651 class V8_EXPORT Boolean : public Primitive {
1652  public:
1653  bool Value() const;
1654  V8_INLINE static Handle<Boolean> New(Isolate* isolate, bool value);
1655 };
1656 
1657 
1661 class V8_EXPORT String : public Primitive {
1662  public:
1663  enum Encoding {
1664  UNKNOWN_ENCODING = 0x1,
1665  TWO_BYTE_ENCODING = 0x0,
1666  ASCII_ENCODING = 0x4,
1667  ONE_BYTE_ENCODING = 0x4
1668  };
1672  int Length() const;
1673 
1678  int Utf8Length() const;
1679 
1685  bool IsOneByte() const;
1686 
1691  bool ContainsOnlyOneByte() const;
1692 
1719  NO_OPTIONS = 0,
1720  HINT_MANY_WRITES_EXPECTED = 1,
1721  NO_NULL_TERMINATION = 2,
1722  PRESERVE_ASCII_NULL = 4,
1723  // Used by WriteUtf8 to replace orphan surrogate code units with the
1724  // unicode replacement character. Needs to be set to guarantee valid UTF-8
1725  // output.
1726  REPLACE_INVALID_UTF8 = 8
1727  };
1728 
1729  // 16-bit character codes.
1730  int Write(uint16_t* buffer,
1731  int start = 0,
1732  int length = -1,
1733  int options = NO_OPTIONS) const;
1734  // One byte characters.
1735  int WriteOneByte(uint8_t* buffer,
1736  int start = 0,
1737  int length = -1,
1738  int options = NO_OPTIONS) const;
1739  // UTF-8 encoded characters.
1740  int WriteUtf8(char* buffer,
1741  int length = -1,
1742  int* nchars_ref = NULL,
1743  int options = NO_OPTIONS) const;
1744 
1748  V8_INLINE static v8::Local<v8::String> Empty(Isolate* isolate);
1749 
1753  bool IsExternal() const;
1754 
1758  bool IsExternalAscii() const;
1759 
1761  public:
1763 
1764  protected:
1766 
1773  virtual void Dispose() { delete this; }
1774 
1775  private:
1776  // Disallow copying and assigning.
1778  void operator=(const ExternalStringResourceBase&);
1779 
1780  friend class v8::internal::Heap;
1781  };
1782 
1790  : public ExternalStringResourceBase {
1791  public:
1797 
1801  virtual const uint16_t* data() const = 0;
1802 
1806  virtual size_t length() const = 0;
1807 
1808  protected:
1810  };
1811 
1824  : public ExternalStringResourceBase {
1825  public:
1832  virtual const char* data() const = 0;
1834  virtual size_t length() const = 0;
1835  protected:
1837  };
1838 
1840 
1846  V8_INLINE ExternalStringResourceBase* GetExternalStringResourceBase(
1847  Encoding* encoding_out) const;
1848 
1853  V8_INLINE ExternalStringResource* GetExternalStringResource() const;
1854 
1859  const ExternalAsciiStringResource* GetExternalAsciiStringResource() const;
1860 
1861  V8_INLINE static String* Cast(v8::Value* obj);
1862 
1864  kNormalString, kInternalizedString, kUndetectableString
1865  };
1866 
1868  static Local<String> NewFromUtf8(Isolate* isolate,
1869  const char* data,
1870  NewStringType type = kNormalString,
1871  int length = -1);
1872 
1874  static Local<String> NewFromOneByte(
1875  Isolate* isolate,
1876  const uint8_t* data,
1877  NewStringType type = kNormalString,
1878  int length = -1);
1879 
1881  static Local<String> NewFromTwoByte(
1882  Isolate* isolate,
1883  const uint16_t* data,
1884  NewStringType type = kNormalString,
1885  int length = -1);
1886 
1891  static Local<String> Concat(Handle<String> left, Handle<String> right);
1892 
1901  static Local<String> NewExternal(Isolate* isolate,
1902  ExternalStringResource* resource);
1903 
1913  bool MakeExternal(ExternalStringResource* resource);
1914 
1923  static Local<String> NewExternal(Isolate* isolate,
1924  ExternalAsciiStringResource* resource);
1925 
1935  bool MakeExternal(ExternalAsciiStringResource* resource);
1936 
1940  bool CanMakeExternal();
1941 
1950  public:
1951  explicit Utf8Value(Handle<v8::Value> obj);
1952  ~Utf8Value();
1953  char* operator*() { return str_; }
1954  const char* operator*() const { return str_; }
1955  int length() const { return length_; }
1956  private:
1957  char* str_;
1958  int length_;
1959 
1960  // Disallow copying and assigning.
1961  Utf8Value(const Utf8Value&);
1962  void operator=(const Utf8Value&);
1963  };
1964 
1972  public:
1973  explicit Value(Handle<v8::Value> obj);
1974  ~Value();
1975  uint16_t* operator*() { return str_; }
1976  const uint16_t* operator*() const { return str_; }
1977  int length() const { return length_; }
1978  private:
1979  uint16_t* str_;
1980  int length_;
1981 
1982  // Disallow copying and assigning.
1983  Value(const Value&);
1984  void operator=(const Value&);
1985  };
1986 
1987  private:
1988  void VerifyExternalStringResourceBase(ExternalStringResourceBase* v,
1989  Encoding encoding) const;
1990  void VerifyExternalStringResource(ExternalStringResource* val) const;
1991  static void CheckCast(v8::Value* obj);
1992 };
1993 
1994 
2000 class V8_EXPORT Symbol : public Primitive {
2001  public:
2002  // Returns the print name string of the symbol, or undefined if none.
2003  Local<Value> Name() const;
2004 
2005  // Create a symbol. If name is not empty, it will be used as the description.
2006  static Local<Symbol> New(
2007  Isolate *isolate, Local<String> name = Local<String>());
2008 
2009  // Access global symbol registry.
2010  // Note that symbols created this way are never collected, so
2011  // they should only be used for statically fixed properties.
2012  // Also, there is only one global name space for the names used as keys.
2013  // To minimize the potential for clashes, use qualified names as keys.
2014  static Local<Symbol> For(Isolate *isolate, Local<String> name);
2015 
2016  // Retrieve a global symbol. Similar to |For|, but using a separate
2017  // registry that is not accessible by (and cannot clash with) JavaScript code.
2018  static Local<Symbol> ForApi(Isolate *isolate, Local<String> name);
2019 
2020  V8_INLINE static Symbol* Cast(v8::Value* obj);
2021  private:
2022  Symbol();
2023  static void CheckCast(v8::Value* obj);
2024 };
2025 
2026 
2032 class V8_EXPORT Private : public Data {
2033  public:
2034  // Returns the print name string of the private symbol, or undefined if none.
2035  Local<Value> Name() const;
2036 
2037  // Create a private symbol. If name is not empty, it will be the description.
2038  static Local<Private> New(
2039  Isolate *isolate, Local<String> name = Local<String>());
2040 
2041  // Retrieve a global private symbol. If a symbol with this name has not
2042  // been retrieved in the same isolate before, it is created.
2043  // Note that private symbols created this way are never collected, so
2044  // they should only be used for statically fixed properties.
2045  // Also, there is only one global name space for the names used as keys.
2046  // To minimize the potential for clashes, use qualified names as keys,
2047  // e.g., "Class#property".
2048  static Local<Private> ForApi(Isolate *isolate, Local<String> name);
2049 
2050  private:
2051  Private();
2052 };
2053 
2054 
2058 class V8_EXPORT Number : public Primitive {
2059  public:
2060  double Value() const;
2061  static Local<Number> New(Isolate* isolate, double value);
2062  V8_INLINE static Number* Cast(v8::Value* obj);
2063  private:
2064  Number();
2065  static void CheckCast(v8::Value* obj);
2066 };
2067 
2068 
2072 class V8_EXPORT Integer : public Number {
2073  public:
2074  static Local<Integer> New(Isolate* isolate, int32_t value);
2075  static Local<Integer> NewFromUnsigned(Isolate* isolate, uint32_t value);
2076  int64_t Value() const;
2077  V8_INLINE static Integer* Cast(v8::Value* obj);
2078  private:
2079  Integer();
2080  static void CheckCast(v8::Value* obj);
2081 };
2082 
2083 
2087 class V8_EXPORT Int32 : public Integer {
2088  public:
2089  int32_t Value() const;
2090  private:
2091  Int32();
2092 };
2093 
2094 
2098 class V8_EXPORT Uint32 : public Integer {
2099  public:
2100  uint32_t Value() const;
2101  private:
2102  Uint32();
2103 };
2104 
2105 
2107  None = 0,
2108  ReadOnly = 1 << 0,
2109  DontEnum = 1 << 1,
2110  DontDelete = 1 << 2
2111 };
2112 
2123 
2124  // Legacy constant names
2134 };
2135 
2141 typedef void (*AccessorGetterCallback)(
2142  Local<String> property,
2144 
2145 
2146 typedef void (*AccessorSetterCallback)(
2147  Local<String> property,
2148  Local<Value> value,
2150 
2151 
2166  DEFAULT = 0,
2168  ALL_CAN_WRITE = 1 << 1,
2170 };
2171 
2172 
2176 class V8_EXPORT Object : public Value {
2177  public:
2178  bool Set(Handle<Value> key,
2179  Handle<Value> value,
2180  PropertyAttribute attribs = None);
2181 
2182  bool Set(uint32_t index, Handle<Value> value);
2183 
2184  // Sets a local property on this object bypassing interceptors and
2185  // overriding accessors or read-only properties.
2186  //
2187  // Note that if the object has an interceptor the property will be set
2188  // locally, but since the interceptor takes precedence the local property
2189  // will only be returned if the interceptor doesn't return a value.
2190  //
2191  // Note also that this only works for named properties.
2192  bool ForceSet(Handle<Value> key,
2193  Handle<Value> value,
2194  PropertyAttribute attribs = None);
2195 
2196  Local<Value> Get(Handle<Value> key);
2197 
2198  Local<Value> Get(uint32_t index);
2199 
2205  PropertyAttribute GetPropertyAttributes(Handle<Value> key);
2206 
2207  bool Has(Handle<Value> key);
2208 
2209  bool Delete(Handle<Value> key);
2210 
2211  // Delete a property on this object bypassing interceptors and
2212  // ignoring dont-delete attributes.
2213  bool ForceDelete(Handle<Value> key);
2214 
2215  bool Has(uint32_t index);
2216 
2217  bool Delete(uint32_t index);
2218 
2219  bool SetAccessor(Handle<String> name,
2220  AccessorGetterCallback getter,
2221  AccessorSetterCallback setter = 0,
2222  Handle<Value> data = Handle<Value>(),
2223  AccessControl settings = DEFAULT,
2224  PropertyAttribute attribute = None);
2225 
2226  // This function is not yet stable and should not be used at this time.
2227  bool SetDeclaredAccessor(Local<String> name,
2229  PropertyAttribute attribute = None,
2230  AccessControl settings = DEFAULT);
2231 
2232  void SetAccessorProperty(Local<String> name,
2233  Local<Function> getter,
2235  PropertyAttribute attribute = None,
2236  AccessControl settings = DEFAULT);
2237 
2244  bool HasPrivate(Handle<Private> key);
2245  bool SetPrivate(Handle<Private> key, Handle<Value> value);
2246  bool DeletePrivate(Handle<Private> key);
2247  Local<Value> GetPrivate(Handle<Private> key);
2248 
2255  Local<Array> GetPropertyNames();
2256 
2262  Local<Array> GetOwnPropertyNames();
2263 
2269  Local<Value> GetPrototype();
2270 
2276  bool SetPrototype(Handle<Value> prototype);
2277 
2282  Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl);
2283 
2289  Local<String> ObjectProtoToString();
2290 
2295  Local<Value> GetConstructor();
2296 
2300  Local<String> GetConstructorName();
2301 
2303  int InternalFieldCount();
2304 
2307  const PersistentBase<Object>& object) {
2308  return object.val_->InternalFieldCount();
2309  }
2310 
2312  V8_INLINE Local<Value> GetInternalField(int index);
2313 
2315  void SetInternalField(int index, Handle<Value> value);
2316 
2322  V8_INLINE void* GetAlignedPointerFromInternalField(int index);
2323 
2326  const PersistentBase<Object>& object, int index) {
2327  return object.val_->GetAlignedPointerFromInternalField(index);
2328  }
2329 
2335  void SetAlignedPointerInInternalField(int index, void* value);
2336 
2337  // Testers for local properties.
2338  bool HasOwnProperty(Handle<String> key);
2339  bool HasRealNamedProperty(Handle<String> key);
2340  bool HasRealIndexedProperty(uint32_t index);
2341  bool HasRealNamedCallbackProperty(Handle<String> key);
2342 
2347  Local<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key);
2348 
2354  Local<Value> GetRealNamedProperty(Handle<String> key);
2355 
2357  bool HasNamedLookupInterceptor();
2358 
2360  bool HasIndexedLookupInterceptor();
2361 
2367  void TurnOnAccessCheck();
2368 
2376  int GetIdentityHash();
2377 
2384  bool SetHiddenValue(Handle<String> key, Handle<Value> value);
2385  Local<Value> GetHiddenValue(Handle<String> key);
2386  bool DeleteHiddenValue(Handle<String> key);
2387 
2395  bool IsDirty();
2396 
2401  Local<Object> Clone();
2402 
2406  Local<Context> CreationContext();
2407 
2415  void SetIndexedPropertiesToPixelData(uint8_t* data, int length);
2416  bool HasIndexedPropertiesInPixelData();
2417  uint8_t* GetIndexedPropertiesPixelData();
2418  int GetIndexedPropertiesPixelDataLength();
2419 
2427  void SetIndexedPropertiesToExternalArrayData(void* data,
2428  ExternalArrayType array_type,
2429  int number_of_elements);
2430  bool HasIndexedPropertiesInExternalArrayData();
2431  void* GetIndexedPropertiesExternalArrayData();
2432  ExternalArrayType GetIndexedPropertiesExternalArrayDataType();
2433  int GetIndexedPropertiesExternalArrayDataLength();
2434 
2440  bool IsCallable();
2441 
2446  Local<Value> CallAsFunction(Handle<Value> recv,
2447  int argc,
2448  Handle<Value> argv[]);
2449 
2455  Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]);
2456 
2457  static Local<Object> New(Isolate* isolate);
2458 
2459  V8_INLINE static Object* Cast(Value* obj);
2460 
2461  private:
2462  Object();
2463  static void CheckCast(Value* obj);
2464  Local<Value> SlowGetInternalField(int index);
2465  void* SlowGetAlignedPointerFromInternalField(int index);
2466 };
2467 
2468 
2472 class V8_EXPORT Array : public Object {
2473  public:
2474  uint32_t Length() const;
2475 
2480  Local<Object> CloneElementAt(uint32_t index);
2481 
2486  static Local<Array> New(Isolate* isolate, int length = 0);
2487 
2488  V8_INLINE static Array* Cast(Value* obj);
2489  private:
2490  Array();
2491  static void CheckCast(Value* obj);
2492 };
2493 
2494 
2495 template<typename T>
2496 class ReturnValue {
2497  public:
2498  template <class S> V8_INLINE ReturnValue(const ReturnValue<S>& that)
2499  : value_(that.value_) {
2500  TYPE_CHECK(T, S);
2501  }
2502  // Handle setters
2503  template <typename S> V8_INLINE void Set(const Persistent<S>& handle);
2504  template <typename S> V8_INLINE void Set(const Handle<S> handle);
2505  // Fast primitive setters
2506  V8_INLINE void Set(bool value);
2507  V8_INLINE void Set(double i);
2508  V8_INLINE void Set(int32_t i);
2509  V8_INLINE void Set(uint32_t i);
2510  // Fast JS primitive setters
2511  V8_INLINE void SetNull();
2512  V8_INLINE void SetUndefined();
2513  V8_INLINE void SetEmptyString();
2514  // Convenience getter for Isolate
2516 
2517  private:
2518  template<class F> friend class ReturnValue;
2519  template<class F> friend class FunctionCallbackInfo;
2520  template<class F> friend class PropertyCallbackInfo;
2521  template<class F, class G, class H> friend class PersistentValueMap;
2522  V8_INLINE void SetInternal(internal::Object* value) { *value_ = value; }
2523  V8_INLINE internal::Object* GetDefaultValue();
2524  V8_INLINE explicit ReturnValue(internal::Object** slot);
2525  internal::Object** value_;
2526 };
2527 
2528 
2535 template<typename T>
2536 class FunctionCallbackInfo {
2537  public:
2538  V8_INLINE int Length() const;
2539  V8_INLINE Local<Value> operator[](int i) const;
2540  V8_INLINE Local<Function> Callee() const;
2541  V8_INLINE Local<Object> This() const;
2542  V8_INLINE Local<Object> Holder() const;
2543  V8_INLINE bool IsConstructCall() const;
2544  V8_INLINE Local<Value> Data() const;
2545  V8_INLINE Isolate* GetIsolate() const;
2546  V8_INLINE ReturnValue<T> GetReturnValue() const;
2547  // This shouldn't be public, but the arm compiler needs it.
2548  static const int kArgsLength = 7;
2549 
2550  protected:
2553  static const int kHolderIndex = 0;
2554  static const int kIsolateIndex = 1;
2555  static const int kReturnValueDefaultValueIndex = 2;
2556  static const int kReturnValueIndex = 3;
2557  static const int kDataIndex = 4;
2558  static const int kCalleeIndex = 5;
2559  static const int kContextSaveIndex = 6;
2560 
2562  internal::Object** values,
2563  int length,
2564  bool is_construct_call);
2567  int length_;
2569 };
2570 
2571 
2576 template<typename T>
2577 class PropertyCallbackInfo {
2578  public:
2579  V8_INLINE Isolate* GetIsolate() const;
2580  V8_INLINE Local<Value> Data() const;
2581  V8_INLINE Local<Object> This() const;
2582  V8_INLINE Local<Object> Holder() const;
2584  // This shouldn't be public, but the arm compiler needs it.
2585  static const int kArgsLength = 6;
2586 
2587  protected:
2588  friend class MacroAssembler;
2591  static const int kHolderIndex = 0;
2592  static const int kIsolateIndex = 1;
2593  static const int kReturnValueDefaultValueIndex = 2;
2594  static const int kReturnValueIndex = 3;
2595  static const int kDataIndex = 4;
2596  static const int kThisIndex = 5;
2597 
2600 };
2601 
2602 
2604 
2605 
2609 class V8_EXPORT Function : public Object {
2610  public:
2615  static Local<Function> New(Isolate* isolate,
2616  FunctionCallback callback,
2617  Local<Value> data = Local<Value>(),
2618  int length = 0);
2619 
2620  Local<Object> NewInstance() const;
2621  Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
2622  Local<Value> Call(Handle<Value> recv, int argc, Handle<Value> argv[]);
2623  void SetName(Handle<String> name);
2624  Handle<Value> GetName() const;
2625 
2632  Handle<Value> GetInferredName() const;
2633 
2638  Handle<Value> GetDisplayName() const;
2639 
2644  int GetScriptLineNumber() const;
2649  int GetScriptColumnNumber() const;
2650 
2654  bool IsBuiltin() const;
2655 
2659  int ScriptId() const;
2660 
2665  Local<Value> GetBoundFunction() const;
2666 
2667  ScriptOrigin GetScriptOrigin() const;
2668  V8_INLINE static Function* Cast(Value* obj);
2669  static const int kLineOffsetNotFound;
2670 
2671  private:
2672  Function();
2673  static void CheckCast(Value* obj);
2674 };
2675 
2676 
2681 class V8_EXPORT Promise : public Object {
2682  public:
2683  class V8_EXPORT Resolver : public Object {
2684  public:
2688  static Local<Resolver> New(Isolate* isolate);
2689 
2693  Local<Promise> GetPromise();
2694 
2699  void Resolve(Handle<Value> value);
2700  void Reject(Handle<Value> value);
2701 
2702  V8_INLINE static Resolver* Cast(Value* obj);
2703 
2704  private:
2705  Resolver();
2706  static void CheckCast(Value* obj);
2707  };
2708 
2715  Local<Promise> Chain(Handle<Function> handler);
2716  Local<Promise> Catch(Handle<Function> handler);
2717 
2718  V8_INLINE static Promise* Cast(Value* obj);
2719 
2720  private:
2721  Promise();
2722  static void CheckCast(Value* obj);
2723 };
2724 
2725 
2726 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
2727 // The number of required internal fields can be defined by embedder.
2728 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
2729 #endif
2730 
2735 class V8_EXPORT ArrayBuffer : public Object {
2736  public:
2744  class V8_EXPORT Allocator { // NOLINT
2745  public:
2746  virtual ~Allocator() {}
2747 
2752  virtual void* Allocate(size_t length) = 0;
2753 
2758  virtual void* AllocateUninitialized(size_t length) = 0;
2763  virtual void Free(void* data, size_t length) = 0;
2764  };
2765 
2776  class V8_EXPORT Contents { // NOLINT
2777  public:
2778  Contents() : data_(NULL), byte_length_(0) {}
2779 
2780  void* Data() const { return data_; }
2781  size_t ByteLength() const { return byte_length_; }
2782 
2783  private:
2784  void* data_;
2785  size_t byte_length_;
2786 
2787  friend class ArrayBuffer;
2788  };
2789 
2790 
2794  size_t ByteLength() const;
2795 
2802  static Local<ArrayBuffer> New(Isolate* isolate, size_t byte_length);
2803 
2810  static Local<ArrayBuffer> New(Isolate* isolate, void* data,
2811  size_t byte_length);
2812 
2817  bool IsExternal() const;
2818 
2825  void Neuter();
2826 
2836  Contents Externalize();
2837 
2838  V8_INLINE static ArrayBuffer* Cast(Value* obj);
2839 
2840  static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
2841 
2842  private:
2843  ArrayBuffer();
2844  static void CheckCast(Value* obj);
2845 };
2846 
2847 
2848 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
2849 // The number of required internal fields can be defined by embedder.
2850 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
2851 #endif
2852 
2853 
2861  public:
2865  Local<ArrayBuffer> Buffer();
2869  size_t ByteOffset();
2873  size_t ByteLength();
2874 
2875  V8_INLINE static ArrayBufferView* Cast(Value* obj);
2876 
2877  static const int kInternalFieldCount =
2879 
2880  private:
2881  ArrayBufferView();
2882  static void CheckCast(Value* obj);
2883 };
2884 
2885 
2892  public:
2897  size_t Length();
2898 
2899  V8_INLINE static TypedArray* Cast(Value* obj);
2900 
2901  private:
2902  TypedArray();
2903  static void CheckCast(Value* obj);
2904 };
2905 
2906 
2912  public:
2913  static Local<Uint8Array> New(Handle<ArrayBuffer> array_buffer,
2914  size_t byte_offset, size_t length);
2915  V8_INLINE static Uint8Array* Cast(Value* obj);
2916 
2917  private:
2918  Uint8Array();
2919  static void CheckCast(Value* obj);
2920 };
2921 
2922 
2928  public:
2929  static Local<Uint8ClampedArray> New(Handle<ArrayBuffer> array_buffer,
2930  size_t byte_offset, size_t length);
2931  V8_INLINE static Uint8ClampedArray* Cast(Value* obj);
2932 
2933  private:
2935  static void CheckCast(Value* obj);
2936 };
2937 
2943  public:
2944  static Local<Int8Array> New(Handle<ArrayBuffer> array_buffer,
2945  size_t byte_offset, size_t length);
2946  V8_INLINE static Int8Array* Cast(Value* obj);
2947 
2948  private:
2949  Int8Array();
2950  static void CheckCast(Value* obj);
2951 };
2952 
2953 
2959  public:
2960  static Local<Uint16Array> New(Handle<ArrayBuffer> array_buffer,
2961  size_t byte_offset, size_t length);
2962  V8_INLINE static Uint16Array* Cast(Value* obj);
2963 
2964  private:
2965  Uint16Array();
2966  static void CheckCast(Value* obj);
2967 };
2968 
2969 
2975  public:
2976  static Local<Int16Array> New(Handle<ArrayBuffer> array_buffer,
2977  size_t byte_offset, size_t length);
2978  V8_INLINE static Int16Array* Cast(Value* obj);
2979 
2980  private:
2981  Int16Array();
2982  static void CheckCast(Value* obj);
2983 };
2984 
2985 
2991  public:
2992  static Local<Uint32Array> New(Handle<ArrayBuffer> array_buffer,
2993  size_t byte_offset, size_t length);
2994  V8_INLINE static Uint32Array* Cast(Value* obj);
2995 
2996  private:
2997  Uint32Array();
2998  static void CheckCast(Value* obj);
2999 };
3000 
3001 
3007  public:
3008  static Local<Int32Array> New(Handle<ArrayBuffer> array_buffer,
3009  size_t byte_offset, size_t length);
3010  V8_INLINE static Int32Array* Cast(Value* obj);
3011 
3012  private:
3013  Int32Array();
3014  static void CheckCast(Value* obj);
3015 };
3016 
3017 
3023  public:
3024  static Local<Float32Array> New(Handle<ArrayBuffer> array_buffer,
3025  size_t byte_offset, size_t length);
3026  V8_INLINE static Float32Array* Cast(Value* obj);
3027 
3028  private:
3029  Float32Array();
3030  static void CheckCast(Value* obj);
3031 };
3032 
3033 
3039  public:
3040  static Local<Float64Array> New(Handle<ArrayBuffer> array_buffer,
3041  size_t byte_offset, size_t length);
3042  V8_INLINE static Float64Array* Cast(Value* obj);
3043 
3044  private:
3045  Float64Array();
3046  static void CheckCast(Value* obj);
3047 };
3048 
3049 
3055  public:
3056  static Local<DataView> New(Handle<ArrayBuffer> array_buffer,
3057  size_t byte_offset, size_t length);
3058  V8_INLINE static DataView* Cast(Value* obj);
3059 
3060  private:
3061  DataView();
3062  static void CheckCast(Value* obj);
3063 };
3064 
3065 
3069 class V8_EXPORT Date : public Object {
3070  public:
3071  static Local<Value> New(Isolate* isolate, double time);
3072 
3077  double ValueOf() const;
3078 
3079  V8_INLINE static Date* Cast(v8::Value* obj);
3080 
3093  static void DateTimeConfigurationChangeNotification(Isolate* isolate);
3094 
3095  private:
3096  static void CheckCast(v8::Value* obj);
3097 };
3098 
3099 
3104  public:
3105  static Local<Value> New(Isolate* isolate, double value);
3106 
3107  double ValueOf() const;
3108 
3109  V8_INLINE static NumberObject* Cast(v8::Value* obj);
3110 
3111  private:
3112  static void CheckCast(v8::Value* obj);
3113 };
3114 
3115 
3120  public:
3121  static Local<Value> New(bool value);
3122 
3123  bool ValueOf() const;
3124 
3125  V8_INLINE static BooleanObject* Cast(v8::Value* obj);
3126 
3127  private:
3128  static void CheckCast(v8::Value* obj);
3129 };
3130 
3131 
3136  public:
3137  static Local<Value> New(Handle<String> value);
3138 
3139  Local<String> ValueOf() const;
3140 
3141  V8_INLINE static StringObject* Cast(v8::Value* obj);
3142 
3143  private:
3144  static void CheckCast(v8::Value* obj);
3145 };
3146 
3147 
3154  public:
3155  static Local<Value> New(Isolate* isolate, Handle<Symbol> value);
3156 
3157  Local<Symbol> ValueOf() const;
3158 
3159  V8_INLINE static SymbolObject* Cast(v8::Value* obj);
3160 
3161  private:
3162  static void CheckCast(v8::Value* obj);
3163 };
3164 
3165 
3169 class V8_EXPORT RegExp : public Object {
3170  public:
3175  enum Flags {
3176  kNone = 0,
3177  kGlobal = 1,
3178  kIgnoreCase = 2,
3179  kMultiline = 4
3180  };
3181 
3192  static Local<RegExp> New(Handle<String> pattern, Flags flags);
3193 
3198  Local<String> GetSource() const;
3199 
3203  Flags GetFlags() const;
3204 
3205  V8_INLINE static RegExp* Cast(v8::Value* obj);
3206 
3207  private:
3208  static void CheckCast(v8::Value* obj);
3209 };
3210 
3211 
3216 class V8_EXPORT External : public Value {
3217  public:
3218  static Local<External> New(Isolate* isolate, void* value);
3219  V8_INLINE static External* Cast(Value* obj);
3220  void* Value() const;
3221  private:
3222  static void CheckCast(v8::Value* obj);
3223 };
3224 
3225 
3226 // --- Templates ---
3227 
3228 
3232 class V8_EXPORT Template : public Data {
3233  public:
3235  void Set(Handle<String> name, Handle<Data> value,
3236  PropertyAttribute attributes = None);
3237  V8_INLINE void Set(Isolate* isolate, const char* name, Handle<Data> value);
3238 
3239  void SetAccessorProperty(
3240  Local<String> name,
3243  PropertyAttribute attribute = None,
3244  AccessControl settings = DEFAULT);
3245 
3273  void SetNativeDataProperty(Local<String> name,
3274  AccessorGetterCallback getter,
3275  AccessorSetterCallback setter = 0,
3276  // TODO(dcarney): gcc can't handle Local below
3277  Handle<Value> data = Handle<Value>(),
3278  PropertyAttribute attribute = None,
3279  Local<AccessorSignature> signature =
3281  AccessControl settings = DEFAULT);
3282 
3283  // This function is not yet stable and should not be used at this time.
3284  bool SetDeclaredAccessor(Local<String> name,
3286  PropertyAttribute attribute = None,
3287  Local<AccessorSignature> signature =
3289  AccessControl settings = DEFAULT);
3290 
3291  private:
3292  Template();
3293 
3294  friend class ObjectTemplate;
3295  friend class FunctionTemplate;
3296 };
3297 
3298 
3304  Local<String> property,
3306 
3307 
3313  Local<String> property,
3314  Local<Value> value,
3316 
3317 
3324  Local<String> property,
3326 
3327 
3334  Local<String> property,
3336 
3337 
3344 
3345 
3351  uint32_t index,
3353 
3354 
3360  uint32_t index,
3361  Local<Value> value,
3363 
3364 
3370  uint32_t index,
3372 
3373 
3380  uint32_t index,
3382 
3383 
3390 
3391 
3401 };
3402 
3403 
3409  Local<Value> key,
3410  AccessType type,
3411  Local<Value> data);
3412 
3413 
3419  uint32_t index,
3420  AccessType type,
3421  Local<Value> data);
3422 
3423 
3517  public:
3519  static Local<FunctionTemplate> New(
3520  Isolate* isolate,
3521  FunctionCallback callback = 0,
3522  Handle<Value> data = Handle<Value>(),
3523  Handle<Signature> signature = Handle<Signature>(),
3524  int length = 0);
3525 
3527  Local<Function> GetFunction();
3528 
3534  void SetCallHandler(FunctionCallback callback,
3535  Handle<Value> data = Handle<Value>());
3536 
3538  void SetLength(int length);
3539 
3541  Local<ObjectTemplate> InstanceTemplate();
3542 
3544  void Inherit(Handle<FunctionTemplate> parent);
3545 
3550  Local<ObjectTemplate> PrototypeTemplate();
3551 
3557  void SetClassName(Handle<String> name);
3558 
3571  void SetHiddenPrototype(bool value);
3572 
3577  void ReadOnlyPrototype();
3578 
3583  void RemovePrototype();
3584 
3589  bool HasInstance(Handle<Value> object);
3590 
3591  private:
3592  FunctionTemplate();
3593  friend class Context;
3594  friend class ObjectTemplate;
3595 };
3596 
3597 
3605  public:
3607  static Local<ObjectTemplate> New(Isolate* isolate);
3608  // Will be deprecated soon.
3609  static Local<ObjectTemplate> New();
3610 
3612  Local<Object> NewInstance();
3613 
3643  void SetAccessor(Handle<String> name,
3644  AccessorGetterCallback getter,
3645  AccessorSetterCallback setter = 0,
3646  Handle<Value> data = Handle<Value>(),
3647  AccessControl settings = DEFAULT,
3648  PropertyAttribute attribute = None,
3649  Handle<AccessorSignature> signature =
3651 
3669  void SetNamedPropertyHandler(
3671  NamedPropertySetterCallback setter = 0,
3672  NamedPropertyQueryCallback query = 0,
3673  NamedPropertyDeleterCallback deleter = 0,
3674  NamedPropertyEnumeratorCallback enumerator = 0,
3675  Handle<Value> data = Handle<Value>());
3676 
3693  void SetIndexedPropertyHandler(
3695  IndexedPropertySetterCallback setter = 0,
3696  IndexedPropertyQueryCallback query = 0,
3697  IndexedPropertyDeleterCallback deleter = 0,
3698  IndexedPropertyEnumeratorCallback enumerator = 0,
3699  Handle<Value> data = Handle<Value>());
3700 
3707  void SetCallAsFunctionHandler(FunctionCallback callback,
3708  Handle<Value> data = Handle<Value>());
3709 
3718  void MarkAsUndetectable();
3719 
3731  void SetAccessCheckCallbacks(NamedSecurityCallback named_handler,
3732  IndexedSecurityCallback indexed_handler,
3733  Handle<Value> data = Handle<Value>(),
3734  bool turned_on_by_default = true);
3735 
3740  int InternalFieldCount();
3741 
3746  void SetInternalFieldCount(int value);
3747 
3748  private:
3749  ObjectTemplate();
3750  static Local<ObjectTemplate> New(internal::Isolate* isolate,
3751  Handle<FunctionTemplate> constructor);
3752  friend class FunctionTemplate;
3753 };
3754 
3755 
3760 class V8_EXPORT Signature : public Data {
3761  public:
3762  static Local<Signature> New(Isolate* isolate,
3763  Handle<FunctionTemplate> receiver =
3765  int argc = 0,
3766  Handle<FunctionTemplate> argv[] = 0);
3767 
3768  private:
3769  Signature();
3770 };
3771 
3772 
3778  public:
3779  static Local<AccessorSignature> New(Isolate* isolate,
3780  Handle<FunctionTemplate> receiver =
3782 
3783  private:
3785 };
3786 
3787 
3789  private:
3791 };
3792 
3793 
3795  public:
3796  // This function is not yet stable and should not be used at this time.
3797  static Local<RawOperationDescriptor> NewInternalFieldDereference(
3798  Isolate* isolate,
3799  int internal_field);
3800  private:
3802 };
3803 
3804 
3811 };
3812 
3813 
3815  public:
3816  Local<DeclaredAccessorDescriptor> NewHandleDereference(Isolate* isolate);
3817  Local<RawOperationDescriptor> NewRawDereference(Isolate* isolate);
3818  Local<RawOperationDescriptor> NewRawShift(Isolate* isolate,
3819  int16_t byte_offset);
3820  Local<DeclaredAccessorDescriptor> NewPointerCompare(Isolate* isolate,
3821  void* compare_value);
3822  Local<DeclaredAccessorDescriptor> NewPrimitiveValue(
3823  Isolate* isolate,
3825  uint8_t bool_offset = 0);
3826  Local<DeclaredAccessorDescriptor> NewBitmaskCompare8(Isolate* isolate,
3827  uint8_t bitmask,
3828  uint8_t compare_value);
3829  Local<DeclaredAccessorDescriptor> NewBitmaskCompare16(
3830  Isolate* isolate,
3831  uint16_t bitmask,
3832  uint16_t compare_value);
3833  Local<DeclaredAccessorDescriptor> NewBitmaskCompare32(
3834  Isolate* isolate,
3835  uint32_t bitmask,
3836  uint32_t compare_value);
3837 
3838  private:
3840 };
3841 
3842 
3847 class V8_EXPORT TypeSwitch : public Data {
3848  public:
3850  static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]);
3851  int match(Handle<Value> value);
3852  private:
3853  TypeSwitch();
3854 };
3855 
3856 
3857 // --- Extensions ---
3858 
3861  public:
3862  ExternalAsciiStringResourceImpl() : data_(0), length_(0) {}
3863  ExternalAsciiStringResourceImpl(const char* data, size_t length)
3864  : data_(data), length_(length) {}
3865  const char* data() const { return data_; }
3866  size_t length() const { return length_; }
3867 
3868  private:
3869  const char* data_;
3870  size_t length_;
3871 };
3872 
3876 class V8_EXPORT Extension { // NOLINT
3877  public:
3878  // Note that the strings passed into this constructor must live as long
3879  // as the Extension itself.
3880  Extension(const char* name,
3881  const char* source = 0,
3882  int dep_count = 0,
3883  const char** deps = 0,
3884  int source_length = -1);
3885  virtual ~Extension() { }
3887  v8::Isolate* isolate, v8::Handle<v8::String> name) {
3889  }
3890 
3891  const char* name() const { return name_; }
3892  size_t source_length() const { return source_length_; }
3894  return &source_; }
3895  int dependency_count() { return dep_count_; }
3896  const char** dependencies() { return deps_; }
3897  void set_auto_enable(bool value) { auto_enable_ = value; }
3898  bool auto_enable() { return auto_enable_; }
3899 
3900  private:
3901  const char* name_;
3902  size_t source_length_; // expected to initialize before source_
3904  int dep_count_;
3905  const char** deps_;
3906  bool auto_enable_;
3907 
3908  // Disallow copying and assigning.
3909  Extension(const Extension&);
3910  void operator=(const Extension&);
3911 };
3912 
3913 
3914 void V8_EXPORT RegisterExtension(Extension* extension);
3915 
3916 
3917 // --- Statics ---
3918 
3919 V8_INLINE Handle<Primitive> Undefined(Isolate* isolate);
3920 V8_INLINE Handle<Primitive> Null(Isolate* isolate);
3921 V8_INLINE Handle<Boolean> True(Isolate* isolate);
3922 V8_INLINE Handle<Boolean> False(Isolate* isolate);
3923 
3924 
3935  public:
3937 
3947  void ConfigureDefaults(uint64_t physical_memory,
3948  uint32_t number_of_processors);
3949 
3950  int max_young_space_size() const { return max_young_space_size_; }
3951  void set_max_young_space_size(int value) { max_young_space_size_ = value; }
3952  int max_old_space_size() const { return max_old_space_size_; }
3953  void set_max_old_space_size(int value) { max_old_space_size_ = value; }
3954  int max_executable_size() const { return max_executable_size_; }
3955  void set_max_executable_size(int value) { max_executable_size_ = value; }
3956  uint32_t* stack_limit() const { return stack_limit_; }
3957  // Sets an address beyond which the VM's stack may not grow.
3958  void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
3959  int max_available_threads() const { return max_available_threads_; }
3960  // Set the number of threads available to V8, assuming at least 1.
3961  void set_max_available_threads(int value) {
3962  max_available_threads_ = value;
3963  }
3964 
3965  private:
3966  int max_young_space_size_;
3967  int max_old_space_size_;
3968  int max_executable_size_;
3969  uint32_t* stack_limit_;
3970  int max_available_threads_;
3971 };
3972 
3973 
3977 bool V8_EXPORT SetResourceConstraints(Isolate* isolate,
3978  ResourceConstraints* constraints);
3979 
3980 
3981 // --- Exceptions ---
3982 
3983 
3984 typedef void (*FatalErrorCallback)(const char* location, const char* message);
3985 
3986 
3988 
3989 // --- Tracing ---
3990 
3991 typedef void (*LogEventCallback)(const char* name, int event);
3992 
3998  public:
3999  static Local<Value> RangeError(Handle<String> message);
4000  static Local<Value> ReferenceError(Handle<String> message);
4001  static Local<Value> SyntaxError(Handle<String> message);
4002  static Local<Value> TypeError(Handle<String> message);
4003  static Local<Value> Error(Handle<String> message);
4004 };
4005 
4006 
4007 // --- Counters Callbacks ---
4008 
4009 typedef int* (*CounterLookupCallback)(const char* name);
4010 
4011 typedef void* (*CreateHistogramCallback)(const char* name,
4012  int min,
4013  int max,
4014  size_t buckets);
4015 
4016 typedef void (*AddHistogramSampleCallback)(void* histogram, int sample);
4017 
4018 // --- Memory Allocation Callback ---
4026 
4030  };
4031 
4036  };
4037 
4039  AllocationAction action,
4040  int size);
4041 
4042 // --- Leave Script Callback ---
4043 typedef void (*CallCompletedCallback)();
4044 
4045 // --- Failed Access Check Callback ---
4047  AccessType type,
4048  Local<Value> data);
4049 
4050 // --- AllowCodeGenerationFromStrings callbacks ---
4051 
4057 
4058 // --- Garbage Collection Callbacks ---
4059 
4067 enum GCType {
4071 };
4072 
4078 };
4079 
4082 
4083 typedef void (*InterruptCallback)(Isolate* isolate, void* data);
4084 
4085 
4093  public:
4094  HeapStatistics();
4095  size_t total_heap_size() { return total_heap_size_; }
4096  size_t total_heap_size_executable() { return total_heap_size_executable_; }
4097  size_t total_physical_size() { return total_physical_size_; }
4098  size_t used_heap_size() { return used_heap_size_; }
4099  size_t heap_size_limit() { return heap_size_limit_; }
4100 
4101  private:
4102  size_t total_heap_size_;
4103  size_t total_heap_size_executable_;
4104  size_t total_physical_size_;
4105  size_t used_heap_size_;
4106  size_t heap_size_limit_;
4107 
4108  friend class V8;
4109  friend class Isolate;
4110 };
4111 
4112 
4113 class RetainedObjectInfo;
4114 
4125  public:
4131  public:
4132  explicit Scope(Isolate* isolate) : isolate_(isolate) {
4133  isolate->Enter();
4134  }
4135 
4136  ~Scope() { isolate_->Exit(); }
4137 
4138  private:
4139  Isolate* const isolate_;
4140 
4141  // Prevent copying of Scope objects.
4142  Scope(const Scope&);
4143  Scope& operator=(const Scope&);
4144  };
4145 
4146 
4151  public:
4152  enum OnFailure { CRASH_ON_FAILURE, THROW_ON_FAILURE };
4153 
4154  DisallowJavascriptExecutionScope(Isolate* isolate, OnFailure on_failure);
4156 
4157  private:
4158  bool on_failure_;
4159  void* internal_;
4160 
4161  // Prevent copying of Scope objects.
4165  };
4166 
4167 
4172  public:
4173  explicit AllowJavascriptExecutionScope(Isolate* isolate);
4175 
4176  private:
4177  void* internal_throws_;
4178  void* internal_assert_;
4179 
4180  // Prevent copying of Scope objects.
4182  AllowJavascriptExecutionScope& operator=(
4184  };
4185 
4192  kMinorGarbageCollection
4193  };
4194 
4202  static Isolate* New();
4203 
4208  static Isolate* GetCurrent();
4209 
4220  void Enter();
4221 
4229  void Exit();
4230 
4235  void Dispose();
4236 
4241  V8_INLINE void SetData(uint32_t slot, void* data);
4242 
4247  V8_INLINE void* GetData(uint32_t slot);
4248 
4253  V8_INLINE static uint32_t GetNumberOfDataSlots();
4254 
4258  void GetHeapStatistics(HeapStatistics* heap_statistics);
4259 
4273  int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
4274 
4279  HeapProfiler* GetHeapProfiler();
4280 
4286  CpuProfiler* GetCpuProfiler();
4287 
4289  bool InContext();
4290 
4292  Local<Context> GetCurrentContext();
4293 
4299  Local<Context> GetCallingContext();
4300 
4302  Local<Context> GetEnteredContext();
4303 
4310  Local<Value> ThrowException(Local<Value> exception);
4311 
4323  template<typename T> void SetObjectGroupId(const Persistent<T>& object,
4324  UniqueId id);
4325 
4333  template<typename T> void SetReferenceFromGroup(UniqueId id,
4334  const Persistent<T>& child);
4335 
4342  template<typename T, typename S>
4343  void SetReference(const Persistent<T>& parent, const Persistent<S>& child);
4344 
4345  typedef void (*GCPrologueCallback)(Isolate* isolate,
4346  GCType type,
4348  typedef void (*GCEpilogueCallback)(Isolate* isolate,
4349  GCType type,
4351 
4361  void AddGCPrologueCallback(
4362  GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll);
4363 
4368  void RemoveGCPrologueCallback(GCPrologueCallback callback);
4369 
4379  void AddGCEpilogueCallback(
4380  GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll);
4381 
4386  void RemoveGCEpilogueCallback(GCEpilogueCallback callback);
4387 
4397  void RequestInterrupt(InterruptCallback callback, void* data);
4398 
4403  void ClearInterrupt();
4404 
4414  void RequestGarbageCollectionForTesting(GarbageCollectionType type);
4415 
4419  void SetEventLogger(LogEventCallback that);
4420 
4421  private:
4422  template<class K, class V, class Traits> friend class PersistentValueMap;
4423 
4424  Isolate();
4425  Isolate(const Isolate&);
4426  ~Isolate();
4427  Isolate& operator=(const Isolate&);
4428  void* operator new(size_t size);
4429  void operator delete(void*, size_t);
4430 
4431  void SetObjectGroupId(internal::Object** object, UniqueId id);
4432  void SetReferenceFromGroup(UniqueId id, internal::Object** object);
4433  void SetReference(internal::Object** parent, internal::Object** child);
4434 };
4435 
4437  public:
4440  kBZip2
4441  };
4442 
4443  const char* data;
4446 };
4447 
4448 
4458  public:
4460  virtual ~StartupDataDecompressor();
4461  int Decompress();
4462 
4463  protected:
4464  virtual int DecompressData(char* raw_data,
4465  int* raw_data_size,
4466  const char* compressed_data,
4467  int compressed_data_size) = 0;
4468 
4469  private:
4470  char** raw_data;
4471 };
4472 
4473 
4478 typedef bool (*EntropySource)(unsigned char* buffer, size_t length);
4479 
4480 
4494 typedef uintptr_t (*ReturnAddressLocationResolver)(
4495  uintptr_t return_addr_location);
4496 
4497 
4509 typedef void (*FunctionEntryHook)(uintptr_t function,
4510  uintptr_t return_addr_location);
4511 
4512 
4519  enum EventType {
4526  };
4527  // Definition of the code position type. The "POSITION" type means the place
4528  // in the source code which are of interest when making stack traces to
4529  // pin-point the source location of a stack frame as close as possible.
4530  // The "STATEMENT_POSITION" means the place at the beginning of each
4531  // statement, and is used to indicate possible break locations.
4535  };
4536 
4537  // Type of event.
4539  // Start of the instructions.
4540  void* code_start;
4541  // Size of the instructions.
4542  size_t code_len;
4543  // Script info for CODE_ADDED event.
4545  // User-defined data for *_LINE_INFO_* event. It's used to hold the source
4546  // code line information which is returned from the
4547  // CODE_START_LINE_INFO_RECORDING event. And it's passed to subsequent
4548  // CODE_ADD_LINE_POS_INFO and CODE_END_LINE_INFO_RECORDING events.
4549  void* user_data;
4550 
4551  struct name_t {
4552  // Name of the object associated with the code, note that the string is not
4553  // zero-terminated.
4554  const char* str;
4555  // Number of chars in str.
4556  size_t len;
4557  };
4558 
4559  struct line_info_t {
4560  // PC offset
4561  size_t offset;
4562  // Code postion
4563  size_t pos;
4564  // The position type.
4566  };
4567 
4568  union {
4569  // Only valid for CODE_ADDED.
4570  struct name_t name;
4571 
4572  // Only valid for CODE_ADD_LINE_POS_INFO
4574 
4575  // New location of instructions. Only valid for CODE_MOVED.
4577  };
4578 };
4579 
4585  // Generate callbacks for already existent code.
4587 };
4588 
4589 
4595 typedef void (*JitCodeEventHandler)(const JitCodeEvent* event);
4596 
4597 
4602  public:
4604  virtual void VisitExternalString(Handle<String> string) {}
4605 };
4606 
4607 
4612  public:
4615  uint16_t class_id) {}
4616 };
4617 
4618 
4622 class V8_EXPORT V8 {
4623  public:
4625  static void SetFatalErrorHandler(FatalErrorCallback that);
4626 
4631  static void SetAllowCodeGenerationFromStringsCallback(
4633 
4640  static void SetArrayBufferAllocator(ArrayBuffer::Allocator* allocator);
4641 
4646  static bool IsDead();
4647 
4667  static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm();
4668  static int GetCompressedStartupDataCount();
4669  static void GetCompressedStartupData(StartupData* compressed_data);
4670  static void SetDecompressedStartupData(StartupData* decompressed_data);
4671 
4681  static bool AddMessageListener(MessageCallback that,
4682  Handle<Value> data = Handle<Value>());
4683 
4687  static void RemoveMessageListeners(MessageCallback that);
4688 
4693  static void SetCaptureStackTraceForUncaughtExceptions(
4694  bool capture,
4695  int frame_limit = 10,
4697 
4701  static void SetFlagsFromString(const char* str, int length);
4702 
4706  static void SetFlagsFromCommandLine(int* argc,
4707  char** argv,
4708  bool remove_flags);
4709 
4711  static const char* GetVersion();
4712 
4717  static void SetCounterFunction(CounterLookupCallback);
4718 
4725  static void SetCreateHistogramFunction(CreateHistogramCallback);
4726  static void SetAddHistogramSampleFunction(AddHistogramSampleCallback);
4727 
4729  static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
4730 
4741  static void AddGCPrologueCallback(
4742  GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll);
4743 
4748  static void RemoveGCPrologueCallback(GCPrologueCallback callback);
4749 
4760  static void AddGCEpilogueCallback(
4761  GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll);
4762 
4767  static void RemoveGCEpilogueCallback(GCEpilogueCallback callback);
4768 
4773  static void AddMemoryAllocationCallback(MemoryAllocationCallback callback,
4774  ObjectSpace space,
4775  AllocationAction action);
4776 
4780  static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback);
4781 
4789  static void AddCallCompletedCallback(CallCompletedCallback callback);
4790 
4794  static void RemoveCallCompletedCallback(CallCompletedCallback callback);
4795 
4799  static void RunMicrotasks(Isolate* isolate);
4800 
4804  static void EnqueueMicrotask(Isolate* isolate, Handle<Function> microtask);
4805 
4810  static void SetAutorunMicrotasks(Isolate *source, bool autorun);
4811 
4817  static bool Initialize();
4818 
4823  static void SetEntropySource(EntropySource source);
4824 
4829  static void SetReturnAddressLocationResolver(
4830  ReturnAddressLocationResolver return_address_resolver);
4831 
4845  static bool SetFunctionEntryHook(Isolate* isolate,
4846  FunctionEntryHook entry_hook);
4847 
4868  static void SetJitCodeEventHandler(JitCodeEventOptions options,
4869  JitCodeEventHandler event_handler);
4870 
4881  static void TerminateExecution(Isolate* isolate = NULL);
4882 
4893  static bool IsExecutionTerminating(Isolate* isolate = NULL);
4894 
4911  static void CancelTerminateExecution(Isolate* isolate);
4912 
4922  static bool Dispose();
4923 
4929  static void VisitExternalResources(ExternalResourceVisitor* visitor);
4930 
4935  static void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor);
4936 
4944  static void VisitHandlesForPartialDependence(
4945  Isolate* isolate, PersistentHandleVisitor* visitor);
4946 
4959  static bool IdleNotification(int hint = 1000);
4960 
4965  static void LowMemoryNotification();
4966 
4973  static int ContextDisposedNotification();
4974 
4982  static bool InitializeICU(const char* icu_data_file = NULL);
4983 
4988  static void InitializePlatform(Platform* platform);
4989 
4994  static void ShutdownPlatform();
4995 
4996  private:
4997  V8();
4998 
4999  static internal::Object** GlobalizeReference(internal::Isolate* isolate,
5001  static internal::Object** CopyPersistent(internal::Object** handle);
5002  static void DisposeGlobal(internal::Object** global_handle);
5003  typedef WeakCallbackData<Value, void>::Callback WeakCallback;
5004  static void MakeWeak(internal::Object** global_handle,
5005  void* data,
5006  WeakCallback weak_callback);
5007  static void* ClearWeak(internal::Object** global_handle);
5008  static void Eternalize(Isolate* isolate,
5009  Value* handle,
5010  int* index);
5011  static Local<Value> GetEternal(Isolate* isolate, int index);
5012 
5013  template <class T> friend class Handle;
5014  template <class T> friend class Local;
5015  template <class T> friend class Eternal;
5016  template <class T> friend class PersistentBase;
5017  template <class T, class M> friend class Persistent;
5018  friend class Context;
5019 };
5020 
5021 
5026  public:
5032  TryCatch();
5033 
5037  ~TryCatch();
5038 
5042  bool HasCaught() const;
5043 
5052  bool CanContinue() const;
5053 
5066  bool HasTerminated() const;
5067 
5075  Handle<Value> ReThrow();
5076 
5083  Local<Value> Exception() const;
5084 
5089  Local<Value> StackTrace() const;
5090 
5098  Local<v8::Message> Message() const;
5099 
5109  void Reset();
5110 
5119  void SetVerbose(bool value);
5120 
5126  void SetCaptureMessage(bool value);
5127 
5128  private:
5129  // Make it hard to create heap-allocated TryCatch blocks.
5130  TryCatch(const TryCatch&);
5131  void operator=(const TryCatch&);
5132  void* operator new(size_t size);
5133  void operator delete(void*, size_t);
5134 
5135  v8::internal::Isolate* isolate_;
5136  void* next_;
5137  void* exception_;
5138  void* message_obj_;
5139  void* message_script_;
5140  int message_start_pos_;
5141  int message_end_pos_;
5142  bool is_verbose_ : 1;
5143  bool can_continue_ : 1;
5144  bool capture_message_ : 1;
5145  bool rethrow_ : 1;
5146  bool has_terminated_ : 1;
5147 
5149 };
5150 
5151 
5152 // --- Context ---
5153 
5154 
5159  public:
5160  ExtensionConfiguration() : name_count_(0), names_(NULL) { }
5161  ExtensionConfiguration(int name_count, const char* names[])
5162  : name_count_(name_count), names_(names) { }
5163 
5164  const char** begin() const { return &names_[0]; }
5165  const char** end() const { return &names_[name_count_]; }
5166 
5167  private:
5168  const int name_count_;
5169  const char** names_;
5170 };
5171 
5172 
5178  public:
5191  Local<Object> Global();
5192 
5197  void DetachGlobal();
5198 
5217  static Local<Context> New(
5218  Isolate* isolate,
5219  ExtensionConfiguration* extensions = NULL,
5220  Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(),
5221  Handle<Value> global_object = Handle<Value>());
5222 
5227  void SetSecurityToken(Handle<Value> token);
5228 
5230  void UseDefaultSecurityToken();
5231 
5233  Handle<Value> GetSecurityToken();
5234 
5241  void Enter();
5242 
5247  void Exit();
5248 
5250  bool HasOutOfMemoryException() { return false; }
5251 
5253  v8::Isolate* GetIsolate();
5254 
5260  V8_INLINE Local<Value> GetEmbedderData(int index);
5261 
5267  void SetEmbedderData(int index, Handle<Value> value);
5268 
5275  V8_INLINE void* GetAlignedPointerFromEmbedderData(int index);
5276 
5282  void SetAlignedPointerInEmbedderData(int index, void* value);
5283 
5297  void AllowCodeGenerationFromStrings(bool allow);
5298 
5303  bool IsCodeGenerationFromStringsAllowed();
5304 
5310  void SetErrorMessageForCodeGenerationFromStrings(Handle<String> message);
5311 
5316  class Scope {
5317  public:
5318  explicit V8_INLINE Scope(Handle<Context> context) : context_(context) {
5319  context_->Enter();
5320  }
5321  V8_INLINE ~Scope() { context_->Exit(); }
5322 
5323  private:
5324  Handle<Context> context_;
5325  };
5326 
5327  private:
5328  friend class Value;
5329  friend class Script;
5330  friend class Object;
5331  friend class Function;
5332 
5333  Local<Value> SlowGetEmbedderData(int index);
5334  void* SlowGetAlignedPointerFromEmbedderData(int index);
5335 };
5336 
5337 
5415  public:
5419  V8_INLINE explicit Unlocker(Isolate* isolate) { Initialize(isolate); }
5420 
5421  ~Unlocker();
5422  private:
5423  void Initialize(Isolate* isolate);
5424 
5425  internal::Isolate* isolate_;
5426 };
5427 
5428 
5430  public:
5434  V8_INLINE explicit Locker(Isolate* isolate) { Initialize(isolate); }
5435 
5436  ~Locker();
5437 
5442  static bool IsLocked(Isolate* isolate);
5443 
5447  static bool IsActive();
5448 
5449  private:
5450  void Initialize(Isolate* isolate);
5451 
5452  bool has_lock_;
5453  bool top_level_;
5454  internal::Isolate* isolate_;
5455 
5456  static bool active_;
5457 
5458  // Disallow copying and assigning.
5459  Locker(const Locker&);
5460  void operator=(const Locker&);
5461 };
5462 
5463 
5464 // --- Implementation ---
5465 
5466 
5467 namespace internal {
5468 
5469 const int kApiPointerSize = sizeof(void*); // NOLINT
5470 const int kApiIntSize = sizeof(int); // NOLINT
5471 
5472 // Tag information for HeapObject.
5473 const int kHeapObjectTag = 1;
5474 const int kHeapObjectTagSize = 2;
5475 const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1;
5476 
5477 // Tag information for Smi.
5478 const int kSmiTag = 0;
5479 const int kSmiTagSize = 1;
5480 const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
5481 
5482 template <size_t ptr_size> struct SmiTagging;
5483 
5484 template<int kSmiShiftSize>
5486  int smi_shift_bits = kSmiTagSize + kSmiShiftSize;
5487  intptr_t tagged_value =
5488  (static_cast<intptr_t>(value) << smi_shift_bits) | kSmiTag;
5489  return reinterpret_cast<internal::Object*>(tagged_value);
5490 }
5491 
5492 // Smi constants for 32-bit systems.
5493 template <> struct SmiTagging<4> {
5494  static const int kSmiShiftSize = 0;
5495  static const int kSmiValueSize = 31;
5496  V8_INLINE static int SmiToInt(internal::Object* value) {
5497  int shift_bits = kSmiTagSize + kSmiShiftSize;
5498  // Throw away top 32 bits and shift down (requires >> to be sign extending).
5499  return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> shift_bits;
5500  }
5501  V8_INLINE static internal::Object* IntToSmi(int value) {
5502  return internal::IntToSmi<kSmiShiftSize>(value);
5503  }
5504  V8_INLINE static bool IsValidSmi(intptr_t value) {
5505  // To be representable as an tagged small integer, the two
5506  // most-significant bits of 'value' must be either 00 or 11 due to
5507  // sign-extension. To check this we add 01 to the two
5508  // most-significant bits, and check if the most-significant bit is 0
5509  //
5510  // CAUTION: The original code below:
5511  // bool result = ((value + 0x40000000) & 0x80000000) == 0;
5512  // may lead to incorrect results according to the C language spec, and
5513  // in fact doesn't work correctly with gcc4.1.1 in some cases: The
5514  // compiler may produce undefined results in case of signed integer
5515  // overflow. The computation must be done w/ unsigned ints.
5516  return static_cast<uintptr_t>(value + 0x40000000U) < 0x80000000U;
5517  }
5518 };
5519 
5520 // Smi constants for 64-bit systems.
5521 template <> struct SmiTagging<8> {
5522  static const int kSmiShiftSize = 31;
5523  static const int kSmiValueSize = 32;
5524  V8_INLINE static int SmiToInt(internal::Object* value) {
5525  int shift_bits = kSmiTagSize + kSmiShiftSize;
5526  // Shift down and throw away top 32 bits.
5527  return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits);
5528  }
5529  V8_INLINE static internal::Object* IntToSmi(int value) {
5530  return internal::IntToSmi<kSmiShiftSize>(value);
5531  }
5532  V8_INLINE static bool IsValidSmi(intptr_t value) {
5533  // To be representable as a long smi, the value must be a 32-bit integer.
5534  return (value == static_cast<int32_t>(value));
5535  }
5536 };
5537 
5541 V8_INLINE static bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
5542 V8_INLINE static bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
5543 
5549 class Internals {
5550  public:
5551  // These values match non-compiler-dependent values defined within
5552  // the implementation of v8.
5553  static const int kHeapObjectMapOffset = 0;
5555  static const int kStringResourceOffset = 3 * kApiPointerSize;
5556 
5557  static const int kOddballKindOffset = 3 * kApiPointerSize;
5559  static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
5560  static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
5561  static const int kContextHeaderSize = 2 * kApiPointerSize;
5562  static const int kContextEmbedderDataIndex = 65;
5563  static const int kFullStringRepresentationMask = 0x07;
5564  static const int kStringEncodingMask = 0x4;
5565  static const int kExternalTwoByteRepresentationTag = 0x02;
5566  static const int kExternalAsciiRepresentationTag = 0x06;
5567 
5569  static const int kIsolateRootsOffset = 5 * kApiPointerSize;
5570  static const int kUndefinedValueRootIndex = 5;
5571  static const int kNullValueRootIndex = 7;
5572  static const int kTrueValueRootIndex = 8;
5573  static const int kFalseValueRootIndex = 9;
5574  static const int kEmptyStringRootIndex = 154;
5575 
5576  static const int kNodeClassIdOffset = 1 * kApiPointerSize;
5577  static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
5578  static const int kNodeStateMask = 0xf;
5579  static const int kNodeStateIsWeakValue = 2;
5580  static const int kNodeStateIsPendingValue = 3;
5581  static const int kNodeStateIsNearDeathValue = 4;
5582  static const int kNodeIsIndependentShift = 4;
5583  static const int kNodeIsPartiallyDependentShift = 5;
5584 
5585  static const int kJSObjectType = 0xbb;
5586  static const int kFirstNonstringType = 0x80;
5587  static const int kOddballType = 0x83;
5588  static const int kForeignType = 0x87;
5589 
5590  static const int kUndefinedOddballKind = 5;
5591  static const int kNullOddballKind = 3;
5592 
5593  static const uint32_t kNumIsolateDataSlots = 4;
5594 
5595  V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate);
5596  V8_INLINE static void CheckInitialized(v8::Isolate* isolate) {
5597 #ifdef V8_ENABLE_CHECKS
5598  CheckInitializedImpl(isolate);
5599 #endif
5600  }
5601 
5603  return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
5604  kHeapObjectTag);
5605  }
5606 
5607  V8_INLINE static int SmiValue(internal::Object* value) {
5608  return PlatformSmiTagging::SmiToInt(value);
5609  }
5610 
5611  V8_INLINE static internal::Object* IntToSmi(int value) {
5612  return PlatformSmiTagging::IntToSmi(value);
5613  }
5614 
5615  V8_INLINE static bool IsValidSmi(intptr_t value) {
5616  return PlatformSmiTagging::IsValidSmi(value);
5617  }
5618 
5620  typedef internal::Object O;
5621  O* map = ReadField<O*>(obj, kHeapObjectMapOffset);
5622  return ReadField<uint8_t>(map, kMapInstanceTypeOffset);
5623  }
5624 
5626  typedef internal::Object O;
5627  return SmiValue(ReadField<O*>(obj, kOddballKindOffset));
5628  }
5629 
5630  V8_INLINE static bool IsExternalTwoByteString(int instance_type) {
5631  int representation = (instance_type & kFullStringRepresentationMask);
5632  return representation == kExternalTwoByteRepresentationTag;
5633  }
5634 
5636  uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
5637  return *addr & static_cast<uint8_t>(1U << shift);
5638  }
5639 
5641  bool value, int shift) {
5642  uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
5643  uint8_t mask = static_cast<uint8_t>(1 << shift);
5644  *addr = static_cast<uint8_t>((*addr & ~mask) | (value << shift));
5645  }
5646 
5648  uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
5649  return *addr & kNodeStateMask;
5650  }
5651 
5653  uint8_t value) {
5654  uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
5655  *addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value);
5656  }
5657 
5658  V8_INLINE static void SetEmbedderData(v8::Isolate *isolate,
5659  uint32_t slot,
5660  void *data) {
5661  uint8_t *addr = reinterpret_cast<uint8_t *>(isolate) +
5663  *reinterpret_cast<void**>(addr) = data;
5664  }
5665 
5666  V8_INLINE static void* GetEmbedderData(v8::Isolate* isolate, uint32_t slot) {
5667  uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
5669  return *reinterpret_cast<void**>(addr);
5670  }
5671 
5673  int index) {
5674  uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset;
5675  return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize);
5676  }
5677 
5678  template <typename T> V8_INLINE static T ReadField(Object* ptr, int offset) {
5679  uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag;
5680  return *reinterpret_cast<T*>(addr);
5681  }
5682 
5683  template <typename T>
5684  V8_INLINE static T ReadEmbedderData(Context* context, int index) {
5685  typedef internal::Object O;
5686  typedef internal::Internals I;
5687  O* ctx = *reinterpret_cast<O**>(context);
5688  int embedder_data_offset = I::kContextHeaderSize +
5689  (internal::kApiPointerSize * I::kContextEmbedderDataIndex);
5690  O* embedder_data = I::ReadField<O*>(ctx, embedder_data_offset);
5691  int value_offset =
5692  I::kFixedArrayHeaderSize + (internal::kApiPointerSize * index);
5693  return I::ReadField<T>(embedder_data, value_offset);
5694  }
5695 
5696  V8_INLINE static bool CanCastToHeapObject(void* o) { return false; }
5697  V8_INLINE static bool CanCastToHeapObject(Context* o) { return true; }
5698  V8_INLINE static bool CanCastToHeapObject(String* o) { return true; }
5699  V8_INLINE static bool CanCastToHeapObject(Object* o) { return true; }
5700  V8_INLINE static bool CanCastToHeapObject(Message* o) { return true; }
5701  V8_INLINE static bool CanCastToHeapObject(StackTrace* o) { return true; }
5702  V8_INLINE static bool CanCastToHeapObject(StackFrame* o) { return true; }
5703 };
5704 
5705 } // namespace internal
5706 
5707 
5708 template <class T>
5710 
5711 
5712 template <class T>
5714  return New(isolate, that.val_);
5715 }
5716 
5717 template <class T>
5719  return New(isolate, that.val_);
5720 }
5721 
5722 template <class T>
5723 Handle<T> Handle<T>::New(Isolate* isolate, T* that) {
5724  if (that == NULL) return Handle<T>();
5725  T* that_ptr = that;
5726  internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr);
5727  return Handle<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(
5728  reinterpret_cast<internal::Isolate*>(isolate), *p)));
5729 }
5730 
5731 
5732 template <class T>
5733 Local<T> Local<T>::New(Isolate* isolate, T* that) {
5734  if (that == NULL) return Local<T>();
5735  T* that_ptr = that;
5736  internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr);
5737  return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(
5738  reinterpret_cast<internal::Isolate*>(isolate), *p)));
5739 }
5740 
5741 
5742 template<class T>
5743 template<class S>
5745  TYPE_CHECK(T, S);
5746  V8::Eternalize(isolate, reinterpret_cast<Value*>(*handle), &this->index_);
5747 }
5748 
5749 
5750 template<class T>
5752  return Local<T>(reinterpret_cast<T*>(*V8::GetEternal(isolate, index_)));
5753 }
5754 
5755 
5756 template <class T>
5757 T* PersistentBase<T>::New(Isolate* isolate, T* that) {
5758  if (that == NULL) return NULL;
5759  internal::Object** p = reinterpret_cast<internal::Object**>(that);
5760  return reinterpret_cast<T*>(
5761  V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate),
5762  p));
5763 }
5764 
5765 
5766 template <class T, class M>
5767 template <class S, class M2>
5769  TYPE_CHECK(T, S);
5770  this->Reset();
5771  if (that.IsEmpty()) return;
5772  internal::Object** p = reinterpret_cast<internal::Object**>(that.val_);
5773  this->val_ = reinterpret_cast<T*>(V8::CopyPersistent(p));
5774  M::Copy(that, this);
5775 }
5776 
5777 
5778 template <class T>
5780  typedef internal::Internals I;
5781  if (this->IsEmpty()) return false;
5782  return I::GetNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
5783  I::kNodeIsIndependentShift);
5784 }
5785 
5786 
5787 template <class T>
5789  typedef internal::Internals I;
5790  if (this->IsEmpty()) return false;
5791  uint8_t node_state =
5792  I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_));
5793  return node_state == I::kNodeStateIsNearDeathValue ||
5794  node_state == I::kNodeStateIsPendingValue;
5795 }
5796 
5797 
5798 template <class T>
5800  typedef internal::Internals I;
5801  if (this->IsEmpty()) return false;
5802  return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) ==
5803  I::kNodeStateIsWeakValue;
5804 }
5805 
5806 
5807 template <class T>
5809  if (this->IsEmpty()) return;
5810  V8::DisposeGlobal(reinterpret_cast<internal::Object**>(this->val_));
5811  val_ = 0;
5812 }
5813 
5814 
5815 template <class T>
5816 template <class S>
5817 void PersistentBase<T>::Reset(Isolate* isolate, const Handle<S>& other) {
5818  TYPE_CHECK(T, S);
5819  Reset();
5820  if (other.IsEmpty()) return;
5821  this->val_ = New(isolate, other.val_);
5822 }
5823 
5824 
5825 template <class T>
5826 template <class S>
5828  const PersistentBase<S>& other) {
5829  TYPE_CHECK(T, S);
5830  Reset();
5831  if (other.IsEmpty()) return;
5832  this->val_ = New(isolate, other.val_);
5833 }
5834 
5835 
5836 template <class T>
5837 template <typename S, typename P>
5839  P* parameter,
5840  typename WeakCallbackData<S, P>::Callback callback) {
5841  TYPE_CHECK(S, T);
5842  typedef typename WeakCallbackData<Value, void>::Callback Callback;
5843  V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_),
5844  parameter,
5845  reinterpret_cast<Callback>(callback));
5846 }
5847 
5848 
5849 template <class T>
5850 template <typename P>
5852  P* parameter,
5853  typename WeakCallbackData<T, P>::Callback callback) {
5854  SetWeak<T, P>(parameter, callback);
5855 }
5856 
5857 
5858 template <class T>
5859 template<typename P>
5861  return reinterpret_cast<P*>(
5862  V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_)));
5863 }
5864 
5865 
5866 template <class T>
5868  typedef internal::Internals I;
5869  if (this->IsEmpty()) return;
5870  I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
5871  true,
5872  I::kNodeIsIndependentShift);
5873 }
5874 
5875 
5876 template <class T>
5878  typedef internal::Internals I;
5879  if (this->IsEmpty()) return;
5880  I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
5881  true,
5882  I::kNodeIsPartiallyDependentShift);
5883 }
5884 
5885 
5886 template <class T, class M>
5888  T* old;
5889  old = this->val_;
5890  this->val_ = NULL;
5891  return old;
5892 }
5893 
5894 
5895 template <class T>
5897  typedef internal::Internals I;
5898  if (this->IsEmpty()) return;
5899  internal::Object** obj = reinterpret_cast<internal::Object**>(this->val_);
5900  uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
5901  *reinterpret_cast<uint16_t*>(addr) = class_id;
5902 }
5903 
5904 
5905 template <class T>
5907  typedef internal::Internals I;
5908  if (this->IsEmpty()) return 0;
5909  internal::Object** obj = reinterpret_cast<internal::Object**>(this->val_);
5910  uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
5911  return *reinterpret_cast<uint16_t*>(addr);
5912 }
5913 
5914 
5915 template<typename T>
5916 ReturnValue<T>::ReturnValue(internal::Object** slot) : value_(slot) {}
5917 
5918 template<typename T>
5919 template<typename S>
5921  TYPE_CHECK(T, S);
5922  if (V8_UNLIKELY(handle.IsEmpty())) {
5923  *value_ = GetDefaultValue();
5924  } else {
5925  *value_ = *reinterpret_cast<internal::Object**>(*handle);
5926  }
5927 }
5928 
5929 template<typename T>
5930 template<typename S>
5932  TYPE_CHECK(T, S);
5933  if (V8_UNLIKELY(handle.IsEmpty())) {
5934  *value_ = GetDefaultValue();
5935  } else {
5936  *value_ = *reinterpret_cast<internal::Object**>(*handle);
5937  }
5938 }
5939 
5940 template<typename T>
5941 void ReturnValue<T>::Set(double i) {
5942  TYPE_CHECK(T, Number);
5943  Set(Number::New(GetIsolate(), i));
5944 }
5945 
5946 template<typename T>
5948  TYPE_CHECK(T, Integer);
5949  typedef internal::Internals I;
5950  if (V8_LIKELY(I::IsValidSmi(i))) {
5951  *value_ = I::IntToSmi(i);
5952  return;
5953  }
5954  Set(Integer::New(GetIsolate(), i));
5955 }
5956 
5957 template<typename T>
5958 void ReturnValue<T>::Set(uint32_t i) {
5959  TYPE_CHECK(T, Integer);
5960  // Can't simply use INT32_MAX here for whatever reason.
5961  bool fits_into_int32_t = (i & (1U << 31)) == 0;
5962  if (V8_LIKELY(fits_into_int32_t)) {
5963  Set(static_cast<int32_t>(i));
5964  return;
5965  }
5966  Set(Integer::NewFromUnsigned(GetIsolate(), i));
5967 }
5968 
5969 template<typename T>
5970 void ReturnValue<T>::Set(bool value) {
5971  TYPE_CHECK(T, Boolean);
5972  typedef internal::Internals I;
5973  int root_index;
5974  if (value) {
5975  root_index = I::kTrueValueRootIndex;
5976  } else {
5977  root_index = I::kFalseValueRootIndex;
5978  }
5979  *value_ = *I::GetRoot(GetIsolate(), root_index);
5980 }
5981 
5982 template<typename T>
5985  typedef internal::Internals I;
5986  *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
5987 }
5988 
5989 template<typename T>
5992  typedef internal::Internals I;
5993  *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
5994 }
5995 
5996 template<typename T>
5998  TYPE_CHECK(T, String);
5999  typedef internal::Internals I;
6000  *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
6001 }
6002 
6003 template<typename T>
6005  // Isolate is always the pointer below the default value on the stack.
6006  return *reinterpret_cast<Isolate**>(&value_[-2]);
6007 }
6008 
6009 template<typename T>
6011  // Default value is always the pointer below value_ on the stack.
6012  return value_[-1];
6013 }
6014 
6015 
6016 template<typename T>
6018  internal::Object** values,
6019  int length,
6020  bool is_construct_call)
6021  : implicit_args_(implicit_args),
6022  values_(values),
6023  length_(length),
6024  is_construct_call_(is_construct_call) { }
6025 
6026 
6027 template<typename T>
6029  if (i < 0 || length_ <= i) return Local<Value>(*Undefined(GetIsolate()));
6030  return Local<Value>(reinterpret_cast<Value*>(values_ - i));
6031 }
6032 
6033 
6034 template<typename T>
6036  return Local<Function>(reinterpret_cast<Function*>(
6037  &implicit_args_[kCalleeIndex]));
6038 }
6039 
6040 
6041 template<typename T>
6043  return Local<Object>(reinterpret_cast<Object*>(values_ + 1));
6044 }
6045 
6046 
6047 template<typename T>
6049  return Local<Object>(reinterpret_cast<Object*>(
6050  &implicit_args_[kHolderIndex]));
6051 }
6052 
6053 
6054 template<typename T>
6056  return Local<Value>(reinterpret_cast<Value*>(&implicit_args_[kDataIndex]));
6057 }
6058 
6059 
6060 template<typename T>
6062  return *reinterpret_cast<Isolate**>(&implicit_args_[kIsolateIndex]);
6063 }
6064 
6065 
6066 template<typename T>
6068  return ReturnValue<T>(&implicit_args_[kReturnValueIndex]);
6069 }
6070 
6071 
6072 template<typename T>
6074  return is_construct_call_;
6075 }
6076 
6077 
6078 template<typename T>
6080  return length_;
6081 }
6082 
6083 
6085  return resource_name_;
6086 }
6087 
6088 
6090  return resource_line_offset_;
6091 }
6092 
6093 
6095  return resource_column_offset_;
6096 }
6097 
6099  return resource_is_shared_cross_origin_;
6100 }
6101 
6102 
6104  CachedData* data)
6105  : source_string(string),
6106  resource_name(origin.ResourceName()),
6107  resource_line_offset(origin.ResourceLineOffset()),
6108  resource_column_offset(origin.ResourceColumnOffset()),
6109  resource_is_shared_cross_origin(origin.ResourceIsSharedCrossOrigin()),
6110  cached_data(data) {}
6111 
6112 
6114  CachedData* data)
6115  : source_string(string), cached_data(data) {}
6116 
6117 
6119  delete cached_data;
6120 }
6121 
6122 
6124  const {
6125  return cached_data;
6126 }
6127 
6128 
6129 Handle<Boolean> Boolean::New(Isolate* isolate, bool value) {
6130  return value ? True(isolate) : False(isolate);
6131 }
6132 
6133 
6134 void Template::Set(Isolate* isolate, const char* name, v8::Handle<Data> value) {
6135  Set(v8::String::NewFromUtf8(isolate, name), value);
6136 }
6137 
6138 
6140 #ifndef V8_ENABLE_CHECKS
6141  typedef internal::Object O;
6142  typedef internal::HeapObject HO;
6143  typedef internal::Internals I;
6144  O* obj = *reinterpret_cast<O**>(this);
6145  // Fast path: If the object is a plain JSObject, which is the common case, we
6146  // know where to find the internal fields and can return the value directly.
6147  if (I::GetInstanceType(obj) == I::kJSObjectType) {
6148  int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
6149  O* value = I::ReadField<O*>(obj, offset);
6150  O** result = HandleScope::CreateHandle(reinterpret_cast<HO*>(obj), value);
6151  return Local<Value>(reinterpret_cast<Value*>(result));
6152  }
6153 #endif
6154  return SlowGetInternalField(index);
6155 }
6156 
6157 
6159 #ifndef V8_ENABLE_CHECKS
6160  typedef internal::Object O;
6161  typedef internal::Internals I;
6162  O* obj = *reinterpret_cast<O**>(this);
6163  // Fast path: If the object is a plain JSObject, which is the common case, we
6164  // know where to find the internal fields and can return the value directly.
6165  if (V8_LIKELY(I::GetInstanceType(obj) == I::kJSObjectType)) {
6166  int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
6167  return I::ReadField<void*>(obj, offset);
6168  }
6169 #endif
6170  return SlowGetAlignedPointerFromInternalField(index);
6171 }
6172 
6173 
6175 #ifdef V8_ENABLE_CHECKS
6176  CheckCast(value);
6177 #endif
6178  return static_cast<String*>(value);
6179 }
6180 
6181 
6183  typedef internal::Object* S;
6184  typedef internal::Internals I;
6185  I::CheckInitialized(isolate);
6186  S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex);
6187  return Local<String>(reinterpret_cast<String*>(slot));
6188 }
6189 
6190 
6192  typedef internal::Object O;
6193  typedef internal::Internals I;
6194  O* obj = *reinterpret_cast<O**>(const_cast<String*>(this));
6196  if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
6197  void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
6198  result = reinterpret_cast<String::ExternalStringResource*>(value);
6199  } else {
6200  result = NULL;
6201  }
6202 #ifdef V8_ENABLE_CHECKS
6203  VerifyExternalStringResource(result);
6204 #endif
6205  return result;
6206 }
6207 
6208 
6210  String::Encoding* encoding_out) const {
6211  typedef internal::Object O;
6212  typedef internal::Internals I;
6213  O* obj = *reinterpret_cast<O**>(const_cast<String*>(this));
6214  int type = I::GetInstanceType(obj) & I::kFullStringRepresentationMask;
6215  *encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask);
6216  ExternalStringResourceBase* resource = NULL;
6217  if (type == I::kExternalAsciiRepresentationTag ||
6218  type == I::kExternalTwoByteRepresentationTag) {
6219  void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
6220  resource = static_cast<ExternalStringResourceBase*>(value);
6221  }
6222 #ifdef V8_ENABLE_CHECKS
6223  VerifyExternalStringResourceBase(resource, *encoding_out);
6224 #endif
6225  return resource;
6226 }
6227 
6228 
6229 bool Value::IsUndefined() const {
6230 #ifdef V8_ENABLE_CHECKS
6231  return FullIsUndefined();
6232 #else
6233  return QuickIsUndefined();
6234 #endif
6235 }
6236 
6237 bool Value::QuickIsUndefined() const {
6238  typedef internal::Object O;
6239  typedef internal::Internals I;
6240  O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this));
6241  if (!I::HasHeapObjectTag(obj)) return false;
6242  if (I::GetInstanceType(obj) != I::kOddballType) return false;
6243  return (I::GetOddballKind(obj) == I::kUndefinedOddballKind);
6244 }
6245 
6246 
6247 bool Value::IsNull() const {
6248 #ifdef V8_ENABLE_CHECKS
6249  return FullIsNull();
6250 #else
6251  return QuickIsNull();
6252 #endif
6253 }
6254 
6255 bool Value::QuickIsNull() const {
6256  typedef internal::Object O;
6257  typedef internal::Internals I;
6258  O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this));
6259  if (!I::HasHeapObjectTag(obj)) return false;
6260  if (I::GetInstanceType(obj) != I::kOddballType) return false;
6261  return (I::GetOddballKind(obj) == I::kNullOddballKind);
6262 }
6263 
6264 
6265 bool Value::IsString() const {
6266 #ifdef V8_ENABLE_CHECKS
6267  return FullIsString();
6268 #else
6269  return QuickIsString();
6270 #endif
6271 }
6272 
6273 bool Value::QuickIsString() const {
6274  typedef internal::Object O;
6275  typedef internal::Internals I;
6276  O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this));
6277  if (!I::HasHeapObjectTag(obj)) return false;
6278  return (I::GetInstanceType(obj) < I::kFirstNonstringType);
6279 }
6280 
6281 
6282 template <class T> Value* Value::Cast(T* value) {
6283  return static_cast<Value*>(value);
6284 }
6285 
6286 
6288 #ifdef V8_ENABLE_CHECKS
6289  CheckCast(value);
6290 #endif
6291  return static_cast<Symbol*>(value);
6292 }
6293 
6294 
6296 #ifdef V8_ENABLE_CHECKS
6297  CheckCast(value);
6298 #endif
6299  return static_cast<Number*>(value);
6300 }
6301 
6302 
6304 #ifdef V8_ENABLE_CHECKS
6305  CheckCast(value);
6306 #endif
6307  return static_cast<Integer*>(value);
6308 }
6309 
6310 
6312 #ifdef V8_ENABLE_CHECKS
6313  CheckCast(value);
6314 #endif
6315  return static_cast<Date*>(value);
6316 }
6317 
6318 
6320 #ifdef V8_ENABLE_CHECKS
6321  CheckCast(value);
6322 #endif
6323  return static_cast<StringObject*>(value);
6324 }
6325 
6326 
6328 #ifdef V8_ENABLE_CHECKS
6329  CheckCast(value);
6330 #endif
6331  return static_cast<SymbolObject*>(value);
6332 }
6333 
6334 
6336 #ifdef V8_ENABLE_CHECKS
6337  CheckCast(value);
6338 #endif
6339  return static_cast<NumberObject*>(value);
6340 }
6341 
6342 
6344 #ifdef V8_ENABLE_CHECKS
6345  CheckCast(value);
6346 #endif
6347  return static_cast<BooleanObject*>(value);
6348 }
6349 
6350 
6352 #ifdef V8_ENABLE_CHECKS
6353  CheckCast(value);
6354 #endif
6355  return static_cast<RegExp*>(value);
6356 }
6357 
6358 
6360 #ifdef V8_ENABLE_CHECKS
6361  CheckCast(value);
6362 #endif
6363  return static_cast<Object*>(value);
6364 }
6365 
6366 
6368 #ifdef V8_ENABLE_CHECKS
6369  CheckCast(value);
6370 #endif
6371  return static_cast<Array*>(value);
6372 }
6373 
6374 
6376 #ifdef V8_ENABLE_CHECKS
6377  CheckCast(value);
6378 #endif
6379  return static_cast<Promise*>(value);
6380 }
6381 
6382 
6384 #ifdef V8_ENABLE_CHECKS
6385  CheckCast(value);
6386 #endif
6387  return static_cast<Promise::Resolver*>(value);
6388 }
6389 
6390 
6392 #ifdef V8_ENABLE_CHECKS
6393  CheckCast(value);
6394 #endif
6395  return static_cast<ArrayBuffer*>(value);
6396 }
6397 
6398 
6400 #ifdef V8_ENABLE_CHECKS
6401  CheckCast(value);
6402 #endif
6403  return static_cast<ArrayBufferView*>(value);
6404 }
6405 
6406 
6408 #ifdef V8_ENABLE_CHECKS
6409  CheckCast(value);
6410 #endif
6411  return static_cast<TypedArray*>(value);
6412 }
6413 
6414 
6416 #ifdef V8_ENABLE_CHECKS
6417  CheckCast(value);
6418 #endif
6419  return static_cast<Uint8Array*>(value);
6420 }
6421 
6422 
6424 #ifdef V8_ENABLE_CHECKS
6425  CheckCast(value);
6426 #endif
6427  return static_cast<Int8Array*>(value);
6428 }
6429 
6430 
6432 #ifdef V8_ENABLE_CHECKS
6433  CheckCast(value);
6434 #endif
6435  return static_cast<Uint16Array*>(value);
6436 }
6437 
6438 
6440 #ifdef V8_ENABLE_CHECKS
6441  CheckCast(value);
6442 #endif
6443  return static_cast<Int16Array*>(value);
6444 }
6445 
6446 
6448 #ifdef V8_ENABLE_CHECKS
6449  CheckCast(value);
6450 #endif
6451  return static_cast<Uint32Array*>(value);
6452 }
6453 
6454 
6456 #ifdef V8_ENABLE_CHECKS
6457  CheckCast(value);
6458 #endif
6459  return static_cast<Int32Array*>(value);
6460 }
6461 
6462 
6464 #ifdef V8_ENABLE_CHECKS
6465  CheckCast(value);
6466 #endif
6467  return static_cast<Float32Array*>(value);
6468 }
6469 
6470 
6472 #ifdef V8_ENABLE_CHECKS
6473  CheckCast(value);
6474 #endif
6475  return static_cast<Float64Array*>(value);
6476 }
6477 
6478 
6480 #ifdef V8_ENABLE_CHECKS
6481  CheckCast(value);
6482 #endif
6483  return static_cast<Uint8ClampedArray*>(value);
6484 }
6485 
6486 
6488 #ifdef V8_ENABLE_CHECKS
6489  CheckCast(value);
6490 #endif
6491  return static_cast<DataView*>(value);
6492 }
6493 
6494 
6496 #ifdef V8_ENABLE_CHECKS
6497  CheckCast(value);
6498 #endif
6499  return static_cast<Function*>(value);
6500 }
6501 
6502 
6504 #ifdef V8_ENABLE_CHECKS
6505  CheckCast(value);
6506 #endif
6507  return static_cast<External*>(value);
6508 }
6509 
6510 
6511 template<typename T>
6513  return *reinterpret_cast<Isolate**>(&args_[kIsolateIndex]);
6514 }
6515 
6516 
6517 template<typename T>
6519  return Local<Value>(reinterpret_cast<Value*>(&args_[kDataIndex]));
6520 }
6521 
6522 
6523 template<typename T>
6525  return Local<Object>(reinterpret_cast<Object*>(&args_[kThisIndex]));
6526 }
6527 
6528 
6529 template<typename T>
6531  return Local<Object>(reinterpret_cast<Object*>(&args_[kHolderIndex]));
6532 }
6533 
6534 
6535 template<typename T>
6537  return ReturnValue<T>(&args_[kReturnValueIndex]);
6538 }
6539 
6540 
6542  typedef internal::Object* S;
6543  typedef internal::Internals I;
6544  I::CheckInitialized(isolate);
6545  S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
6546  return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
6547 }
6548 
6549 
6551  typedef internal::Object* S;
6552  typedef internal::Internals I;
6553  I::CheckInitialized(isolate);
6554  S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
6555  return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
6556 }
6557 
6558 
6560  typedef internal::Object* S;
6561  typedef internal::Internals I;
6562  I::CheckInitialized(isolate);
6563  S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
6564  return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
6565 }
6566 
6567 
6569  typedef internal::Object* S;
6570  typedef internal::Internals I;
6571  I::CheckInitialized(isolate);
6572  S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
6573  return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
6574 }
6575 
6576 
6577 void Isolate::SetData(uint32_t slot, void* data) {
6578  typedef internal::Internals I;
6579  I::SetEmbedderData(this, slot, data);
6580 }
6581 
6582 
6583 void* Isolate::GetData(uint32_t slot) {
6584  typedef internal::Internals I;
6585  return I::GetEmbedderData(this, slot);
6586 }
6587 
6588 
6590  typedef internal::Internals I;
6591  return I::kNumIsolateDataSlots;
6592 }
6593 
6594 
6595 template<typename T>
6597  UniqueId id) {
6598  TYPE_CHECK(Value, T);
6599  SetObjectGroupId(reinterpret_cast<v8::internal::Object**>(object.val_), id);
6600 }
6601 
6602 
6603 template<typename T>
6605  const Persistent<T>& object) {
6606  TYPE_CHECK(Value, T);
6607  SetReferenceFromGroup(id,
6608  reinterpret_cast<v8::internal::Object**>(object.val_));
6609 }
6610 
6611 
6612 template<typename T, typename S>
6614  const Persistent<S>& child) {
6615  TYPE_CHECK(Object, T);
6616  TYPE_CHECK(Value, S);
6617  SetReference(reinterpret_cast<v8::internal::Object**>(parent.val_),
6618  reinterpret_cast<v8::internal::Object**>(child.val_));
6619 }
6620 
6621 
6623 #ifndef V8_ENABLE_CHECKS
6624  typedef internal::Object O;
6625  typedef internal::HeapObject HO;
6626  typedef internal::Internals I;
6627  HO* context = *reinterpret_cast<HO**>(this);
6628  O** result =
6629  HandleScope::CreateHandle(context, I::ReadEmbedderData<O*>(this, index));
6630  return Local<Value>(reinterpret_cast<Value*>(result));
6631 #else
6632  return SlowGetEmbedderData(index);
6633 #endif
6634 }
6635 
6636 
6638 #ifndef V8_ENABLE_CHECKS
6639  typedef internal::Internals I;
6640  return I::ReadEmbedderData<void*>(this, index);
6641 #else
6642  return SlowGetAlignedPointerFromEmbedderData(index);
6643 #endif
6644 }
6645 
6646 
6659 } // namespace v8
6660 
6661 
6662 #undef TYPE_CHECK
6663 
6664 
6665 #endif // V8_H_
V8_INLINE UniquePersistent Pass()
Definition: v8.h:807
static V8_INLINE bool CanCastToHeapObject(Message *o)
Definition: v8.h:5700
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
static V8_INLINE bool CanCastToHeapObject(StackFrame *o)
Definition: v8.h:5702
V8_INLINE Local< Value > GetEmbedderData(int index)
Definition: v8.h:6622
static V8_INLINE Local< T > New(Isolate *isolate, Handle< T > that)
Definition: v8.h:5713
static V8_INLINE bool CanCastToHeapObject(String *o)
Definition: v8.h:5698
GarbageCollectionType
Definition: v8.h:4190
static V8_INLINE Object * Cast(Value *obj)
Definition: v8.h:6359
static V8_INLINE Persistent< T > & Cast(Persistent< S > &that)
Definition: v8.h:705
static V8_INLINE Uint8ClampedArray * Cast(Value *obj)
Definition: v8.h:6479
Persistent< T, CopyablePersistentTraits< T > > CopyablePersistent
Definition: v8.h:629
V8_INLINE void SetWrapperClassId(uint16_t class_id)
Definition: v8.h:5896
const intptr_t kSmiTagMask
Definition: v8.h:5480
static V8_INLINE void Uncompilable()
Definition: v8.h:617
void(* MemoryAllocationCallback)(ObjectSpace space, AllocationAction action, int size)
Definition: v8.h:4038
void set_max_young_space_size(int value)
Definition: v8.h:3951
static const int kExternalAsciiRepresentationTag
Definition: v8.h:5566
#define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
Definition: v8.h:2850
const char * data
Definition: v8.h:4443
void(* Callback)(const WeakCallbackData< T, P > &data)
Definition: v8.h:447
static V8_INLINE int SmiValue(internal::Object *value)
Definition: v8.h:5607
static V8_INLINE int SmiToInt(internal::Object *value)
Definition: v8.h:5524
char * operator*()
Definition: v8.h:1953
static V8_INLINE int GetOddballKind(internal::Object *obj)
Definition: v8.h:5625
static internal::Object ** CreateHandle(internal::Isolate *isolate, internal::Object *value)
Definition: api.cc:617
static V8_INLINE Int8Array * Cast(Value *obj)
Definition: v8.h:6423
Definition: v8.h:1388
static V8_INLINE Date * Cast(v8::Value *obj)
Definition: v8.h:6311
void(* CallCompletedCallback)()
Definition: v8.h:4043
V8_INLINE bool operator==(const PersistentBase< S > &that) const
Definition: v8.h:500
V8_INLINE Persistent & operator=(const Persistent< S, M2 > &that)
Definition: v8.h:690
static V8_INLINE ArrayBufferView * Cast(Value *obj)
Definition: v8.h:6399
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf map
Definition: flags.cc:350
V8_INLINE Eternal(Isolate *isolate, Local< S > handle)
Definition: v8.h:430
friend class ReturnValue
Definition: v8.h:2518
#define I(name, number_of_args, result_size)
Definition: runtime.cc:15091
V8_INLINE void SetUndefined()
Definition: v8.h:5990
static V8_INLINE Float32Array * Cast(Value *obj)
Definition: v8.h:6463
T value
Definition: v8.h:923
V8_INLINE HandleScope()
Definition: v8.h:845
Definition: v8.h:4622
void(* FunctionCallback)(const FunctionCallbackInfo< Value > &info)
Definition: v8.h:2603
V8_INLINE UniquePersistent(RValue rvalue)
Definition: v8.h:784
Definition: v8.h:1407
void * user_data
Definition: v8.h:4549
V8_INLINE Isolate * GetIsolate() const
Definition: v8.h:6061
bool HasOutOfMemoryException()
Definition: v8.h:5250
V8_INLINE void * GetAlignedPointerFromInternalField(int index)
Definition: v8.h:6158
virtual ~PersistentHandleVisitor()
Definition: v8.h:4613
static V8_INLINE Uint32Array * Cast(Value *obj)
Definition: v8.h:6447
static const int kOddballKindOffset
Definition: v8.h:5557
V8_INLINE Handle< Integer > ResourceLineOffset() const
Definition: v8.h:6089
virtual v8::Handle< v8::FunctionTemplate > GetNativeFunctionTemplate(v8::Isolate *isolate, v8::Handle< v8::String > name)
Definition: v8.h:3886
void SetObjectGroupId(const Persistent< T > &object, UniqueId id)
Definition: v8.h:6596
void V8_EXPORT RegisterExtension(Extension *extension)
Definition: api.cc:439
static V8_INLINE uint8_t GetNodeState(internal::Object **obj)
Definition: v8.h:5647
V8_INLINE ReturnValue< T > GetReturnValue() const
Definition: v8.h:6067
StackTraceOptions
Definition: v8.h:1280
bool operator!=(const UniqueId &other) const
Definition: v8.h:173
const char ** begin() const
Definition: v8.h:5164
static const int kArgsLength
Definition: v8.h:2548
friend class PersistentBase
Definition: v8.h:586
V8_INLINE ExternalStringResourceBase * GetExternalStringResourceBase(Encoding *encoding_out) const
Definition: v8.h:6209
bool auto_enable()
Definition: v8.h:3898
static const int kFirstNonstringType
Definition: v8.h:5586
static const int kNullValueRootIndex
Definition: v8.h:5571
static const uint32_t kNumIsolateDataSlots
Definition: v8.h:5593
static V8_INLINE int SmiToInt(internal::Object *value)
Definition: v8.h:5496
static V8_INLINE Array * Cast(Value *obj)
Definition: v8.h:6367
TickSample * sample
Handle< Script > script
Definition: v8.h:4544
const int kSmiValueSize
Definition: v8.h:5540
static const int kHolderIndex
Definition: v8.h:2553
V8_INLINE Persistent & operator=(const Persistent &that)
Definition: v8.h:685
void * new_code_start
Definition: v8.h:4576
V8_INLINE void * GetAlignedPointerFromEmbedderData(int index)
Definition: v8.h:6637
static V8_INLINE bool CanCastToHeapObject(Object *o)
Definition: v8.h:5699
V8_INLINE int Length() const
Definition: v8.h:6079
bool(* IndexedSecurityCallback)(Local< Object > host, uint32_t index, AccessType type, Local< Value > data)
Definition: v8.h:3418
bool InitializeICU(const char *icu_data_file)
Definition: icu_util.cc:64
V8_INLINE Handle()
Definition: v8.h:223
size_t used_heap_size()
Definition: v8.h:4098
kSerializedDataOffset Object
Definition: objects-inl.h:5016
static V8_INLINE Float64Array * Cast(Value *obj)
Definition: v8.h:6471
static const bool kResetInDestructor
Definition: v8.h:610
Definition: v8.h:933
V8_INLINE PropertyCallbackInfo(internal::Object **args)
Definition: v8.h:2598
WriteOptions
Definition: v8.h:1718
Encoding
Definition: v8.h:1663
static V8_INLINE internal::Object ** GetRoot(v8::Isolate *isolate, int index)
Definition: v8.h:5672
int int32_t
Definition: unicode.cc:47
V8_INLINE Local< Function > Callee() const
Definition: v8.h:6035
void(* MessageCallback)(Handle< Message > message, Handle< Value > error)
Definition: v8.h:3987
V8_INLINE Eternal()
Definition: v8.h:428
static V8_INLINE uint32_t GetNumberOfDataSlots()
Definition: v8.h:6589
friend Handle< Primitive > Undefined(Isolate *isolate)
Definition: v8.h:6541
V8_INLINE Local< Object > Holder() const
Definition: v8.h:6530
V8_INLINE bool operator!=(const Handle< S > &that) const
Definition: v8.h:521
AllocationAction
Definition: v8.h:4032
int *(* CounterLookupCallback)(const char *name)
Definition: v8.h:4009
V8_INLINE Local< T > GetValue() const
Definition: v8.h:450
static V8_INLINE bool HasHeapObjectTag(internal::Object *value)
Definition: v8.h:5602
V8_INLINE Local< T > Escape(Local< T > value)
Definition: v8.h:892
#define S(x)
Definition: version.cc:55
static const int kLineOffsetNotFound
Definition: v8.h:2669
void(* IndexedPropertyDeleterCallback)(uint32_t index, const PropertyCallbackInfo< Boolean > &info)
Definition: v8.h:3379
V8_INLINE void Set(const Persistent< S > &handle)
void(* GCPrologueCallback)(GCType type, GCCallbackFlags flags)
Definition: v8.h:4080
V8_INLINE Persistent(const Persistent< S, M2 > &that)
Definition: v8.h:682
CompressionAlgorithm
Definition: v8.h:4438
static V8_INLINE Resolver * Cast(Value *obj)
Definition: v8.h:6383
bool operator==(const UniqueId &other) const
Definition: v8.h:169
Persistent< T, NonCopyablePersistentTraits< T > > NonCopyablePersistent
Definition: v8.h:609
V8_INLINE bool operator!=(const Persistent< S > &that) const
Definition: v8.h:292
V8_INLINE ~Persistent()
Definition: v8.h:699
static const bool kResetInDestructor
Definition: v8.h:630
ExternalArrayType
Definition: v8.h:2113
BufferPolicy buffer_policy
Definition: v8.h:1119
unsigned short uint16_t
Definition: unicode.cc:46
void(* AccessorSetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
Definition: v8.h:2146
V8_INLINE const CachedData * GetCachedData() const
Definition: v8.h:6123
size_t heap_size_limit()
Definition: v8.h:4099
internal::Object ** args_
Definition: v8.h:2599
V8_INLINE Handle< Value > ResourceName() const
Definition: v8.h:6084
static Local< Integer > New(Isolate *isolate, int32_t value)
Definition: api.cc:6233
V8_INLINE Local< Value > GetInternalField(int index)
Definition: v8.h:6139
static V8_INLINE bool IsValidSmi(intptr_t value)
Definition: v8.h:5615
void(* FatalErrorCallback)(const char *location, const char *message)
Definition: v8.h:3984
static V8_INLINE bool CanCastToHeapObject(Context *o)
Definition: v8.h:5697
static V8_INLINE T ReadEmbedderData(Context *context, int index)
Definition: v8.h:5684
const uint16_t * operator*() const
Definition: v8.h:1976
internal::Object ** values_
Definition: v8.h:2566
static const int kStringResourceOffset
Definition: v8.h:5555
int GetScriptColumnNumber(Handle< Script > script, int code_pos)
Definition: handles.cc:389
int length() const
Definition: v8.h:1977
void(* IndexedPropertySetterCallback)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3359
V8_INLINE bool IsConstructCall() const
Definition: v8.h:6073
static V8_INLINE void Copy(const Persistent< S, M > &source, CopyablePersistent *dest)
Definition: v8.h:632
static V8_INLINE Handle< T > New(Isolate *isolate, Handle< T > that)
Definition: v8.h:310
void Set(Handle< String > name, Handle< Data > value, PropertyAttribute attributes=None)
Definition: api.cc:841
static const int kJSObjectHeaderSize
Definition: v8.h:5559
V8_INLINE void Set(Isolate *isolate, Local< S > handle)
static V8_INLINE Function * Cast(Value *obj)
Definition: v8.h:6495
V8_INLINE Persistent(Isolate *isolate, const Persistent< S, M2 > &that)
Definition: v8.h:668
void(* IndexedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Definition: v8.h:3388
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage message
V8_INLINE bool operator==(const Handle< S > &that) const
Definition: v8.h:265
static V8_INLINE Symbol * Cast(v8::Value *obj)
Definition: v8.h:6287
static const int kArgsLength
Definition: v8.h:2585
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in name
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object size
const intptr_t kHeapObjectTagMask
Definition: v8.h:5475
static const int kNodeStateIsNearDeathValue
Definition: v8.h:5581
V8_INLINE P * ClearWeak()
static V8_INLINE Number * Cast(v8::Value *obj)
Definition: v8.h:6295
V8_INLINE void MarkPartiallyDependent()
Definition: v8.h:5877
static V8_INLINE bool CanCastToHeapObject(StackTrace *o)
Definition: v8.h:5701
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage including flags
void(* FailedAccessCheckCallback)(Local< Object > target, AccessType type, Local< Value > data)
Definition: v8.h:4046
int GetId()
Definition: v8.h:1067
ExtensionConfiguration(int name_count, const char *names[])
Definition: v8.h:5161
V8_INLINE ~EscapableHandleScope()
Definition: v8.h:885
static V8_INLINE SymbolObject * Cast(v8::Value *obj)
Definition: v8.h:6327
void(* LogEventCallback)(const char *name, int event)
Definition: v8.h:3991
size_t total_physical_size()
Definition: v8.h:4097
V8_INLINE Handle< Boolean > True(Isolate *isolate)
Definition: v8.h:6559
static V8_INLINE Int32Array * Cast(Value *obj)
Definition: v8.h:6455
static const int kDataIndex
Definition: v8.h:2557
V8_INLINE Local< Value > operator[](int i) const
Definition: v8.h:6028
void(* AccessorGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:2141
V8_INLINE T * operator*() const
Definition: v8.h:257
static V8_INLINE bool CanCastToHeapObject(void *o)
Definition: v8.h:5696
V8_INLINE ~Source()
Definition: v8.h:6118
static const int kContextEmbedderDataIndex
Definition: v8.h:5562
void(* IndexedPropertyGetterCallback)(uint32_t index, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3350
V8_INLINE internal::Object * IntToSmi(int value)
Definition: v8.h:5485
void(* FunctionEntryHook)(uintptr_t function, uintptr_t return_addr_location)
Definition: v8.h:4509
V8_INLINE bool IsNull() const
Definition: v8.h:6247
HANDLE HANDLE LPSTACKFRAME64 StackFrame
static const int kNodeFlagsOffset
Definition: v8.h:5577
static const int kFixedArrayHeaderSize
Definition: v8.h:5560
static V8_INLINE void * GetAlignedPointerFromInternalField(const PersistentBase< Object > &object, int index)
Definition: v8.h:2325
int max_old_space_size() const
Definition: v8.h:3952
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths true
V8_INLINE Persistent()
Definition: v8.h:652
Maybe(T t)
Definition: v8.h:919
void *(* CreateHistogramCallback)(const char *name, int min, int max, size_t buckets)
Definition: v8.h:4011
void(* NamedPropertyQueryCallback)(Local< String > property, const PropertyCallbackInfo< Integer > &info)
Definition: v8.h:3323
void set_max_old_space_size(int value)
Definition: v8.h:3953
V8_INLINE ReturnValue(const ReturnValue< S > &that)
Definition: v8.h:2498
static const int kNodeStateIsPendingValue
Definition: v8.h:5580
V8_INLINE Local< Value > Data() const
Definition: v8.h:6055
void(* NamedPropertySetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3312
V8_INLINE void SetNull()
Definition: v8.h:5983
V8_INLINE Isolate * GetIsolate() const
Definition: v8.h:449
V8_INLINE Isolate * GetIsolate() const
Definition: v8.h:840
static const int kReturnValueDefaultValueIndex
Definition: v8.h:2555
V8_INLINE bool IsWeak() const
Definition: v8.h:5799
Definition: v8.h:917
static const int kNodeStateIsWeakValue
Definition: v8.h:5579
static V8_INLINE bool IsExternalTwoByteString(int instance_type)
Definition: v8.h:5630
int max_young_space_size() const
Definition: v8.h:3950
V8_INLINE Isolate * GetIsolate() const
Definition: v8.h:6512
V8_INLINE ~Scope()
Definition: v8.h:5321
bool V8_EXPORT SetResourceConstraints(Isolate *isolate, ResourceConstraints *constraints)
Definition: api.cc:508
friend Handle< Primitive > Null(Isolate *isolate)
Definition: v8.h:6550
static const int kReturnValueIndex
Definition: v8.h:2594
const char * operator*() const
Definition: v8.h:1954
static const int kMapInstanceTypeOffset
Definition: v8.h:5554
EventType type
Definition: v8.h:4538
friend Handle< Boolean > True(Isolate *isolate)
Definition: v8.h:6559
bool(* AllowCodeGenerationFromStringsCallback)(Local< Context > context)
Definition: v8.h:4056
int compressed_size
Definition: v8.h:4444
static V8_INLINE void CheckInitialized(v8::Isolate *isolate)
Definition: v8.h:5596
V8_INLINE bool IsIndependent() const
Definition: v8.h:5779
V8_INLINE Local< Object > Holder() const
Definition: v8.h:6048
static V8_INLINE bool IsValidSmi(intptr_t value)
Definition: v8.h:5532
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array shift
Definition: flags.cc:211
static V8_INLINE Handle< T > New(Isolate *isolate, const PersistentBase< T > &that)
Definition: v8.h:313
const int kHeapObjectTag
Definition: v8.h:5473
V8_INLINE ~UniquePersistent()
Definition: v8.h:788
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
Definition: v8.h:4494
V8_INLINE UniquePersistent(Isolate *isolate, const PersistentBase< S > &that)
Definition: v8.h:777
const char * name() const
Definition: v8.h:3891
V8_INLINE void SetData(uint32_t slot, void *data)
Definition: v8.h:6577
V8_INLINE bool operator!=(const Handle< S > &that) const
Definition: v8.h:288
static V8_INLINE Handle< T > Cast(Handle< S > that)
Definition: v8.h:297
V8_INLINE UniquePersistent & operator=(UniquePersistent< S > rhs)
Definition: v8.h:793
friend Handle< Boolean > False(Isolate *isolate)
Definition: v8.h:6568
int raw_size
Definition: v8.h:4445
V8_INLINE Unlocker(Isolate *isolate)
Definition: v8.h:5419
internal::Object ** implicit_args_
Definition: v8.h:2565
V8_INLINE ReturnValue< T > GetReturnValue() const
Definition: v8.h:6536
#define TYPE_CHECK(T, S)
Definition: v8.h:187
struct name_t name
Definition: v8.h:4570
static V8_INLINE RegExp * Cast(v8::Value *obj)
Definition: v8.h:6351
void Enter()
Definition: api.cc:6603
static const int kReturnValueDefaultValueIndex
Definition: v8.h:2593
GCType
Definition: v8.h:4067
#define V8_UNLIKELY(condition)
Definition: v8config.h:370
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
Definition: v8.h:2728
V8_INLINE Local< Object > This() const
Definition: v8.h:6042
void(* AddHistogramSampleCallback)(void *histogram, int sample)
Definition: v8.h:4016
void set_stack_limit(uint32_t *value)
Definition: v8.h:3958
static const int kUndefinedValueRootIndex
Definition: v8.h:5570
AccessType
Definition: v8.h:3395
static V8_INLINE void SetEmbedderData(v8::Isolate *isolate, uint32_t slot, void *data)
Definition: v8.h:5658
static V8_INLINE T ReadField(Object *ptr, int offset)
Definition: v8.h:5678
static const int kOddballType
Definition: v8.h:5587
static V8_INLINE String * Cast(v8::Value *obj)
Definition: v8.h:6174
void * Data() const
Definition: v8.h:2780
Definition: v8.h:123
static V8_INLINE External * Cast(Value *obj)
Definition: v8.h:6503
static Local< Number > New(Isolate *isolate, double value)
Definition: api.cc:6220
uint32_t * stack_limit() const
Definition: v8.h:3956
V8_DEPRECATED("Use GetUnboundScript()->GetId()", Handle< Value > GetScriptName())
Definition: v8.h:1072
static V8_INLINE bool IsValidSmi(intptr_t value)
Definition: v8.h:5504
static V8_INLINE Integer * Cast(v8::Value *obj)
Definition: v8.h:6303
V8_INLINE bool IsUndefined() const
Definition: v8.h:6229
static const int kFalseValueRootIndex
Definition: v8.h:5573
V8_INLINE Handle< Primitive > Undefined(Isolate *isolate)
Definition: v8.h:6541
static V8_INLINE ArrayBuffer * Cast(Value *obj)
Definition: v8.h:6391
static V8_INLINE Local< T > Cast(Local< S > that)
Definition: v8.h:372
V8_INLINE uint16_t WrapperClassId() const
Definition: v8.h:5906
#define V8_EXPORT
Definition: v8.h:76
void(* IndexedPropertyQueryCallback)(uint32_t index, const PropertyCallbackInfo< Integer > &info)
Definition: v8.h:3369
struct line_info_t line_info
Definition: v8.h:4573
V8_INLINE P * GetParameter() const
Definition: v8.h:451
V8_INLINE Local()
Definition: v8.h:5709
V8_INLINE ExternalStringResource * GetExternalStringResource() const
Definition: v8.h:6191
V8_INLINE Local(Local< S > that)
Definition: v8.h:361
#define T(name, string, precedence)
Definition: token.cc:48
Definition: v8.h:2472
static V8_INLINE internal::Object * IntToSmi(int value)
Definition: v8.h:5501
void(* NamedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Definition: v8.h:3342
static const int kEmptyStringRootIndex
Definition: v8.h:5574
V8_INLINE bool IsString() const
Definition: v8.h:6265
size_t ByteLength() const
Definition: v8.h:2781
void(* GCEpilogueCallback)(GCType type, GCCallbackFlags flags)
Definition: v8.h:4081
Definition: v8.h:2107
void SetReferenceFromGroup(UniqueId id, const Persistent< T > &child)
Definition: v8.h:6604
void(* JitCodeEventHandler)(const JitCodeEvent *event)
Definition: v8.h:4595
static V8_INLINE int GetInstanceType(internal::Object *obj)
Definition: v8.h:5619
int GetScriptLineNumber(Handle< Script > script, int code_pos)
Definition: handles.cc:363
static V8_INLINE void Copy(const Persistent< S, M > &source, NonCopyablePersistent *dest)
Definition: v8.h:612
int dependency_count()
Definition: v8.h:3895
static const int kNodeIsIndependentShift
Definition: v8.h:5582
V8_INLINE bool operator!=(const PersistentBase< S > &that) const
Definition: v8.h:517
static const int kIsolateIndex
Definition: v8.h:2554
const int kApiIntSize
Definition: v8.h:5470
int ToNumber(Register reg)
V8_INLINE Handle< Boolean > False(Isolate *isolate)
Definition: v8.h:6568
NewStringType
Definition: v8.h:1863
const int kApiPointerSize
Definition: v8.h:5469
int max_executable_size() const
Definition: v8.h:3954
V8_INLINE Handle< Integer > ResourceColumnOffset() const
Definition: v8.h:6094
static V8_INLINE uint8_t GetNodeFlag(internal::Object **obj, int shift)
Definition: v8.h:5635
V8_INLINE bool IsNearDeath() const
Definition: v8.h:5788
static const int kNodeIsPartiallyDependentShift
Definition: v8.h:5583
virtual ~Extension()
Definition: v8.h:3885
V8_INLINE Local< S > As()
Definition: v8.h:385
uint16_t * operator*()
Definition: v8.h:1975
void set_max_available_threads(int value)
Definition: v8.h:3961
void SetReference(const Persistent< T > &parent, const Persistent< S > &child)
Definition: v8.h:6613
static const int kHeapObjectMapOffset
Definition: v8.h:5553
V8_INLINE Local< Object > This() const
Definition: v8.h:6524
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:103
V8_INLINE bool IsEmpty() const
Definition: v8.h:248
static const int kCalleeIndex
Definition: v8.h:2558
int length() const
Definition: v8.h:1955
V8_INLINE Persistent< S > & As()
Definition: v8.h:715
V8_INLINE void ClearWeak()
Definition: v8.h:539
const String::ExternalAsciiStringResource * source() const
Definition: v8.h:3893
V8_INLINE UniquePersistent(Isolate *isolate, Handle< S > that)
Definition: v8.h:767
ExternalAsciiStringResourceImpl(const char *data, size_t length)
Definition: v8.h:3863
V8_INLINE bool IsEmpty() const
Definition: v8.h:497
static V8_INLINE DataView * Cast(Value *obj)
Definition: v8.h:6487
static V8_INLINE internal::Object * IntToSmi(int value)
Definition: v8.h:5529
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function info
static V8_INLINE Promise * Cast(Value *obj)
Definition: v8.h:6375
void(* NamedPropertyGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3303
const int kSmiShiftSize
Definition: v8.h:5539
static const int kIsolateIndex
Definition: v8.h:2592
const int kSmiTagSize
Definition: v8.h:5479
V8_INLINE bool operator==(const Handle< S > &that) const
Definition: v8.h:508
static V8_INLINE void UpdateNodeState(internal::Object **obj, uint8_t value)
Definition: v8.h:5652
Handle< Object > GetScriptNameOrSourceURL(Handle< Script > script)
Definition: handles.cc:474
V8_INLINE void Reset()
Definition: v8.h:5808
V8_INLINE Local(Handle< S > that)
Definition: v8.h:380
V8_INLINE void * GetData(uint32_t slot)
Definition: v8.h:6583
static const int kFullStringRepresentationMask
Definition: v8.h:5563
static const int kContextHeaderSize
Definition: v8.h:5561
const uint8_t * data
Definition: v8.h:1117
virtual void VisitExternalString(Handle< String > string)
Definition: v8.h:4604
bool(* NamedSecurityCallback)(Local< Object > host, Local< Value > key, AccessType type, Local< Value > data)
Definition: v8.h:3408
virtual ~ScriptData()
Definition: v8.h:947
ExternalAsciiStringResource ExternalOneByteStringResource
Definition: v8.h:1839
void(* InterruptCallback)(Isolate *isolate, void *data)
Definition: v8.h:4083
bool(* EntropySource)(unsigned char *buffer, size_t length)
Definition: v8.h:4478
static V8_INLINE NumberObject * Cast(v8::Value *obj)
Definition: v8.h:6335
Definition: v8.h:3069
V8_INLINE Isolate * GetIsolate()
Definition: v8.h:6004
void set_auto_enable(bool value)
Definition: v8.h:3897
virtual void VisitPersistentHandle(Persistent< Value > *value, uint16_t class_id)
Definition: v8.h:4614
static const int kThisIndex
Definition: v8.h:2596
const int kSmiTag
Definition: v8.h:5478
DeclaredAccessorDescriptorDataType
Definition: v8.h:3805
IN DWORD64 OUT PDWORD64 OUT PIMAGEHLP_SYMBOL64 Symbol
static const int kUndefinedOddballKind
Definition: v8.h:5590
const int kHeapObjectTagSize
Definition: v8.h:5474
V8_INLINE bool IsEmpty()
Definition: v8.h:435
SmiTagging< kApiPointerSize > PlatformSmiTagging
Definition: v8.h:5538
ObjectSpace
Definition: v8.h:4019
static const int kNodeStateMask
Definition: v8.h:5578
static const int kStringEncodingMask
Definition: v8.h:5564
Definition: v8.h:2087
V8_INLINE void SetEmptyString()
Definition: v8.h:5997
static const int kHolderIndex
Definition: v8.h:2591
static V8_INLINE void UpdateNodeFlag(internal::Object **obj, bool value, int shift)
Definition: v8.h:5640
GCCallbackFlags
Definition: v8.h:4073
static V8_INLINE Uint16Array * Cast(Value *obj)
Definition: v8.h:6431
bool operator<(const UniqueId &other) const
Definition: v8.h:177
V8_DEPRECATED("Use GetUnboundScript()->GetLineNumber()", int GetLineNumber(int code_pos))
Definition: v8.h:1081
V8_INLINE Handle< Boolean > ResourceIsSharedCrossOrigin() const
Definition: v8.h:6098
friend class MacroAssembler
Definition: v8.h:2588
Maybe()
Definition: v8.h:918
HeapObject * obj
Definition: api.h:197
V8_INLINE Source(Local< String > source_string, const ScriptOrigin &origin, CachedData *cached_data=NULL)
Definition: v8.h:6103
V8_INLINE Persistent(const Persistent &that)
Definition: v8.h:678
V8_INLINE FunctionCallbackInfo(internal::Object **implicit_args, internal::Object **values, int length, bool is_construct_call)
Definition: v8.h:6017
static const int kExternalTwoByteRepresentationTag
Definition: v8.h:5565
static const int kTrueValueRootIndex
Definition: v8.h:5572
friend class Isolate
Definition: v8.h:580
V8_INLINE Handle< S > As()
Definition: v8.h:306
V8_INLINE bool operator==(const PersistentBase< S > &that) const
Definition: v8.h:273
static V8_EXPORT void CheckInitializedImpl(v8::Isolate *isolate)
static V8_INLINE Uint8Array * Cast(Value *obj)
Definition: v8.h:6415
static V8_INLINE BooleanObject * Cast(v8::Value *obj)
Definition: v8.h:6343
const char ** end() const
Definition: v8.h:5165
int max_available_threads() const
Definition: v8.h:3959
static const int kForeignType
Definition: v8.h:5588
Scope(Isolate *isolate)
Definition: v8.h:4132
V8_INLINE T * operator->() const
Definition: v8.h:255
size_t total_heap_size()
Definition: v8.h:4095
static V8_INLINE TypedArray * Cast(Value *obj)
Definition: v8.h:6407
static V8_INLINE Value * Cast(T *value)
V8_INLINE ScriptOrigin(Handle< Value > resource_name, Handle< Integer > resource_line_offset=Handle< Integer >(), Handle< Integer > resource_column_offset=Handle< Integer >(), Handle< Boolean > resource_is_shared_cross_origin=Handle< Boolean >())
Definition: v8.h:991
static const int kIsolateRootsOffset
Definition: v8.h:5569
bool has_value
Definition: v8.h:922
V8_INLINE Scope(Handle< Context > context)
Definition: v8.h:5318
signed short int16_t
Definition: unicode.cc:45
V8_INLINE Local< T > Get(Isolate *isolate)
Definition: v8.h:5751
virtual ~Allocator()
Definition: v8.h:2746
V8_INLINE void SetWeak(P *parameter, typename WeakCallbackData< T, P >::Callback callback)
const char * data() const
Definition: v8.h:3865
size_t source_length() const
Definition: v8.h:3892
static V8_INLINE StringObject * Cast(v8::Value *obj)
Definition: v8.h:6319
static V8_INLINE internal::Object * IntToSmi(int value)
Definition: v8.h:5611
static V8_INLINE int InternalFieldCount(const PersistentBase< Object > &object)
Definition: v8.h:2306
V8_INLINE Local< Value > Data() const
Definition: v8.h:6518
static const int kReturnValueIndex
Definition: v8.h:2556
const char ** dependencies()
Definition: v8.h:3896
void * code_start
Definition: v8.h:4540
static const int kIsolateEmbedderDataOffset
Definition: v8.h:5568
V8_INLINE void MarkIndependent()
Definition: v8.h:5867
static const int kNullOddballKind
Definition: v8.h:5591
const char * str
Definition: v8.h:4554
static const int kContextSaveIndex
Definition: v8.h:2559
V8_INLINE Locker(Isolate *isolate)
Definition: v8.h:5434
Definition: v8.h:124
#define V8_INLINE
Definition: v8config.h:316
static V8_INLINE v8::Local< v8::String > Empty(Isolate *isolate)
Definition: v8.h:6182
void(* NamedPropertyDeleterCallback)(Local< String > property, const PropertyCallbackInfo< Boolean > &info)
Definition: v8.h:3333
V8_INLINE Handle< Primitive > Null(Isolate *isolate)
Definition: v8.h:6550
static V8_INLINE Int16Array * Cast(Value *obj)
Definition: v8.h:6439
static V8_INLINE void * GetEmbedderData(v8::Isolate *isolate, uint32_t slot)
Definition: v8.h:5666
AccessControl
Definition: v8.h:2165
PropertyAttribute
Definition: v8.h:2106
#define V8_LIKELY(condition)
Definition: v8config.h:371
static const int kDataIndex
Definition: v8.h:2595
virtual ~ExternalResourceVisitor()
Definition: v8.h:4603
size_t code_len
Definition: v8.h:4542
size_t total_heap_size_executable()
Definition: v8.h:4096
V8_INLINE Persistent(Isolate *isolate, Handle< S > that)
Definition: v8.h:658
UniqueId(intptr_t data)
Definition: v8.h:166
V8_INLINE T * ClearAndLeak()
Definition: v8.h:5887
static V8_INLINE Handle< Boolean > New(Isolate *isolate, bool value)
Definition: v8.h:6129
static const int kNodeClassIdOffset
Definition: v8.h:5576
const uint32_t kStringEncodingMask
Definition: objects.h:609
V8_INLINE UniquePersistent()
Definition: v8.h:760
static const int kJSObjectType
Definition: v8.h:5585
void set_max_executable_size(int value)
Definition: v8.h:3955
Maybe(bool has, T t)
Definition: v8.h:920
JitCodeEventOptions
Definition: v8.h:4583
static Local< Integer > NewFromUnsigned(Isolate *isolate, uint32_t value)
Definition: api.cc:6246
static const int kForeignAddressOffset
Definition: v8.h:5558
static Local< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=kNormalString, int length=-1)
Definition: api.cc:5417
V8_INLINE void Clear()
Definition: v8.h:253
PositionType position_type
Definition: v8.h:4565
V8_INLINE Handle(Handle< S > that)
Definition: v8.h:235