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

Side by Side Diff: src/objects.cc

Issue 197813004: Handlify PropertyAttribute lookups. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment Created 6 years, 9 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/objects.h ('k') | src/objects-inl.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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 615
616 // No accessible property found. 616 // No accessible property found.
617 *attributes = ABSENT; 617 *attributes = ABSENT;
618 isolate->ReportFailedAccessCheckWrapper(object, v8::ACCESS_GET); 618 isolate->ReportFailedAccessCheckWrapper(object, v8::ACCESS_GET);
619 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); 619 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
620 return isolate->factory()->undefined_value(); 620 return isolate->factory()->undefined_value();
621 } 621 }
622 622
623 623
624 PropertyAttributes JSObject::GetPropertyAttributeWithFailedAccessCheck( 624 PropertyAttributes JSObject::GetPropertyAttributeWithFailedAccessCheck(
625 Object* receiver, 625 Handle<JSObject> object,
626 LookupResult* result, 626 LookupResult* result,
627 Name* name, 627 Handle<Name> name,
628 bool continue_search) { 628 bool continue_search) {
629 if (result->IsProperty()) { 629 if (result->IsProperty()) {
630 switch (result->type()) { 630 switch (result->type()) {
631 case CALLBACKS: { 631 case CALLBACKS: {
632 // Only allow API accessors. 632 // Only allow API accessors.
633 Object* obj = result->GetCallbackObject(); 633 Handle<Object> obj(result->GetCallbackObject(), object->GetIsolate());
634 if (obj->IsAccessorInfo()) { 634 if (obj->IsAccessorInfo()) {
635 AccessorInfo* info = AccessorInfo::cast(obj); 635 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(obj);
636 if (info->all_can_read()) { 636 if (info->all_can_read()) {
637 return result->GetAttributes(); 637 return result->GetAttributes();
638 } 638 }
639 } else if (obj->IsAccessorPair()) { 639 } else if (obj->IsAccessorPair()) {
640 AccessorPair* pair = AccessorPair::cast(obj); 640 Handle<AccessorPair> pair = Handle<AccessorPair>::cast(obj);
641 if (pair->all_can_read()) { 641 if (pair->all_can_read()) {
642 return result->GetAttributes(); 642 return result->GetAttributes();
643 } 643 }
644 } 644 }
645 break; 645 break;
646 } 646 }
647 647
648 case NORMAL: 648 case NORMAL:
649 case FIELD: 649 case FIELD:
650 case CONSTANT: { 650 case CONSTANT: {
651 if (!continue_search) break; 651 if (!continue_search) break;
652 // Search ALL_CAN_READ accessors in prototype chain. 652 // Search ALL_CAN_READ accessors in prototype chain.
653 LookupResult r(GetIsolate()); 653 LookupResult r(object->GetIsolate());
654 result->holder()->LookupRealNamedPropertyInPrototypes(name, &r); 654 result->holder()->LookupRealNamedPropertyInPrototypes(*name, &r);
655 if (r.IsProperty()) { 655 if (r.IsProperty()) {
656 return GetPropertyAttributeWithFailedAccessCheck(receiver, 656 return GetPropertyAttributeWithFailedAccessCheck(
657 &r, 657 object, &r, name, continue_search);
658 name,
659 continue_search);
660 } 658 }
661 break; 659 break;
662 } 660 }
663 661
664 case INTERCEPTOR: { 662 case INTERCEPTOR: {
665 // If the object has an interceptor, try real named properties. 663 // If the object has an interceptor, try real named properties.
666 // No access check in GetPropertyAttributeWithInterceptor. 664 // No access check in GetPropertyAttributeWithInterceptor.
667 LookupResult r(GetIsolate()); 665 LookupResult r(object->GetIsolate());
668 if (continue_search) { 666 if (continue_search) {
669 result->holder()->LookupRealNamedProperty(name, &r); 667 result->holder()->LookupRealNamedProperty(*name, &r);
670 } else { 668 } else {
671 result->holder()->LocalLookupRealNamedProperty(name, &r); 669 result->holder()->LocalLookupRealNamedProperty(*name, &r);
672 } 670 }
673 if (!r.IsFound()) break; 671 if (!r.IsFound()) break;
674 return GetPropertyAttributeWithFailedAccessCheck(receiver, 672 return GetPropertyAttributeWithFailedAccessCheck(
675 &r, 673 object, &r, name, continue_search);
676 name,
677 continue_search);
678 } 674 }
679 675
680 case HANDLER: 676 case HANDLER:
681 case TRANSITION: 677 case TRANSITION:
682 case NONEXISTENT: 678 case NONEXISTENT:
683 UNREACHABLE(); 679 UNREACHABLE();
684 } 680 }
685 } 681 }
686 682
687 GetIsolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS); 683 object->GetIsolate()->ReportFailedAccessCheckWrapper(object, v8::ACCESS_HAS);
688 return ABSENT; 684 return ABSENT;
689 } 685 }
690 686
691 687
692 Object* JSObject::GetNormalizedProperty(const LookupResult* result) { 688 Object* JSObject::GetNormalizedProperty(const LookupResult* result) {
693 ASSERT(!HasFastProperties()); 689 ASSERT(!HasFastProperties());
694 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry()); 690 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry());
695 if (IsGlobalObject()) { 691 if (IsGlobalObject()) {
696 value = PropertyCell::cast(value)->value(); 692 value = PropertyCell::cast(value)->value();
697 } 693 }
(...skipping 2357 matching lines...) Expand 10 before | Expand all | Expand 10 after
3055 LookupResult result(isolate); 3051 LookupResult result(isolate);
3056 object->LookupRealNamedPropertyInPrototypes(*name, &result); 3052 object->LookupRealNamedPropertyInPrototypes(*name, &result);
3057 if (result.IsFound()) { 3053 if (result.IsFound()) {
3058 switch (result.type()) { 3054 switch (result.type()) {
3059 case NORMAL: 3055 case NORMAL:
3060 case FIELD: 3056 case FIELD:
3061 case CONSTANT: 3057 case CONSTANT:
3062 *done = result.IsReadOnly(); 3058 *done = result.IsReadOnly();
3063 break; 3059 break;
3064 case INTERCEPTOR: { 3060 case INTERCEPTOR: {
3065 PropertyAttributes attr = 3061 PropertyAttributes attr = GetPropertyAttributeWithInterceptor(
3066 result.holder()->GetPropertyAttributeWithInterceptor( 3062 handle(result.holder()), object, name, true);
3067 *object, *name, true);
3068 *done = !!(attr & READ_ONLY); 3063 *done = !!(attr & READ_ONLY);
3069 break; 3064 break;
3070 } 3065 }
3071 case CALLBACKS: { 3066 case CALLBACKS: {
3072 *done = true; 3067 *done = true;
3073 Handle<Object> callback_object(result.GetCallbackObject(), isolate); 3068 Handle<Object> callback_object(result.GetCallbackObject(), isolate);
3074 return SetPropertyWithCallback(object, callback_object, name, value, 3069 return SetPropertyWithCallback(object, callback_object, name, value,
3075 handle(result.holder()), strict_mode); 3070 handle(result.holder()), strict_mode);
3076 } 3071 }
3077 case HANDLER: { 3072 case HANDLER: {
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
3700 3695
3701 3696
3702 Handle<Object> JSProxy::DeleteElementWithHandler( 3697 Handle<Object> JSProxy::DeleteElementWithHandler(
3703 Handle<JSProxy> proxy, uint32_t index, DeleteMode mode) { 3698 Handle<JSProxy> proxy, uint32_t index, DeleteMode mode) {
3704 Isolate* isolate = proxy->GetIsolate(); 3699 Isolate* isolate = proxy->GetIsolate();
3705 Handle<String> name = isolate->factory()->Uint32ToString(index); 3700 Handle<String> name = isolate->factory()->Uint32ToString(index);
3706 return JSProxy::DeletePropertyWithHandler(proxy, name, mode); 3701 return JSProxy::DeletePropertyWithHandler(proxy, name, mode);
3707 } 3702 }
3708 3703
3709 3704
3710 MUST_USE_RESULT PropertyAttributes JSProxy::GetPropertyAttributeWithHandler( 3705 PropertyAttributes JSProxy::GetPropertyAttributeWithHandler(
3711 JSReceiver* receiver_raw, 3706 Handle<JSProxy> proxy,
3712 Name* name_raw) { 3707 Handle<JSReceiver> receiver,
3713 Isolate* isolate = GetIsolate(); 3708 Handle<Name> name) {
3709 Isolate* isolate = proxy->GetIsolate();
3714 HandleScope scope(isolate); 3710 HandleScope scope(isolate);
3715 Handle<JSProxy> proxy(this);
3716 Handle<Object> handler(this->handler(), isolate); // Trap might morph proxy.
3717 Handle<JSReceiver> receiver(receiver_raw);
3718 Handle<Object> name(name_raw, isolate);
3719 3711
3720 // TODO(rossberg): adjust once there is a story for symbols vs proxies. 3712 // TODO(rossberg): adjust once there is a story for symbols vs proxies.
3721 if (name->IsSymbol()) return ABSENT; 3713 if (name->IsSymbol()) return ABSENT;
3722 3714
3723 Handle<Object> args[] = { name }; 3715 Handle<Object> args[] = { name };
3724 Handle<Object> result = CallTrap( 3716 Handle<Object> result = proxy->CallTrap(
3725 "getPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args); 3717 "getPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args);
3726 if (isolate->has_pending_exception()) return NONE; 3718 if (isolate->has_pending_exception()) return NONE;
3727 3719
3728 if (result->IsUndefined()) return ABSENT; 3720 if (result->IsUndefined()) return ABSENT;
3729 3721
3730 bool has_pending_exception; 3722 bool has_pending_exception;
3731 Handle<Object> argv[] = { result }; 3723 Handle<Object> argv[] = { result };
3732 Handle<Object> desc = Execution::Call( 3724 Handle<Object> desc = Execution::Call(
3733 isolate, isolate->to_complete_property_descriptor(), result, 3725 isolate, isolate->to_complete_property_descriptor(), result,
3734 ARRAY_SIZE(argv), argv, &has_pending_exception); 3726 ARRAY_SIZE(argv), argv, &has_pending_exception);
(...skipping 14 matching lines...) Expand all
3749 if (isolate->has_pending_exception()) return NONE; 3741 if (isolate->has_pending_exception()) return NONE;
3750 if (!writable->BooleanValue()) { 3742 if (!writable->BooleanValue()) {
3751 Handle<String> set_n = isolate->factory()->InternalizeOneByteString( 3743 Handle<String> set_n = isolate->factory()->InternalizeOneByteString(
3752 STATIC_ASCII_VECTOR("set_")); 3744 STATIC_ASCII_VECTOR("set_"));
3753 Handle<Object> setter(v8::internal::GetProperty(isolate, desc, set_n)); 3745 Handle<Object> setter(v8::internal::GetProperty(isolate, desc, set_n));
3754 if (isolate->has_pending_exception()) return NONE; 3746 if (isolate->has_pending_exception()) return NONE;
3755 writable = isolate->factory()->ToBoolean(!setter->IsUndefined()); 3747 writable = isolate->factory()->ToBoolean(!setter->IsUndefined());
3756 } 3748 }
3757 3749
3758 if (configurable->IsFalse()) { 3750 if (configurable->IsFalse()) {
3751 Handle<Object> handler(proxy->handler(), isolate);
3759 Handle<String> trap = isolate->factory()->InternalizeOneByteString( 3752 Handle<String> trap = isolate->factory()->InternalizeOneByteString(
3760 STATIC_ASCII_VECTOR("getPropertyDescriptor")); 3753 STATIC_ASCII_VECTOR("getPropertyDescriptor"));
3761 Handle<Object> args[] = { handler, trap, name }; 3754 Handle<Object> args[] = { handler, trap, name };
3762 Handle<Object> error = isolate->factory()->NewTypeError( 3755 Handle<Object> error = isolate->factory()->NewTypeError(
3763 "proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args))); 3756 "proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args)));
3764 isolate->Throw(*error); 3757 isolate->Throw(*error);
3765 return NONE; 3758 return NONE;
3766 } 3759 }
3767 3760
3768 int attributes = NONE; 3761 int attributes = NONE;
3769 if (!enumerable->BooleanValue()) attributes |= DONT_ENUM; 3762 if (!enumerable->BooleanValue()) attributes |= DONT_ENUM;
3770 if (!configurable->BooleanValue()) attributes |= DONT_DELETE; 3763 if (!configurable->BooleanValue()) attributes |= DONT_DELETE;
3771 if (!writable->BooleanValue()) attributes |= READ_ONLY; 3764 if (!writable->BooleanValue()) attributes |= READ_ONLY;
3772 return static_cast<PropertyAttributes>(attributes); 3765 return static_cast<PropertyAttributes>(attributes);
3773 } 3766 }
3774 3767
3775 3768
3776 MUST_USE_RESULT PropertyAttributes JSProxy::GetElementAttributeWithHandler( 3769 PropertyAttributes JSProxy::GetElementAttributeWithHandler(
3777 JSReceiver* receiver_raw, 3770 Handle<JSProxy> proxy,
3771 Handle<JSReceiver> receiver,
3778 uint32_t index) { 3772 uint32_t index) {
3779 Isolate* isolate = GetIsolate(); 3773 Isolate* isolate = proxy->GetIsolate();
3780 HandleScope scope(isolate);
3781 Handle<JSProxy> proxy(this);
3782 Handle<JSReceiver> receiver(receiver_raw);
3783 Handle<String> name = isolate->factory()->Uint32ToString(index); 3774 Handle<String> name = isolate->factory()->Uint32ToString(index);
3784 return proxy->GetPropertyAttributeWithHandler(*receiver, *name); 3775 return GetPropertyAttributeWithHandler(proxy, receiver, name);
3785 } 3776 }
3786 3777
3787 3778
3788 void JSProxy::Fix(Handle<JSProxy> proxy) { 3779 void JSProxy::Fix(Handle<JSProxy> proxy) {
3789 Isolate* isolate = proxy->GetIsolate(); 3780 Isolate* isolate = proxy->GetIsolate();
3790 3781
3791 // Save identity hash. 3782 // Save identity hash.
3792 Handle<Object> hash(proxy->GetIdentityHash(), isolate); 3783 Handle<Object> hash(proxy->GetIdentityHash(), isolate);
3793 3784
3794 if (proxy->IsJSFunctionProxy()) { 3785 if (proxy->IsJSFunctionProxy()) {
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
4259 EnqueueChangeRecord(object, "update", name, old_value); 4250 EnqueueChangeRecord(object, "update", name, old_value);
4260 } 4251 }
4261 } 4252 }
4262 } 4253 }
4263 4254
4264 return value; 4255 return value;
4265 } 4256 }
4266 4257
4267 4258
4268 PropertyAttributes JSObject::GetPropertyAttributePostInterceptor( 4259 PropertyAttributes JSObject::GetPropertyAttributePostInterceptor(
4269 JSObject* receiver, 4260 Handle<JSObject> object,
4270 Name* name, 4261 Handle<JSObject> receiver,
4271 bool continue_search) { 4262 Handle<Name> name,
4263 bool continue_search) {
4272 // Check local property, ignore interceptor. 4264 // Check local property, ignore interceptor.
4273 LookupResult result(GetIsolate()); 4265 Isolate* isolate = object->GetIsolate();
4274 LocalLookupRealNamedProperty(name, &result); 4266 LookupResult result(isolate);
4267 object->LocalLookupRealNamedProperty(*name, &result);
4275 if (result.IsFound()) return result.GetAttributes(); 4268 if (result.IsFound()) return result.GetAttributes();
4276 4269
4277 if (continue_search) { 4270 if (continue_search) {
4278 // Continue searching via the prototype chain. 4271 // Continue searching via the prototype chain.
4279 Object* pt = GetPrototype(); 4272 Handle<Object> proto(object->GetPrototype(), isolate);
4280 if (!pt->IsNull()) { 4273 if (!proto->IsNull()) {
4281 return JSObject::cast(pt)-> 4274 return JSReceiver::GetPropertyAttributeWithReceiver(
4282 GetPropertyAttributeWithReceiver(receiver, name); 4275 Handle<JSObject>::cast(proto), receiver, name);
4283 } 4276 }
4284 } 4277 }
4285 return ABSENT; 4278 return ABSENT;
4286 } 4279 }
4287 4280
4288 4281
4289 PropertyAttributes JSObject::GetPropertyAttributeWithInterceptor( 4282 PropertyAttributes JSObject::GetPropertyAttributeWithInterceptor(
4290 JSObject* receiver, 4283 Handle<JSObject> object,
4291 Name* name, 4284 Handle<JSObject> receiver,
4292 bool continue_search) { 4285 Handle<Name> name,
4286 bool continue_search) {
4293 // TODO(rossberg): Support symbols in the API. 4287 // TODO(rossberg): Support symbols in the API.
4294 if (name->IsSymbol()) return ABSENT; 4288 if (name->IsSymbol()) return ABSENT;
4295 4289
4296 Isolate* isolate = GetIsolate(); 4290 Isolate* isolate = object->GetIsolate();
4297 HandleScope scope(isolate); 4291 HandleScope scope(isolate);
4298 4292
4299 // Make sure that the top context does not change when doing 4293 // Make sure that the top context does not change when doing
4300 // callbacks or interceptor calls. 4294 // callbacks or interceptor calls.
4301 AssertNoContextChange ncc(isolate); 4295 AssertNoContextChange ncc(isolate);
4302 4296
4303 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); 4297 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor());
4304 Handle<JSObject> receiver_handle(receiver); 4298 PropertyCallbackArguments args(
4305 Handle<JSObject> holder_handle(this); 4299 isolate, interceptor->data(), *receiver, *object);
4306 Handle<String> name_handle(String::cast(name));
4307 PropertyCallbackArguments args(isolate, interceptor->data(), receiver, this);
4308 if (!interceptor->query()->IsUndefined()) { 4300 if (!interceptor->query()->IsUndefined()) {
4309 v8::NamedPropertyQueryCallback query = 4301 v8::NamedPropertyQueryCallback query =
4310 v8::ToCData<v8::NamedPropertyQueryCallback>(interceptor->query()); 4302 v8::ToCData<v8::NamedPropertyQueryCallback>(interceptor->query());
4311 LOG(isolate, 4303 LOG(isolate,
4312 ApiNamedPropertyAccess("interceptor-named-has", *holder_handle, name)); 4304 ApiNamedPropertyAccess("interceptor-named-has", *object, *name));
4313 v8::Handle<v8::Integer> result = 4305 v8::Handle<v8::Integer> result =
4314 args.Call(query, v8::Utils::ToLocal(name_handle)); 4306 args.Call(query, v8::Utils::ToLocal(Handle<String>::cast(name)));
4315 if (!result.IsEmpty()) { 4307 if (!result.IsEmpty()) {
4316 ASSERT(result->IsInt32()); 4308 ASSERT(result->IsInt32());
4317 return static_cast<PropertyAttributes>(result->Int32Value()); 4309 return static_cast<PropertyAttributes>(result->Int32Value());
4318 } 4310 }
4319 } else if (!interceptor->getter()->IsUndefined()) { 4311 } else if (!interceptor->getter()->IsUndefined()) {
4320 v8::NamedPropertyGetterCallback getter = 4312 v8::NamedPropertyGetterCallback getter =
4321 v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter()); 4313 v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter());
4322 LOG(isolate, 4314 LOG(isolate,
4323 ApiNamedPropertyAccess("interceptor-named-get-has", this, name)); 4315 ApiNamedPropertyAccess("interceptor-named-get-has", *object, *name));
4324 v8::Handle<v8::Value> result = 4316 v8::Handle<v8::Value> result =
4325 args.Call(getter, v8::Utils::ToLocal(name_handle)); 4317 args.Call(getter, v8::Utils::ToLocal(Handle<String>::cast(name)));
4326 if (!result.IsEmpty()) return DONT_ENUM; 4318 if (!result.IsEmpty()) return DONT_ENUM;
4327 } 4319 }
4328 return holder_handle->GetPropertyAttributePostInterceptor(*receiver_handle, 4320 return GetPropertyAttributePostInterceptor(
4329 *name_handle, 4321 object, receiver, name, continue_search);
4330 continue_search);
4331 } 4322 }
4332 4323
4333 4324
4334 PropertyAttributes JSReceiver::GetPropertyAttributeWithReceiver( 4325 PropertyAttributes JSReceiver::GetPropertyAttributeWithReceiver(
4335 JSReceiver* receiver, 4326 Handle<JSReceiver> object,
4336 Name* key) { 4327 Handle<JSReceiver> receiver,
4328 Handle<Name> key) {
4337 uint32_t index = 0; 4329 uint32_t index = 0;
4338 if (IsJSObject() && key->AsArrayIndex(&index)) { 4330 if (object->IsJSObject() && key->AsArrayIndex(&index)) {
4339 return JSObject::cast(this)->GetElementAttributeWithReceiver( 4331 return JSObject::GetElementAttributeWithReceiver(
4340 receiver, index, true); 4332 Handle<JSObject>::cast(object), receiver, index, true);
4341 } 4333 }
4342 // Named property. 4334 // Named property.
4343 LookupResult lookup(GetIsolate()); 4335 LookupResult lookup(object->GetIsolate());
4344 Lookup(key, &lookup); 4336 object->Lookup(*key, &lookup);
4345 return GetPropertyAttributeForResult(receiver, &lookup, key, true); 4337 return GetPropertyAttributeForResult(object, receiver, &lookup, key, true);
4346 } 4338 }
4347 4339
4348 4340
4349 PropertyAttributes JSReceiver::GetPropertyAttributeForResult( 4341 PropertyAttributes JSReceiver::GetPropertyAttributeForResult(
4350 JSReceiver* receiver, 4342 Handle<JSReceiver> object,
4343 Handle<JSReceiver> receiver,
4351 LookupResult* lookup, 4344 LookupResult* lookup,
4352 Name* name, 4345 Handle<Name> name,
4353 bool continue_search) { 4346 bool continue_search) {
4354 // Check access rights if needed. 4347 // Check access rights if needed.
4355 if (IsAccessCheckNeeded()) { 4348 if (object->IsAccessCheckNeeded()) {
4356 JSObject* this_obj = JSObject::cast(this); 4349 Heap* heap = object->GetHeap();
4357 Heap* heap = GetHeap(); 4350 Handle<JSObject> obj = Handle<JSObject>::cast(object);
4358 if (!heap->isolate()->MayNamedAccess(this_obj, name, v8::ACCESS_HAS)) { 4351 if (!heap->isolate()->MayNamedAccessWrapper(obj, name, v8::ACCESS_HAS)) {
4359 return this_obj->GetPropertyAttributeWithFailedAccessCheck( 4352 return JSObject::GetPropertyAttributeWithFailedAccessCheck(
4360 receiver, lookup, name, continue_search); 4353 obj, lookup, name, continue_search);
4361 } 4354 }
4362 } 4355 }
4363 if (lookup->IsFound()) { 4356 if (lookup->IsFound()) {
4364 switch (lookup->type()) { 4357 switch (lookup->type()) {
4365 case NORMAL: // fall through 4358 case NORMAL: // fall through
4366 case FIELD: 4359 case FIELD:
4367 case CONSTANT: 4360 case CONSTANT:
4368 case CALLBACKS: 4361 case CALLBACKS:
4369 return lookup->GetAttributes(); 4362 return lookup->GetAttributes();
4370 case HANDLER: { 4363 case HANDLER: {
4371 return JSProxy::cast(lookup->proxy())->GetPropertyAttributeWithHandler( 4364 return JSProxy::GetPropertyAttributeWithHandler(
4372 receiver, name); 4365 handle(lookup->proxy()), receiver, name);
4373 } 4366 }
4374 case INTERCEPTOR: 4367 case INTERCEPTOR:
4375 return lookup->holder()->GetPropertyAttributeWithInterceptor( 4368 return JSObject::GetPropertyAttributeWithInterceptor(
4376 JSObject::cast(receiver), name, continue_search); 4369 handle(lookup->holder()),
4370 Handle<JSObject>::cast(receiver),
4371 name,
4372 continue_search);
4377 case TRANSITION: 4373 case TRANSITION:
4378 case NONEXISTENT: 4374 case NONEXISTENT:
4379 UNREACHABLE(); 4375 UNREACHABLE();
4380 } 4376 }
4381 } 4377 }
4382 return ABSENT; 4378 return ABSENT;
4383 } 4379 }
4384 4380
4385 4381
4386 PropertyAttributes JSReceiver::GetLocalPropertyAttribute(Name* name) { 4382 PropertyAttributes JSReceiver::GetLocalPropertyAttribute(
4383 Handle<JSReceiver> object, Handle<Name> name) {
4387 // Check whether the name is an array index. 4384 // Check whether the name is an array index.
4388 uint32_t index = 0; 4385 uint32_t index = 0;
4389 if (IsJSObject() && name->AsArrayIndex(&index)) { 4386 if (object->IsJSObject() && name->AsArrayIndex(&index)) {
4390 return GetLocalElementAttribute(index); 4387 return GetLocalElementAttribute(object, index);
4391 } 4388 }
4392 // Named property. 4389 // Named property.
4393 LookupResult lookup(GetIsolate()); 4390 LookupResult lookup(object->GetIsolate());
4394 LocalLookup(name, &lookup, true); 4391 object->LocalLookup(*name, &lookup, true);
4395 return GetPropertyAttributeForResult(this, &lookup, name, false); 4392 return GetPropertyAttributeForResult(object, object, &lookup, name, false);
4396 } 4393 }
4397 4394
4398 4395
4399 PropertyAttributes JSObject::GetElementAttributeWithReceiver( 4396 PropertyAttributes JSObject::GetElementAttributeWithReceiver(
4400 JSReceiver* receiver, uint32_t index, bool continue_search) { 4397 Handle<JSObject> object,
4401 Isolate* isolate = GetIsolate(); 4398 Handle<JSReceiver> receiver,
4399 uint32_t index,
4400 bool continue_search) {
4401 Isolate* isolate = object->GetIsolate();
4402 4402
4403 // Check access rights if needed. 4403 // Check access rights if needed.
4404 if (IsAccessCheckNeeded()) { 4404 if (object->IsAccessCheckNeeded()) {
4405 if (!isolate->MayIndexedAccess(this, index, v8::ACCESS_HAS)) { 4405 if (!isolate->MayIndexedAccessWrapper(object, index, v8::ACCESS_HAS)) {
4406 isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS); 4406 isolate->ReportFailedAccessCheckWrapper(object, v8::ACCESS_HAS);
4407 return ABSENT; 4407 return ABSENT;
4408 } 4408 }
4409 } 4409 }
4410 4410
4411 if (IsJSGlobalProxy()) { 4411 if (object->IsJSGlobalProxy()) {
4412 Object* proto = GetPrototype(); 4412 Handle<Object> proto(object->GetPrototype(), isolate);
4413 if (proto->IsNull()) return ABSENT; 4413 if (proto->IsNull()) return ABSENT;
4414 ASSERT(proto->IsJSGlobalObject()); 4414 ASSERT(proto->IsJSGlobalObject());
4415 return JSObject::cast(proto)->GetElementAttributeWithReceiver( 4415 return JSObject::GetElementAttributeWithReceiver(
4416 receiver, index, continue_search); 4416 Handle<JSObject>::cast(proto), receiver, index, continue_search);
4417 } 4417 }
4418 4418
4419 // Check for lookup interceptor except when bootstrapping. 4419 // Check for lookup interceptor except when bootstrapping.
4420 if (HasIndexedInterceptor() && !isolate->bootstrapper()->IsActive()) { 4420 if (object->HasIndexedInterceptor() && !isolate->bootstrapper()->IsActive()) {
4421 return GetElementAttributeWithInterceptor(receiver, index, continue_search); 4421 return JSObject::GetElementAttributeWithInterceptor(
4422 object, receiver, index, continue_search);
4422 } 4423 }
4423 4424
4424 return GetElementAttributeWithoutInterceptor( 4425 return GetElementAttributeWithoutInterceptor(
4425 receiver, index, continue_search); 4426 object, receiver, index, continue_search);
4426 } 4427 }
4427 4428
4428 4429
4429 PropertyAttributes JSObject::GetElementAttributeWithInterceptor( 4430 PropertyAttributes JSObject::GetElementAttributeWithInterceptor(
4430 JSReceiver* receiver, uint32_t index, bool continue_search) { 4431 Handle<JSObject> object,
4431 Isolate* isolate = GetIsolate(); 4432 Handle<JSReceiver> receiver,
4433 uint32_t index,
4434 bool continue_search) {
4435 Isolate* isolate = object->GetIsolate();
4432 HandleScope scope(isolate); 4436 HandleScope scope(isolate);
4433 4437
4434 // Make sure that the top context does not change when doing 4438 // Make sure that the top context does not change when doing
4435 // callbacks or interceptor calls. 4439 // callbacks or interceptor calls.
4436 AssertNoContextChange ncc(isolate); 4440 AssertNoContextChange ncc(isolate);
4437 4441
4438 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); 4442 Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor());
4439 Handle<JSReceiver> hreceiver(receiver); 4443 PropertyCallbackArguments args(
4440 Handle<JSObject> holder(this); 4444 isolate, interceptor->data(), *receiver, *object);
4441 PropertyCallbackArguments args(isolate, interceptor->data(), receiver, this);
4442 if (!interceptor->query()->IsUndefined()) { 4445 if (!interceptor->query()->IsUndefined()) {
4443 v8::IndexedPropertyQueryCallback query = 4446 v8::IndexedPropertyQueryCallback query =
4444 v8::ToCData<v8::IndexedPropertyQueryCallback>(interceptor->query()); 4447 v8::ToCData<v8::IndexedPropertyQueryCallback>(interceptor->query());
4445 LOG(isolate, 4448 LOG(isolate,
4446 ApiIndexedPropertyAccess("interceptor-indexed-has", this, index)); 4449 ApiIndexedPropertyAccess("interceptor-indexed-has", *object, index));
4447 v8::Handle<v8::Integer> result = args.Call(query, index); 4450 v8::Handle<v8::Integer> result = args.Call(query, index);
4448 if (!result.IsEmpty()) 4451 if (!result.IsEmpty())
4449 return static_cast<PropertyAttributes>(result->Int32Value()); 4452 return static_cast<PropertyAttributes>(result->Int32Value());
4450 } else if (!interceptor->getter()->IsUndefined()) { 4453 } else if (!interceptor->getter()->IsUndefined()) {
4451 v8::IndexedPropertyGetterCallback getter = 4454 v8::IndexedPropertyGetterCallback getter =
4452 v8::ToCData<v8::IndexedPropertyGetterCallback>(interceptor->getter()); 4455 v8::ToCData<v8::IndexedPropertyGetterCallback>(interceptor->getter());
4453 LOG(isolate, 4456 LOG(isolate,
4454 ApiIndexedPropertyAccess("interceptor-indexed-get-has", this, index)); 4457 ApiIndexedPropertyAccess(
4458 "interceptor-indexed-get-has", *object, index));
4455 v8::Handle<v8::Value> result = args.Call(getter, index); 4459 v8::Handle<v8::Value> result = args.Call(getter, index);
4456 if (!result.IsEmpty()) return NONE; 4460 if (!result.IsEmpty()) return NONE;
4457 } 4461 }
4458 4462
4459 return holder->GetElementAttributeWithoutInterceptor( 4463 return GetElementAttributeWithoutInterceptor(
4460 *hreceiver, index, continue_search); 4464 object, receiver, index, continue_search);
4461 } 4465 }
4462 4466
4463 4467
4464 PropertyAttributes JSObject::GetElementAttributeWithoutInterceptor( 4468 PropertyAttributes JSObject::GetElementAttributeWithoutInterceptor(
4465 JSReceiver* receiver, uint32_t index, bool continue_search) { 4469 Handle<JSObject> object,
4466 PropertyAttributes attr = GetElementsAccessor()->GetAttributes( 4470 Handle<JSReceiver> receiver,
4467 receiver, this, index); 4471 uint32_t index,
4472 bool continue_search) {
4473 PropertyAttributes attr = object->GetElementsAccessor()->GetAttributes(
4474 *receiver, *object, index);
4468 if (attr != ABSENT) return attr; 4475 if (attr != ABSENT) return attr;
4469 4476
4470 // Handle [] on String objects. 4477 // Handle [] on String objects.
4471 if (IsStringObjectWithCharacterAt(index)) { 4478 if (object->IsStringObjectWithCharacterAt(index)) {
4472 return static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE); 4479 return static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
4473 } 4480 }
4474 4481
4475 if (!continue_search) return ABSENT; 4482 if (!continue_search) return ABSENT;
4476 4483
4477 Object* pt = GetPrototype(); 4484 Handle<Object> proto(object->GetPrototype(), object->GetIsolate());
4478 if (pt->IsJSProxy()) { 4485 if (proto->IsJSProxy()) {
4479 // We need to follow the spec and simulate a call to [[GetOwnProperty]]. 4486 // We need to follow the spec and simulate a call to [[GetOwnProperty]].
4480 return JSProxy::cast(pt)->GetElementAttributeWithHandler(receiver, index); 4487 return JSProxy::GetElementAttributeWithHandler(
4488 Handle<JSProxy>::cast(proto), receiver, index);
4481 } 4489 }
4482 if (pt->IsNull()) return ABSENT; 4490 if (proto->IsNull()) return ABSENT;
4483 return JSObject::cast(pt)->GetElementAttributeWithReceiver( 4491 return GetElementAttributeWithReceiver(
4484 receiver, index, true); 4492 Handle<JSObject>::cast(proto), receiver, index, true);
4485 } 4493 }
4486 4494
4487 4495
4488 Handle<Map> NormalizedMapCache::Get(Handle<NormalizedMapCache> cache, 4496 Handle<Map> NormalizedMapCache::Get(Handle<NormalizedMapCache> cache,
4489 Handle<JSObject> obj, 4497 Handle<JSObject> obj,
4490 PropertyNormalizationMode mode) { 4498 PropertyNormalizationMode mode) {
4491 int index = obj->map()->Hash() % kEntries; 4499 int index = obj->map()->Hash() % kEntries;
4492 Handle<Object> result = handle(cache->get(index), cache->GetIsolate()); 4500 Handle<Object> result = handle(cache->get(index), cache->GetIsolate());
4493 if (result->IsMap() && 4501 if (result->IsMap() &&
4494 Handle<Map>::cast(result)->EquivalentToForNormalization(obj->map(), 4502 Handle<Map>::cast(result)->EquivalentToForNormalization(obj->map(),
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
4933 4941
4934 // We never delete (inline-stored) identity hashes. 4942 // We never delete (inline-stored) identity hashes.
4935 ASSERT(*key != *isolate->factory()->identity_hash_string()); 4943 ASSERT(*key != *isolate->factory()->identity_hash_string());
4936 if (inline_value->IsUndefined() || inline_value->IsSmi()) return; 4944 if (inline_value->IsUndefined() || inline_value->IsSmi()) return;
4937 4945
4938 Handle<ObjectHashTable> hashtable(ObjectHashTable::cast(inline_value)); 4946 Handle<ObjectHashTable> hashtable(ObjectHashTable::cast(inline_value));
4939 ObjectHashTable::Put(hashtable, key, isolate->factory()->the_hole_value()); 4947 ObjectHashTable::Put(hashtable, key, isolate->factory()->the_hole_value());
4940 } 4948 }
4941 4949
4942 4950
4943 bool JSObject::HasHiddenProperties() { 4951 bool JSObject::HasHiddenProperties(Handle<JSObject> object) {
4944 return GetPropertyAttributePostInterceptor(this, 4952 Handle<Name> hidden = object->GetIsolate()->factory()->hidden_string();
4945 GetHeap()->hidden_string(), 4953 return GetPropertyAttributePostInterceptor(
4946 false) != ABSENT; 4954 object, object, hidden, false) != ABSENT;
4947 } 4955 }
4948 4956
4949 4957
4950 Object* JSObject::GetHiddenPropertiesHashTable() { 4958 Object* JSObject::GetHiddenPropertiesHashTable() {
4951 ASSERT(!IsJSGlobalProxy()); 4959 ASSERT(!IsJSGlobalProxy());
4952 if (HasFastProperties()) { 4960 if (HasFastProperties()) {
4953 // If the object has fast properties, check whether the first slot 4961 // If the object has fast properties, check whether the first slot
4954 // in the descriptor array matches the hidden string. Since the 4962 // in the descriptor array matches the hidden string. Since the
4955 // hidden strings hash code is zero (and no other name has hash 4963 // hidden strings hash code is zero (and no other name has hash
4956 // code zero) it will always occupy the first entry if present. 4964 // code zero) it will always occupy the first entry if present.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
5017 5025
5018 5026
5019 Handle<Object> JSObject::SetHiddenPropertiesHashTable(Handle<JSObject> object, 5027 Handle<Object> JSObject::SetHiddenPropertiesHashTable(Handle<JSObject> object,
5020 Handle<Object> value) { 5028 Handle<Object> value) {
5021 ASSERT(!object->IsJSGlobalProxy()); 5029 ASSERT(!object->IsJSGlobalProxy());
5022 5030
5023 Isolate* isolate = object->GetIsolate(); 5031 Isolate* isolate = object->GetIsolate();
5024 5032
5025 // We can store the identity hash inline iff there is no backing store 5033 // We can store the identity hash inline iff there is no backing store
5026 // for hidden properties yet. 5034 // for hidden properties yet.
5027 ASSERT(object->HasHiddenProperties() != value->IsSmi()); 5035 ASSERT(JSObject::HasHiddenProperties(object) != value->IsSmi());
5028 if (object->HasFastProperties()) { 5036 if (object->HasFastProperties()) {
5029 // If the object has fast properties, check whether the first slot 5037 // If the object has fast properties, check whether the first slot
5030 // in the descriptor array matches the hidden string. Since the 5038 // in the descriptor array matches the hidden string. Since the
5031 // hidden strings hash code is zero (and no other name has hash 5039 // hidden strings hash code is zero (and no other name has hash
5032 // code zero) it will always occupy the first entry if present. 5040 // code zero) it will always occupy the first entry if present.
5033 DescriptorArray* descriptors = object->map()->instance_descriptors(); 5041 DescriptorArray* descriptors = object->map()->instance_descriptors();
5034 if (descriptors->number_of_descriptors() > 0) { 5042 if (descriptors->number_of_descriptors() > 0) {
5035 int sorted_index = descriptors->GetSortedKeyIndex(0); 5043 int sorted_index = descriptors->GetSortedKeyIndex(0);
5036 if (descriptors->GetKey(sorted_index) == isolate->heap()->hidden_string() 5044 if (descriptors->GetKey(sorted_index) == isolate->heap()->hidden_string()
5037 && sorted_index < object->map()->NumberOfOwnDescriptors()) { 5045 && sorted_index < object->map()->NumberOfOwnDescriptors()) {
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
5767 } 5775 }
5768 } 5776 }
5769 } else { 5777 } else {
5770 Handle<FixedArray> names = 5778 Handle<FixedArray> names =
5771 isolate->factory()->NewFixedArray(copy->NumberOfLocalProperties()); 5779 isolate->factory()->NewFixedArray(copy->NumberOfLocalProperties());
5772 copy->GetLocalPropertyNames(*names, 0); 5780 copy->GetLocalPropertyNames(*names, 0);
5773 for (int i = 0; i < names->length(); i++) { 5781 for (int i = 0; i < names->length(); i++) {
5774 ASSERT(names->get(i)->IsString()); 5782 ASSERT(names->get(i)->IsString());
5775 Handle<String> key_string(String::cast(names->get(i))); 5783 Handle<String> key_string(String::cast(names->get(i)));
5776 PropertyAttributes attributes = 5784 PropertyAttributes attributes =
5777 copy->GetLocalPropertyAttribute(*key_string); 5785 JSReceiver::GetLocalPropertyAttribute(copy, key_string);
5778 // Only deep copy fields from the object literal expression. 5786 // Only deep copy fields from the object literal expression.
5779 // In particular, don't try to copy the length attribute of 5787 // In particular, don't try to copy the length attribute of
5780 // an array. 5788 // an array.
5781 if (attributes != NONE) continue; 5789 if (attributes != NONE) continue;
5782 Handle<Object> value( 5790 Handle<Object> value(
5783 copy->GetProperty(*key_string, &attributes)->ToObjectUnchecked(), 5791 copy->GetProperty(*key_string, &attributes)->ToObjectUnchecked(),
5784 isolate); 5792 isolate);
5785 if (value->IsJSObject()) { 5793 if (value->IsJSObject()) {
5786 Handle<JSObject> result = VisitElementOrProperty( 5794 Handle<JSObject> result = VisitElementOrProperty(
5787 copy, Handle<JSObject>::cast(value)); 5795 copy, Handle<JSObject>::cast(value));
(...skipping 5552 matching lines...) Expand 10 before | Expand all | Expand 10 after
11340 11348
11341 11349
11342 // Returns false if the passed-in index is marked non-configurable, 11350 // Returns false if the passed-in index is marked non-configurable,
11343 // which will cause the ES5 truncation operation to halt, and thus 11351 // which will cause the ES5 truncation operation to halt, and thus
11344 // no further old values need be collected. 11352 // no further old values need be collected.
11345 static bool GetOldValue(Isolate* isolate, 11353 static bool GetOldValue(Isolate* isolate,
11346 Handle<JSObject> object, 11354 Handle<JSObject> object,
11347 uint32_t index, 11355 uint32_t index,
11348 List<Handle<Object> >* old_values, 11356 List<Handle<Object> >* old_values,
11349 List<uint32_t>* indices) { 11357 List<uint32_t>* indices) {
11350 PropertyAttributes attributes = object->GetLocalElementAttribute(index); 11358 PropertyAttributes attributes =
11359 JSReceiver::GetLocalElementAttribute(object, index);
11351 ASSERT(attributes != ABSENT); 11360 ASSERT(attributes != ABSENT);
11352 if (attributes == DONT_DELETE) return false; 11361 if (attributes == DONT_DELETE) return false;
11353 old_values->Add(object->GetLocalElementAccessorPair(index) == NULL 11362 old_values->Add(object->GetLocalElementAccessorPair(index) == NULL
11354 ? Object::GetElement(isolate, object, index) 11363 ? Object::GetElement(isolate, object, index)
11355 : Handle<Object>::cast(isolate->factory()->the_hole_value())); 11364 : Handle<Object>::cast(isolate->factory()->the_hole_value()));
11356 indices->Add(index); 11365 indices->Add(index);
11357 return true; 11366 return true;
11358 } 11367 }
11359 11368
11360 static void EnqueueSpliceRecord(Handle<JSArray> object, 11369 static void EnqueueSpliceRecord(Handle<JSArray> object,
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
12543 return object->HasIndexedInterceptor() 12552 return object->HasIndexedInterceptor()
12544 ? SetElementWithInterceptor(object, index, value, attributes, strict_mode, 12553 ? SetElementWithInterceptor(object, index, value, attributes, strict_mode,
12545 check_prototype, 12554 check_prototype,
12546 set_mode) 12555 set_mode)
12547 : SetElementWithoutInterceptor(object, index, value, attributes, 12556 : SetElementWithoutInterceptor(object, index, value, attributes,
12548 strict_mode, 12557 strict_mode,
12549 check_prototype, 12558 check_prototype,
12550 set_mode); 12559 set_mode);
12551 } 12560 }
12552 12561
12553 PropertyAttributes old_attributes = object->GetLocalElementAttribute(index); 12562 PropertyAttributes old_attributes =
12563 JSReceiver::GetLocalElementAttribute(object, index);
12554 Handle<Object> old_value = isolate->factory()->the_hole_value(); 12564 Handle<Object> old_value = isolate->factory()->the_hole_value();
12555 Handle<Object> old_length_handle; 12565 Handle<Object> old_length_handle;
12556 Handle<Object> new_length_handle; 12566 Handle<Object> new_length_handle;
12557 12567
12558 if (old_attributes != ABSENT) { 12568 if (old_attributes != ABSENT) {
12559 if (object->GetLocalElementAccessorPair(index) == NULL) 12569 if (object->GetLocalElementAccessorPair(index) == NULL)
12560 old_value = Object::GetElement(isolate, object, index); 12570 old_value = Object::GetElement(isolate, object, index);
12561 } else if (object->IsJSArray()) { 12571 } else if (object->IsJSArray()) {
12562 // Store old array length in case adding an element grows the array. 12572 // Store old array length in case adding an element grows the array.
12563 old_length_handle = handle(Handle<JSArray>::cast(object)->length(), 12573 old_length_handle = handle(Handle<JSArray>::cast(object)->length(),
12564 isolate); 12574 isolate);
12565 } 12575 }
12566 12576
12567 // Check for lookup interceptor 12577 // Check for lookup interceptor
12568 Handle<Object> result = object->HasIndexedInterceptor() 12578 Handle<Object> result = object->HasIndexedInterceptor()
12569 ? SetElementWithInterceptor(object, index, value, attributes, strict_mode, 12579 ? SetElementWithInterceptor(object, index, value, attributes, strict_mode,
12570 check_prototype, 12580 check_prototype,
12571 set_mode) 12581 set_mode)
12572 : SetElementWithoutInterceptor(object, index, value, attributes, 12582 : SetElementWithoutInterceptor(object, index, value, attributes,
12573 strict_mode, 12583 strict_mode,
12574 check_prototype, 12584 check_prototype,
12575 set_mode); 12585 set_mode);
12576 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<Object>()); 12586 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<Object>());
12577 12587
12578 Handle<String> name = isolate->factory()->Uint32ToString(index); 12588 Handle<String> name = isolate->factory()->Uint32ToString(index);
12579 PropertyAttributes new_attributes = object->GetLocalElementAttribute(index); 12589 PropertyAttributes new_attributes = GetLocalElementAttribute(object, index);
12580 if (old_attributes == ABSENT) { 12590 if (old_attributes == ABSENT) {
12581 if (object->IsJSArray() && 12591 if (object->IsJSArray() &&
12582 !old_length_handle->SameValue( 12592 !old_length_handle->SameValue(
12583 Handle<JSArray>::cast(object)->length())) { 12593 Handle<JSArray>::cast(object)->length())) {
12584 new_length_handle = handle(Handle<JSArray>::cast(object)->length(), 12594 new_length_handle = handle(Handle<JSArray>::cast(object)->length(),
12585 isolate); 12595 isolate);
12586 uint32_t old_length = 0; 12596 uint32_t old_length = 0;
12587 uint32_t new_length = 0; 12597 uint32_t new_length = 0;
12588 CHECK(old_length_handle->ToArrayIndex(&old_length)); 12598 CHECK(old_length_handle->ToArrayIndex(&old_length));
12589 CHECK(new_length_handle->ToArrayIndex(&new_length)); 12599 CHECK(new_length_handle->ToArrayIndex(&new_length));
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
13342 } 13352 }
13343 13353
13344 LookupResult result(isolate); 13354 LookupResult result(isolate);
13345 object->LocalLookupRealNamedProperty(*key, &result); 13355 object->LocalLookupRealNamedProperty(*key, &result);
13346 return result.IsFound() && !result.IsInterceptor(); 13356 return result.IsFound() && !result.IsInterceptor();
13347 } 13357 }
13348 13358
13349 13359
13350 bool JSObject::HasRealElementProperty(Handle<JSObject> object, uint32_t index) { 13360 bool JSObject::HasRealElementProperty(Handle<JSObject> object, uint32_t index) {
13351 Isolate* isolate = object->GetIsolate(); 13361 Isolate* isolate = object->GetIsolate();
13352 SealHandleScope shs(isolate); 13362 HandleScope scope(isolate);
13353 // Check access rights if needed. 13363 // Check access rights if needed.
13354 if (object->IsAccessCheckNeeded()) { 13364 if (object->IsAccessCheckNeeded()) {
13355 if (!isolate->MayIndexedAccessWrapper(object, index, v8::ACCESS_HAS)) { 13365 if (!isolate->MayIndexedAccessWrapper(object, index, v8::ACCESS_HAS)) {
13356 isolate->ReportFailedAccessCheckWrapper(object, v8::ACCESS_HAS); 13366 isolate->ReportFailedAccessCheckWrapper(object, v8::ACCESS_HAS);
13357 return false; 13367 return false;
13358 } 13368 }
13359 } 13369 }
13360 13370
13361 if (object->IsJSGlobalProxy()) { 13371 if (object->IsJSGlobalProxy()) {
13362 HandleScope scope(isolate); 13372 HandleScope scope(isolate);
13363 Handle<Object> proto(object->GetPrototype(), isolate); 13373 Handle<Object> proto(object->GetPrototype(), isolate);
13364 if (proto->IsNull()) return false; 13374 if (proto->IsNull()) return false;
13365 ASSERT(proto->IsJSGlobalObject()); 13375 ASSERT(proto->IsJSGlobalObject());
13366 return HasRealElementProperty(Handle<JSObject>::cast(proto), index); 13376 return HasRealElementProperty(Handle<JSObject>::cast(proto), index);
13367 } 13377 }
13368 13378
13369 return object->GetElementAttributeWithoutInterceptor( 13379 return GetElementAttributeWithoutInterceptor(
13370 *object, index, false) != ABSENT; 13380 object, object, index, false) != ABSENT;
13371 } 13381 }
13372 13382
13373 13383
13374 bool JSObject::HasRealNamedCallbackProperty(Handle<JSObject> object, 13384 bool JSObject::HasRealNamedCallbackProperty(Handle<JSObject> object,
13375 Handle<Name> key) { 13385 Handle<Name> key) {
13376 Isolate* isolate = object->GetIsolate(); 13386 Isolate* isolate = object->GetIsolate();
13377 SealHandleScope shs(isolate); 13387 SealHandleScope shs(isolate);
13378 // Check access rights if needed. 13388 // Check access rights if needed.
13379 if (object->IsAccessCheckNeeded()) { 13389 if (object->IsAccessCheckNeeded()) {
13380 if (!isolate->MayNamedAccessWrapper(object, key, v8::ACCESS_HAS)) { 13390 if (!isolate->MayNamedAccessWrapper(object, key, v8::ACCESS_HAS)) {
(...skipping 3094 matching lines...) Expand 10 before | Expand all | Expand 10 after
16475 #define ERROR_MESSAGES_TEXTS(C, T) T, 16485 #define ERROR_MESSAGES_TEXTS(C, T) T,
16476 static const char* error_messages_[] = { 16486 static const char* error_messages_[] = {
16477 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16487 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16478 }; 16488 };
16479 #undef ERROR_MESSAGES_TEXTS 16489 #undef ERROR_MESSAGES_TEXTS
16480 return error_messages_[reason]; 16490 return error_messages_[reason];
16481 } 16491 }
16482 16492
16483 16493
16484 } } // namespace v8::internal 16494 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698