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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
821 array.add(isolate->factory()->NewNumberFromInt(length)); | 821 array.add(isolate->factory()->NewNumberFromInt(length)); |
822 for (int i = 0; i < length; i++) { | 822 for (int i = 0; i < length; i++) { |
823 i::Handle<i::Object> value = data[i].IsEmpty() ? | 823 i::Handle<i::Object> value = data[i].IsEmpty() ? |
824 i::Handle<i::Object>(isolate->factory()->undefined_value()) : | 824 i::Handle<i::Object>(isolate->factory()->undefined_value()) : |
825 Utils::OpenHandle(*data[i]); | 825 Utils::OpenHandle(*data[i]); |
826 array.add(value); | 826 array.add(value); |
827 } | 827 } |
828 } | 828 } |
829 | 829 |
830 | 830 |
831 void Template::Set(v8::Handle<String> name, | 831 void Template::Set(v8::Handle<Name> name, |
832 v8::Handle<Data> value, | 832 v8::Handle<Data> value, |
833 v8::PropertyAttribute attribute) { | 833 v8::PropertyAttribute attribute) { |
834 i::Isolate* isolate = i::Isolate::Current(); | 834 i::Isolate* isolate = i::Isolate::Current(); |
835 ENTER_V8(isolate); | 835 ENTER_V8(isolate); |
836 i::HandleScope scope(isolate); | 836 i::HandleScope scope(isolate); |
837 const int kSize = 3; | 837 const int kSize = 3; |
838 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 838 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
839 v8::Handle<v8::Data> data[kSize] = { | 839 v8::Handle<v8::Data> data[kSize] = { |
840 name, | 840 name, |
841 value, | 841 value, |
842 v8::Integer::New(v8_isolate, attribute)}; | 842 v8::Integer::New(v8_isolate, attribute)}; |
843 TemplateSet(isolate, this, kSize, data); | 843 TemplateSet(isolate, this, kSize, data); |
844 } | 844 } |
845 | 845 |
846 | 846 |
847 void Template::SetAccessorProperty( | 847 void Template::SetAccessorProperty( |
848 v8::Local<v8::String> name, | 848 v8::Local<v8::Name> name, |
849 v8::Local<FunctionTemplate> getter, | 849 v8::Local<FunctionTemplate> getter, |
850 v8::Local<FunctionTemplate> setter, | 850 v8::Local<FunctionTemplate> setter, |
851 v8::PropertyAttribute attribute, | 851 v8::PropertyAttribute attribute, |
852 v8::AccessControl access_control) { | 852 v8::AccessControl access_control) { |
853 // TODO(verwaest): Remove |access_control|. | 853 // TODO(verwaest): Remove |access_control|. |
854 DCHECK_EQ(v8::DEFAULT, access_control); | 854 DCHECK_EQ(v8::DEFAULT, access_control); |
855 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 855 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
856 ENTER_V8(isolate); | 856 ENTER_V8(isolate); |
857 DCHECK(!name.IsEmpty()); | 857 DCHECK(!name.IsEmpty()); |
858 DCHECK(!getter.IsEmpty() || !setter.IsEmpty()); | 858 DCHECK(!getter.IsEmpty() || !setter.IsEmpty()); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1149 if (data.IsEmpty()) { | 1149 if (data.IsEmpty()) { |
1150 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 1150 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
1151 } | 1151 } |
1152 obj->set_data(*Utils::OpenHandle(*data)); | 1152 obj->set_data(*Utils::OpenHandle(*data)); |
1153 Utils::OpenHandle(this)->set_call_code(*obj); | 1153 Utils::OpenHandle(this)->set_call_code(*obj); |
1154 } | 1154 } |
1155 | 1155 |
1156 | 1156 |
1157 static i::Handle<i::AccessorInfo> SetAccessorInfoProperties( | 1157 static i::Handle<i::AccessorInfo> SetAccessorInfoProperties( |
1158 i::Handle<i::AccessorInfo> obj, | 1158 i::Handle<i::AccessorInfo> obj, |
1159 v8::Handle<String> name, | 1159 v8::Handle<Name> name, |
1160 v8::AccessControl settings, | 1160 v8::AccessControl settings, |
1161 v8::PropertyAttribute attributes, | 1161 v8::PropertyAttribute attributes, |
1162 v8::Handle<AccessorSignature> signature) { | 1162 v8::Handle<AccessorSignature> signature) { |
1163 obj->set_name(*Utils::OpenHandle(*name)); | 1163 obj->set_name(*Utils::OpenHandle(*name)); |
1164 if (settings & ALL_CAN_READ) obj->set_all_can_read(true); | 1164 if (settings & ALL_CAN_READ) obj->set_all_can_read(true); |
1165 if (settings & ALL_CAN_WRITE) obj->set_all_can_write(true); | 1165 if (settings & ALL_CAN_WRITE) obj->set_all_can_write(true); |
1166 obj->set_property_attributes(static_cast<PropertyAttributes>(attributes)); | 1166 obj->set_property_attributes(static_cast<PropertyAttributes>(attributes)); |
1167 if (!signature.IsEmpty()) { | 1167 if (!signature.IsEmpty()) { |
1168 obj->set_expected_receiver_type(*Utils::OpenHandle(*signature)); | 1168 obj->set_expected_receiver_type(*Utils::OpenHandle(*signature)); |
1169 } | 1169 } |
1170 return obj; | 1170 return obj; |
1171 } | 1171 } |
1172 | 1172 |
1173 | 1173 |
1174 template<typename Getter, typename Setter> | 1174 template<typename Getter, typename Setter> |
1175 static i::Handle<i::AccessorInfo> MakeAccessorInfo( | 1175 static i::Handle<i::AccessorInfo> MakeAccessorInfo( |
1176 v8::Handle<String> name, | 1176 v8::Handle<Name> name, |
1177 Getter getter, | 1177 Getter getter, |
1178 Setter setter, | 1178 Setter setter, |
1179 v8::Handle<Value> data, | 1179 v8::Handle<Value> data, |
1180 v8::AccessControl settings, | 1180 v8::AccessControl settings, |
1181 v8::PropertyAttribute attributes, | 1181 v8::PropertyAttribute attributes, |
1182 v8::Handle<AccessorSignature> signature) { | 1182 v8::Handle<AccessorSignature> signature) { |
1183 i::Isolate* isolate = Utils::OpenHandle(*name)->GetIsolate(); | 1183 i::Isolate* isolate = Utils::OpenHandle(*name)->GetIsolate(); |
1184 i::Handle<i::ExecutableAccessorInfo> obj = | 1184 i::Handle<i::ExecutableAccessorInfo> obj = |
1185 isolate->factory()->NewExecutableAccessorInfo(); | 1185 isolate->factory()->NewExecutableAccessorInfo(); |
1186 SET_FIELD_WRAPPED(obj, set_getter, getter); | 1186 SET_FIELD_WRAPPED(obj, set_getter, getter); |
1187 SET_FIELD_WRAPPED(obj, set_setter, setter); | 1187 SET_FIELD_WRAPPED(obj, set_setter, setter); |
1188 if (data.IsEmpty()) { | 1188 if (data.IsEmpty()) { |
1189 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 1189 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
1190 } | 1190 } |
1191 obj->set_data(*Utils::OpenHandle(*data)); | 1191 obj->set_data(*Utils::OpenHandle(*data)); |
1192 return SetAccessorInfoProperties(obj, name, settings, attributes, signature); | 1192 return SetAccessorInfoProperties(obj, name, settings, attributes, signature); |
1193 } | 1193 } |
1194 | 1194 |
1195 | 1195 |
1196 static i::Handle<i::AccessorInfo> MakeAccessorInfo( | 1196 static i::Handle<i::AccessorInfo> MakeAccessorInfo( |
1197 v8::Handle<String> name, | 1197 v8::Handle<Name> name, |
1198 v8::Handle<v8::DeclaredAccessorDescriptor> descriptor, | 1198 v8::Handle<v8::DeclaredAccessorDescriptor> descriptor, |
1199 void* setter_ignored, | 1199 void* setter_ignored, |
1200 void* data_ignored, | 1200 void* data_ignored, |
1201 v8::AccessControl settings, | 1201 v8::AccessControl settings, |
1202 v8::PropertyAttribute attributes, | 1202 v8::PropertyAttribute attributes, |
1203 v8::Handle<AccessorSignature> signature) { | 1203 v8::Handle<AccessorSignature> signature) { |
1204 i::Isolate* isolate = Utils::OpenHandle(*name)->GetIsolate(); | 1204 i::Isolate* isolate = Utils::OpenHandle(*name)->GetIsolate(); |
1205 if (descriptor.IsEmpty()) return i::Handle<i::DeclaredAccessorInfo>(); | 1205 if (descriptor.IsEmpty()) return i::Handle<i::DeclaredAccessorInfo>(); |
1206 i::Handle<i::DeclaredAccessorInfo> obj = | 1206 i::Handle<i::DeclaredAccessorInfo> obj = |
1207 isolate->factory()->NewDeclaredAccessorInfo(); | 1207 isolate->factory()->NewDeclaredAccessorInfo(); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1338 | 1338 |
1339 // TODO(dcarney): remove this with ObjectTemplate::SetAccessor | 1339 // TODO(dcarney): remove this with ObjectTemplate::SetAccessor |
1340 static inline i::Handle<i::TemplateInfo> GetTemplateInfo( | 1340 static inline i::Handle<i::TemplateInfo> GetTemplateInfo( |
1341 i::Isolate* isolate, | 1341 i::Isolate* isolate, |
1342 ObjectTemplate* object_template) { | 1342 ObjectTemplate* object_template) { |
1343 EnsureConstructor(isolate, object_template); | 1343 EnsureConstructor(isolate, object_template); |
1344 return Utils::OpenHandle(object_template); | 1344 return Utils::OpenHandle(object_template); |
1345 } | 1345 } |
1346 | 1346 |
1347 | 1347 |
1348 template<typename Setter, typename Getter, typename Data, typename Template> | 1348 template<typename Getter, typename Setter, typename Data, typename Template> |
1349 static bool TemplateSetAccessor( | 1349 static bool TemplateSetAccessor( |
1350 Template* template_obj, | 1350 Template* template_obj, |
1351 v8::Local<String> name, | 1351 v8::Local<Name> name, |
1352 Getter getter, | 1352 Getter getter, |
1353 Setter setter, | 1353 Setter setter, |
1354 Data data, | 1354 Data data, |
1355 AccessControl settings, | 1355 AccessControl settings, |
1356 PropertyAttribute attribute, | 1356 PropertyAttribute attribute, |
1357 v8::Local<AccessorSignature> signature) { | 1357 v8::Local<AccessorSignature> signature) { |
1358 i::Isolate* isolate = Utils::OpenHandle(template_obj)->GetIsolate(); | 1358 i::Isolate* isolate = Utils::OpenHandle(template_obj)->GetIsolate(); |
1359 ENTER_V8(isolate); | 1359 ENTER_V8(isolate); |
1360 i::HandleScope scope(isolate); | 1360 i::HandleScope scope(isolate); |
1361 i::Handle<i::AccessorInfo> obj = MakeAccessorInfo( | 1361 i::Handle<i::AccessorInfo> obj = MakeAccessorInfo( |
1362 name, getter, setter, data, settings, attribute, signature); | 1362 name, getter, setter, data, settings, attribute, signature); |
1363 if (obj.is_null()) return false; | 1363 if (obj.is_null()) return false; |
1364 i::Handle<i::TemplateInfo> info = GetTemplateInfo(isolate, template_obj); | 1364 i::Handle<i::TemplateInfo> info = GetTemplateInfo(isolate, template_obj); |
1365 AddPropertyToTemplate(info, obj); | 1365 AddPropertyToTemplate(info, obj); |
1366 return true; | 1366 return true; |
1367 } | 1367 } |
1368 | 1368 |
1369 | 1369 |
1370 bool Template::SetDeclaredAccessor( | 1370 bool Template::SetDeclaredAccessor( |
1371 Local<String> name, | 1371 Local<Name> name, |
1372 Local<DeclaredAccessorDescriptor> descriptor, | 1372 Local<DeclaredAccessorDescriptor> descriptor, |
1373 PropertyAttribute attribute, | 1373 PropertyAttribute attribute, |
1374 Local<AccessorSignature> signature, | 1374 Local<AccessorSignature> signature, |
1375 AccessControl settings) { | 1375 AccessControl settings) { |
1376 void* null = NULL; | 1376 void* null = NULL; |
1377 return TemplateSetAccessor( | 1377 return TemplateSetAccessor( |
1378 this, name, descriptor, null, null, settings, attribute, signature); | 1378 this, name, descriptor, null, null, settings, attribute, signature); |
1379 } | 1379 } |
1380 | 1380 |
1381 | 1381 |
1382 void Template::SetNativeDataProperty(v8::Local<String> name, | 1382 void Template::SetNativeDataProperty(v8::Local<String> name, |
1383 AccessorGetterCallback getter, | 1383 AccessorGetterCallback getter, |
1384 AccessorSetterCallback setter, | 1384 AccessorSetterCallback setter, |
1385 v8::Handle<Value> data, | 1385 v8::Handle<Value> data, |
1386 PropertyAttribute attribute, | 1386 PropertyAttribute attribute, |
1387 v8::Local<AccessorSignature> signature, | 1387 v8::Local<AccessorSignature> signature, |
1388 AccessControl settings) { | 1388 AccessControl settings) { |
1389 TemplateSetAccessor( | 1389 TemplateSetAccessor( |
1390 this, name, getter, setter, data, settings, attribute, signature); | 1390 this, name, getter, setter, data, settings, attribute, signature); |
1391 } | 1391 } |
1392 | 1392 |
1393 | 1393 |
1394 void Template::SetNativeDataProperty(v8::Local<Name> name, | |
1395 AccessorNameGetterCallback getter, | |
1396 AccessorNameSetterCallback setter, | |
1397 v8::Handle<Value> data, | |
1398 PropertyAttribute attribute, | |
1399 v8::Local<AccessorSignature> signature, | |
1400 AccessControl settings) { | |
1401 TemplateSetAccessor( | |
1402 this, name, getter, setter, data, settings, attribute, signature); | |
1403 } | |
1404 | |
1405 | |
1394 void ObjectTemplate::SetAccessor(v8::Handle<String> name, | 1406 void ObjectTemplate::SetAccessor(v8::Handle<String> name, |
1395 AccessorGetterCallback getter, | 1407 AccessorGetterCallback getter, |
1396 AccessorSetterCallback setter, | 1408 AccessorSetterCallback setter, |
1397 v8::Handle<Value> data, | 1409 v8::Handle<Value> data, |
1398 AccessControl settings, | 1410 AccessControl settings, |
1399 PropertyAttribute attribute, | 1411 PropertyAttribute attribute, |
1400 v8::Handle<AccessorSignature> signature) { | 1412 v8::Handle<AccessorSignature> signature) { |
1401 TemplateSetAccessor( | 1413 TemplateSetAccessor( |
1402 this, name, getter, setter, data, settings, attribute, signature); | 1414 this, name, getter, setter, data, settings, attribute, signature); |
1403 } | 1415 } |
1404 | 1416 |
1405 | 1417 |
1418 void ObjectTemplate::SetAccessor(v8::Handle<Name> name, | |
1419 AccessorNameGetterCallback getter, | |
1420 AccessorNameSetterCallback setter, | |
1421 v8::Handle<Value> data, | |
1422 AccessControl settings, | |
1423 PropertyAttribute attribute, | |
1424 v8::Handle<AccessorSignature> signature) { | |
1425 TemplateSetAccessor( | |
1426 this, name, getter, setter, data, settings, attribute, signature); | |
1427 } | |
1428 | |
1429 | |
1406 void ObjectTemplate::SetNamedPropertyHandler( | 1430 void ObjectTemplate::SetNamedPropertyHandler( |
1407 NamedPropertyGetterCallback getter, | 1431 NamedPropertyGetterCallback getter, |
1408 NamedPropertySetterCallback setter, | 1432 NamedPropertySetterCallback setter, |
1409 NamedPropertyQueryCallback query, | 1433 NamedPropertyQueryCallback query, |
1410 NamedPropertyDeleterCallback remover, | 1434 NamedPropertyDeleterCallback remover, |
1411 NamedPropertyEnumeratorCallback enumerator, | 1435 NamedPropertyEnumeratorCallback enumerator, |
1412 Handle<Value> data) { | 1436 Handle<Value> data) { |
1413 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1437 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
1414 ENTER_V8(isolate); | 1438 ENTER_V8(isolate); |
1415 i::HandleScope scope(isolate); | 1439 i::HandleScope scope(isolate); |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2317 bool Value::IsFalse() const { | 2341 bool Value::IsFalse() const { |
2318 return Utils::OpenHandle(this)->IsFalse(); | 2342 return Utils::OpenHandle(this)->IsFalse(); |
2319 } | 2343 } |
2320 | 2344 |
2321 | 2345 |
2322 bool Value::IsFunction() const { | 2346 bool Value::IsFunction() const { |
2323 return Utils::OpenHandle(this)->IsJSFunction(); | 2347 return Utils::OpenHandle(this)->IsJSFunction(); |
2324 } | 2348 } |
2325 | 2349 |
2326 | 2350 |
2351 bool Value::IsName() const { | |
2352 return Utils::OpenHandle(this)->IsName(); | |
2353 } | |
2354 | |
2355 | |
2327 bool Value::FullIsString() const { | 2356 bool Value::FullIsString() const { |
2328 bool result = Utils::OpenHandle(this)->IsString(); | 2357 bool result = Utils::OpenHandle(this)->IsString(); |
2329 DCHECK_EQ(result, QuickIsString()); | 2358 DCHECK_EQ(result, QuickIsString()); |
2330 return result; | 2359 return result; |
2331 } | 2360 } |
2332 | 2361 |
2333 | 2362 |
2334 bool Value::IsSymbol() const { | 2363 bool Value::IsSymbol() const { |
2335 return Utils::OpenHandle(this)->IsSymbol(); | 2364 return Utils::OpenHandle(this)->IsSymbol(); |
2336 } | 2365 } |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2625 | 2654 |
2626 | 2655 |
2627 void v8::Function::CheckCast(Value* that) { | 2656 void v8::Function::CheckCast(Value* that) { |
2628 i::Handle<i::Object> obj = Utils::OpenHandle(that); | 2657 i::Handle<i::Object> obj = Utils::OpenHandle(that); |
2629 Utils::ApiCheck(obj->IsJSFunction(), | 2658 Utils::ApiCheck(obj->IsJSFunction(), |
2630 "v8::Function::Cast()", | 2659 "v8::Function::Cast()", |
2631 "Could not convert to function"); | 2660 "Could not convert to function"); |
2632 } | 2661 } |
2633 | 2662 |
2634 | 2663 |
2664 void v8::Name::CheckCast(v8::Value* that) { | |
2665 i::Handle<i::Object> obj = Utils::OpenHandle(that); | |
2666 Utils::ApiCheck(obj->IsName(), | |
2667 "v8::Name::Cast()", | |
2668 "Could not convert to name"); | |
2669 } | |
2670 | |
2671 | |
2635 void v8::String::CheckCast(v8::Value* that) { | 2672 void v8::String::CheckCast(v8::Value* that) { |
2636 i::Handle<i::Object> obj = Utils::OpenHandle(that); | 2673 i::Handle<i::Object> obj = Utils::OpenHandle(that); |
2637 Utils::ApiCheck(obj->IsString(), | 2674 Utils::ApiCheck(obj->IsString(), |
2638 "v8::String::Cast()", | 2675 "v8::String::Cast()", |
2639 "Could not convert to string"); | 2676 "Could not convert to string"); |
2640 } | 2677 } |
2641 | 2678 |
2642 | 2679 |
2643 void v8::Symbol::CheckCast(v8::Value* that) { | 2680 void v8::Symbol::CheckCast(v8::Value* that) { |
2644 i::Handle<i::Object> obj = Utils::OpenHandle(that); | 2681 i::Handle<i::Object> obj = Utils::OpenHandle(that); |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3407 ON_BAILOUT(isolate, "v8::Object::HasProperty()", return false); | 3444 ON_BAILOUT(isolate, "v8::Object::HasProperty()", return false); |
3408 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3445 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
3409 EXCEPTION_PREAMBLE(isolate); | 3446 EXCEPTION_PREAMBLE(isolate); |
3410 Maybe<bool> maybe = i::JSReceiver::HasElement(self, index); | 3447 Maybe<bool> maybe = i::JSReceiver::HasElement(self, index); |
3411 has_pending_exception = !maybe.has_value; | 3448 has_pending_exception = !maybe.has_value; |
3412 EXCEPTION_BAILOUT_CHECK(isolate, false); | 3449 EXCEPTION_BAILOUT_CHECK(isolate, false); |
3413 return maybe.value; | 3450 return maybe.value; |
3414 } | 3451 } |
3415 | 3452 |
3416 | 3453 |
3417 template<typename Setter, typename Getter, typename Data> | 3454 template<typename Getter, typename Setter, typename Data> |
3418 static inline bool ObjectSetAccessor(Object* obj, | 3455 static inline bool ObjectSetAccessor(Object* obj, |
3419 Handle<String> name, | 3456 Handle<Name> name, |
3420 Setter getter, | 3457 Getter getter, |
rossberg
2014/08/19 11:19:27
OMG...
| |
3421 Getter setter, | 3458 Setter setter, |
3422 Data data, | 3459 Data data, |
3423 AccessControl settings, | 3460 AccessControl settings, |
3424 PropertyAttribute attributes) { | 3461 PropertyAttribute attributes) { |
3425 i::Isolate* isolate = Utils::OpenHandle(obj)->GetIsolate(); | 3462 i::Isolate* isolate = Utils::OpenHandle(obj)->GetIsolate(); |
3426 ON_BAILOUT(isolate, "v8::Object::SetAccessor()", return false); | 3463 ON_BAILOUT(isolate, "v8::Object::SetAccessor()", return false); |
3427 ENTER_V8(isolate); | 3464 ENTER_V8(isolate); |
3428 i::HandleScope scope(isolate); | 3465 i::HandleScope scope(isolate); |
3429 v8::Handle<AccessorSignature> signature; | 3466 v8::Handle<AccessorSignature> signature; |
3430 i::Handle<i::AccessorInfo> info = MakeAccessorInfo( | 3467 i::Handle<i::AccessorInfo> info = MakeAccessorInfo( |
3431 name, getter, setter, data, settings, attributes, signature); | 3468 name, getter, setter, data, settings, attributes, signature); |
(...skipping 14 matching lines...) Expand all Loading... | |
3446 AccessorGetterCallback getter, | 3483 AccessorGetterCallback getter, |
3447 AccessorSetterCallback setter, | 3484 AccessorSetterCallback setter, |
3448 v8::Handle<Value> data, | 3485 v8::Handle<Value> data, |
3449 AccessControl settings, | 3486 AccessControl settings, |
3450 PropertyAttribute attributes) { | 3487 PropertyAttribute attributes) { |
3451 return ObjectSetAccessor( | 3488 return ObjectSetAccessor( |
3452 this, name, getter, setter, data, settings, attributes); | 3489 this, name, getter, setter, data, settings, attributes); |
3453 } | 3490 } |
3454 | 3491 |
3455 | 3492 |
3456 bool Object::SetDeclaredAccessor(Local<String> name, | 3493 bool Object::SetAccessor(Handle<Name> name, |
3494 AccessorNameGetterCallback getter, | |
3495 AccessorNameSetterCallback setter, | |
3496 v8::Handle<Value> data, | |
3497 AccessControl settings, | |
3498 PropertyAttribute attributes) { | |
3499 return ObjectSetAccessor( | |
3500 this, name, getter, setter, data, settings, attributes); | |
3501 } | |
3502 | |
3503 | |
3504 bool Object::SetDeclaredAccessor(Local<Name> name, | |
3457 Local<DeclaredAccessorDescriptor> descriptor, | 3505 Local<DeclaredAccessorDescriptor> descriptor, |
3458 PropertyAttribute attributes, | 3506 PropertyAttribute attributes, |
3459 AccessControl settings) { | 3507 AccessControl settings) { |
3460 void* null = NULL; | 3508 void* null = NULL; |
3461 return ObjectSetAccessor( | 3509 return ObjectSetAccessor( |
3462 this, name, descriptor, null, null, settings, attributes); | 3510 this, name, descriptor, null, null, settings, attributes); |
3463 } | 3511 } |
3464 | 3512 |
3465 | 3513 |
3466 void Object::SetAccessorProperty(Local<String> name, | 3514 void Object::SetAccessorProperty(Local<Name> name, |
3467 Local<Function> getter, | 3515 Local<Function> getter, |
3468 Handle<Function> setter, | 3516 Handle<Function> setter, |
3469 PropertyAttribute attribute, | 3517 PropertyAttribute attribute, |
3470 AccessControl settings) { | 3518 AccessControl settings) { |
3471 // TODO(verwaest): Remove |settings|. | 3519 // TODO(verwaest): Remove |settings|. |
3472 DCHECK_EQ(v8::DEFAULT, settings); | 3520 DCHECK_EQ(v8::DEFAULT, settings); |
3473 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3521 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3474 ON_BAILOUT(isolate, "v8::Object::SetAccessorProperty()", return); | 3522 ON_BAILOUT(isolate, "v8::Object::SetAccessorProperty()", return); |
3475 ENTER_V8(isolate); | 3523 ENTER_V8(isolate); |
3476 i::HandleScope scope(isolate); | 3524 i::HandleScope scope(isolate); |
(...skipping 4129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7606 | 7654 |
7607 v->VisitPointers(blocks_.first(), first_block_limit_); | 7655 v->VisitPointers(blocks_.first(), first_block_limit_); |
7608 | 7656 |
7609 for (int i = 1; i < blocks_.length(); i++) { | 7657 for (int i = 1; i < blocks_.length(); i++) { |
7610 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 7658 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
7611 } | 7659 } |
7612 } | 7660 } |
7613 | 7661 |
7614 | 7662 |
7615 void InvokeAccessorGetterCallback( | 7663 void InvokeAccessorGetterCallback( |
7616 v8::Local<v8::String> property, | 7664 v8::Local<v8::Name> property, |
7617 const v8::PropertyCallbackInfo<v8::Value>& info, | 7665 const v8::PropertyCallbackInfo<v8::Value>& info, |
7618 v8::AccessorGetterCallback getter) { | 7666 v8::AccessorNameGetterCallback getter) { |
7619 // Leaving JavaScript. | 7667 // Leaving JavaScript. |
7620 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7668 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7621 Address getter_address = reinterpret_cast<Address>(reinterpret_cast<intptr_t>( | 7669 Address getter_address = reinterpret_cast<Address>(reinterpret_cast<intptr_t>( |
7622 getter)); | 7670 getter)); |
7623 VMState<EXTERNAL> state(isolate); | 7671 VMState<EXTERNAL> state(isolate); |
7624 ExternalCallbackScope call_scope(isolate, getter_address); | 7672 ExternalCallbackScope call_scope(isolate, getter_address); |
7625 getter(property, info); | 7673 getter(property, info); |
7626 } | 7674 } |
7627 | 7675 |
7628 | 7676 |
7629 void InvokeFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>& info, | 7677 void InvokeFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>& info, |
7630 v8::FunctionCallback callback) { | 7678 v8::FunctionCallback callback) { |
7631 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7679 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7632 Address callback_address = | 7680 Address callback_address = |
7633 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7681 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7634 VMState<EXTERNAL> state(isolate); | 7682 VMState<EXTERNAL> state(isolate); |
7635 ExternalCallbackScope call_scope(isolate, callback_address); | 7683 ExternalCallbackScope call_scope(isolate, callback_address); |
7636 callback(info); | 7684 callback(info); |
7637 } | 7685 } |
7638 | 7686 |
7639 | 7687 |
7640 } } // namespace v8::internal | 7688 } } // namespace v8::internal |
OLD | NEW |