OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
849 i_isolate, callback, data, signature, length, false); | 849 i_isolate, callback, data, signature, length, false); |
850 } | 850 } |
851 | 851 |
852 | 852 |
853 Local<Signature> Signature::New(Isolate* isolate, | 853 Local<Signature> Signature::New(Isolate* isolate, |
854 Handle<FunctionTemplate> receiver, int argc, | 854 Handle<FunctionTemplate> receiver, int argc, |
855 Handle<FunctionTemplate> argv[]) { | 855 Handle<FunctionTemplate> argv[]) { |
856 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 856 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
857 LOG_API(i_isolate, "Signature::New"); | 857 LOG_API(i_isolate, "Signature::New"); |
858 ENTER_V8(i_isolate); | 858 ENTER_V8(i_isolate); |
859 i::Handle<i::Struct> struct_obj = | |
860 i_isolate->factory()->NewStruct(i::SIGNATURE_INFO_TYPE); | |
861 i::Handle<i::SignatureInfo> obj = | 859 i::Handle<i::SignatureInfo> obj = |
dcarney
2015/01/14 14:09:46
need a TODO to convert SignatureInfo to FunctionTe
| |
862 i::Handle<i::SignatureInfo>::cast(struct_obj); | 860 Utils::OpenHandle(*Signature::New(isolate, receiver)); |
863 if (!receiver.IsEmpty()) obj->set_receiver(*Utils::OpenHandle(*receiver)); | |
864 if (argc > 0) { | 861 if (argc > 0) { |
865 i::Handle<i::FixedArray> args = i_isolate->factory()->NewFixedArray(argc); | 862 i::Handle<i::FixedArray> args = i_isolate->factory()->NewFixedArray(argc); |
866 for (int i = 0; i < argc; i++) { | 863 for (int i = 0; i < argc; i++) { |
867 if (!argv[i].IsEmpty()) | 864 if (!argv[i].IsEmpty()) |
868 args->set(i, *Utils::OpenHandle(*argv[i])); | 865 args->set(i, *Utils::OpenHandle(*argv[i])); |
869 } | 866 } |
870 obj->set_args(*args); | 867 obj->set_args(*args); |
871 } | 868 } |
872 return Utils::ToLocal(obj); | 869 return Utils::ToLocal(obj); |
873 } | 870 } |
874 | 871 |
875 | 872 |
873 Local<Signature> Signature::New(Isolate* isolate, | |
874 Handle<FunctionTemplate> receiver) { | |
875 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | |
876 LOG_API(i_isolate, "Signature::New"); | |
877 ENTER_V8(i_isolate); | |
878 i::Handle<i::Struct> struct_obj = | |
879 i_isolate->factory()->NewStruct(i::SIGNATURE_INFO_TYPE); | |
880 i::Handle<i::SignatureInfo> obj = | |
881 i::Handle<i::SignatureInfo>::cast(struct_obj); | |
882 if (!receiver.IsEmpty()) obj->set_receiver(*Utils::OpenHandle(*receiver)); | |
883 return Utils::ToLocal(obj); | |
884 } | |
885 | |
886 | |
876 Local<AccessorSignature> AccessorSignature::New( | 887 Local<AccessorSignature> AccessorSignature::New( |
877 Isolate* isolate, | 888 Isolate* isolate, |
878 Handle<FunctionTemplate> receiver) { | 889 Handle<FunctionTemplate> receiver) { |
879 return Utils::AccessorSignatureToLocal(Utils::OpenHandle(*receiver)); | 890 return Utils::AccessorSignatureToLocal(Utils::OpenHandle(*receiver)); |
880 } | 891 } |
881 | 892 |
882 | 893 |
883 Local<TypeSwitch> TypeSwitch::New(Handle<FunctionTemplate> type) { | 894 Local<TypeSwitch> TypeSwitch::New(Handle<FunctionTemplate> type) { |
884 Handle<FunctionTemplate> types[1] = { type }; | 895 Handle<FunctionTemplate> types[1] = { type }; |
885 return TypeSwitch::New(1, types); | 896 return TypeSwitch::New(1, types); |
(...skipping 6740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7626 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7637 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7627 Address callback_address = | 7638 Address callback_address = |
7628 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7639 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7629 VMState<EXTERNAL> state(isolate); | 7640 VMState<EXTERNAL> state(isolate); |
7630 ExternalCallbackScope call_scope(isolate, callback_address); | 7641 ExternalCallbackScope call_scope(isolate, callback_address); |
7631 callback(info); | 7642 callback(info); |
7632 } | 7643 } |
7633 | 7644 |
7634 | 7645 |
7635 } } // namespace v8::internal | 7646 } } // namespace v8::internal |
OLD | NEW |