| 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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 DCHECK(!name.IsEmpty()); | 950 DCHECK(!name.IsEmpty()); |
| 951 DCHECK(!getter.IsEmpty() || !setter.IsEmpty()); | 951 DCHECK(!getter.IsEmpty() || !setter.IsEmpty()); |
| 952 i::HandleScope scope(isolate); | 952 i::HandleScope scope(isolate); |
| 953 i::ApiNatives::AddAccessorProperty( | 953 i::ApiNatives::AddAccessorProperty( |
| 954 isolate, templ, Utils::OpenHandle(*name), | 954 isolate, templ, Utils::OpenHandle(*name), |
| 955 Utils::OpenHandle(*getter, true), Utils::OpenHandle(*setter, true), | 955 Utils::OpenHandle(*getter, true), Utils::OpenHandle(*setter, true), |
| 956 static_cast<PropertyAttributes>(attribute)); | 956 static_cast<PropertyAttributes>(attribute)); |
| 957 } | 957 } |
| 958 | 958 |
| 959 | 959 |
| 960 #ifdef V8_JS_ACCESSORS | |
| 961 void Template::SetAccessorProperty(v8::Local<v8::Name> name, | |
| 962 v8::Local<Function> getter, | |
| 963 v8::Local<Function> setter, | |
| 964 v8::PropertyAttribute attribute) { | |
| 965 auto templ = Utils::OpenHandle(this); | |
| 966 auto isolate = templ->GetIsolate(); | |
| 967 ENTER_V8(isolate); | |
| 968 DCHECK(!name.IsEmpty()); | |
| 969 DCHECK(!getter.IsEmpty() || !setter.IsEmpty()); | |
| 970 i::HandleScope scope(isolate); | |
| 971 i::ApiNatives::AddAccessorProperty( | |
| 972 isolate, templ, Utils::OpenHandle(*name), | |
| 973 Utils::OpenHandle(*getter, true), Utils::OpenHandle(*setter, true), | |
| 974 static_cast<PropertyAttributes>(attribute)); | |
| 975 } | |
| 976 #endif // V8_JS_ACCESSORS | |
| 977 | |
| 978 | |
| 979 // --- F u n c t i o n T e m p l a t e --- | 960 // --- F u n c t i o n T e m p l a t e --- |
| 980 static void InitializeFunctionTemplate( | 961 static void InitializeFunctionTemplate( |
| 981 i::Handle<i::FunctionTemplateInfo> info) { | 962 i::Handle<i::FunctionTemplateInfo> info) { |
| 982 InitializeTemplate(info, Consts::FUNCTION_TEMPLATE); | 963 InitializeTemplate(info, Consts::FUNCTION_TEMPLATE); |
| 983 info->set_flag(0); | 964 info->set_flag(0); |
| 984 } | 965 } |
| 985 | 966 |
| 986 | 967 |
| 987 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { | 968 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { |
| 988 i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate(); | 969 i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate(); |
| (...skipping 7530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8519 Address callback_address = | 8500 Address callback_address = |
| 8520 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8501 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8521 VMState<EXTERNAL> state(isolate); | 8502 VMState<EXTERNAL> state(isolate); |
| 8522 ExternalCallbackScope call_scope(isolate, callback_address); | 8503 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8523 callback(info); | 8504 callback(info); |
| 8524 } | 8505 } |
| 8525 | 8506 |
| 8526 | 8507 |
| 8527 } // namespace internal | 8508 } // namespace internal |
| 8528 } // namespace v8 | 8509 } // namespace v8 |
| OLD | NEW |