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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 that->set_tag(i::Smi::FromInt(type)); | 933 that->set_tag(i::Smi::FromInt(type)); |
934 } | 934 } |
935 | 935 |
936 | 936 |
937 void Template::Set(v8::Local<Name> name, v8::Local<Data> value, | 937 void Template::Set(v8::Local<Name> name, v8::Local<Data> value, |
938 v8::PropertyAttribute attribute) { | 938 v8::PropertyAttribute attribute) { |
939 auto templ = Utils::OpenHandle(this); | 939 auto templ = Utils::OpenHandle(this); |
940 i::Isolate* isolate = templ->GetIsolate(); | 940 i::Isolate* isolate = templ->GetIsolate(); |
941 ENTER_V8(isolate); | 941 ENTER_V8(isolate); |
942 i::HandleScope scope(isolate); | 942 i::HandleScope scope(isolate); |
| 943 auto value_obj = Utils::OpenHandle(*value); |
| 944 if (value_obj->IsObjectTemplateInfo()) { |
| 945 templ->set_serial_number(i::Smi::FromInt(0)); |
| 946 if (templ->IsFunctionTemplateInfo()) { |
| 947 i::Handle<i::FunctionTemplateInfo>::cast(templ)->set_do_not_cache(true); |
| 948 } |
| 949 } |
943 // TODO(dcarney): split api to allow values of v8::Value or v8::TemplateInfo. | 950 // TODO(dcarney): split api to allow values of v8::Value or v8::TemplateInfo. |
944 i::ApiNatives::AddDataProperty(isolate, templ, Utils::OpenHandle(*name), | 951 i::ApiNatives::AddDataProperty(isolate, templ, Utils::OpenHandle(*name), |
945 Utils::OpenHandle(*value), | 952 value_obj, |
946 static_cast<i::PropertyAttributes>(attribute)); | 953 static_cast<i::PropertyAttributes>(attribute)); |
947 } | 954 } |
948 | 955 |
949 | 956 |
950 void Template::SetAccessorProperty( | 957 void Template::SetAccessorProperty( |
951 v8::Local<v8::Name> name, | 958 v8::Local<v8::Name> name, |
952 v8::Local<FunctionTemplate> getter, | 959 v8::Local<FunctionTemplate> getter, |
953 v8::Local<FunctionTemplate> setter, | 960 v8::Local<FunctionTemplate> setter, |
954 v8::PropertyAttribute attribute, | 961 v8::PropertyAttribute attribute, |
955 v8::AccessControl access_control) { | 962 v8::AccessControl access_control) { |
(...skipping 7658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8614 Address callback_address = | 8621 Address callback_address = |
8615 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8622 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8616 VMState<EXTERNAL> state(isolate); | 8623 VMState<EXTERNAL> state(isolate); |
8617 ExternalCallbackScope call_scope(isolate, callback_address); | 8624 ExternalCallbackScope call_scope(isolate, callback_address); |
8618 callback(info); | 8625 callback(info); |
8619 } | 8626 } |
8620 | 8627 |
8621 | 8628 |
8622 } // namespace internal | 8629 } // namespace internal |
8623 } // namespace v8 | 8630 } // namespace v8 |
OLD | NEW |