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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
948 DCHECK(!name.IsEmpty()); | 948 DCHECK(!name.IsEmpty()); |
949 DCHECK(!getter.IsEmpty() || !setter.IsEmpty()); | 949 DCHECK(!getter.IsEmpty() || !setter.IsEmpty()); |
950 i::HandleScope scope(isolate); | 950 i::HandleScope scope(isolate); |
951 i::ApiNatives::AddAccessorProperty( | 951 i::ApiNatives::AddAccessorProperty( |
952 isolate, templ, Utils::OpenHandle(*name), | 952 isolate, templ, Utils::OpenHandle(*name), |
953 Utils::OpenHandle(*getter, true), Utils::OpenHandle(*setter, true), | 953 Utils::OpenHandle(*getter, true), Utils::OpenHandle(*setter, true), |
954 static_cast<PropertyAttributes>(attribute)); | 954 static_cast<PropertyAttributes>(attribute)); |
955 } | 955 } |
956 | 956 |
957 | 957 |
958 #ifdef V8_JS_ACCESSORS | |
959 void Template::SetAccessorProperty(v8::Local<v8::Name> name, | |
960 v8::Local<Function> getter, | |
961 v8::Local<Function> setter, | |
962 v8::PropertyAttribute attribute, | |
963 v8::AccessControl access_control) { | |
964 // TODO(verwaest): Remove |access_control|. | |
965 DCHECK_EQ(v8::DEFAULT, access_control); | |
jochen (gone - plz use gerrit)
2015/09/25 09:20:51
Why not just remove the parameter?
vogelheim
2015/09/25 12:59:45
Done.
| |
966 auto templ = Utils::OpenHandle(this); | |
967 auto isolate = templ->GetIsolate(); | |
968 ENTER_V8(isolate); | |
969 DCHECK(!name.IsEmpty()); | |
970 DCHECK(!getter.IsEmpty() || !setter.IsEmpty()); | |
971 i::HandleScope scope(isolate); | |
972 i::ApiNatives::AddAccessorProperty( | |
973 isolate, templ, Utils::OpenHandle(*name), | |
974 Utils::OpenHandle(*getter, true), Utils::OpenHandle(*setter, true), | |
975 static_cast<PropertyAttributes>(attribute)); | |
976 } | |
977 #endif // V8_JS_ACCESSORS | |
978 | |
979 | |
958 // --- F u n c t i o n T e m p l a t e --- | 980 // --- F u n c t i o n T e m p l a t e --- |
959 static void InitializeFunctionTemplate( | 981 static void InitializeFunctionTemplate( |
960 i::Handle<i::FunctionTemplateInfo> info) { | 982 i::Handle<i::FunctionTemplateInfo> info) { |
961 InitializeTemplate(info, Consts::FUNCTION_TEMPLATE); | 983 InitializeTemplate(info, Consts::FUNCTION_TEMPLATE); |
962 info->set_flag(0); | 984 info->set_flag(0); |
963 } | 985 } |
964 | 986 |
965 | 987 |
966 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { | 988 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { |
967 i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate(); | 989 i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate(); |
(...skipping 7392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8360 Address callback_address = | 8382 Address callback_address = |
8361 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8383 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8362 VMState<EXTERNAL> state(isolate); | 8384 VMState<EXTERNAL> state(isolate); |
8363 ExternalCallbackScope call_scope(isolate, callback_address); | 8385 ExternalCallbackScope call_scope(isolate, callback_address); |
8364 callback(info); | 8386 callback(info); |
8365 } | 8387 } |
8366 | 8388 |
8367 | 8389 |
8368 } // namespace internal | 8390 } // namespace internal |
8369 } // namespace v8 | 8391 } // namespace v8 |
OLD | NEW |