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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 return JSProxy::GetPropertyWithHandler(it->GetHolder<JSProxy>(), | 119 return JSProxy::GetPropertyWithHandler(it->GetHolder<JSProxy>(), |
120 it->GetReceiver(), it->name()); | 120 it->GetReceiver(), it->name()); |
121 case LookupIterator::INTERCEPTOR: { | 121 case LookupIterator::INTERCEPTOR: { |
122 MaybeHandle<Object> maybe_result = JSObject::GetPropertyWithInterceptor( | 122 MaybeHandle<Object> maybe_result = JSObject::GetPropertyWithInterceptor( |
123 it->GetHolder<JSObject>(), it->GetReceiver(), it->name()); | 123 it->GetHolder<JSObject>(), it->GetReceiver(), it->name()); |
124 if (!maybe_result.is_null()) return maybe_result; | 124 if (!maybe_result.is_null()) return maybe_result; |
125 if (it->isolate()->has_pending_exception()) return maybe_result; | 125 if (it->isolate()->has_pending_exception()) return maybe_result; |
126 break; | 126 break; |
127 } | 127 } |
128 case LookupIterator::ACCESS_CHECK: | 128 case LookupIterator::ACCESS_CHECK: |
129 if (it->HasAccess(v8::ACCESS_GET)) break; | 129 if (it->HasAccess()) break; |
130 return JSObject::GetPropertyWithFailedAccessCheck(it); | 130 return JSObject::GetPropertyWithFailedAccessCheck(it); |
131 case LookupIterator::ACCESSOR: | 131 case LookupIterator::ACCESSOR: |
132 return GetPropertyWithAccessor(it->GetReceiver(), it->name(), | 132 return GetPropertyWithAccessor(it->GetReceiver(), it->name(), |
133 it->GetHolder<JSObject>(), | 133 it->GetHolder<JSObject>(), |
134 it->GetAccessors()); | 134 it->GetAccessors()); |
135 case LookupIterator::DATA: | 135 case LookupIterator::DATA: |
136 return it->GetDataValue(); | 136 return it->GetDataValue(); |
137 } | 137 } |
138 } | 138 } |
139 return it->factory()->undefined_value(); | 139 return it->factory()->undefined_value(); |
140 } | 140 } |
141 | 141 |
142 | 142 |
143 Handle<Object> JSObject::GetDataProperty(Handle<JSObject> object, | 143 Handle<Object> JSObject::GetDataProperty(Handle<JSObject> object, |
144 Handle<Name> key) { | 144 Handle<Name> key) { |
145 LookupIterator it(object, key, | 145 LookupIterator it(object, key, |
146 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 146 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
147 return GetDataProperty(&it); | 147 return GetDataProperty(&it); |
148 } | 148 } |
149 | 149 |
150 | 150 |
151 Handle<Object> JSObject::GetDataProperty(LookupIterator* it) { | 151 Handle<Object> JSObject::GetDataProperty(LookupIterator* it) { |
152 for (; it->IsFound(); it->Next()) { | 152 for (; it->IsFound(); it->Next()) { |
153 switch (it->state()) { | 153 switch (it->state()) { |
154 case LookupIterator::INTERCEPTOR: | 154 case LookupIterator::INTERCEPTOR: |
155 case LookupIterator::NOT_FOUND: | 155 case LookupIterator::NOT_FOUND: |
156 case LookupIterator::TRANSITION: | 156 case LookupIterator::TRANSITION: |
157 UNREACHABLE(); | 157 UNREACHABLE(); |
158 case LookupIterator::ACCESS_CHECK: | 158 case LookupIterator::ACCESS_CHECK: |
159 if (it->HasAccess(v8::ACCESS_GET)) continue; | 159 if (it->HasAccess()) continue; |
160 // Fall through. | 160 // Fall through. |
161 case LookupIterator::JSPROXY: | 161 case LookupIterator::JSPROXY: |
162 it->NotFound(); | 162 it->NotFound(); |
163 return it->isolate()->factory()->undefined_value(); | 163 return it->isolate()->factory()->undefined_value(); |
164 case LookupIterator::ACCESSOR: | 164 case LookupIterator::ACCESSOR: |
165 // TODO(verwaest): For now this doesn't call into | 165 // TODO(verwaest): For now this doesn't call into |
166 // ExecutableAccessorInfo, since clients don't need it. Update once | 166 // ExecutableAccessorInfo, since clients don't need it. Update once |
167 // relevant. | 167 // relevant. |
168 it->NotFound(); | 168 it->NotFound(); |
169 return it->isolate()->factory()->undefined_value(); | 169 return it->isolate()->factory()->undefined_value(); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 it->GetHolder<JSObject>(), | 462 it->GetHolder<JSObject>(), |
463 it->GetAccessors()); | 463 it->GetAccessors()); |
464 } | 464 } |
465 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); | 465 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); |
466 auto receiver = Handle<JSObject>::cast(it->GetReceiver()); | 466 auto receiver = Handle<JSObject>::cast(it->GetReceiver()); |
467 auto result = GetPropertyWithInterceptor(it->GetHolder<JSObject>(), | 467 auto result = GetPropertyWithInterceptor(it->GetHolder<JSObject>(), |
468 receiver, it->name()); | 468 receiver, it->name()); |
469 if (it->isolate()->has_scheduled_exception()) break; | 469 if (it->isolate()->has_scheduled_exception()) break; |
470 if (!result.is_null()) return result; | 470 if (!result.is_null()) return result; |
471 } | 471 } |
472 it->isolate()->ReportFailedAccessCheck(checked, v8::ACCESS_GET); | 472 it->isolate()->ReportFailedAccessCheck(checked); |
473 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); | 473 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); |
474 return it->factory()->undefined_value(); | 474 return it->factory()->undefined_value(); |
475 } | 475 } |
476 | 476 |
477 | 477 |
478 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithFailedAccessCheck( | 478 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithFailedAccessCheck( |
479 LookupIterator* it) { | 479 LookupIterator* it) { |
480 Handle<JSObject> checked = it->GetHolder<JSObject>(); | 480 Handle<JSObject> checked = it->GetHolder<JSObject>(); |
481 while (FindAllCanReadHolder(it)) { | 481 while (FindAllCanReadHolder(it)) { |
482 if (it->state() == LookupIterator::ACCESSOR) { | 482 if (it->state() == LookupIterator::ACCESSOR) { |
483 return maybe(it->property_details().attributes()); | 483 return maybe(it->property_details().attributes()); |
484 } | 484 } |
485 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); | 485 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); |
486 auto result = GetPropertyAttributesWithInterceptor( | 486 auto result = GetPropertyAttributesWithInterceptor( |
487 it->GetHolder<JSObject>(), it->GetReceiver(), it->name()); | 487 it->GetHolder<JSObject>(), it->GetReceiver(), it->name()); |
488 if (it->isolate()->has_scheduled_exception()) break; | 488 if (it->isolate()->has_scheduled_exception()) break; |
489 if (result.has_value && result.value != ABSENT) return result; | 489 if (result.has_value && result.value != ABSENT) return result; |
490 } | 490 } |
491 it->isolate()->ReportFailedAccessCheck(checked, v8::ACCESS_HAS); | 491 it->isolate()->ReportFailedAccessCheck(checked); |
492 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(), | 492 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(), |
493 Maybe<PropertyAttributes>()); | 493 Maybe<PropertyAttributes>()); |
494 return maybe(ABSENT); | 494 return maybe(ABSENT); |
495 } | 495 } |
496 | 496 |
497 | 497 |
498 static bool FindAllCanWriteHolder(LookupIterator* it) { | 498 static bool FindAllCanWriteHolder(LookupIterator* it) { |
499 for (; it->IsFound(); it->Next()) { | 499 for (; it->IsFound(); it->Next()) { |
500 if (it->state() == LookupIterator::ACCESSOR) { | 500 if (it->state() == LookupIterator::ACCESSOR) { |
501 Handle<Object> accessors = it->GetAccessors(); | 501 Handle<Object> accessors = it->GetAccessors(); |
502 if (accessors->IsAccessorInfo()) { | 502 if (accessors->IsAccessorInfo()) { |
503 if (AccessorInfo::cast(*accessors)->all_can_write()) return true; | 503 if (AccessorInfo::cast(*accessors)->all_can_write()) return true; |
504 } | 504 } |
505 } | 505 } |
506 } | 506 } |
507 return false; | 507 return false; |
508 } | 508 } |
509 | 509 |
510 | 510 |
511 MaybeHandle<Object> JSObject::SetPropertyWithFailedAccessCheck( | 511 MaybeHandle<Object> JSObject::SetPropertyWithFailedAccessCheck( |
512 LookupIterator* it, Handle<Object> value, LanguageMode language_mode) { | 512 LookupIterator* it, Handle<Object> value, LanguageMode language_mode) { |
513 Handle<JSObject> checked = it->GetHolder<JSObject>(); | 513 Handle<JSObject> checked = it->GetHolder<JSObject>(); |
514 if (FindAllCanWriteHolder(it)) { | 514 if (FindAllCanWriteHolder(it)) { |
515 return SetPropertyWithAccessor(it->GetReceiver(), it->name(), value, | 515 return SetPropertyWithAccessor(it->GetReceiver(), it->name(), value, |
516 it->GetHolder<JSObject>(), | 516 it->GetHolder<JSObject>(), |
517 it->GetAccessors(), language_mode); | 517 it->GetAccessors(), language_mode); |
518 } | 518 } |
519 | 519 |
520 it->isolate()->ReportFailedAccessCheck(checked, v8::ACCESS_SET); | 520 it->isolate()->ReportFailedAccessCheck(checked); |
521 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); | 521 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); |
522 return value; | 522 return value; |
523 } | 523 } |
524 | 524 |
525 | 525 |
526 void JSObject::SetNormalizedProperty(Handle<JSObject> object, | 526 void JSObject::SetNormalizedProperty(Handle<JSObject> object, |
527 Handle<Name> name, | 527 Handle<Name> name, |
528 Handle<Object> value, | 528 Handle<Object> value, |
529 PropertyDetails details) { | 529 PropertyDetails details) { |
530 DCHECK(!object->HasFastProperties()); | 530 DCHECK(!object->HasFastProperties()); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 while (true) { | 598 while (true) { |
599 auto all_can_read_holder = | 599 auto all_can_read_holder = |
600 FindIndexedAllCanReadHolder(isolate, holder, where_to_start); | 600 FindIndexedAllCanReadHolder(isolate, holder, where_to_start); |
601 if (!all_can_read_holder.ToHandle(&holder)) break; | 601 if (!all_can_read_holder.ToHandle(&holder)) break; |
602 auto result = | 602 auto result = |
603 JSObject::GetElementWithInterceptor(holder, receiver, index, false); | 603 JSObject::GetElementWithInterceptor(holder, receiver, index, false); |
604 if (isolate->has_scheduled_exception()) break; | 604 if (isolate->has_scheduled_exception()) break; |
605 if (!result.is_null()) return result; | 605 if (!result.is_null()) return result; |
606 where_to_start = PrototypeIterator::START_AT_PROTOTYPE; | 606 where_to_start = PrototypeIterator::START_AT_PROTOTYPE; |
607 } | 607 } |
608 isolate->ReportFailedAccessCheck(object, v8::ACCESS_GET); | 608 isolate->ReportFailedAccessCheck(object); |
609 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 609 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
610 return isolate->factory()->undefined_value(); | 610 return isolate->factory()->undefined_value(); |
611 } | 611 } |
612 | 612 |
613 | 613 |
614 Maybe<PropertyAttributes> JSObject::GetElementAttributesWithFailedAccessCheck( | 614 Maybe<PropertyAttributes> JSObject::GetElementAttributesWithFailedAccessCheck( |
615 Isolate* isolate, Handle<JSObject> object, Handle<Object> receiver, | 615 Isolate* isolate, Handle<JSObject> object, Handle<Object> receiver, |
616 uint32_t index) { | 616 uint32_t index) { |
617 Handle<JSObject> holder = object; | 617 Handle<JSObject> holder = object; |
618 PrototypeIterator::WhereToStart where_to_start = | 618 PrototypeIterator::WhereToStart where_to_start = |
619 PrototypeIterator::START_AT_RECEIVER; | 619 PrototypeIterator::START_AT_RECEIVER; |
620 while (true) { | 620 while (true) { |
621 auto all_can_read_holder = | 621 auto all_can_read_holder = |
622 FindIndexedAllCanReadHolder(isolate, holder, where_to_start); | 622 FindIndexedAllCanReadHolder(isolate, holder, where_to_start); |
623 if (!all_can_read_holder.ToHandle(&holder)) break; | 623 if (!all_can_read_holder.ToHandle(&holder)) break; |
624 auto result = | 624 auto result = |
625 JSObject::GetElementAttributeFromInterceptor(object, receiver, index); | 625 JSObject::GetElementAttributeFromInterceptor(object, receiver, index); |
626 if (isolate->has_scheduled_exception()) break; | 626 if (isolate->has_scheduled_exception()) break; |
627 if (result.has_value && result.value != ABSENT) return result; | 627 if (result.has_value && result.value != ABSENT) return result; |
628 where_to_start = PrototypeIterator::START_AT_PROTOTYPE; | 628 where_to_start = PrototypeIterator::START_AT_PROTOTYPE; |
629 } | 629 } |
630 isolate->ReportFailedAccessCheck(object, v8::ACCESS_HAS); | 630 isolate->ReportFailedAccessCheck(object); |
631 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Maybe<PropertyAttributes>()); | 631 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Maybe<PropertyAttributes>()); |
632 return maybe(ABSENT); | 632 return maybe(ABSENT); |
633 } | 633 } |
634 | 634 |
635 | 635 |
636 MaybeHandle<Object> Object::GetElementWithReceiver(Isolate* isolate, | 636 MaybeHandle<Object> Object::GetElementWithReceiver(Isolate* isolate, |
637 Handle<Object> object, | 637 Handle<Object> object, |
638 Handle<Object> receiver, | 638 Handle<Object> receiver, |
639 uint32_t index) { | 639 uint32_t index) { |
640 if (object->IsUndefined()) { | 640 if (object->IsUndefined()) { |
(...skipping 16 matching lines...) Expand all Loading... |
657 } | 657 } |
658 | 658 |
659 // Inline the case for JSObjects. Doing so significantly improves the | 659 // Inline the case for JSObjects. Doing so significantly improves the |
660 // performance of fetching elements where checking the prototype chain is | 660 // performance of fetching elements where checking the prototype chain is |
661 // necessary. | 661 // necessary. |
662 Handle<JSObject> js_object = | 662 Handle<JSObject> js_object = |
663 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); | 663 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); |
664 | 664 |
665 // Check access rights if needed. | 665 // Check access rights if needed. |
666 if (js_object->IsAccessCheckNeeded()) { | 666 if (js_object->IsAccessCheckNeeded()) { |
667 if (!isolate->MayIndexedAccess(js_object, index, v8::ACCESS_GET)) { | 667 if (!isolate->MayAccess(js_object)) { |
668 return JSObject::GetElementWithFailedAccessCheck(isolate, js_object, | 668 return JSObject::GetElementWithFailedAccessCheck(isolate, js_object, |
669 receiver, index); | 669 receiver, index); |
670 } | 670 } |
671 } | 671 } |
672 | 672 |
673 if (js_object->HasIndexedInterceptor()) { | 673 if (js_object->HasIndexedInterceptor()) { |
674 return JSObject::GetElementWithInterceptor(js_object, receiver, index, | 674 return JSObject::GetElementWithInterceptor(js_object, receiver, index, |
675 true); | 675 true); |
676 } | 676 } |
677 | 677 |
(...skipping 26 matching lines...) Expand all Loading... |
704 // TODO(dslomov): implement. | 704 // TODO(dslomov): implement. |
705 isolate->ThrowIllegalOperation(); | 705 isolate->ThrowIllegalOperation(); |
706 return MaybeHandle<Object>(); | 706 return MaybeHandle<Object>(); |
707 } | 707 } |
708 | 708 |
709 Handle<JSObject> js_object = | 709 Handle<JSObject> js_object = |
710 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); | 710 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); |
711 | 711 |
712 // Check access rights if needed. | 712 // Check access rights if needed. |
713 if (js_object->IsAccessCheckNeeded()) { | 713 if (js_object->IsAccessCheckNeeded()) { |
714 if (!isolate->MayIndexedAccess(js_object, index, v8::ACCESS_SET)) { | 714 if (!isolate->MayAccess(js_object)) { |
715 isolate->ReportFailedAccessCheck(js_object, v8::ACCESS_SET); | 715 isolate->ReportFailedAccessCheck(js_object); |
716 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 716 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
717 return isolate->factory()->undefined_value(); | 717 return isolate->factory()->undefined_value(); |
718 } | 718 } |
719 } | 719 } |
720 | 720 |
721 if (js_object->HasIndexedInterceptor()) { | 721 if (js_object->HasIndexedInterceptor()) { |
722 Maybe<PropertyAttributes> from_interceptor = | 722 Maybe<PropertyAttributes> from_interceptor = |
723 JSObject::GetElementAttributeFromInterceptor(js_object, receiver, | 723 JSObject::GetElementAttributeFromInterceptor(js_object, receiver, |
724 index); | 724 index); |
725 if (!from_interceptor.has_value) return MaybeHandle<Object>(); | 725 if (!from_interceptor.has_value) return MaybeHandle<Object>(); |
(...skipping 2330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3056 bool done = false; | 3056 bool done = false; |
3057 for (; it->IsFound(); it->Next()) { | 3057 for (; it->IsFound(); it->Next()) { |
3058 switch (it->state()) { | 3058 switch (it->state()) { |
3059 case LookupIterator::NOT_FOUND: | 3059 case LookupIterator::NOT_FOUND: |
3060 UNREACHABLE(); | 3060 UNREACHABLE(); |
3061 | 3061 |
3062 case LookupIterator::ACCESS_CHECK: | 3062 case LookupIterator::ACCESS_CHECK: |
3063 // TODO(verwaest): Remove the distinction. This is mostly bogus since we | 3063 // TODO(verwaest): Remove the distinction. This is mostly bogus since we |
3064 // don't know whether we'll want to fetch attributes or call a setter | 3064 // don't know whether we'll want to fetch attributes or call a setter |
3065 // until we find the property. | 3065 // until we find the property. |
3066 if (it->HasAccess(v8::ACCESS_SET)) break; | 3066 if (it->HasAccess()) break; |
3067 return JSObject::SetPropertyWithFailedAccessCheck(it, value, | 3067 return JSObject::SetPropertyWithFailedAccessCheck(it, value, |
3068 language_mode); | 3068 language_mode); |
3069 | 3069 |
3070 case LookupIterator::JSPROXY: | 3070 case LookupIterator::JSPROXY: |
3071 if (it->HolderIsReceiverOrHiddenPrototype()) { | 3071 if (it->HolderIsReceiverOrHiddenPrototype()) { |
3072 return JSProxy::SetPropertyWithHandler(it->GetHolder<JSProxy>(), | 3072 return JSProxy::SetPropertyWithHandler(it->GetHolder<JSProxy>(), |
3073 it->GetReceiver(), it->name(), | 3073 it->GetReceiver(), it->name(), |
3074 value, language_mode); | 3074 value, language_mode); |
3075 } else { | 3075 } else { |
3076 // TODO(verwaest): Use the MaybeHandle to indicate result. | 3076 // TODO(verwaest): Use the MaybeHandle to indicate result. |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3358 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { | 3358 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { |
3359 return JSProxy::SetPropertyViaPrototypesWithHandler( | 3359 return JSProxy::SetPropertyViaPrototypesWithHandler( |
3360 Handle<JSProxy>::cast(PrototypeIterator::GetCurrent(iter)), object, | 3360 Handle<JSProxy>::cast(PrototypeIterator::GetCurrent(iter)), object, |
3361 isolate->factory()->Uint32ToString(index), // name | 3361 isolate->factory()->Uint32ToString(index), // name |
3362 value, language_mode, found); | 3362 value, language_mode, found); |
3363 } | 3363 } |
3364 Handle<JSObject> js_proto = | 3364 Handle<JSObject> js_proto = |
3365 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); | 3365 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); |
3366 | 3366 |
3367 if (js_proto->IsAccessCheckNeeded()) { | 3367 if (js_proto->IsAccessCheckNeeded()) { |
3368 if (!isolate->MayIndexedAccess(js_proto, index, v8::ACCESS_SET)) { | 3368 if (!isolate->MayAccess(js_proto)) { |
3369 *found = true; | 3369 *found = true; |
3370 isolate->ReportFailedAccessCheck(js_proto, v8::ACCESS_SET); | 3370 isolate->ReportFailedAccessCheck(js_proto); |
3371 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 3371 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
3372 return MaybeHandle<Object>(); | 3372 return MaybeHandle<Object>(); |
3373 } | 3373 } |
3374 } | 3374 } |
3375 | 3375 |
3376 if (!js_proto->HasDictionaryElements()) { | 3376 if (!js_proto->HasDictionaryElements()) { |
3377 continue; | 3377 continue; |
3378 } | 3378 } |
3379 | 3379 |
3380 Handle<SeededNumberDictionary> dictionary(js_proto->element_dictionary()); | 3380 Handle<SeededNumberDictionary> dictionary(js_proto->element_dictionary()); |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4167 !it.isolate()->IsInternallyUsedPropertyName(name); | 4167 !it.isolate()->IsInternallyUsedPropertyName(name); |
4168 for (; it.IsFound(); it.Next()) { | 4168 for (; it.IsFound(); it.Next()) { |
4169 switch (it.state()) { | 4169 switch (it.state()) { |
4170 case LookupIterator::INTERCEPTOR: | 4170 case LookupIterator::INTERCEPTOR: |
4171 case LookupIterator::JSPROXY: | 4171 case LookupIterator::JSPROXY: |
4172 case LookupIterator::NOT_FOUND: | 4172 case LookupIterator::NOT_FOUND: |
4173 case LookupIterator::TRANSITION: | 4173 case LookupIterator::TRANSITION: |
4174 UNREACHABLE(); | 4174 UNREACHABLE(); |
4175 | 4175 |
4176 case LookupIterator::ACCESS_CHECK: | 4176 case LookupIterator::ACCESS_CHECK: |
4177 if (!it.isolate()->MayNamedAccess(object, name, v8::ACCESS_SET)) { | 4177 if (!it.isolate()->MayAccess(object)) { |
4178 return SetPropertyWithFailedAccessCheck(&it, value, SLOPPY); | 4178 return SetPropertyWithFailedAccessCheck(&it, value, SLOPPY); |
4179 } | 4179 } |
4180 break; | 4180 break; |
4181 | 4181 |
4182 case LookupIterator::ACCESSOR: { | 4182 case LookupIterator::ACCESSOR: { |
4183 PropertyDetails details = it.property_details(); | 4183 PropertyDetails details = it.property_details(); |
4184 // Ensure the context isn't changed after calling into accessors. | 4184 // Ensure the context isn't changed after calling into accessors. |
4185 AssertNoContextChange ncc(it.isolate()); | 4185 AssertNoContextChange ncc(it.isolate()); |
4186 | 4186 |
4187 Handle<Object> accessors = it.GetAccessors(); | 4187 Handle<Object> accessors = it.GetAccessors(); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4336 it->GetHolder<JSProxy>(), it->GetReceiver(), it->name()); | 4336 it->GetHolder<JSProxy>(), it->GetReceiver(), it->name()); |
4337 case LookupIterator::INTERCEPTOR: { | 4337 case LookupIterator::INTERCEPTOR: { |
4338 Maybe<PropertyAttributes> result = | 4338 Maybe<PropertyAttributes> result = |
4339 JSObject::GetPropertyAttributesWithInterceptor( | 4339 JSObject::GetPropertyAttributesWithInterceptor( |
4340 it->GetHolder<JSObject>(), it->GetReceiver(), it->name()); | 4340 it->GetHolder<JSObject>(), it->GetReceiver(), it->name()); |
4341 if (!result.has_value) return result; | 4341 if (!result.has_value) return result; |
4342 if (result.value != ABSENT) return result; | 4342 if (result.value != ABSENT) return result; |
4343 break; | 4343 break; |
4344 } | 4344 } |
4345 case LookupIterator::ACCESS_CHECK: | 4345 case LookupIterator::ACCESS_CHECK: |
4346 if (it->HasAccess(v8::ACCESS_HAS)) break; | 4346 if (it->HasAccess()) break; |
4347 return JSObject::GetPropertyAttributesWithFailedAccessCheck(it); | 4347 return JSObject::GetPropertyAttributesWithFailedAccessCheck(it); |
4348 case LookupIterator::ACCESSOR: | 4348 case LookupIterator::ACCESSOR: |
4349 case LookupIterator::DATA: | 4349 case LookupIterator::DATA: |
4350 return maybe(it->property_details().attributes()); | 4350 return maybe(it->property_details().attributes()); |
4351 } | 4351 } |
4352 } | 4352 } |
4353 return maybe(ABSENT); | 4353 return maybe(ABSENT); |
4354 } | 4354 } |
4355 | 4355 |
4356 | 4356 |
4357 Maybe<PropertyAttributes> JSObject::GetElementAttributeWithReceiver( | 4357 Maybe<PropertyAttributes> JSObject::GetElementAttributeWithReceiver( |
4358 Handle<JSObject> object, Handle<JSReceiver> receiver, uint32_t index, | 4358 Handle<JSObject> object, Handle<JSReceiver> receiver, uint32_t index, |
4359 bool check_prototype) { | 4359 bool check_prototype) { |
4360 Isolate* isolate = object->GetIsolate(); | 4360 Isolate* isolate = object->GetIsolate(); |
4361 | 4361 |
4362 // Check access rights if needed. | 4362 // Check access rights if needed. |
4363 if (object->IsAccessCheckNeeded()) { | 4363 if (object->IsAccessCheckNeeded()) { |
4364 if (!isolate->MayIndexedAccess(object, index, v8::ACCESS_HAS)) { | 4364 if (!isolate->MayAccess(object)) { |
4365 return GetElementAttributesWithFailedAccessCheck(isolate, object, | 4365 return GetElementAttributesWithFailedAccessCheck(isolate, object, |
4366 receiver, index); | 4366 receiver, index); |
4367 } | 4367 } |
4368 } | 4368 } |
4369 | 4369 |
4370 if (object->IsJSGlobalProxy()) { | 4370 if (object->IsJSGlobalProxy()) { |
4371 PrototypeIterator iter(isolate, object); | 4371 PrototypeIterator iter(isolate, object); |
4372 if (iter.IsAtEnd()) return maybe(ABSENT); | 4372 if (iter.IsAtEnd()) return maybe(ABSENT); |
4373 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); | 4373 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); |
4374 return JSObject::GetElementAttributeWithReceiver( | 4374 return JSObject::GetElementAttributeWithReceiver( |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5204 } | 5204 } |
5205 | 5205 |
5206 | 5206 |
5207 MaybeHandle<Object> JSObject::DeleteElement(Handle<JSObject> object, | 5207 MaybeHandle<Object> JSObject::DeleteElement(Handle<JSObject> object, |
5208 uint32_t index, | 5208 uint32_t index, |
5209 LanguageMode language_mode) { | 5209 LanguageMode language_mode) { |
5210 Isolate* isolate = object->GetIsolate(); | 5210 Isolate* isolate = object->GetIsolate(); |
5211 Factory* factory = isolate->factory(); | 5211 Factory* factory = isolate->factory(); |
5212 | 5212 |
5213 // Check access rights if needed. | 5213 // Check access rights if needed. |
5214 if (object->IsAccessCheckNeeded() && | 5214 if (object->IsAccessCheckNeeded() && !isolate->MayAccess(object)) { |
5215 !isolate->MayIndexedAccess(object, index, v8::ACCESS_DELETE)) { | 5215 isolate->ReportFailedAccessCheck(object); |
5216 isolate->ReportFailedAccessCheck(object, v8::ACCESS_DELETE); | |
5217 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 5216 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
5218 return factory->false_value(); | 5217 return factory->false_value(); |
5219 } | 5218 } |
5220 | 5219 |
5221 if (object->IsStringObjectWithCharacterAt(index)) { | 5220 if (object->IsStringObjectWithCharacterAt(index)) { |
5222 if (is_strict(language_mode)) { | 5221 if (is_strict(language_mode)) { |
5223 // Deleting a non-configurable property in strict mode. | 5222 // Deleting a non-configurable property in strict mode. |
5224 Handle<Object> name = factory->NewNumberFromUint(index); | 5223 Handle<Object> name = factory->NewNumberFromUint(index); |
5225 Handle<Object> args[] = {name, object}; | 5224 Handle<Object> args[] = {name, object}; |
5226 THROW_NEW_ERROR(isolate, | 5225 THROW_NEW_ERROR(isolate, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5325 !it.isolate()->IsInternallyUsedPropertyName(name); | 5324 !it.isolate()->IsInternallyUsedPropertyName(name); |
5326 Handle<Object> old_value = it.isolate()->factory()->the_hole_value(); | 5325 Handle<Object> old_value = it.isolate()->factory()->the_hole_value(); |
5327 | 5326 |
5328 for (; it.IsFound(); it.Next()) { | 5327 for (; it.IsFound(); it.Next()) { |
5329 switch (it.state()) { | 5328 switch (it.state()) { |
5330 case LookupIterator::JSPROXY: | 5329 case LookupIterator::JSPROXY: |
5331 case LookupIterator::NOT_FOUND: | 5330 case LookupIterator::NOT_FOUND: |
5332 case LookupIterator::TRANSITION: | 5331 case LookupIterator::TRANSITION: |
5333 UNREACHABLE(); | 5332 UNREACHABLE(); |
5334 case LookupIterator::ACCESS_CHECK: | 5333 case LookupIterator::ACCESS_CHECK: |
5335 if (it.HasAccess(v8::ACCESS_DELETE)) break; | 5334 if (it.HasAccess()) break; |
5336 it.isolate()->ReportFailedAccessCheck(it.GetHolder<JSObject>(), | 5335 it.isolate()->ReportFailedAccessCheck(it.GetHolder<JSObject>()); |
5337 v8::ACCESS_DELETE); | |
5338 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it.isolate(), Object); | 5336 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it.isolate(), Object); |
5339 return it.isolate()->factory()->false_value(); | 5337 return it.isolate()->factory()->false_value(); |
5340 case LookupIterator::INTERCEPTOR: { | 5338 case LookupIterator::INTERCEPTOR: { |
5341 MaybeHandle<Object> maybe_result = | 5339 MaybeHandle<Object> maybe_result = |
5342 JSObject::DeletePropertyWithInterceptor(it.GetHolder<JSObject>(), | 5340 JSObject::DeletePropertyWithInterceptor(it.GetHolder<JSObject>(), |
5343 object, it.name()); | 5341 object, it.name()); |
5344 // Delete with interceptor succeeded. Return result. | 5342 // Delete with interceptor succeeded. Return result. |
5345 if (!maybe_result.is_null()) return maybe_result; | 5343 if (!maybe_result.is_null()) return maybe_result; |
5346 // An exception was thrown in the interceptor. Propagate. | 5344 // An exception was thrown in the interceptor. Propagate. |
5347 if (it.isolate()->has_pending_exception()) return maybe_result; | 5345 if (it.isolate()->has_pending_exception()) return maybe_result; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5556 | 5554 |
5557 MaybeHandle<Object> JSObject::PreventExtensions(Handle<JSObject> object) { | 5555 MaybeHandle<Object> JSObject::PreventExtensions(Handle<JSObject> object) { |
5558 if (!object->map()->is_extensible()) return object; | 5556 if (!object->map()->is_extensible()) return object; |
5559 | 5557 |
5560 if (!object->HasSloppyArgumentsElements() && !object->map()->is_observed()) { | 5558 if (!object->HasSloppyArgumentsElements() && !object->map()->is_observed()) { |
5561 return PreventExtensionsWithTransition<NONE>(object); | 5559 return PreventExtensionsWithTransition<NONE>(object); |
5562 } | 5560 } |
5563 | 5561 |
5564 Isolate* isolate = object->GetIsolate(); | 5562 Isolate* isolate = object->GetIsolate(); |
5565 | 5563 |
5566 if (object->IsAccessCheckNeeded() && | 5564 if (object->IsAccessCheckNeeded() && !isolate->MayAccess(object)) { |
5567 !isolate->MayNamedAccess( | 5565 isolate->ReportFailedAccessCheck(object); |
5568 object, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) { | |
5569 isolate->ReportFailedAccessCheck(object, v8::ACCESS_KEYS); | |
5570 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 5566 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
5571 return isolate->factory()->false_value(); | 5567 return isolate->factory()->false_value(); |
5572 } | 5568 } |
5573 | 5569 |
5574 if (object->IsJSGlobalProxy()) { | 5570 if (object->IsJSGlobalProxy()) { |
5575 PrototypeIterator iter(isolate, object); | 5571 PrototypeIterator iter(isolate, object); |
5576 if (iter.IsAtEnd()) return object; | 5572 if (iter.IsAtEnd()) return object; |
5577 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); | 5573 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); |
5578 return PreventExtensions( | 5574 return PreventExtensions( |
5579 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter))); | 5575 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter))); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5667 template <PropertyAttributes attrs> | 5663 template <PropertyAttributes attrs> |
5668 MaybeHandle<Object> JSObject::PreventExtensionsWithTransition( | 5664 MaybeHandle<Object> JSObject::PreventExtensionsWithTransition( |
5669 Handle<JSObject> object) { | 5665 Handle<JSObject> object) { |
5670 STATIC_ASSERT(attrs == NONE || attrs == SEALED || attrs == FROZEN); | 5666 STATIC_ASSERT(attrs == NONE || attrs == SEALED || attrs == FROZEN); |
5671 | 5667 |
5672 // Sealing/freezing sloppy arguments should be handled elsewhere. | 5668 // Sealing/freezing sloppy arguments should be handled elsewhere. |
5673 DCHECK(!object->HasSloppyArgumentsElements()); | 5669 DCHECK(!object->HasSloppyArgumentsElements()); |
5674 DCHECK(!object->map()->is_observed()); | 5670 DCHECK(!object->map()->is_observed()); |
5675 | 5671 |
5676 Isolate* isolate = object->GetIsolate(); | 5672 Isolate* isolate = object->GetIsolate(); |
5677 if (object->IsAccessCheckNeeded() && | 5673 if (object->IsAccessCheckNeeded() && !isolate->MayAccess(object)) { |
5678 !isolate->MayNamedAccess( | 5674 isolate->ReportFailedAccessCheck(object); |
5679 object, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) { | |
5680 isolate->ReportFailedAccessCheck(object, v8::ACCESS_KEYS); | |
5681 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 5675 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
5682 return isolate->factory()->false_value(); | 5676 return isolate->factory()->false_value(); |
5683 } | 5677 } |
5684 | 5678 |
5685 if (object->IsJSGlobalProxy()) { | 5679 if (object->IsJSGlobalProxy()) { |
5686 PrototypeIterator iter(isolate, object); | 5680 PrototypeIterator iter(isolate, object); |
5687 if (iter.IsAtEnd()) return object; | 5681 if (iter.IsAtEnd()) return object; |
5688 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); | 5682 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); |
5689 return PreventExtensionsWithTransition<attrs>( | 5683 return PreventExtensionsWithTransition<attrs>( |
5690 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter))); | 5684 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter))); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6275 FixedArray::AddKeysFromArrayLike( | 6269 FixedArray::AddKeysFromArrayLike( |
6276 content, Handle<JSObject>::cast(names)), | 6270 content, Handle<JSObject>::cast(names)), |
6277 FixedArray); | 6271 FixedArray); |
6278 break; | 6272 break; |
6279 } | 6273 } |
6280 | 6274 |
6281 Handle<JSObject> current = | 6275 Handle<JSObject> current = |
6282 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); | 6276 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); |
6283 | 6277 |
6284 // Check access rights if required. | 6278 // Check access rights if required. |
6285 if (current->IsAccessCheckNeeded() && | 6279 if (current->IsAccessCheckNeeded() && !isolate->MayAccess(current)) { |
6286 !isolate->MayNamedAccess( | 6280 isolate->ReportFailedAccessCheck(current); |
6287 current, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) { | |
6288 isolate->ReportFailedAccessCheck(current, v8::ACCESS_KEYS); | |
6289 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, FixedArray); | 6281 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, FixedArray); |
6290 break; | 6282 break; |
6291 } | 6283 } |
6292 | 6284 |
6293 // Compute the element keys. | 6285 // Compute the element keys. |
6294 Handle<FixedArray> element_keys = | 6286 Handle<FixedArray> element_keys = |
6295 isolate->factory()->NewFixedArray(current->NumberOfEnumElements()); | 6287 isolate->factory()->NewFixedArray(current->NumberOfEnumElements()); |
6296 current->GetEnumElementKeys(*element_keys); | 6288 current->GetEnumElementKeys(*element_keys); |
6297 ASSIGN_RETURN_ON_EXCEPTION( | 6289 ASSIGN_RETURN_ON_EXCEPTION( |
6298 isolate, content, | 6290 isolate, content, |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6547 } | 6539 } |
6548 | 6540 |
6549 | 6541 |
6550 MaybeHandle<Object> JSObject::DefineAccessor(Handle<JSObject> object, | 6542 MaybeHandle<Object> JSObject::DefineAccessor(Handle<JSObject> object, |
6551 Handle<Name> name, | 6543 Handle<Name> name, |
6552 Handle<Object> getter, | 6544 Handle<Object> getter, |
6553 Handle<Object> setter, | 6545 Handle<Object> setter, |
6554 PropertyAttributes attributes) { | 6546 PropertyAttributes attributes) { |
6555 Isolate* isolate = object->GetIsolate(); | 6547 Isolate* isolate = object->GetIsolate(); |
6556 // Check access rights if needed. | 6548 // Check access rights if needed. |
6557 if (object->IsAccessCheckNeeded() && | 6549 if (object->IsAccessCheckNeeded() && !isolate->MayAccess(object)) { |
6558 !isolate->MayNamedAccess(object, name, v8::ACCESS_SET)) { | 6550 isolate->ReportFailedAccessCheck(object); |
6559 isolate->ReportFailedAccessCheck(object, v8::ACCESS_SET); | |
6560 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 6551 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
6561 return isolate->factory()->undefined_value(); | 6552 return isolate->factory()->undefined_value(); |
6562 } | 6553 } |
6563 | 6554 |
6564 if (object->IsJSGlobalProxy()) { | 6555 if (object->IsJSGlobalProxy()) { |
6565 PrototypeIterator iter(isolate, object); | 6556 PrototypeIterator iter(isolate, object); |
6566 if (iter.IsAtEnd()) return isolate->factory()->undefined_value(); | 6557 if (iter.IsAtEnd()) return isolate->factory()->undefined_value(); |
6567 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); | 6558 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); |
6568 DefineAccessor(Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), | 6559 DefineAccessor(Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), |
6569 name, getter, setter, attributes); | 6560 name, getter, setter, attributes); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6641 } | 6632 } |
6642 | 6633 |
6643 | 6634 |
6644 MaybeHandle<Object> JSObject::SetAccessor(Handle<JSObject> object, | 6635 MaybeHandle<Object> JSObject::SetAccessor(Handle<JSObject> object, |
6645 Handle<AccessorInfo> info) { | 6636 Handle<AccessorInfo> info) { |
6646 Isolate* isolate = object->GetIsolate(); | 6637 Isolate* isolate = object->GetIsolate(); |
6647 Factory* factory = isolate->factory(); | 6638 Factory* factory = isolate->factory(); |
6648 Handle<Name> name(Name::cast(info->name())); | 6639 Handle<Name> name(Name::cast(info->name())); |
6649 | 6640 |
6650 // Check access rights if needed. | 6641 // Check access rights if needed. |
6651 if (object->IsAccessCheckNeeded() && | 6642 if (object->IsAccessCheckNeeded() && !isolate->MayAccess(object)) { |
6652 !isolate->MayNamedAccess(object, name, v8::ACCESS_SET)) { | 6643 isolate->ReportFailedAccessCheck(object); |
6653 isolate->ReportFailedAccessCheck(object, v8::ACCESS_SET); | |
6654 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 6644 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
6655 return factory->undefined_value(); | 6645 return factory->undefined_value(); |
6656 } | 6646 } |
6657 | 6647 |
6658 if (object->IsJSGlobalProxy()) { | 6648 if (object->IsJSGlobalProxy()) { |
6659 PrototypeIterator iter(isolate, object); | 6649 PrototypeIterator iter(isolate, object); |
6660 if (iter.IsAtEnd()) return object; | 6650 if (iter.IsAtEnd()) return object; |
6661 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); | 6651 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); |
6662 return SetAccessor( | 6652 return SetAccessor( |
6663 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), info); | 6653 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), info); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6732 | 6722 |
6733 // Make the lookup and include prototypes. | 6723 // Make the lookup and include prototypes. |
6734 uint32_t index = 0; | 6724 uint32_t index = 0; |
6735 if (name->AsArrayIndex(&index)) { | 6725 if (name->AsArrayIndex(&index)) { |
6736 for (PrototypeIterator iter(isolate, object, | 6726 for (PrototypeIterator iter(isolate, object, |
6737 PrototypeIterator::START_AT_RECEIVER); | 6727 PrototypeIterator::START_AT_RECEIVER); |
6738 !iter.IsAtEnd(); iter.Advance()) { | 6728 !iter.IsAtEnd(); iter.Advance()) { |
6739 Handle<Object> current = PrototypeIterator::GetCurrent(iter); | 6729 Handle<Object> current = PrototypeIterator::GetCurrent(iter); |
6740 // Check access rights if needed. | 6730 // Check access rights if needed. |
6741 if (current->IsAccessCheckNeeded() && | 6731 if (current->IsAccessCheckNeeded() && |
6742 !isolate->MayNamedAccess(Handle<JSObject>::cast(current), name, | 6732 !isolate->MayAccess(Handle<JSObject>::cast(current))) { |
6743 v8::ACCESS_HAS)) { | 6733 isolate->ReportFailedAccessCheck(Handle<JSObject>::cast(current)); |
6744 isolate->ReportFailedAccessCheck(Handle<JSObject>::cast(current), | |
6745 v8::ACCESS_HAS); | |
6746 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 6734 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
6747 return isolate->factory()->undefined_value(); | 6735 return isolate->factory()->undefined_value(); |
6748 } | 6736 } |
6749 | 6737 |
6750 if (current->IsJSObject() && | 6738 if (current->IsJSObject() && |
6751 Handle<JSObject>::cast(current)->HasDictionaryElements()) { | 6739 Handle<JSObject>::cast(current)->HasDictionaryElements()) { |
6752 JSObject* js_object = JSObject::cast(*current); | 6740 JSObject* js_object = JSObject::cast(*current); |
6753 SeededNumberDictionary* dictionary = js_object->element_dictionary(); | 6741 SeededNumberDictionary* dictionary = js_object->element_dictionary(); |
6754 int entry = dictionary->FindEntry(index); | 6742 int entry = dictionary->FindEntry(index); |
6755 if (entry != SeededNumberDictionary::kNotFound) { | 6743 if (entry != SeededNumberDictionary::kNotFound) { |
(...skipping 10 matching lines...) Expand all Loading... |
6766 LookupIterator it(object, name, | 6754 LookupIterator it(object, name, |
6767 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 6755 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
6768 for (; it.IsFound(); it.Next()) { | 6756 for (; it.IsFound(); it.Next()) { |
6769 switch (it.state()) { | 6757 switch (it.state()) { |
6770 case LookupIterator::INTERCEPTOR: | 6758 case LookupIterator::INTERCEPTOR: |
6771 case LookupIterator::NOT_FOUND: | 6759 case LookupIterator::NOT_FOUND: |
6772 case LookupIterator::TRANSITION: | 6760 case LookupIterator::TRANSITION: |
6773 UNREACHABLE(); | 6761 UNREACHABLE(); |
6774 | 6762 |
6775 case LookupIterator::ACCESS_CHECK: | 6763 case LookupIterator::ACCESS_CHECK: |
6776 if (it.HasAccess(v8::ACCESS_HAS)) continue; | 6764 if (it.HasAccess()) continue; |
6777 isolate->ReportFailedAccessCheck(it.GetHolder<JSObject>(), | 6765 isolate->ReportFailedAccessCheck(it.GetHolder<JSObject>()); |
6778 v8::ACCESS_HAS); | |
6779 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 6766 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
6780 return isolate->factory()->undefined_value(); | 6767 return isolate->factory()->undefined_value(); |
6781 | 6768 |
6782 case LookupIterator::JSPROXY: | 6769 case LookupIterator::JSPROXY: |
6783 return isolate->factory()->undefined_value(); | 6770 return isolate->factory()->undefined_value(); |
6784 | 6771 |
6785 case LookupIterator::DATA: | 6772 case LookupIterator::DATA: |
6786 continue; | 6773 continue; |
6787 case LookupIterator::ACCESSOR: { | 6774 case LookupIterator::ACCESSOR: { |
6788 Handle<Object> maybe_pair = it.GetAccessors(); | 6775 Handle<Object> maybe_pair = it.GetAccessors(); |
(...skipping 6234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13023 object->HasFixedTypedArrayElements()) { | 13010 object->HasFixedTypedArrayElements()) { |
13024 if (!value->IsNumber() && !value->IsUndefined()) { | 13011 if (!value->IsNumber() && !value->IsUndefined()) { |
13025 ASSIGN_RETURN_ON_EXCEPTION( | 13012 ASSIGN_RETURN_ON_EXCEPTION( |
13026 isolate, value, | 13013 isolate, value, |
13027 Execution::ToNumber(isolate, value), Object); | 13014 Execution::ToNumber(isolate, value), Object); |
13028 } | 13015 } |
13029 } | 13016 } |
13030 | 13017 |
13031 // Check access rights if needed. | 13018 // Check access rights if needed. |
13032 if (object->IsAccessCheckNeeded()) { | 13019 if (object->IsAccessCheckNeeded()) { |
13033 if (!isolate->MayIndexedAccess(object, index, v8::ACCESS_SET)) { | 13020 if (!isolate->MayAccess(object)) { |
13034 isolate->ReportFailedAccessCheck(object, v8::ACCESS_SET); | 13021 isolate->ReportFailedAccessCheck(object); |
13035 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 13022 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
13036 return value; | 13023 return value; |
13037 } | 13024 } |
13038 } | 13025 } |
13039 | 13026 |
13040 if (object->IsJSGlobalProxy()) { | 13027 if (object->IsJSGlobalProxy()) { |
13041 PrototypeIterator iter(isolate, object); | 13028 PrototypeIterator iter(isolate, object); |
13042 if (iter.IsAtEnd()) return value; | 13029 if (iter.IsAtEnd()) return value; |
13043 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); | 13030 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); |
13044 return SetElement( | 13031 return SetElement( |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13909 return maybe(it.IsFound()); | 13896 return maybe(it.IsFound()); |
13910 } | 13897 } |
13911 | 13898 |
13912 | 13899 |
13913 Maybe<bool> JSObject::HasRealElementProperty(Handle<JSObject> object, | 13900 Maybe<bool> JSObject::HasRealElementProperty(Handle<JSObject> object, |
13914 uint32_t index) { | 13901 uint32_t index) { |
13915 Isolate* isolate = object->GetIsolate(); | 13902 Isolate* isolate = object->GetIsolate(); |
13916 HandleScope scope(isolate); | 13903 HandleScope scope(isolate); |
13917 // Check access rights if needed. | 13904 // Check access rights if needed. |
13918 if (object->IsAccessCheckNeeded()) { | 13905 if (object->IsAccessCheckNeeded()) { |
13919 if (!isolate->MayIndexedAccess(object, index, v8::ACCESS_HAS)) { | 13906 if (!isolate->MayAccess(object)) { |
13920 isolate->ReportFailedAccessCheck(object, v8::ACCESS_HAS); | 13907 isolate->ReportFailedAccessCheck(object); |
13921 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Maybe<bool>()); | 13908 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Maybe<bool>()); |
13922 return maybe(false); | 13909 return maybe(false); |
13923 } | 13910 } |
13924 } | 13911 } |
13925 | 13912 |
13926 if (object->IsJSGlobalProxy()) { | 13913 if (object->IsJSGlobalProxy()) { |
13927 HandleScope scope(isolate); | 13914 HandleScope scope(isolate); |
13928 PrototypeIterator iter(isolate, object); | 13915 PrototypeIterator iter(isolate, object); |
13929 if (iter.IsAtEnd()) return maybe(false); | 13916 if (iter.IsAtEnd()) return maybe(false); |
13930 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); | 13917 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); |
(...skipping 3223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17154 CompilationInfo* info) { | 17141 CompilationInfo* info) { |
17155 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( | 17142 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( |
17156 handle(cell->dependent_code(), info->isolate()), | 17143 handle(cell->dependent_code(), info->isolate()), |
17157 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); | 17144 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); |
17158 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17145 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
17159 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17146 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
17160 cell, info->zone()); | 17147 cell, info->zone()); |
17161 } | 17148 } |
17162 | 17149 |
17163 } } // namespace v8::internal | 17150 } } // namespace v8::internal |
OLD | NEW |