| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| 11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
| 12 #include "src/codegen.h" | 12 #include "src/codegen.h" |
| 13 #include "src/code-stubs.h" | 13 #include "src/code-stubs.h" |
| 14 #include "src/cpu-profiler.h" | 14 #include "src/cpu-profiler.h" |
| 15 #include "src/debug.h" | 15 #include "src/debug.h" |
| 16 #include "src/deoptimizer.h" | 16 #include "src/deoptimizer.h" |
| 17 #include "src/date.h" | 17 #include "src/date.h" |
| 18 #include "src/elements.h" | 18 #include "src/elements.h" |
| 19 #include "src/execution.h" | 19 #include "src/execution.h" |
| 20 #include "src/field-index.h" | 20 #include "src/field-index.h" |
| 21 #include "src/field-index-inl.h" | 21 #include "src/field-index-inl.h" |
| 22 #include "src/full-codegen.h" | 22 #include "src/full-codegen.h" |
| 23 #include "src/hydrogen.h" | 23 #include "src/hydrogen.h" |
| 24 #include "src/isolate-inl.h" | 24 #include "src/isolate-inl.h" |
| 25 #include "src/log.h" | 25 #include "src/log.h" |
| 26 #include "src/lookup.h" |
| 26 #include "src/objects-inl.h" | 27 #include "src/objects-inl.h" |
| 27 #include "src/objects-visiting-inl.h" | 28 #include "src/objects-visiting-inl.h" |
| 28 #include "src/macro-assembler.h" | 29 #include "src/macro-assembler.h" |
| 29 #include "src/mark-compact.h" | 30 #include "src/mark-compact.h" |
| 30 #include "src/safepoint-table.h" | 31 #include "src/safepoint-table.h" |
| 31 #include "src/string-search.h" | 32 #include "src/string-search.h" |
| 32 #include "src/string-stream.h" | 33 #include "src/string-stream.h" |
| 33 #include "src/utils.h" | 34 #include "src/utils.h" |
| 34 | 35 |
| 35 #ifdef ENABLE_DISASSEMBLER | 36 #ifdef ENABLE_DISASSEMBLER |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } else { | 121 } else { |
| 121 result->isolate()->PushStackTraceAndDie( | 122 result->isolate()->PushStackTraceAndDie( |
| 122 0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001); | 123 0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001); |
| 123 } | 124 } |
| 124 } | 125 } |
| 125 ASSERT(holder != NULL); // Cannot handle null or undefined. | 126 ASSERT(holder != NULL); // Cannot handle null or undefined. |
| 126 JSReceiver::cast(holder)->Lookup(name, result); | 127 JSReceiver::cast(holder)->Lookup(name, result); |
| 127 } | 128 } |
| 128 | 129 |
| 129 | 130 |
| 130 MaybeHandle<Object> Object::GetPropertyWithReceiver( | 131 MaybeHandle<Object> Object::GetProperty(LookupIterator* it) { |
| 131 Handle<Object> object, | 132 for (; it->IsFound(); it->Next()) { |
| 132 Handle<Object> receiver, | 133 switch (it->state()) { |
| 133 Handle<Name> name, | 134 case LookupIterator::NOT_FOUND: |
| 134 PropertyAttributes* attributes) { | 135 UNREACHABLE(); |
| 135 LookupResult lookup(name->GetIsolate()); | 136 case LookupIterator::JSPROXY: |
| 136 object->Lookup(name, &lookup); | 137 return JSProxy::GetPropertyWithHandler( |
| 137 MaybeHandle<Object> result = | 138 it->GetJSProxy(), it->GetReceiver(), it->name()); |
| 138 GetProperty(object, receiver, &lookup, name, attributes); | 139 case LookupIterator::INTERCEPTOR: { |
| 139 ASSERT(*attributes <= ABSENT); | 140 MaybeHandle<Object> maybe_result = JSObject::GetPropertyWithInterceptor( |
| 140 return result; | 141 it->GetHolder(), it->GetReceiver(), it->name()); |
| 142 if (!maybe_result.is_null()) return maybe_result; |
| 143 if (it->isolate()->has_pending_exception()) return maybe_result; |
| 144 break; |
| 145 } |
| 146 case LookupIterator::ACCESS_CHECK: { |
| 147 if (it->HasAccess(v8::ACCESS_GET)) break; |
| 148 return JSObject::GetPropertyWithFailedAccessCheck(it); |
| 149 } |
| 150 case LookupIterator::PROPERTY: |
| 151 if (it->HasProperty()) { |
| 152 switch (it->property_type()) { |
| 153 case LookupIterator::ACCESSORS: |
| 154 return GetPropertyWithAccessor( |
| 155 it->GetReceiver(), it->name(), |
| 156 it->GetHolder(), it->GetAccessors()); |
| 157 case LookupIterator::DATA: |
| 158 return it->GetDataValue(); |
| 159 } |
| 160 } |
| 161 break; |
| 162 } |
| 163 } |
| 164 return it->factory()->undefined_value(); |
| 141 } | 165 } |
| 142 | 166 |
| 143 | 167 |
| 144 bool Object::ToInt32(int32_t* value) { | 168 bool Object::ToInt32(int32_t* value) { |
| 145 if (IsSmi()) { | 169 if (IsSmi()) { |
| 146 *value = Smi::cast(this)->value(); | 170 *value = Smi::cast(this)->value(); |
| 147 return true; | 171 return true; |
| 148 } | 172 } |
| 149 if (IsHeapNumber()) { | 173 if (IsHeapNumber()) { |
| 150 double num = HeapNumber::cast(this)->value(); | 174 double num = HeapNumber::cast(this)->value(); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 394 |
| 371 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 395 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
| 372 if (name->IsSymbol()) return isolate->factory()->undefined_value(); | 396 if (name->IsSymbol()) return isolate->factory()->undefined_value(); |
| 373 | 397 |
| 374 Handle<Object> args[] = { receiver, name }; | 398 Handle<Object> args[] = { receiver, name }; |
| 375 return CallTrap( | 399 return CallTrap( |
| 376 proxy, "get", isolate->derived_get_trap(), ARRAY_SIZE(args), args); | 400 proxy, "get", isolate->derived_get_trap(), ARRAY_SIZE(args), args); |
| 377 } | 401 } |
| 378 | 402 |
| 379 | 403 |
| 380 MaybeHandle<Object> Object::GetPropertyWithCallback(Handle<Object> receiver, | 404 MaybeHandle<Object> Object::GetPropertyWithAccessor(Handle<Object> receiver, |
| 381 Handle<Name> name, | 405 Handle<Name> name, |
| 382 Handle<JSObject> holder, | 406 Handle<JSObject> holder, |
| 383 Handle<Object> structure) { | 407 Handle<Object> structure) { |
| 384 Isolate* isolate = name->GetIsolate(); | 408 Isolate* isolate = name->GetIsolate(); |
| 385 ASSERT(!structure->IsForeign()); | 409 ASSERT(!structure->IsForeign()); |
| 386 // api style callbacks. | 410 // api style callbacks. |
| 387 if (structure->IsAccessorInfo()) { | 411 if (structure->IsAccessorInfo()) { |
| 388 Handle<AccessorInfo> accessor_info = Handle<AccessorInfo>::cast(structure); | 412 Handle<AccessorInfo> accessor_info = Handle<AccessorInfo>::cast(structure); |
| 389 if (!accessor_info->IsCompatibleReceiver(*receiver)) { | 413 if (!accessor_info->IsCompatibleReceiver(*receiver)) { |
| 390 Handle<Object> args[2] = { name, receiver }; | 414 Handle<Object> args[2] = { name, receiver }; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 559 |
| 536 Handle<Object> argv[] = { value }; | 560 Handle<Object> argv[] = { value }; |
| 537 RETURN_ON_EXCEPTION( | 561 RETURN_ON_EXCEPTION( |
| 538 isolate, | 562 isolate, |
| 539 Execution::Call(isolate, setter, receiver, ARRAY_SIZE(argv), argv), | 563 Execution::Call(isolate, setter, receiver, ARRAY_SIZE(argv), argv), |
| 540 Object); | 564 Object); |
| 541 return value; | 565 return value; |
| 542 } | 566 } |
| 543 | 567 |
| 544 | 568 |
| 545 static bool FindAllCanReadHolder(LookupResult* result, | 569 static bool FindAllCanReadHolder(LookupIterator* it) { |
| 546 Handle<Name> name, | 570 for (; it->IsFound(); it->Next()) { |
| 547 bool check_prototype) { | 571 if (it->state() == LookupIterator::PROPERTY && |
| 548 if (result->IsInterceptor()) { | 572 it->HasProperty() && |
| 549 result->holder()->LookupOwnRealNamedProperty(name, result); | 573 it->property_type() == LookupIterator::ACCESSORS) { |
| 550 } | 574 Handle<Object> accessors = it->GetAccessors(); |
| 551 | 575 if (accessors->IsAccessorInfo()) { |
| 552 while (result->IsProperty()) { | 576 if (AccessorInfo::cast(*accessors)->all_can_read()) return true; |
| 553 if (result->type() == CALLBACKS) { | 577 } else if (accessors->IsAccessorPair()) { |
| 554 Object* callback_obj = result->GetCallbackObject(); | 578 if (AccessorPair::cast(*accessors)->all_can_read()) return true; |
| 555 if (callback_obj->IsAccessorInfo()) { | |
| 556 if (AccessorInfo::cast(callback_obj)->all_can_read()) return true; | |
| 557 } else if (callback_obj->IsAccessorPair()) { | |
| 558 if (AccessorPair::cast(callback_obj)->all_can_read()) return true; | |
| 559 } | 579 } |
| 560 } | 580 } |
| 561 if (!check_prototype) break; | |
| 562 result->holder()->LookupRealNamedPropertyInPrototypes(name, result); | |
| 563 } | 581 } |
| 564 return false; | 582 return false; |
| 565 } | 583 } |
| 566 | 584 |
| 567 | 585 |
| 568 MaybeHandle<Object> JSObject::GetPropertyWithFailedAccessCheck( | 586 MaybeHandle<Object> JSObject::GetPropertyWithFailedAccessCheck( |
| 569 Handle<JSObject> object, | 587 LookupIterator* it) { |
| 570 Handle<Object> receiver, | 588 Handle<JSObject> checked = Handle<JSObject>::cast(it->GetHolder()); |
| 571 LookupResult* result, | 589 if (FindAllCanReadHolder(it)) { |
| 572 Handle<Name> name, | 590 return GetPropertyWithAccessor( |
| 573 PropertyAttributes* attributes) { | 591 it->GetReceiver(), it->name(), it->GetHolder(), it->GetAccessors()); |
| 574 if (FindAllCanReadHolder(result, name, true)) { | |
| 575 *attributes = result->GetAttributes(); | |
| 576 Handle<JSObject> holder(result->holder()); | |
| 577 Handle<Object> callbacks(result->GetCallbackObject(), result->isolate()); | |
| 578 return GetPropertyWithCallback(receiver, name, holder, callbacks); | |
| 579 } | 592 } |
| 580 *attributes = ABSENT; | 593 it->isolate()->ReportFailedAccessCheck(checked, v8::ACCESS_GET); |
| 581 Isolate* isolate = result->isolate(); | 594 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); |
| 582 isolate->ReportFailedAccessCheck(object, v8::ACCESS_GET); | 595 return it->factory()->undefined_value(); |
| 583 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | |
| 584 return isolate->factory()->undefined_value(); | |
| 585 } | 596 } |
| 586 | 597 |
| 587 | 598 |
| 588 PropertyAttributes JSObject::GetPropertyAttributeWithFailedAccessCheck( | 599 PropertyAttributes JSObject::GetPropertyAttributeWithFailedAccessCheck( |
| 589 Handle<JSObject> object, | 600 Handle<JSObject> object, |
| 590 LookupResult* result, | 601 LookupResult* result, |
| 591 Handle<Name> name, | 602 Handle<Name> name, |
| 592 bool check_prototype) { | 603 bool check_prototype) { |
| 593 if (FindAllCanReadHolder(result, name, check_prototype)) { | 604 LookupIterator::Type type = check_prototype |
| 594 return result->GetAttributes(); | 605 ? LookupIterator::CHECK_DERIVED |
| 595 } | 606 : LookupIterator::CHECK_OWN_REAL; |
| 596 result->isolate()->ReportFailedAccessCheck(object, v8::ACCESS_HAS); | 607 LookupIterator it(object, name, object, type); |
| 608 if (FindAllCanReadHolder(&it)) return it.property_details().attributes(); |
| 609 it.isolate()->ReportFailedAccessCheck(object, v8::ACCESS_HAS); |
| 597 // TODO(yangguo): Issue 3269, check for scheduled exception missing? | 610 // TODO(yangguo): Issue 3269, check for scheduled exception missing? |
| 598 return ABSENT; | 611 return ABSENT; |
| 599 } | 612 } |
| 600 | 613 |
| 601 | 614 |
| 602 static bool FindAllCanWriteHolder(LookupResult* result, | 615 static bool FindAllCanWriteHolder(LookupResult* result, |
| 603 Handle<Name> name, | 616 Handle<Name> name, |
| 604 bool check_prototype) { | 617 bool check_prototype) { |
| 605 if (result->IsInterceptor()) { | 618 if (result->IsInterceptor()) { |
| 606 result->holder()->LookupOwnRealNamedProperty(name, result); | 619 result->holder()->LookupOwnRealNamedProperty(name, result); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 if (!fun->shared()->IsApiFunction()) | 799 if (!fun->shared()->IsApiFunction()) |
| 787 return true; | 800 return true; |
| 788 // If the object is fully fast case and has the same map it was | 801 // If the object is fully fast case and has the same map it was |
| 789 // created with then no changes can have been made to it. | 802 // created with then no changes can have been made to it. |
| 790 return map() != fun->initial_map() | 803 return map() != fun->initial_map() |
| 791 || !HasFastObjectElements() | 804 || !HasFastObjectElements() |
| 792 || !HasFastProperties(); | 805 || !HasFastProperties(); |
| 793 } | 806 } |
| 794 | 807 |
| 795 | 808 |
| 796 MaybeHandle<Object> Object::GetProperty(Handle<Object> object, | |
| 797 Handle<Object> receiver, | |
| 798 LookupResult* result, | |
| 799 Handle<Name> name, | |
| 800 PropertyAttributes* attributes) { | |
| 801 Isolate* isolate = name->GetIsolate(); | |
| 802 Factory* factory = isolate->factory(); | |
| 803 | |
| 804 // Make sure that the top context does not change when doing | |
| 805 // callbacks or interceptor calls. | |
| 806 AssertNoContextChange ncc(isolate); | |
| 807 | |
| 808 // Traverse the prototype chain from the current object (this) to | |
| 809 // the holder and check for access rights. This avoids traversing the | |
| 810 // objects more than once in case of interceptors, because the | |
| 811 // holder will always be the interceptor holder and the search may | |
| 812 // only continue with a current object just after the interceptor | |
| 813 // holder in the prototype chain. | |
| 814 // Proxy handlers do not use the proxy's prototype, so we can skip this. | |
| 815 if (!result->IsHandler()) { | |
| 816 ASSERT(*object != object->GetPrototype(isolate)); | |
| 817 Handle<Object> last = result->IsProperty() | |
| 818 ? handle(result->holder()->GetPrototype(), isolate) | |
| 819 : Handle<Object>::cast(factory->null_value()); | |
| 820 for (Handle<Object> current = object; | |
| 821 !current.is_identical_to(last); | |
| 822 current = Object::GetPrototype(isolate, current)) { | |
| 823 if (current->IsAccessCheckNeeded()) { | |
| 824 // Check if we're allowed to read from the current object. Note | |
| 825 // that even though we may not actually end up loading the named | |
| 826 // property from the current object, we still check that we have | |
| 827 // access to it. | |
| 828 Handle<JSObject> checked = Handle<JSObject>::cast(current); | |
| 829 if (!isolate->MayNamedAccess(checked, name, v8::ACCESS_GET)) { | |
| 830 return JSObject::GetPropertyWithFailedAccessCheck( | |
| 831 checked, receiver, result, name, attributes); | |
| 832 } | |
| 833 } | |
| 834 } | |
| 835 } | |
| 836 | |
| 837 if (!result->IsProperty()) { | |
| 838 *attributes = ABSENT; | |
| 839 return factory->undefined_value(); | |
| 840 } | |
| 841 *attributes = result->GetAttributes(); | |
| 842 | |
| 843 Handle<Object> value; | |
| 844 switch (result->type()) { | |
| 845 case NORMAL: { | |
| 846 value = JSObject::GetNormalizedProperty( | |
| 847 handle(result->holder(), isolate), result); | |
| 848 break; | |
| 849 } | |
| 850 case FIELD: | |
| 851 value = JSObject::FastPropertyAt(handle(result->holder(), isolate), | |
| 852 result->representation(), FieldIndex::ForLookupResult(result)); | |
| 853 break; | |
| 854 case CONSTANT: | |
| 855 return handle(result->GetConstant(), isolate); | |
| 856 case CALLBACKS: | |
| 857 return GetPropertyWithCallback( | |
| 858 receiver, name, handle(result->holder(), isolate), | |
| 859 handle(result->GetCallbackObject(), isolate)); | |
| 860 case HANDLER: | |
| 861 return JSProxy::GetPropertyWithHandler( | |
| 862 handle(result->proxy(), isolate), receiver, name); | |
| 863 case INTERCEPTOR: | |
| 864 return JSObject::GetPropertyWithInterceptor( | |
| 865 handle(result->holder(), isolate), receiver, name, attributes); | |
| 866 case NONEXISTENT: | |
| 867 UNREACHABLE(); | |
| 868 break; | |
| 869 } | |
| 870 ASSERT(!value->IsTheHole() || result->IsReadOnly()); | |
| 871 return value->IsTheHole() ? Handle<Object>::cast(factory->undefined_value()) | |
| 872 : value; | |
| 873 } | |
| 874 | |
| 875 | |
| 876 MaybeHandle<Object> Object::GetElementWithReceiver(Isolate* isolate, | 809 MaybeHandle<Object> Object::GetElementWithReceiver(Isolate* isolate, |
| 877 Handle<Object> object, | 810 Handle<Object> object, |
| 878 Handle<Object> receiver, | 811 Handle<Object> receiver, |
| 879 uint32_t index) { | 812 uint32_t index) { |
| 880 Handle<Object> holder; | 813 Handle<Object> holder; |
| 881 | 814 |
| 882 // Iterate up the prototype chain until an element is found or the null | 815 // Iterate up the prototype chain until an element is found or the null |
| 883 // prototype is encountered. | 816 // prototype is encountered. |
| 884 for (holder = object; | 817 for (holder = object; |
| 885 !holder->IsNull(); | 818 !holder->IsNull(); |
| (...skipping 12876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13762 InterceptorInfo* JSObject::GetIndexedInterceptor() { | 13695 InterceptorInfo* JSObject::GetIndexedInterceptor() { |
| 13763 ASSERT(map()->has_indexed_interceptor()); | 13696 ASSERT(map()->has_indexed_interceptor()); |
| 13764 JSFunction* constructor = JSFunction::cast(map()->constructor()); | 13697 JSFunction* constructor = JSFunction::cast(map()->constructor()); |
| 13765 ASSERT(constructor->shared()->IsApiFunction()); | 13698 ASSERT(constructor->shared()->IsApiFunction()); |
| 13766 Object* result = | 13699 Object* result = |
| 13767 constructor->shared()->get_api_func_data()->indexed_property_handler(); | 13700 constructor->shared()->get_api_func_data()->indexed_property_handler(); |
| 13768 return InterceptorInfo::cast(result); | 13701 return InterceptorInfo::cast(result); |
| 13769 } | 13702 } |
| 13770 | 13703 |
| 13771 | 13704 |
| 13772 MaybeHandle<Object> JSObject::GetPropertyPostInterceptor( | |
| 13773 Handle<JSObject> object, | |
| 13774 Handle<Object> receiver, | |
| 13775 Handle<Name> name, | |
| 13776 PropertyAttributes* attributes) { | |
| 13777 // Check own property in holder, ignore interceptor. | |
| 13778 Isolate* isolate = object->GetIsolate(); | |
| 13779 LookupResult lookup(isolate); | |
| 13780 object->LookupOwnRealNamedProperty(name, &lookup); | |
| 13781 if (lookup.IsFound()) { | |
| 13782 return GetProperty(object, receiver, &lookup, name, attributes); | |
| 13783 } else { | |
| 13784 // Continue searching via the prototype chain. | |
| 13785 Handle<Object> prototype(object->GetPrototype(), isolate); | |
| 13786 *attributes = ABSENT; | |
| 13787 if (prototype->IsNull()) return isolate->factory()->undefined_value(); | |
| 13788 return GetPropertyWithReceiver(prototype, receiver, name, attributes); | |
| 13789 } | |
| 13790 } | |
| 13791 | |
| 13792 | |
| 13793 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor( | 13705 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor( |
| 13794 Handle<JSObject> object, | 13706 Handle<JSObject> holder, |
| 13795 Handle<Object> receiver, | 13707 Handle<Object> receiver, |
| 13796 Handle<Name> name, | 13708 Handle<Name> name) { |
| 13797 PropertyAttributes* attributes) { | 13709 Isolate* isolate = holder->GetIsolate(); |
| 13798 Isolate* isolate = object->GetIsolate(); | |
| 13799 | 13710 |
| 13800 // TODO(rossberg): Support symbols in the API. | 13711 // TODO(rossberg): Support symbols in the API. |
| 13801 if (name->IsSymbol()) return isolate->factory()->undefined_value(); | 13712 if (name->IsSymbol()) return isolate->factory()->undefined_value(); |
| 13802 | 13713 |
| 13803 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor(), isolate); | 13714 Handle<InterceptorInfo> interceptor(holder->GetNamedInterceptor(), isolate); |
| 13804 Handle<String> name_string = Handle<String>::cast(name); | 13715 Handle<String> name_string = Handle<String>::cast(name); |
| 13805 | 13716 |
| 13806 if (!interceptor->getter()->IsUndefined()) { | 13717 if (interceptor->getter()->IsUndefined()) return MaybeHandle<Object>(); |
| 13807 v8::NamedPropertyGetterCallback getter = | |
| 13808 v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter()); | |
| 13809 LOG(isolate, | |
| 13810 ApiNamedPropertyAccess("interceptor-named-get", *object, *name)); | |
| 13811 PropertyCallbackArguments | |
| 13812 args(isolate, interceptor->data(), *receiver, *object); | |
| 13813 v8::Handle<v8::Value> result = | |
| 13814 args.Call(getter, v8::Utils::ToLocal(name_string)); | |
| 13815 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | |
| 13816 if (!result.IsEmpty()) { | |
| 13817 *attributes = NONE; | |
| 13818 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); | |
| 13819 result_internal->VerifyApiCallResultType(); | |
| 13820 // Rebox handle before return. | |
| 13821 return handle(*result_internal, isolate); | |
| 13822 } | |
| 13823 } | |
| 13824 | 13718 |
| 13825 return GetPropertyPostInterceptor(object, receiver, name, attributes); | 13719 v8::NamedPropertyGetterCallback getter = |
| 13720 v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter()); |
| 13721 LOG(isolate, |
| 13722 ApiNamedPropertyAccess("interceptor-named-get", *holder, *name)); |
| 13723 PropertyCallbackArguments |
| 13724 args(isolate, interceptor->data(), *receiver, *holder); |
| 13725 v8::Handle<v8::Value> result = |
| 13726 args.Call(getter, v8::Utils::ToLocal(name_string)); |
| 13727 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
| 13728 if (result.IsEmpty()) return MaybeHandle<Object>(); |
| 13729 |
| 13730 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
| 13731 result_internal->VerifyApiCallResultType(); |
| 13732 // Rebox handle before return |
| 13733 return handle(*result_internal, isolate); |
| 13826 } | 13734 } |
| 13827 | 13735 |
| 13828 | 13736 |
| 13829 // Compute the property keys from the interceptor. | 13737 // Compute the property keys from the interceptor. |
| 13830 // TODO(rossberg): support symbols in API, and filter here if needed. | 13738 // TODO(rossberg): support symbols in API, and filter here if needed. |
| 13831 MaybeHandle<JSObject> JSObject::GetKeysForNamedInterceptor( | 13739 MaybeHandle<JSObject> JSObject::GetKeysForNamedInterceptor( |
| 13832 Handle<JSObject> object, Handle<JSReceiver> receiver) { | 13740 Handle<JSObject> object, Handle<JSReceiver> receiver) { |
| 13833 Isolate* isolate = receiver->GetIsolate(); | 13741 Isolate* isolate = receiver->GetIsolate(); |
| 13834 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); | 13742 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); |
| 13835 PropertyCallbackArguments | 13743 PropertyCallbackArguments |
| (...skipping 3353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17189 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17097 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 17190 static const char* error_messages_[] = { | 17098 static const char* error_messages_[] = { |
| 17191 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17099 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 17192 }; | 17100 }; |
| 17193 #undef ERROR_MESSAGES_TEXTS | 17101 #undef ERROR_MESSAGES_TEXTS |
| 17194 return error_messages_[reason]; | 17102 return error_messages_[reason]; |
| 17195 } | 17103 } |
| 17196 | 17104 |
| 17197 | 17105 |
| 17198 } } // namespace v8::internal | 17106 } } // namespace v8::internal |
| OLD | NEW |