| 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 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 info->set_data(*Utils::OpenHandle(*data)); | 1328 info->set_data(*Utils::OpenHandle(*data)); |
| 1329 | 1329 |
| 1330 i::FunctionTemplateInfo* constructor = | 1330 i::FunctionTemplateInfo* constructor = |
| 1331 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); | 1331 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); |
| 1332 i::Handle<i::FunctionTemplateInfo> cons(constructor); | 1332 i::Handle<i::FunctionTemplateInfo> cons(constructor); |
| 1333 cons->set_access_check_info(*info); | 1333 cons->set_access_check_info(*info); |
| 1334 cons->set_needs_access_check(turned_on_by_default); | 1334 cons->set_needs_access_check(turned_on_by_default); |
| 1335 } | 1335 } |
| 1336 | 1336 |
| 1337 | 1337 |
| 1338 void ObjectTemplate::SetIndexedPropertyHandler( | 1338 void ObjectTemplate::SetHandler( |
| 1339 IndexedPropertyGetterCallback getter, | 1339 const IndexedPropertyHandlerConfiguration& config) { |
| 1340 IndexedPropertySetterCallback setter, | |
| 1341 IndexedPropertyQueryCallback query, | |
| 1342 IndexedPropertyDeleterCallback remover, | |
| 1343 IndexedPropertyEnumeratorCallback enumerator, | |
| 1344 Handle<Value> data) { | |
| 1345 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1340 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1346 ENTER_V8(isolate); | 1341 ENTER_V8(isolate); |
| 1347 i::HandleScope scope(isolate); | 1342 i::HandleScope scope(isolate); |
| 1348 EnsureConstructor(isolate, this); | 1343 EnsureConstructor(isolate, this); |
| 1349 i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( | 1344 i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( |
| 1350 Utils::OpenHandle(this)->constructor()); | 1345 Utils::OpenHandle(this)->constructor()); |
| 1351 i::Handle<i::FunctionTemplateInfo> cons(constructor); | 1346 i::Handle<i::FunctionTemplateInfo> cons(constructor); |
| 1352 i::Handle<i::Struct> struct_obj = | 1347 i::Handle<i::Struct> struct_obj = |
| 1353 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); | 1348 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); |
| 1354 i::Handle<i::InterceptorInfo> obj = | 1349 i::Handle<i::InterceptorInfo> obj = |
| 1355 i::Handle<i::InterceptorInfo>::cast(struct_obj); | 1350 i::Handle<i::InterceptorInfo>::cast(struct_obj); |
| 1356 | 1351 |
| 1357 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); | 1352 if (config.getter != 0) SET_FIELD_WRAPPED(obj, set_getter, config.getter); |
| 1358 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); | 1353 if (config.setter != 0) SET_FIELD_WRAPPED(obj, set_setter, config.setter); |
| 1359 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); | 1354 if (config.query != 0) SET_FIELD_WRAPPED(obj, set_query, config.query); |
| 1360 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); | 1355 if (config.deleter != 0) SET_FIELD_WRAPPED(obj, set_deleter, config.deleter); |
| 1361 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); | 1356 if (config.enumerator != 0) { |
| 1357 SET_FIELD_WRAPPED(obj, set_enumerator, config.enumerator); |
| 1358 } |
| 1362 obj->set_flags(0); | 1359 obj->set_flags(0); |
| 1363 | 1360 |
| 1361 v8::Local<v8::Value> data = config.data; |
| 1364 if (data.IsEmpty()) { | 1362 if (data.IsEmpty()) { |
| 1365 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 1363 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 1366 } | 1364 } |
| 1367 obj->set_data(*Utils::OpenHandle(*data)); | 1365 obj->set_data(*Utils::OpenHandle(*data)); |
| 1368 cons->set_indexed_property_handler(*obj); | 1366 cons->set_indexed_property_handler(*obj); |
| 1369 } | 1367 } |
| 1370 | 1368 |
| 1371 | 1369 |
| 1372 void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback, | 1370 void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback, |
| 1373 Handle<Value> data) { | 1371 Handle<Value> data) { |
| (...skipping 6323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7697 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7695 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7698 Address callback_address = | 7696 Address callback_address = |
| 7699 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7697 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7700 VMState<EXTERNAL> state(isolate); | 7698 VMState<EXTERNAL> state(isolate); |
| 7701 ExternalCallbackScope call_scope(isolate, callback_address); | 7699 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7702 callback(info); | 7700 callback(info); |
| 7703 } | 7701 } |
| 7704 | 7702 |
| 7705 | 7703 |
| 7706 } } // namespace v8::internal | 7704 } } // namespace v8::internal |
| OLD | NEW |