| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 class Integer; | 101 class Integer; |
| 102 class Isolate; | 102 class Isolate; |
| 103 class Number; | 103 class Number; |
| 104 class NumberObject; | 104 class NumberObject; |
| 105 class Object; | 105 class Object; |
| 106 class ObjectOperationDescriptor; | 106 class ObjectOperationDescriptor; |
| 107 class ObjectTemplate; | 107 class ObjectTemplate; |
| 108 class Platform; | 108 class Platform; |
| 109 class Primitive; | 109 class Primitive; |
| 110 class RawOperationDescriptor; | 110 class RawOperationDescriptor; |
| 111 class Script; |
| 111 class Signature; | 112 class Signature; |
| 112 class StackFrame; | 113 class StackFrame; |
| 113 class StackTrace; | 114 class StackTrace; |
| 114 class String; | 115 class String; |
| 115 class StringObject; | 116 class StringObject; |
| 116 class Symbol; | 117 class Symbol; |
| 117 class SymbolObject; | 118 class SymbolObject; |
| 118 class Private; | 119 class Private; |
| 119 class Uint32; | 120 class Uint32; |
| 120 class Utils; | 121 class Utils; |
| 121 class Value; | 122 class Value; |
| 122 template <class T> class Handle; | 123 template <class T> class Handle; |
| 123 template <class T> class Local; | 124 template <class T> class Local; |
| 124 template <class T> class Eternal; | 125 template <class T> class Eternal; |
| 125 template<class T> class NonCopyablePersistentTraits; | 126 template<class T> class NonCopyablePersistentTraits; |
| 126 template<class T> class PersistentBase; | 127 template<class T> class PersistentBase; |
| 127 template<class T, | 128 template<class T, |
| 128 class M = NonCopyablePersistentTraits<T> > class Persistent; | 129 class M = NonCopyablePersistentTraits<T> > class Persistent; |
| 129 template<class T> class UniquePersistent; | 130 template<class T> class UniquePersistent; |
| 131 template<class K, class V, class T> class PersistentValueMap; |
| 130 template<class T, class P> class WeakCallbackObject; | 132 template<class T, class P> class WeakCallbackObject; |
| 131 class FunctionTemplate; | 133 class FunctionTemplate; |
| 132 class ObjectTemplate; | 134 class ObjectTemplate; |
| 133 class Data; | 135 class Data; |
| 134 template<typename T> class PropertyCallbackInfo; | 136 template<typename T> class PropertyCallbackInfo; |
| 135 class StackTrace; | 137 class StackTrace; |
| 136 class StackFrame; | 138 class StackFrame; |
| 137 class Isolate; | 139 class Isolate; |
| 138 class DeclaredAccessorDescriptor; | 140 class DeclaredAccessorDescriptor; |
| 139 class ObjectOperationDescriptor; | 141 class ObjectOperationDescriptor; |
| 140 class RawOperationDescriptor; | 142 class RawOperationDescriptor; |
| 141 class CallHandlerHelper; | 143 class CallHandlerHelper; |
| 142 class EscapableHandleScope; | 144 class EscapableHandleScope; |
| 145 template<typename T> class ReturnValue; |
| 143 | 146 |
| 144 namespace internal { | 147 namespace internal { |
| 145 class Arguments; | 148 class Arguments; |
| 146 class Heap; | 149 class Heap; |
| 147 class HeapObject; | 150 class HeapObject; |
| 148 class Isolate; | 151 class Isolate; |
| 149 class Object; | 152 class Object; |
| 150 template<typename T> class CustomArguments; | 153 template<typename T> class CustomArguments; |
| 151 class PropertyCallbackArguments; | 154 class PropertyCallbackArguments; |
| 152 class FunctionCallbackArguments; | 155 class FunctionCallbackArguments; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 template<class F> friend class Handle; | 408 template<class F> friend class Handle; |
| 406 template<class F> friend class Local; | 409 template<class F> friend class Local; |
| 407 template<class F> friend class FunctionCallbackInfo; | 410 template<class F> friend class FunctionCallbackInfo; |
| 408 template<class F> friend class PropertyCallbackInfo; | 411 template<class F> friend class PropertyCallbackInfo; |
| 409 friend class String; | 412 friend class String; |
| 410 friend class Object; | 413 friend class Object; |
| 411 friend class Context; | 414 friend class Context; |
| 412 template<class F> friend class internal::CustomArguments; | 415 template<class F> friend class internal::CustomArguments; |
| 413 friend class HandleScope; | 416 friend class HandleScope; |
| 414 friend class EscapableHandleScope; | 417 friend class EscapableHandleScope; |
| 418 template<class F1, class F2, class F3> friend class PersistentValueMap; |
| 415 | 419 |
| 416 V8_INLINE static Local<T> New(Isolate* isolate, T* that); | 420 V8_INLINE static Local<T> New(Isolate* isolate, T* that); |
| 417 }; | 421 }; |
| 418 | 422 |
| 419 | 423 |
| 420 // Eternal handles are set-once handles that live for the life of the isolate. | 424 // Eternal handles are set-once handles that live for the life of the isolate. |
| 421 template <class T> class Eternal { | 425 template <class T> class Eternal { |
| 422 public: | 426 public: |
| 423 V8_INLINE Eternal() : index_(kInitialValue) { } | 427 V8_INLINE Eternal() : index_(kInitialValue) { } |
| 424 template<class S> | 428 template<class S> |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 template<typename P> | 524 template<typename P> |
| 521 V8_INLINE void SetWeak( | 525 V8_INLINE void SetWeak( |
| 522 P* parameter, | 526 P* parameter, |
| 523 typename WeakCallbackData<T, P>::Callback callback); | 527 typename WeakCallbackData<T, P>::Callback callback); |
| 524 | 528 |
| 525 template<typename S, typename P> | 529 template<typename S, typename P> |
| 526 V8_INLINE void SetWeak( | 530 V8_INLINE void SetWeak( |
| 527 P* parameter, | 531 P* parameter, |
| 528 typename WeakCallbackData<S, P>::Callback callback); | 532 typename WeakCallbackData<S, P>::Callback callback); |
| 529 | 533 |
| 530 V8_INLINE void ClearWeak(); | 534 template<typename P> |
| 535 V8_INLINE P* ClearWeak(); |
| 536 |
| 537 // TODO(dcarney): remove this. |
| 538 V8_INLINE void ClearWeak() { ClearWeak<void>(); } |
| 531 | 539 |
| 532 /** | 540 /** |
| 533 * Marks the reference to this object independent. Garbage collector is free | 541 * Marks the reference to this object independent. Garbage collector is free |
| 534 * to ignore any object groups containing this object. Weak callback for an | 542 * to ignore any object groups containing this object. Weak callback for an |
| 535 * independent handle should not assume that it will be preceded by a global | 543 * independent handle should not assume that it will be preceded by a global |
| 536 * GC prologue callback or followed by a global GC epilogue callback. | 544 * GC prologue callback or followed by a global GC epilogue callback. |
| 537 */ | 545 */ |
| 538 V8_INLINE void MarkIndependent(); | 546 V8_INLINE void MarkIndependent(); |
| 539 | 547 |
| 540 /** | 548 /** |
| (...skipping 28 matching lines...) Expand all Loading... |
| 569 | 577 |
| 570 private: | 578 private: |
| 571 friend class Isolate; | 579 friend class Isolate; |
| 572 friend class Utils; | 580 friend class Utils; |
| 573 template<class F> friend class Handle; | 581 template<class F> friend class Handle; |
| 574 template<class F> friend class Local; | 582 template<class F> friend class Local; |
| 575 template<class F1, class F2> friend class Persistent; | 583 template<class F1, class F2> friend class Persistent; |
| 576 template<class F> friend class UniquePersistent; | 584 template<class F> friend class UniquePersistent; |
| 577 template<class F> friend class PersistentBase; | 585 template<class F> friend class PersistentBase; |
| 578 template<class F> friend class ReturnValue; | 586 template<class F> friend class ReturnValue; |
| 587 template<class F1, class F2, class F3> friend class PersistentValueMap; |
| 588 friend class Object; |
| 579 | 589 |
| 580 explicit V8_INLINE PersistentBase(T* val) : val_(val) {} | 590 explicit V8_INLINE PersistentBase(T* val) : val_(val) {} |
| 581 PersistentBase(PersistentBase& other); // NOLINT | 591 PersistentBase(PersistentBase& other); // NOLINT |
| 582 void operator=(PersistentBase&); | 592 void operator=(PersistentBase&); |
| 583 V8_INLINE static T* New(Isolate* isolate, T* that); | 593 V8_INLINE static T* New(Isolate* isolate, T* that); |
| 584 | 594 |
| 585 T* val_; | 595 T* val_; |
| 586 }; | 596 }; |
| 587 | 597 |
| 588 | 598 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 * Note: Persistent class hierarchy is subject to future changes. | 746 * Note: Persistent class hierarchy is subject to future changes. |
| 737 */ | 747 */ |
| 738 template<class T> | 748 template<class T> |
| 739 class UniquePersistent : public PersistentBase<T> { | 749 class UniquePersistent : public PersistentBase<T> { |
| 740 struct RValue { | 750 struct RValue { |
| 741 V8_INLINE explicit RValue(UniquePersistent* obj) : object(obj) {} | 751 V8_INLINE explicit RValue(UniquePersistent* obj) : object(obj) {} |
| 742 UniquePersistent* object; | 752 UniquePersistent* object; |
| 743 }; | 753 }; |
| 744 | 754 |
| 745 public: | 755 public: |
| 746 /** | 756 /** |
| 747 * A UniquePersistent with no storage cell. | 757 * A UniquePersistent with no storage cell. |
| 748 */ | 758 */ |
| 749 V8_INLINE UniquePersistent() : PersistentBase<T>(0) { } | 759 V8_INLINE UniquePersistent() : PersistentBase<T>(0) { } |
| 750 /** | 760 /** |
| 751 * Construct a UniquePersistent from a Handle. | 761 * Construct a UniquePersistent from a Handle. |
| 752 * When the Handle is non-empty, a new storage cell is created | 762 * When the Handle is non-empty, a new storage cell is created |
| 753 * pointing to the same object, and no flags are set. | 763 * pointing to the same object, and no flags are set. |
| 754 */ | 764 */ |
| 755 template <class S> | 765 template <class S> |
| 756 V8_INLINE UniquePersistent(Isolate* isolate, Handle<S> that) | 766 V8_INLINE UniquePersistent(Isolate* isolate, Handle<S> that) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 774 : PersistentBase<T>(rvalue.object->val_) { | 784 : PersistentBase<T>(rvalue.object->val_) { |
| 775 rvalue.object->val_ = 0; | 785 rvalue.object->val_ = 0; |
| 776 } | 786 } |
| 777 V8_INLINE ~UniquePersistent() { this->Reset(); } | 787 V8_INLINE ~UniquePersistent() { this->Reset(); } |
| 778 /** | 788 /** |
| 779 * Move via assignment. | 789 * Move via assignment. |
| 780 */ | 790 */ |
| 781 template<class S> | 791 template<class S> |
| 782 V8_INLINE UniquePersistent& operator=(UniquePersistent<S> rhs) { | 792 V8_INLINE UniquePersistent& operator=(UniquePersistent<S> rhs) { |
| 783 TYPE_CHECK(T, S); | 793 TYPE_CHECK(T, S); |
| 794 this->Reset(); |
| 784 this->val_ = rhs.val_; | 795 this->val_ = rhs.val_; |
| 785 rhs.val_ = 0; | 796 rhs.val_ = 0; |
| 786 return *this; | 797 return *this; |
| 787 } | 798 } |
| 788 /** | 799 /** |
| 789 * Cast operator for moves. | 800 * Cast operator for moves. |
| 790 */ | 801 */ |
| 791 V8_INLINE operator RValue() { return RValue(this); } | 802 V8_INLINE operator RValue() { return RValue(this); } |
| 792 /** | 803 /** |
| 793 * Pass allows returning uniques from functions, etc. | 804 * Pass allows returning uniques from functions, etc. |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 V8_INLINE Handle<Boolean> ResourceIsSharedCrossOrigin() const; | 1002 V8_INLINE Handle<Boolean> ResourceIsSharedCrossOrigin() const; |
| 992 private: | 1003 private: |
| 993 Handle<Value> resource_name_; | 1004 Handle<Value> resource_name_; |
| 994 Handle<Integer> resource_line_offset_; | 1005 Handle<Integer> resource_line_offset_; |
| 995 Handle<Integer> resource_column_offset_; | 1006 Handle<Integer> resource_column_offset_; |
| 996 Handle<Boolean> resource_is_shared_cross_origin_; | 1007 Handle<Boolean> resource_is_shared_cross_origin_; |
| 997 }; | 1008 }; |
| 998 | 1009 |
| 999 | 1010 |
| 1000 /** | 1011 /** |
| 1001 * A compiled JavaScript script. | 1012 * A compiled JavaScript script, not yet tied to a Context. |
| 1002 */ | 1013 */ |
| 1003 class V8_EXPORT Script { | 1014 class V8_EXPORT UnboundScript { |
| 1004 public: | 1015 public: |
| 1005 /** | 1016 /** |
| 1006 * Compiles the specified script (context-independent). | 1017 * Binds the script to the currently entered context. |
| 1007 * | |
| 1008 * \param source Script source code. | |
| 1009 * \param origin Script origin, owned by caller, no references are kept | |
| 1010 * when New() returns | |
| 1011 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() | |
| 1012 * using pre_data speeds compilation if it's done multiple times. | |
| 1013 * Owned by caller, no references are kept when New() returns. | |
| 1014 * \param script_data Arbitrary data associated with script. Using | |
| 1015 * this has same effect as calling SetData(), but allows data to be | |
| 1016 * available to compile event handlers. | |
| 1017 * \return Compiled script object (context independent; when run it | |
| 1018 * will use the currently entered context). | |
| 1019 */ | 1018 */ |
| 1020 static Local<Script> New(Handle<String> source, | 1019 Local<Script> BindToCurrentContext(); |
| 1021 ScriptOrigin* origin = NULL, | |
| 1022 ScriptData* pre_data = NULL, | |
| 1023 Handle<String> script_data = Handle<String>()); | |
| 1024 | 1020 |
| 1025 /** | |
| 1026 * Compiles the specified script using the specified file name | |
| 1027 * object (typically a string) as the script's origin. | |
| 1028 * | |
| 1029 * \param source Script source code. | |
| 1030 * \param file_name file name object (typically a string) to be used | |
| 1031 * as the script's origin. | |
| 1032 * \return Compiled script object (context independent; when run it | |
| 1033 * will use the currently entered context). | |
| 1034 */ | |
| 1035 static Local<Script> New(Handle<String> source, | |
| 1036 Handle<Value> file_name); | |
| 1037 | |
| 1038 /** | |
| 1039 * Compiles the specified script (bound to current context). | |
| 1040 * | |
| 1041 * \param source Script source code. | |
| 1042 * \param origin Script origin, owned by caller, no references are kept | |
| 1043 * when Compile() returns | |
| 1044 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() | |
| 1045 * using pre_data speeds compilation if it's done multiple times. | |
| 1046 * Owned by caller, no references are kept when Compile() returns. | |
| 1047 * \param script_data Arbitrary data associated with script. Using | |
| 1048 * this has same effect as calling SetData(), but makes data available | |
| 1049 * earlier (i.e. to compile event handlers). | |
| 1050 * \return Compiled script object, bound to the context that was active | |
| 1051 * when this function was called. When run it will always use this | |
| 1052 * context. | |
| 1053 */ | |
| 1054 static Local<Script> Compile(Handle<String> source, | |
| 1055 ScriptOrigin* origin = NULL, | |
| 1056 ScriptData* pre_data = NULL, | |
| 1057 Handle<String> script_data = Handle<String>()); | |
| 1058 | |
| 1059 /** | |
| 1060 * Compiles the specified script using the specified file name | |
| 1061 * object (typically a string) as the script's origin. | |
| 1062 * | |
| 1063 * \param source Script source code. | |
| 1064 * \param file_name File name to use as script's origin | |
| 1065 * \param script_data Arbitrary data associated with script. Using | |
| 1066 * this has same effect as calling SetData(), but makes data available | |
| 1067 * earlier (i.e. to compile event handlers). | |
| 1068 * \return Compiled script object, bound to the context that was active | |
| 1069 * when this function was called. When run it will always use this | |
| 1070 * context. | |
| 1071 */ | |
| 1072 static Local<Script> Compile(Handle<String> source, | |
| 1073 Handle<Value> file_name, | |
| 1074 Handle<String> script_data = Handle<String>()); | |
| 1075 | |
| 1076 /** | |
| 1077 * Runs the script returning the resulting value. If the script is | |
| 1078 * context independent (created using ::New) it will be run in the | |
| 1079 * currently entered context. If it is context specific (created | |
| 1080 * using ::Compile) it will be run in the context in which it was | |
| 1081 * compiled. | |
| 1082 */ | |
| 1083 Local<Value> Run(); | |
| 1084 | |
| 1085 /** | |
| 1086 * Returns the script id. | |
| 1087 */ | |
| 1088 int GetId(); | 1021 int GetId(); |
| 1089 | |
| 1090 /** | |
| 1091 * Associate an additional data object with the script. This is mainly used | |
| 1092 * with the debugger as this data object is only available through the | |
| 1093 * debugger API. | |
| 1094 */ | |
| 1095 void SetData(Handle<String> data); | |
| 1096 | |
| 1097 /** | |
| 1098 * Returns the name value of one Script. | |
| 1099 */ | |
| 1100 Handle<Value> GetScriptName(); | 1022 Handle<Value> GetScriptName(); |
| 1101 | 1023 |
| 1102 /** | 1024 /** |
| 1103 * Returns zero based line number of the code_pos location in the script. | 1025 * Returns zero based line number of the code_pos location in the script. |
| 1104 * -1 will be returned if no information available. | 1026 * -1 will be returned if no information available. |
| 1105 */ | 1027 */ |
| 1106 int GetLineNumber(int code_pos); | 1028 int GetLineNumber(int code_pos); |
| 1107 | 1029 |
| 1108 static const int kNoScriptId = 0; | 1030 static const int kNoScriptId = 0; |
| 1109 }; | 1031 }; |
| 1110 | 1032 |
| 1111 | 1033 |
| 1034 /** |
| 1035 * A compiled JavaScript script, tied to a Context which was active when the |
| 1036 * script was compiled. |
| 1037 */ |
| 1038 class V8_EXPORT Script { |
| 1039 public: |
| 1040 /** |
| 1041 * A shorthand for ScriptCompiler::Compile(). |
| 1042 * The ScriptData parameter will be deprecated; use ScriptCompiler::Compile if |
| 1043 * you want to pass it. |
| 1044 */ |
| 1045 static Local<Script> Compile(Handle<String> source, |
| 1046 ScriptOrigin* origin = NULL, |
| 1047 ScriptData* script_data = NULL); |
| 1048 |
| 1049 // To be decprecated, use the Compile above. |
| 1050 static Local<Script> Compile(Handle<String> source, |
| 1051 Handle<String> file_name); |
| 1052 |
| 1053 /** |
| 1054 * Runs the script returning the resulting value. It will be run in the |
| 1055 * context in which it was created (ScriptCompiler::CompileBound or |
| 1056 * UnboundScript::BindToGlobalContext()). |
| 1057 */ |
| 1058 Local<Value> Run(); |
| 1059 |
| 1060 /** |
| 1061 * Returns the corresponding context-unbound script. |
| 1062 */ |
| 1063 Local<UnboundScript> GetUnboundScript(); |
| 1064 |
| 1065 // To be deprecated; use GetUnboundScript()->GetId(); |
| 1066 int GetId() { |
| 1067 return GetUnboundScript()->GetId(); |
| 1068 } |
| 1069 |
| 1070 // Use GetUnboundScript()->GetId(); |
| 1071 V8_DEPRECATED("Use GetUnboundScript()->GetId()", |
| 1072 Handle<Value> GetScriptName()) { |
| 1073 return GetUnboundScript()->GetScriptName(); |
| 1074 } |
| 1075 |
| 1076 /** |
| 1077 * Returns zero based line number of the code_pos location in the script. |
| 1078 * -1 will be returned if no information available. |
| 1079 */ |
| 1080 V8_DEPRECATED("Use GetUnboundScript()->GetLineNumber()", |
| 1081 int GetLineNumber(int code_pos)) { |
| 1082 return GetUnboundScript()->GetLineNumber(code_pos); |
| 1083 } |
| 1084 }; |
| 1085 |
| 1086 |
| 1087 /** |
| 1088 * For compiling scripts. |
| 1089 */ |
| 1090 class V8_EXPORT ScriptCompiler { |
| 1091 public: |
| 1092 /** |
| 1093 * Compilation data that the embedder can cache and pass back to speed up |
| 1094 * future compilations. The data is produced if the CompilerOptions passed to |
| 1095 * the compilation functions in ScriptCompiler contains produce_data_to_cache |
| 1096 * = true. The data to cache can then can be retrieved from |
| 1097 * UnboundScript. |
| 1098 */ |
| 1099 struct V8_EXPORT CachedData { |
| 1100 CachedData() : data(NULL), length(0) {} |
| 1101 // Caller keeps the ownership of data and guarantees that the data stays |
| 1102 // alive long enough. |
| 1103 CachedData(const uint8_t* data, int length) : data(data), length(length) {} |
| 1104 // TODO(marja): Async compilation; add constructors which take a callback |
| 1105 // which will be called when V8 no longer needs the data. |
| 1106 const uint8_t* data; |
| 1107 int length; |
| 1108 }; |
| 1109 |
| 1110 /** |
| 1111 * Source code which can be then compiled to a UnboundScript or |
| 1112 * BoundScript. |
| 1113 */ |
| 1114 struct V8_EXPORT Source { |
| 1115 Source(Local<String> source_string, const ScriptOrigin& origin, |
| 1116 const CachedData& cached_data = CachedData()); |
| 1117 Source(Local<String> source_string, |
| 1118 const CachedData& cached_data = CachedData()); |
| 1119 |
| 1120 Local<String> source_string; |
| 1121 |
| 1122 // Origin information |
| 1123 Handle<Value> resource_name; |
| 1124 Handle<Integer> resource_line_offset; |
| 1125 Handle<Integer> resource_column_offset; |
| 1126 Handle<Boolean> resource_is_shared_cross_origin; |
| 1127 |
| 1128 // Cached data from previous compilation (if any). |
| 1129 CachedData cached_data; |
| 1130 }; |
| 1131 |
| 1132 enum CompileOptions { |
| 1133 kNoCompileOptions, |
| 1134 kProduceDataToCache = 1 << 0 |
| 1135 }; |
| 1136 |
| 1137 /** |
| 1138 * Compiles the specified script (context-independent). |
| 1139 * |
| 1140 * \param source Script source code. |
| 1141 * \return Compiled script object (context independent; for running it must be |
| 1142 * bound to a context). |
| 1143 */ |
| 1144 static Local<UnboundScript> CompileUnbound( |
| 1145 Isolate* isolate, const Source& source, |
| 1146 CompileOptions options = kNoCompileOptions); |
| 1147 |
| 1148 /** |
| 1149 * Compiles the specified script (bound to current context). |
| 1150 * |
| 1151 * \param source Script source code. |
| 1152 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() |
| 1153 * using pre_data speeds compilation if it's done multiple times. |
| 1154 * Owned by caller, no references are kept when this function returns. |
| 1155 * \return Compiled script object, bound to the context that was active |
| 1156 * when this function was called. When run it will always use this |
| 1157 * context. |
| 1158 */ |
| 1159 static Local<Script> Compile( |
| 1160 Isolate* isolate, const Source& source, |
| 1161 CompileOptions options = kNoCompileOptions); |
| 1162 }; |
| 1163 |
| 1164 |
| 1112 /** | 1165 /** |
| 1113 * An error message. | 1166 * An error message. |
| 1114 */ | 1167 */ |
| 1115 class V8_EXPORT Message { | 1168 class V8_EXPORT Message { |
| 1116 public: | 1169 public: |
| 1117 Local<String> Get() const; | 1170 Local<String> Get() const; |
| 1118 Local<String> GetSourceLine() const; | 1171 Local<String> GetSourceLine() const; |
| 1119 | 1172 |
| 1120 /** | 1173 /** |
| 1121 * Returns the resource name for the script from where the function causing | 1174 * Returns the resource name for the script from where the function causing |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 /** | 1476 /** |
| 1424 * Returns true if this value is a NativeError. | 1477 * Returns true if this value is a NativeError. |
| 1425 */ | 1478 */ |
| 1426 bool IsNativeError() const; | 1479 bool IsNativeError() const; |
| 1427 | 1480 |
| 1428 /** | 1481 /** |
| 1429 * Returns true if this value is a RegExp. | 1482 * Returns true if this value is a RegExp. |
| 1430 */ | 1483 */ |
| 1431 bool IsRegExp() const; | 1484 bool IsRegExp() const; |
| 1432 | 1485 |
| 1486 /** |
| 1487 * Returns true if this value is a Promise. |
| 1488 * This is an experimental feature. |
| 1489 */ |
| 1490 bool IsPromise() const; |
| 1433 | 1491 |
| 1434 /** | 1492 /** |
| 1435 * Returns true if this value is an ArrayBuffer. | 1493 * Returns true if this value is an ArrayBuffer. |
| 1436 * This is an experimental feature. | 1494 * This is an experimental feature. |
| 1437 */ | 1495 */ |
| 1438 bool IsArrayBuffer() const; | 1496 bool IsArrayBuffer() const; |
| 1439 | 1497 |
| 1440 /** | 1498 /** |
| 1441 * Returns true if this value is an ArrayBufferView. | 1499 * Returns true if this value is an ArrayBufferView. |
| 1442 * This is an experimental feature. | 1500 * This is an experimental feature. |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 * A private symbol | 1984 * A private symbol |
| 1927 * | 1985 * |
| 1928 * This is an experimental feature. Use at your own risk. | 1986 * This is an experimental feature. Use at your own risk. |
| 1929 */ | 1987 */ |
| 1930 class V8_EXPORT Private : public Data { | 1988 class V8_EXPORT Private : public Data { |
| 1931 public: | 1989 public: |
| 1932 // Returns the print name string of the private symbol, or undefined if none. | 1990 // Returns the print name string of the private symbol, or undefined if none. |
| 1933 Local<Value> Name() const; | 1991 Local<Value> Name() const; |
| 1934 | 1992 |
| 1935 // Create a private symbol. If data is not NULL, it will be the print name. | 1993 // Create a private symbol. If data is not NULL, it will be the print name. |
| 1936 static Local<Private> New( | 1994 static Local<Private> New(Isolate *isolate, |
| 1937 Isolate *isolate, const char* data = NULL, int length = -1); | 1995 Local<String> name = Local<String>()); |
| 1938 | 1996 |
| 1939 private: | 1997 private: |
| 1940 Private(); | 1998 Private(); |
| 1941 }; | 1999 }; |
| 1942 | 2000 |
| 1943 | 2001 |
| 1944 /** | 2002 /** |
| 1945 * A JavaScript number value (ECMA-262, 4.3.20) | 2003 * A JavaScript number value (ECMA-262, 4.3.20) |
| 1946 */ | 2004 */ |
| 1947 class V8_EXPORT Number : public Primitive { | 2005 class V8_EXPORT Number : public Primitive { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2178 Local<Value> GetConstructor(); | 2236 Local<Value> GetConstructor(); |
| 2179 | 2237 |
| 2180 /** | 2238 /** |
| 2181 * Returns the name of the function invoked as a constructor for this object. | 2239 * Returns the name of the function invoked as a constructor for this object. |
| 2182 */ | 2240 */ |
| 2183 Local<String> GetConstructorName(); | 2241 Local<String> GetConstructorName(); |
| 2184 | 2242 |
| 2185 /** Gets the number of internal fields for this Object. */ | 2243 /** Gets the number of internal fields for this Object. */ |
| 2186 int InternalFieldCount(); | 2244 int InternalFieldCount(); |
| 2187 | 2245 |
| 2246 /** Same as above, but works for Persistents */ |
| 2247 V8_INLINE static int InternalFieldCount( |
| 2248 const PersistentBase<Object>& object) { |
| 2249 return object.val_->InternalFieldCount(); |
| 2250 } |
| 2251 |
| 2188 /** Gets the value from an internal field. */ | 2252 /** Gets the value from an internal field. */ |
| 2189 V8_INLINE Local<Value> GetInternalField(int index); | 2253 V8_INLINE Local<Value> GetInternalField(int index); |
| 2190 | 2254 |
| 2191 /** Sets the value in an internal field. */ | 2255 /** Sets the value in an internal field. */ |
| 2192 void SetInternalField(int index, Handle<Value> value); | 2256 void SetInternalField(int index, Handle<Value> value); |
| 2193 | 2257 |
| 2194 /** | 2258 /** |
| 2195 * Gets a 2-byte-aligned native pointer from an internal field. This field | 2259 * Gets a 2-byte-aligned native pointer from an internal field. This field |
| 2196 * must have been set by SetAlignedPointerInInternalField, everything else | 2260 * must have been set by SetAlignedPointerInInternalField, everything else |
| 2197 * leads to undefined behavior. | 2261 * leads to undefined behavior. |
| 2198 */ | 2262 */ |
| 2199 V8_INLINE void* GetAlignedPointerFromInternalField(int index); | 2263 V8_INLINE void* GetAlignedPointerFromInternalField(int index); |
| 2200 | 2264 |
| 2265 /** Same as above, but works for Persistents */ |
| 2266 V8_INLINE static void* GetAlignedPointerFromInternalField( |
| 2267 const PersistentBase<Object>& object, int index) { |
| 2268 return object.val_->GetAlignedPointerFromInternalField(index); |
| 2269 } |
| 2270 |
| 2201 /** | 2271 /** |
| 2202 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such | 2272 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such |
| 2203 * a field, GetAlignedPointerFromInternalField must be used, everything else | 2273 * a field, GetAlignedPointerFromInternalField must be used, everything else |
| 2204 * leads to undefined behavior. | 2274 * leads to undefined behavior. |
| 2205 */ | 2275 */ |
| 2206 void SetAlignedPointerInInternalField(int index, void* value); | 2276 void SetAlignedPointerInInternalField(int index, void* value); |
| 2207 | 2277 |
| 2208 // Testers for local properties. | 2278 // Testers for local properties. |
| 2209 bool HasOwnProperty(Handle<String> key); | 2279 bool HasOwnProperty(Handle<String> key); |
| 2210 bool HasRealNamedProperty(Handle<String> key); | 2280 bool HasRealNamedProperty(Handle<String> key); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2382 V8_INLINE void SetNull(); | 2452 V8_INLINE void SetNull(); |
| 2383 V8_INLINE void SetUndefined(); | 2453 V8_INLINE void SetUndefined(); |
| 2384 V8_INLINE void SetEmptyString(); | 2454 V8_INLINE void SetEmptyString(); |
| 2385 // Convenience getter for Isolate | 2455 // Convenience getter for Isolate |
| 2386 V8_INLINE Isolate* GetIsolate(); | 2456 V8_INLINE Isolate* GetIsolate(); |
| 2387 | 2457 |
| 2388 private: | 2458 private: |
| 2389 template<class F> friend class ReturnValue; | 2459 template<class F> friend class ReturnValue; |
| 2390 template<class F> friend class FunctionCallbackInfo; | 2460 template<class F> friend class FunctionCallbackInfo; |
| 2391 template<class F> friend class PropertyCallbackInfo; | 2461 template<class F> friend class PropertyCallbackInfo; |
| 2462 template<class F, class G, class H> friend class PersistentValueMap; |
| 2463 V8_INLINE void SetInternal(internal::Object* value) { *value_ = value; } |
| 2392 V8_INLINE internal::Object* GetDefaultValue(); | 2464 V8_INLINE internal::Object* GetDefaultValue(); |
| 2393 V8_INLINE explicit ReturnValue(internal::Object** slot); | 2465 V8_INLINE explicit ReturnValue(internal::Object** slot); |
| 2394 internal::Object** value_; | 2466 internal::Object** value_; |
| 2395 }; | 2467 }; |
| 2396 | 2468 |
| 2397 | 2469 |
| 2398 /** | 2470 /** |
| 2399 * The argument information given to function call callbacks. This | 2471 * The argument information given to function call callbacks. This |
| 2400 * class provides access to information about the context of the call, | 2472 * class provides access to information about the context of the call, |
| 2401 * including the receiver, the number and values of arguments, and | 2473 * including the receiver, the number and values of arguments, and |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2535 | 2607 |
| 2536 ScriptOrigin GetScriptOrigin() const; | 2608 ScriptOrigin GetScriptOrigin() const; |
| 2537 V8_INLINE static Function* Cast(Value* obj); | 2609 V8_INLINE static Function* Cast(Value* obj); |
| 2538 static const int kLineOffsetNotFound; | 2610 static const int kLineOffsetNotFound; |
| 2539 | 2611 |
| 2540 private: | 2612 private: |
| 2541 Function(); | 2613 Function(); |
| 2542 static void CheckCast(Value* obj); | 2614 static void CheckCast(Value* obj); |
| 2543 }; | 2615 }; |
| 2544 | 2616 |
| 2617 |
| 2618 /** |
| 2619 * An instance of the built-in Promise constructor (ES6 draft). |
| 2620 * This API is experimental. Only works with --harmony flag. |
| 2621 */ |
| 2622 class V8_EXPORT Promise : public Object { |
| 2623 public: |
| 2624 /** |
| 2625 * Create a new Promise in pending state. |
| 2626 */ |
| 2627 static Local<Promise> New(Isolate* isolate); |
| 2628 |
| 2629 /** |
| 2630 * Resolve/reject a promise with a given value. |
| 2631 * Ignored if the promise is not unresolved. |
| 2632 */ |
| 2633 void Resolve(Handle<Value> value); |
| 2634 void Reject(Handle<Value> value); |
| 2635 |
| 2636 /** |
| 2637 * Register a resolution/rejection handler with a promise. |
| 2638 * The handler is given the respective resolution/rejection value as |
| 2639 * an argument. If the promise is already resolved/rejected, the handler is |
| 2640 * invoked at the end of turn. |
| 2641 */ |
| 2642 Local<Promise> Chain(Handle<Function> handler); |
| 2643 Local<Promise> Catch(Handle<Function> handler); |
| 2644 |
| 2645 V8_INLINE static Promise* Cast(Value* obj); |
| 2646 |
| 2647 private: |
| 2648 Promise(); |
| 2649 static void CheckCast(Value* obj); |
| 2650 }; |
| 2651 |
| 2652 |
| 2545 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT | 2653 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT |
| 2546 // The number of required internal fields can be defined by embedder. | 2654 // The number of required internal fields can be defined by embedder. |
| 2547 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 | 2655 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 |
| 2548 #endif | 2656 #endif |
| 2549 | 2657 |
| 2550 /** | 2658 /** |
| 2551 * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). | 2659 * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). |
| 2552 * This API is experimental and may change significantly. | 2660 * This API is experimental and may change significantly. |
| 2553 */ | 2661 */ |
| 2554 class V8_EXPORT ArrayBuffer : public Object { | 2662 class V8_EXPORT ArrayBuffer : public Object { |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3798 | 3906 |
| 3799 | 3907 |
| 3800 // --- Exceptions --- | 3908 // --- Exceptions --- |
| 3801 | 3909 |
| 3802 | 3910 |
| 3803 typedef void (*FatalErrorCallback)(const char* location, const char* message); | 3911 typedef void (*FatalErrorCallback)(const char* location, const char* message); |
| 3804 | 3912 |
| 3805 | 3913 |
| 3806 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); | 3914 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); |
| 3807 | 3915 |
| 3916 // --- Tracing --- |
| 3917 |
| 3918 typedef void (*LogEventCallback)(const char* name, int event); |
| 3808 | 3919 |
| 3809 /** | 3920 /** |
| 3810 * Create new error objects by calling the corresponding error object | 3921 * Create new error objects by calling the corresponding error object |
| 3811 * constructor with the message. | 3922 * constructor with the message. |
| 3812 */ | 3923 */ |
| 3813 class V8_EXPORT Exception { | 3924 class V8_EXPORT Exception { |
| 3814 public: | 3925 public: |
| 3815 static Local<Value> RangeError(Handle<String> message); | 3926 static Local<Value> RangeError(Handle<String> message); |
| 3816 static Local<Value> ReferenceError(Handle<String> message); | 3927 static Local<Value> ReferenceError(Handle<String> message); |
| 3817 static Local<Value> SyntaxError(Handle<String> message); | 3928 static Local<Value> SyntaxError(Handle<String> message); |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4184 * Request garbage collection in this Isolate. It is only valid to call this | 4295 * Request garbage collection in this Isolate. It is only valid to call this |
| 4185 * function if --expose_gc was specified. | 4296 * function if --expose_gc was specified. |
| 4186 * | 4297 * |
| 4187 * This should only be used for testing purposes and not to enforce a garbage | 4298 * This should only be used for testing purposes and not to enforce a garbage |
| 4188 * collection schedule. It has strong negative impact on the garbage | 4299 * collection schedule. It has strong negative impact on the garbage |
| 4189 * collection performance. Use IdleNotification() or LowMemoryNotification() | 4300 * collection performance. Use IdleNotification() or LowMemoryNotification() |
| 4190 * instead to influence the garbage collection schedule. | 4301 * instead to influence the garbage collection schedule. |
| 4191 */ | 4302 */ |
| 4192 void RequestGarbageCollectionForTesting(GarbageCollectionType type); | 4303 void RequestGarbageCollectionForTesting(GarbageCollectionType type); |
| 4193 | 4304 |
| 4305 /** |
| 4306 * Set the callback to invoke for logging event. |
| 4307 */ |
| 4308 void SetEventLogger(LogEventCallback that); |
| 4309 |
| 4194 private: | 4310 private: |
| 4311 template<class K, class V, class Traits> friend class PersistentValueMap; |
| 4312 |
| 4195 Isolate(); | 4313 Isolate(); |
| 4196 Isolate(const Isolate&); | 4314 Isolate(const Isolate&); |
| 4197 ~Isolate(); | 4315 ~Isolate(); |
| 4198 Isolate& operator=(const Isolate&); | 4316 Isolate& operator=(const Isolate&); |
| 4199 void* operator new(size_t size); | 4317 void* operator new(size_t size); |
| 4200 void operator delete(void*, size_t); | 4318 void operator delete(void*, size_t); |
| 4201 | 4319 |
| 4202 void SetObjectGroupId(internal::Object** object, UniqueId id); | 4320 void SetObjectGroupId(internal::Object** object, UniqueId id); |
| 4203 void SetReferenceFromGroup(UniqueId id, internal::Object** object); | 4321 void SetReferenceFromGroup(UniqueId id, internal::Object** object); |
| 4204 void SetReference(internal::Object** parent, internal::Object** child); | 4322 void SetReference(internal::Object** parent, internal::Object** child); |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4779 V8(); | 4897 V8(); |
| 4780 | 4898 |
| 4781 static internal::Object** GlobalizeReference(internal::Isolate* isolate, | 4899 static internal::Object** GlobalizeReference(internal::Isolate* isolate, |
| 4782 internal::Object** handle); | 4900 internal::Object** handle); |
| 4783 static internal::Object** CopyPersistent(internal::Object** handle); | 4901 static internal::Object** CopyPersistent(internal::Object** handle); |
| 4784 static void DisposeGlobal(internal::Object** global_handle); | 4902 static void DisposeGlobal(internal::Object** global_handle); |
| 4785 typedef WeakCallbackData<Value, void>::Callback WeakCallback; | 4903 typedef WeakCallbackData<Value, void>::Callback WeakCallback; |
| 4786 static void MakeWeak(internal::Object** global_handle, | 4904 static void MakeWeak(internal::Object** global_handle, |
| 4787 void* data, | 4905 void* data, |
| 4788 WeakCallback weak_callback); | 4906 WeakCallback weak_callback); |
| 4789 static void ClearWeak(internal::Object** global_handle); | 4907 static void* ClearWeak(internal::Object** global_handle); |
| 4790 static void Eternalize(Isolate* isolate, | 4908 static void Eternalize(Isolate* isolate, |
| 4791 Value* handle, | 4909 Value* handle, |
| 4792 int* index); | 4910 int* index); |
| 4793 static Local<Value> GetEternal(Isolate* isolate, int index); | 4911 static Local<Value> GetEternal(Isolate* isolate, int index); |
| 4794 | 4912 |
| 4795 template <class T> friend class Handle; | 4913 template <class T> friend class Handle; |
| 4796 template <class T> friend class Local; | 4914 template <class T> friend class Local; |
| 4797 template <class T> friend class Eternal; | 4915 template <class T> friend class Eternal; |
| 4798 template <class T> friend class PersistentBase; | 4916 template <class T> friend class PersistentBase; |
| 4799 template <class T, class M> friend class Persistent; | 4917 template <class T, class M> friend class Persistent; |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5407 static const int kStringEncodingMask = 0x4; | 5525 static const int kStringEncodingMask = 0x4; |
| 5408 static const int kExternalTwoByteRepresentationTag = 0x02; | 5526 static const int kExternalTwoByteRepresentationTag = 0x02; |
| 5409 static const int kExternalAsciiRepresentationTag = 0x06; | 5527 static const int kExternalAsciiRepresentationTag = 0x06; |
| 5410 | 5528 |
| 5411 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize; | 5529 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize; |
| 5412 static const int kIsolateRootsOffset = 5 * kApiPointerSize; | 5530 static const int kIsolateRootsOffset = 5 * kApiPointerSize; |
| 5413 static const int kUndefinedValueRootIndex = 5; | 5531 static const int kUndefinedValueRootIndex = 5; |
| 5414 static const int kNullValueRootIndex = 7; | 5532 static const int kNullValueRootIndex = 7; |
| 5415 static const int kTrueValueRootIndex = 8; | 5533 static const int kTrueValueRootIndex = 8; |
| 5416 static const int kFalseValueRootIndex = 9; | 5534 static const int kFalseValueRootIndex = 9; |
| 5417 static const int kEmptyStringRootIndex = 141; | 5535 static const int kEmptyStringRootIndex = 144; |
| 5418 | 5536 |
| 5419 static const int kNodeClassIdOffset = 1 * kApiPointerSize; | 5537 static const int kNodeClassIdOffset = 1 * kApiPointerSize; |
| 5420 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; | 5538 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; |
| 5421 static const int kNodeStateMask = 0xf; | 5539 static const int kNodeStateMask = 0xf; |
| 5422 static const int kNodeStateIsWeakValue = 2; | 5540 static const int kNodeStateIsWeakValue = 2; |
| 5423 static const int kNodeStateIsPendingValue = 3; | 5541 static const int kNodeStateIsPendingValue = 3; |
| 5424 static const int kNodeStateIsNearDeathValue = 4; | 5542 static const int kNodeStateIsNearDeathValue = 4; |
| 5425 static const int kNodeIsIndependentShift = 4; | 5543 static const int kNodeIsIndependentShift = 4; |
| 5426 static const int kNodeIsPartiallyDependentShift = 5; | 5544 static const int kNodeIsPartiallyDependentShift = 5; |
| 5427 | 5545 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5692 template <class T> | 5810 template <class T> |
| 5693 template <typename P> | 5811 template <typename P> |
| 5694 void PersistentBase<T>::SetWeak( | 5812 void PersistentBase<T>::SetWeak( |
| 5695 P* parameter, | 5813 P* parameter, |
| 5696 typename WeakCallbackData<T, P>::Callback callback) { | 5814 typename WeakCallbackData<T, P>::Callback callback) { |
| 5697 SetWeak<T, P>(parameter, callback); | 5815 SetWeak<T, P>(parameter, callback); |
| 5698 } | 5816 } |
| 5699 | 5817 |
| 5700 | 5818 |
| 5701 template <class T> | 5819 template <class T> |
| 5702 void PersistentBase<T>::ClearWeak() { | 5820 template<typename P> |
| 5703 V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_)); | 5821 P* PersistentBase<T>::ClearWeak() { |
| 5822 return reinterpret_cast<P*>( |
| 5823 V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_))); |
| 5704 } | 5824 } |
| 5705 | 5825 |
| 5706 | 5826 |
| 5707 template <class T> | 5827 template <class T> |
| 5708 void PersistentBase<T>::MarkIndependent() { | 5828 void PersistentBase<T>::MarkIndependent() { |
| 5709 typedef internal::Internals I; | 5829 typedef internal::Internals I; |
| 5710 if (this->IsEmpty()) return; | 5830 if (this->IsEmpty()) return; |
| 5711 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_), | 5831 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_), |
| 5712 true, | 5832 true, |
| 5713 I::kNodeIsIndependentShift); | 5833 I::kNodeIsIndependentShift); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6180 | 6300 |
| 6181 | 6301 |
| 6182 Array* Array::Cast(v8::Value* value) { | 6302 Array* Array::Cast(v8::Value* value) { |
| 6183 #ifdef V8_ENABLE_CHECKS | 6303 #ifdef V8_ENABLE_CHECKS |
| 6184 CheckCast(value); | 6304 CheckCast(value); |
| 6185 #endif | 6305 #endif |
| 6186 return static_cast<Array*>(value); | 6306 return static_cast<Array*>(value); |
| 6187 } | 6307 } |
| 6188 | 6308 |
| 6189 | 6309 |
| 6310 Promise* Promise::Cast(v8::Value* value) { |
| 6311 #ifdef V8_ENABLE_CHECKS |
| 6312 CheckCast(value); |
| 6313 #endif |
| 6314 return static_cast<Promise*>(value); |
| 6315 } |
| 6316 |
| 6317 |
| 6190 ArrayBuffer* ArrayBuffer::Cast(v8::Value* value) { | 6318 ArrayBuffer* ArrayBuffer::Cast(v8::Value* value) { |
| 6191 #ifdef V8_ENABLE_CHECKS | 6319 #ifdef V8_ENABLE_CHECKS |
| 6192 CheckCast(value); | 6320 CheckCast(value); |
| 6193 #endif | 6321 #endif |
| 6194 return static_cast<ArrayBuffer*>(value); | 6322 return static_cast<ArrayBuffer*>(value); |
| 6195 } | 6323 } |
| 6196 | 6324 |
| 6197 | 6325 |
| 6198 ArrayBufferView* ArrayBufferView::Cast(v8::Value* value) { | 6326 ArrayBufferView* ArrayBufferView::Cast(v8::Value* value) { |
| 6199 #ifdef V8_ENABLE_CHECKS | 6327 #ifdef V8_ENABLE_CHECKS |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6455 */ | 6583 */ |
| 6456 | 6584 |
| 6457 | 6585 |
| 6458 } // namespace v8 | 6586 } // namespace v8 |
| 6459 | 6587 |
| 6460 | 6588 |
| 6461 #undef TYPE_CHECK | 6589 #undef TYPE_CHECK |
| 6462 | 6590 |
| 6463 | 6591 |
| 6464 #endif // V8_H_ | 6592 #endif // V8_H_ |
| OLD | NEW |