OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 6489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6500 DCHECK(key->IsName() || key->IsNumber()); // |key| is a PropertyKey... | 6500 DCHECK(key->IsName() || key->IsNumber()); // |key| is a PropertyKey... |
6501 LookupIterator it = LookupIterator::PropertyOrElement( | 6501 LookupIterator it = LookupIterator::PropertyOrElement( |
6502 isolate, object, key, &success, LookupIterator::HIDDEN); | 6502 isolate, object, key, &success, LookupIterator::HIDDEN); |
6503 DCHECK(success); // ...so creating a LookupIterator can't fail. | 6503 DCHECK(success); // ...so creating a LookupIterator can't fail. |
6504 | 6504 |
6505 // Deal with access checks first. | 6505 // Deal with access checks first. |
6506 if (it.state() == LookupIterator::ACCESS_CHECK) { | 6506 if (it.state() == LookupIterator::ACCESS_CHECK) { |
6507 if (!it.HasAccess()) { | 6507 if (!it.HasAccess()) { |
6508 isolate->ReportFailedAccessCheck(it.GetHolder<JSObject>()); | 6508 isolate->ReportFailedAccessCheck(it.GetHolder<JSObject>()); |
6509 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); | 6509 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); |
6510 return Just(false); | 6510 return Just(true); |
6511 } | 6511 } |
6512 it.Next(); | 6512 it.Next(); |
6513 } | 6513 } |
6514 | 6514 |
6515 return OrdinaryDefineOwnProperty(&it, desc, should_throw); | 6515 return OrdinaryDefineOwnProperty(&it, desc, should_throw); |
6516 } | 6516 } |
6517 | 6517 |
6518 | 6518 |
6519 // ES6 9.1.6.1 | 6519 // ES6 9.1.6.1 |
6520 // static | 6520 // static |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7667 Isolate* isolate = object->GetIsolate(); | 7667 Isolate* isolate = object->GetIsolate(); |
7668 | 7668 |
7669 if (!object->HasSloppyArgumentsElements() && !object->map()->is_observed()) { | 7669 if (!object->HasSloppyArgumentsElements() && !object->map()->is_observed()) { |
7670 return PreventExtensionsWithTransition<NONE>(object, should_throw); | 7670 return PreventExtensionsWithTransition<NONE>(object, should_throw); |
7671 } | 7671 } |
7672 | 7672 |
7673 if (object->IsAccessCheckNeeded() && | 7673 if (object->IsAccessCheckNeeded() && |
7674 !isolate->MayAccess(handle(isolate->context()), object)) { | 7674 !isolate->MayAccess(handle(isolate->context()), object)) { |
7675 isolate->ReportFailedAccessCheck(object); | 7675 isolate->ReportFailedAccessCheck(object); |
7676 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); | 7676 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); |
7677 UNREACHABLE(); | |
7678 RETURN_FAILURE(isolate, should_throw, | 7677 RETURN_FAILURE(isolate, should_throw, |
7679 NewTypeError(MessageTemplate::kNoAccess)); | 7678 NewTypeError(MessageTemplate::kNoAccess)); |
7680 } | 7679 } |
7681 | 7680 |
7682 if (!object->map()->is_extensible()) return Just(true); | 7681 if (!object->map()->is_extensible()) return Just(true); |
7683 | 7682 |
7684 if (object->IsJSGlobalProxy()) { | 7683 if (object->IsJSGlobalProxy()) { |
7685 PrototypeIterator iter(isolate, object); | 7684 PrototypeIterator iter(isolate, object); |
7686 if (iter.IsAtEnd()) return Just(true); | 7685 if (iter.IsAtEnd()) return Just(true); |
7687 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); | 7686 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7815 | 7814 |
7816 // Sealing/freezing sloppy arguments should be handled elsewhere. | 7815 // Sealing/freezing sloppy arguments should be handled elsewhere. |
7817 DCHECK(!object->HasSloppyArgumentsElements()); | 7816 DCHECK(!object->HasSloppyArgumentsElements()); |
7818 DCHECK(!object->map()->is_observed()); | 7817 DCHECK(!object->map()->is_observed()); |
7819 | 7818 |
7820 Isolate* isolate = object->GetIsolate(); | 7819 Isolate* isolate = object->GetIsolate(); |
7821 if (object->IsAccessCheckNeeded() && | 7820 if (object->IsAccessCheckNeeded() && |
7822 !isolate->MayAccess(handle(isolate->context()), object)) { | 7821 !isolate->MayAccess(handle(isolate->context()), object)) { |
7823 isolate->ReportFailedAccessCheck(object); | 7822 isolate->ReportFailedAccessCheck(object); |
7824 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); | 7823 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); |
7825 UNREACHABLE(); | |
7826 RETURN_FAILURE(isolate, should_throw, | 7824 RETURN_FAILURE(isolate, should_throw, |
7827 NewTypeError(MessageTemplate::kNoAccess)); | 7825 NewTypeError(MessageTemplate::kNoAccess)); |
7828 } | 7826 } |
7829 | 7827 |
7830 if (attrs == NONE && !object->map()->is_extensible()) return Just(true); | 7828 if (attrs == NONE && !object->map()->is_extensible()) return Just(true); |
7831 | 7829 |
7832 if (object->IsJSGlobalProxy()) { | 7830 if (object->IsJSGlobalProxy()) { |
7833 PrototypeIterator iter(isolate, object); | 7831 PrototypeIterator iter(isolate, object); |
7834 if (iter.IsAtEnd()) return Just(true); | 7832 if (iter.IsAtEnd()) return Just(true); |
7835 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); | 7833 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); |
(...skipping 7699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15535 int size = object->Size(); | 15533 int size = object->Size(); |
15536 #endif | 15534 #endif |
15537 | 15535 |
15538 Isolate* isolate = object->GetIsolate(); | 15536 Isolate* isolate = object->GetIsolate(); |
15539 | 15537 |
15540 if (from_javascript) { | 15538 if (from_javascript) { |
15541 if (object->IsAccessCheckNeeded() && | 15539 if (object->IsAccessCheckNeeded() && |
15542 !isolate->MayAccess(handle(isolate->context()), object)) { | 15540 !isolate->MayAccess(handle(isolate->context()), object)) { |
15543 isolate->ReportFailedAccessCheck(object); | 15541 isolate->ReportFailedAccessCheck(object); |
15544 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); | 15542 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); |
15545 UNREACHABLE(); | |
neis
2016/01/13 08:54:17
Did you check if we can RETURN_FAILURE here too?
Jakob Kummerow
2016/01/13 12:59:48
Done.
| |
15546 } | 15543 } |
15547 } else { | 15544 } else { |
15548 DCHECK(!object->IsAccessCheckNeeded()); | 15545 DCHECK(!object->IsAccessCheckNeeded()); |
15549 } | 15546 } |
15550 | 15547 |
15551 // Strong objects may not have their prototype set via __proto__ or | 15548 // Strong objects may not have their prototype set via __proto__ or |
15552 // setPrototypeOf. | 15549 // setPrototypeOf. |
15553 if (from_javascript && object->map()->is_strong()) { | 15550 if (from_javascript && object->map()->is_strong()) { |
15554 RETURN_FAILURE(isolate, should_throw, | 15551 RETURN_FAILURE(isolate, should_throw, |
15555 NewTypeError(MessageTemplate::kStrongSetProto, object)); | 15552 NewTypeError(MessageTemplate::kStrongSetProto, object)); |
(...skipping 4094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
19650 if (cell->value() != *new_value) { | 19647 if (cell->value() != *new_value) { |
19651 cell->set_value(*new_value); | 19648 cell->set_value(*new_value); |
19652 Isolate* isolate = cell->GetIsolate(); | 19649 Isolate* isolate = cell->GetIsolate(); |
19653 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19650 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19654 isolate, DependentCode::kPropertyCellChangedGroup); | 19651 isolate, DependentCode::kPropertyCellChangedGroup); |
19655 } | 19652 } |
19656 } | 19653 } |
19657 | 19654 |
19658 } // namespace internal | 19655 } // namespace internal |
19659 } // namespace v8 | 19656 } // namespace v8 |
OLD | NEW |