Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: src/objects.cc

Issue 258243003: Remove old-style accessor support from runtime. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ic.cc ('k') | src/property.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 object->EnsureWritableFastElements(), 375 object->EnsureWritableFastElements(),
376 FixedArray); 376 FixedArray);
377 } 377 }
378 378
379 379
380 MaybeHandle<Object> JSObject::GetPropertyWithCallback(Handle<JSObject> object, 380 MaybeHandle<Object> JSObject::GetPropertyWithCallback(Handle<JSObject> object,
381 Handle<Object> receiver, 381 Handle<Object> receiver,
382 Handle<Object> structure, 382 Handle<Object> structure,
383 Handle<Name> name) { 383 Handle<Name> name) {
384 Isolate* isolate = name->GetIsolate(); 384 Isolate* isolate = name->GetIsolate();
385 // To accommodate both the old and the new api we switch on the 385 ASSERT(!structure->IsForeign());
386 // data structure used to store the callbacks. Eventually foreign
387 // callbacks should be phased out.
388 if (structure->IsForeign()) {
389 AccessorDescriptor* callback =
390 reinterpret_cast<AccessorDescriptor*>(
391 Handle<Foreign>::cast(structure)->foreign_address());
392 CALL_HEAP_FUNCTION(isolate,
393 (callback->getter)(isolate, *receiver, callback->data),
394 Object);
395 }
396
397 // api style callbacks. 386 // api style callbacks.
398 if (structure->IsAccessorInfo()) { 387 if (structure->IsAccessorInfo()) {
399 Handle<AccessorInfo> accessor_info = Handle<AccessorInfo>::cast(structure); 388 Handle<AccessorInfo> accessor_info = Handle<AccessorInfo>::cast(structure);
400 if (!accessor_info->IsCompatibleReceiver(*receiver)) { 389 if (!accessor_info->IsCompatibleReceiver(*receiver)) {
401 Handle<Object> args[2] = { name, receiver }; 390 Handle<Object> args[2] = { name, receiver };
402 Handle<Object> error = 391 Handle<Object> error =
403 isolate->factory()->NewTypeError("incompatible_method_receiver", 392 isolate->factory()->NewTypeError("incompatible_method_receiver",
404 HandleVector(args, 393 HandleVector(args,
405 ARRAY_SIZE(args))); 394 ARRAY_SIZE(args)));
406 return isolate->Throw<Object>(error); 395 return isolate->Throw<Object>(error);
(...skipping 2610 matching lines...) Expand 10 before | Expand all | Expand 10 after
3017 Handle<Object> structure, 3006 Handle<Object> structure,
3018 Handle<Name> name, 3007 Handle<Name> name,
3019 Handle<Object> value, 3008 Handle<Object> value,
3020 Handle<JSObject> holder, 3009 Handle<JSObject> holder,
3021 StrictMode strict_mode) { 3010 StrictMode strict_mode) {
3022 Isolate* isolate = object->GetIsolate(); 3011 Isolate* isolate = object->GetIsolate();
3023 3012
3024 // We should never get here to initialize a const with the hole 3013 // We should never get here to initialize a const with the hole
3025 // value since a const declaration would conflict with the setter. 3014 // value since a const declaration would conflict with the setter.
3026 ASSERT(!value->IsTheHole()); 3015 ASSERT(!value->IsTheHole());
3027 3016 ASSERT(!structure->IsForeign());
3028 // To accommodate both the old and the new api we switch on the
3029 // data structure used to store the callbacks. Eventually foreign
3030 // callbacks should be phased out.
3031 if (structure->IsForeign()) {
3032 AccessorDescriptor* callback =
3033 reinterpret_cast<AccessorDescriptor*>(
3034 Handle<Foreign>::cast(structure)->foreign_address());
3035 CALL_AND_RETRY_OR_DIE(isolate,
3036 (callback->setter)(
3037 isolate, *object, *value, callback->data),
3038 break,
3039 return Handle<Object>());
3040 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
3041 return value;
3042 }
3043
3044 if (structure->IsExecutableAccessorInfo()) { 3017 if (structure->IsExecutableAccessorInfo()) {
3045 // api style callbacks 3018 // api style callbacks
3046 ExecutableAccessorInfo* data = ExecutableAccessorInfo::cast(*structure); 3019 ExecutableAccessorInfo* data = ExecutableAccessorInfo::cast(*structure);
3047 if (!data->IsCompatibleReceiver(*object)) { 3020 if (!data->IsCompatibleReceiver(*object)) {
3048 Handle<Object> args[2] = { name, object }; 3021 Handle<Object> args[2] = { name, object };
3049 Handle<Object> error = 3022 Handle<Object> error =
3050 isolate->factory()->NewTypeError("incompatible_method_receiver", 3023 isolate->factory()->NewTypeError("incompatible_method_receiver",
3051 HandleVector(args, 3024 HandleVector(args,
3052 ARRAY_SIZE(args))); 3025 ARRAY_SIZE(args)));
3053 return isolate->Throw<Object>(error); 3026 return isolate->Throw<Object>(error);
(...skipping 9525 matching lines...) Expand 10 before | Expand all | Expand 10 after
12579 12552
12580 12553
12581 MaybeHandle<Object> JSObject::GetElementWithCallback( 12554 MaybeHandle<Object> JSObject::GetElementWithCallback(
12582 Handle<JSObject> object, 12555 Handle<JSObject> object,
12583 Handle<Object> receiver, 12556 Handle<Object> receiver,
12584 Handle<Object> structure, 12557 Handle<Object> structure,
12585 uint32_t index, 12558 uint32_t index,
12586 Handle<Object> holder) { 12559 Handle<Object> holder) {
12587 Isolate* isolate = object->GetIsolate(); 12560 Isolate* isolate = object->GetIsolate();
12588 ASSERT(!structure->IsForeign()); 12561 ASSERT(!structure->IsForeign());
12589
12590 // api style callbacks. 12562 // api style callbacks.
12591 if (structure->IsExecutableAccessorInfo()) { 12563 if (structure->IsExecutableAccessorInfo()) {
12592 Handle<ExecutableAccessorInfo> data = 12564 Handle<ExecutableAccessorInfo> data =
12593 Handle<ExecutableAccessorInfo>::cast(structure); 12565 Handle<ExecutableAccessorInfo>::cast(structure);
12594 Object* fun_obj = data->getter(); 12566 Object* fun_obj = data->getter();
12595 v8::AccessorGetterCallback call_fun = 12567 v8::AccessorGetterCallback call_fun =
12596 v8::ToCData<v8::AccessorGetterCallback>(fun_obj); 12568 v8::ToCData<v8::AccessorGetterCallback>(fun_obj);
12597 if (call_fun == NULL) return isolate->factory()->undefined_value(); 12569 if (call_fun == NULL) return isolate->factory()->undefined_value();
12598 Handle<JSObject> holder_handle = Handle<JSObject>::cast(holder); 12570 Handle<JSObject> holder_handle = Handle<JSObject>::cast(holder);
12599 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); 12571 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
12637 Handle<Object> structure, 12609 Handle<Object> structure,
12638 uint32_t index, 12610 uint32_t index,
12639 Handle<Object> value, 12611 Handle<Object> value,
12640 Handle<JSObject> holder, 12612 Handle<JSObject> holder,
12641 StrictMode strict_mode) { 12613 StrictMode strict_mode) {
12642 Isolate* isolate = object->GetIsolate(); 12614 Isolate* isolate = object->GetIsolate();
12643 12615
12644 // We should never get here to initialize a const with the hole 12616 // We should never get here to initialize a const with the hole
12645 // value since a const declaration would conflict with the setter. 12617 // value since a const declaration would conflict with the setter.
12646 ASSERT(!value->IsTheHole()); 12618 ASSERT(!value->IsTheHole());
12647
12648 // To accommodate both the old and the new api we switch on the
12649 // data structure used to store the callbacks. Eventually foreign
12650 // callbacks should be phased out.
12651 ASSERT(!structure->IsForeign()); 12619 ASSERT(!structure->IsForeign());
12652
12653 if (structure->IsExecutableAccessorInfo()) { 12620 if (structure->IsExecutableAccessorInfo()) {
12654 // api style callbacks 12621 // api style callbacks
12655 Handle<ExecutableAccessorInfo> data = 12622 Handle<ExecutableAccessorInfo> data =
12656 Handle<ExecutableAccessorInfo>::cast(structure); 12623 Handle<ExecutableAccessorInfo>::cast(structure);
12657 Object* call_obj = data->setter(); 12624 Object* call_obj = data->setter();
12658 v8::AccessorSetterCallback call_fun = 12625 v8::AccessorSetterCallback call_fun =
12659 v8::ToCData<v8::AccessorSetterCallback>(call_obj); 12626 v8::ToCData<v8::AccessorSetterCallback>(call_obj);
12660 if (call_fun == NULL) return value; 12627 if (call_fun == NULL) return value;
12661 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); 12628 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
12662 Handle<String> key(isolate->factory()->NumberToString(number)); 12629 Handle<String> key(isolate->factory()->NumberToString(number));
(...skipping 4663 matching lines...) Expand 10 before | Expand all | Expand 10 after
17326 #define ERROR_MESSAGES_TEXTS(C, T) T, 17293 #define ERROR_MESSAGES_TEXTS(C, T) T,
17327 static const char* error_messages_[] = { 17294 static const char* error_messages_[] = {
17328 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17295 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17329 }; 17296 };
17330 #undef ERROR_MESSAGES_TEXTS 17297 #undef ERROR_MESSAGES_TEXTS
17331 return error_messages_[reason]; 17298 return error_messages_[reason];
17332 } 17299 }
17333 17300
17334 17301
17335 } } // namespace v8::internal 17302 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698