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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 obj->set_serial_number(i::Smi::FromInt(next_serial_number)); | 946 obj->set_serial_number(i::Smi::FromInt(next_serial_number)); |
947 if (callback != 0) { | 947 if (callback != 0) { |
948 if (data.IsEmpty()) { | 948 if (data.IsEmpty()) { |
949 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 949 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
950 } | 950 } |
951 Utils::ToLocal(obj)->SetCallHandler(callback, data); | 951 Utils::ToLocal(obj)->SetCallHandler(callback, data); |
952 } | 952 } |
953 obj->set_length(length); | 953 obj->set_length(length); |
954 obj->set_undetectable(false); | 954 obj->set_undetectable(false); |
955 obj->set_needs_access_check(false); | 955 obj->set_needs_access_check(false); |
| 956 obj->set_accept_any_receiver(true); |
956 if (!signature.IsEmpty()) | 957 if (!signature.IsEmpty()) |
957 obj->set_signature(*Utils::OpenHandle(*signature)); | 958 obj->set_signature(*Utils::OpenHandle(*signature)); |
958 return Utils::ToLocal(obj); | 959 return Utils::ToLocal(obj); |
959 } | 960 } |
960 | 961 |
961 Local<FunctionTemplate> FunctionTemplate::New( | 962 Local<FunctionTemplate> FunctionTemplate::New( |
962 Isolate* isolate, | 963 Isolate* isolate, |
963 FunctionCallback callback, | 964 FunctionCallback callback, |
964 v8::Handle<Value> data, | 965 v8::Handle<Value> data, |
965 v8::Handle<Signature> signature, | 966 v8::Handle<Signature> signature, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 | 1120 |
1120 void FunctionTemplate::SetClassName(Handle<String> name) { | 1121 void FunctionTemplate::SetClassName(Handle<String> name) { |
1121 auto info = Utils::OpenHandle(this); | 1122 auto info = Utils::OpenHandle(this); |
1122 EnsureNotInstantiated(info, "v8::FunctionTemplate::SetClassName"); | 1123 EnsureNotInstantiated(info, "v8::FunctionTemplate::SetClassName"); |
1123 auto isolate = info->GetIsolate(); | 1124 auto isolate = info->GetIsolate(); |
1124 ENTER_V8(isolate); | 1125 ENTER_V8(isolate); |
1125 info->set_class_name(*Utils::OpenHandle(*name)); | 1126 info->set_class_name(*Utils::OpenHandle(*name)); |
1126 } | 1127 } |
1127 | 1128 |
1128 | 1129 |
| 1130 void FunctionTemplate::SetAcceptAnyReceiver(bool value) { |
| 1131 auto info = Utils::OpenHandle(this); |
| 1132 EnsureNotInstantiated(info, "v8::FunctionTemplate::SetAcceptAnyReceiver"); |
| 1133 auto isolate = info->GetIsolate(); |
| 1134 ENTER_V8(isolate); |
| 1135 info->set_accept_any_receiver(value); |
| 1136 } |
| 1137 |
| 1138 |
1129 void FunctionTemplate::SetHiddenPrototype(bool value) { | 1139 void FunctionTemplate::SetHiddenPrototype(bool value) { |
1130 auto info = Utils::OpenHandle(this); | 1140 auto info = Utils::OpenHandle(this); |
1131 EnsureNotInstantiated(info, "v8::FunctionTemplate::SetHiddenPrototype"); | 1141 EnsureNotInstantiated(info, "v8::FunctionTemplate::SetHiddenPrototype"); |
1132 auto isolate = info->GetIsolate(); | 1142 auto isolate = info->GetIsolate(); |
1133 ENTER_V8(isolate); | 1143 ENTER_V8(isolate); |
1134 info->set_hidden_prototype(value); | 1144 info->set_hidden_prototype(value); |
1135 } | 1145 } |
1136 | 1146 |
1137 | 1147 |
1138 void FunctionTemplate::ReadOnlyPrototype() { | 1148 void FunctionTemplate::ReadOnlyPrototype() { |
(...skipping 6913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8052 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8062 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8053 Address callback_address = | 8063 Address callback_address = |
8054 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8064 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8055 VMState<EXTERNAL> state(isolate); | 8065 VMState<EXTERNAL> state(isolate); |
8056 ExternalCallbackScope call_scope(isolate, callback_address); | 8066 ExternalCallbackScope call_scope(isolate, callback_address); |
8057 callback(info); | 8067 callback(info); |
8058 } | 8068 } |
8059 | 8069 |
8060 | 8070 |
8061 } } // namespace v8::internal | 8071 } } // namespace v8::internal |
OLD | NEW |