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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 v8::Handle<Signature> signature, | 936 v8::Handle<Signature> signature, |
937 int length, | 937 int length, |
938 bool do_not_cache) { | 938 bool do_not_cache) { |
939 i::Handle<i::Struct> struct_obj = | 939 i::Handle<i::Struct> struct_obj = |
940 isolate->factory()->NewStruct(i::FUNCTION_TEMPLATE_INFO_TYPE); | 940 isolate->factory()->NewStruct(i::FUNCTION_TEMPLATE_INFO_TYPE); |
941 i::Handle<i::FunctionTemplateInfo> obj = | 941 i::Handle<i::FunctionTemplateInfo> obj = |
942 i::Handle<i::FunctionTemplateInfo>::cast(struct_obj); | 942 i::Handle<i::FunctionTemplateInfo>::cast(struct_obj); |
943 InitializeFunctionTemplate(obj); | 943 InitializeFunctionTemplate(obj); |
944 obj->set_do_not_cache(do_not_cache); | 944 obj->set_do_not_cache(do_not_cache); |
945 int next_serial_number = 0; | 945 int next_serial_number = 0; |
946 if (!do_not_cache && !obj->serial_number()->IsSmi()) { | 946 if (!do_not_cache) { |
947 next_serial_number = isolate->next_serial_number() + 1; | 947 next_serial_number = isolate->next_serial_number() + 1; |
948 isolate->set_next_serial_number(next_serial_number); | 948 isolate->set_next_serial_number(next_serial_number); |
949 } | 949 } |
950 obj->set_serial_number(i::Smi::FromInt(next_serial_number)); | 950 obj->set_serial_number(i::Smi::FromInt(next_serial_number)); |
951 if (callback != 0) { | 951 if (callback != 0) { |
952 if (data.IsEmpty()) { | 952 if (data.IsEmpty()) { |
953 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 953 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
954 } | 954 } |
955 Utils::ToLocal(obj)->SetCallHandler(callback, data); | 955 Utils::ToLocal(obj)->SetCallHandler(callback, data); |
956 } | 956 } |
(...skipping 7069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8026 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8026 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8027 Address callback_address = | 8027 Address callback_address = |
8028 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8028 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8029 VMState<EXTERNAL> state(isolate); | 8029 VMState<EXTERNAL> state(isolate); |
8030 ExternalCallbackScope call_scope(isolate, callback_address); | 8030 ExternalCallbackScope call_scope(isolate, callback_address); |
8031 callback(info); | 8031 callback(info); |
8032 } | 8032 } |
8033 | 8033 |
8034 | 8034 |
8035 } } // namespace v8::internal | 8035 } } // namespace v8::internal |
OLD | NEW |