| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 11 matching lines...) Expand all Loading... |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_APIUTILS_H_ | 28 #ifndef V8_APIUTILS_H_ |
| 29 #define V8_APIUTILS_H_ | 29 #define V8_APIUTILS_H_ |
| 30 | 30 |
| 31 namespace v8 { | 31 namespace v8 { |
| 32 | |
| 33 class ImplementationUtilities { | 32 class ImplementationUtilities { |
| 34 public: | 33 public: |
| 35 static v8::Handle<v8::Primitive> Undefined(); | 34 static v8::Handle<v8::Primitive> Undefined(); |
| 36 static v8::Handle<v8::Primitive> Null(); | 35 static v8::Handle<v8::Primitive> Null(); |
| 37 static v8::Handle<v8::Boolean> True(); | 36 static v8::Handle<v8::Boolean> True(); |
| 38 static v8::Handle<v8::Boolean> False(); | 37 static v8::Handle<v8::Boolean> False(); |
| 39 | 38 |
| 40 static int GetNameCount(ExtensionConfiguration* that) { | 39 static int GetNameCount(ExtensionConfiguration* that) { |
| 41 return that->name_count_; | 40 return that->name_count_; |
| 42 } | 41 } |
| 43 | 42 |
| 44 static const char** GetNames(ExtensionConfiguration* that) { | 43 static const char** GetNames(ExtensionConfiguration* that) { |
| 45 return that->names_; | 44 return that->names_; |
| 46 } | 45 } |
| 47 | 46 |
| 48 static v8::Arguments NewArguments(Local<Value> data, | 47 // Packs additional parameters for the NewArguments function. |implicit_args| |
| 49 Local<Object> holder, | 48 // is a pointer to the last element of 3-elements array controlled by GC. |
| 50 Local<Function> callee, | 49 static void PrepareArgumentsData(internal::Object** implicit_args, |
| 51 bool is_construct_call, | 50 internal::Object* data, |
| 52 void** argv, int argc) { | 51 internal::JSFunction* callee, |
| 53 return v8::Arguments(data, holder, callee, is_construct_call, argv, argc); | 52 internal::Object* holder) { |
| 53 implicit_args[v8::Arguments::kDataIndex] = data; |
| 54 implicit_args[v8::Arguments::kCalleeIndex] = callee; |
| 55 implicit_args[v8::Arguments::kHolderIndex] = holder; |
| 56 } |
| 57 |
| 58 static v8::Arguments NewArguments(internal::Object** implicit_args, |
| 59 internal::Object** argv, int argc, |
| 60 bool is_construct_call) { |
| 61 return v8::Arguments(implicit_args, argv, argc, is_construct_call); |
| 54 } | 62 } |
| 55 | 63 |
| 56 // Introduce an alias for the handle scope data to allow non-friends | 64 // Introduce an alias for the handle scope data to allow non-friends |
| 57 // to access the HandleScope data. | 65 // to access the HandleScope data. |
| 58 typedef v8::HandleScope::Data HandleScopeData; | 66 typedef v8::HandleScope::Data HandleScopeData; |
| 59 | 67 |
| 60 static HandleScopeData* CurrentHandleScope(); | 68 static HandleScopeData* CurrentHandleScope(); |
| 61 | 69 |
| 62 #ifdef DEBUG | 70 #ifdef DEBUG |
| 63 static void ZapHandleRange(internal::Object** begin, internal::Object** end); | 71 static void ZapHandleRange(internal::Object** begin, internal::Object** end); |
| 64 #endif | 72 #endif |
| 65 }; | 73 }; |
| 66 | 74 |
| 67 } // namespace v8 | 75 } // namespace v8 |
| 68 | 76 |
| 69 #endif // V8_APIUTILS_H_ | 77 #endif // V8_APIUTILS_H_ |
| OLD | NEW |