| 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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 | 1019 |
| 1020 void Template::Set(v8::Local<Name> name, v8::Local<Data> value, | 1020 void Template::Set(v8::Local<Name> name, v8::Local<Data> value, |
| 1021 v8::PropertyAttribute attribute) { | 1021 v8::PropertyAttribute attribute) { |
| 1022 auto templ = Utils::OpenHandle(this); | 1022 auto templ = Utils::OpenHandle(this); |
| 1023 i::Isolate* isolate = templ->GetIsolate(); | 1023 i::Isolate* isolate = templ->GetIsolate(); |
| 1024 ENTER_V8(isolate); | 1024 ENTER_V8(isolate); |
| 1025 i::HandleScope scope(isolate); | 1025 i::HandleScope scope(isolate); |
| 1026 auto value_obj = Utils::OpenHandle(*value); | 1026 auto value_obj = Utils::OpenHandle(*value); |
| 1027 CHECK(!value_obj->IsJSReceiver() || value_obj->IsTemplateInfo()); | |
| 1028 if (value_obj->IsObjectTemplateInfo()) { | 1027 if (value_obj->IsObjectTemplateInfo()) { |
| 1029 templ->set_serial_number(i::Smi::FromInt(0)); | 1028 templ->set_serial_number(i::Smi::FromInt(0)); |
| 1030 if (templ->IsFunctionTemplateInfo()) { | 1029 if (templ->IsFunctionTemplateInfo()) { |
| 1031 i::Handle<i::FunctionTemplateInfo>::cast(templ)->set_do_not_cache(true); | 1030 i::Handle<i::FunctionTemplateInfo>::cast(templ)->set_do_not_cache(true); |
| 1032 } | 1031 } |
| 1033 } | 1032 } |
| 1033 // TODO(dcarney): split api to allow values of v8::Value or v8::TemplateInfo. |
| 1034 i::ApiNatives::AddDataProperty(isolate, templ, Utils::OpenHandle(*name), | 1034 i::ApiNatives::AddDataProperty(isolate, templ, Utils::OpenHandle(*name), |
| 1035 value_obj, | 1035 value_obj, |
| 1036 static_cast<i::PropertyAttributes>(attribute)); | 1036 static_cast<i::PropertyAttributes>(attribute)); |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 | 1039 |
| 1040 void Template::SetAccessorProperty( | 1040 void Template::SetAccessorProperty( |
| 1041 v8::Local<v8::Name> name, | 1041 v8::Local<v8::Name> name, |
| 1042 v8::Local<FunctionTemplate> getter, | 1042 v8::Local<FunctionTemplate> getter, |
| 1043 v8::Local<FunctionTemplate> setter, | 1043 v8::Local<FunctionTemplate> setter, |
| (...skipping 7717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8761 Address callback_address = | 8761 Address callback_address = |
| 8762 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8762 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8763 VMState<EXTERNAL> state(isolate); | 8763 VMState<EXTERNAL> state(isolate); |
| 8764 ExternalCallbackScope call_scope(isolate, callback_address); | 8764 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8765 callback(info); | 8765 callback(info); |
| 8766 } | 8766 } |
| 8767 | 8767 |
| 8768 | 8768 |
| 8769 } // namespace internal | 8769 } // namespace internal |
| 8770 } // namespace v8 | 8770 } // namespace v8 |
| OLD | NEW |