OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/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 6498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6509 OrdinaryDefineOwnProperty(isolate, a, isolate->factory()->length_string(), | 6509 OrdinaryDefineOwnProperty(isolate, a, isolate->factory()->length_string(), |
6510 &readonly, should_throw); | 6510 &readonly, should_throw); |
6511 } | 6511 } |
6512 uint32_t actual_new_len = 0; | 6512 uint32_t actual_new_len = 0; |
6513 CHECK(a->length()->ToArrayLength(&actual_new_len)); | 6513 CHECK(a->length()->ToArrayLength(&actual_new_len)); |
6514 // Steps 19d-v, 21. Return false if there were non-deletable elements. | 6514 // Steps 19d-v, 21. Return false if there were non-deletable elements. |
6515 success = actual_new_len == new_len; | 6515 success = actual_new_len == new_len; |
6516 if (!success && should_throw == THROW_ON_ERROR) { | 6516 if (!success && should_throw == THROW_ON_ERROR) { |
6517 isolate->Throw(*isolate->factory()->NewTypeError( | 6517 isolate->Throw(*isolate->factory()->NewTypeError( |
6518 MessageTemplate::kStrictDeleteProperty, | 6518 MessageTemplate::kStrictDeleteProperty, |
6519 isolate->factory()->NewNumberFromUint(actual_new_len - 1), a)); | 6519 isolate->factory()->NewNumberFromUint(actual_new_len - 1))); |
6520 } | 6520 } |
6521 return success; | 6521 return success; |
6522 } | 6522 } |
6523 | 6523 |
6524 | 6524 |
6525 // static | 6525 // static |
6526 bool JSReceiver::GetOwnPropertyDescriptor(Isolate* isolate, | 6526 bool JSReceiver::GetOwnPropertyDescriptor(Isolate* isolate, |
6527 Handle<JSObject> object, | 6527 Handle<JSObject> object, |
6528 Handle<Object> key, | 6528 Handle<Object> key, |
6529 PropertyDescriptor* desc) { | 6529 PropertyDescriptor* desc) { |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7777 !current->HasNamedInterceptor() && | 7777 !current->HasNamedInterceptor() && |
7778 !current->HasIndexedInterceptor()); | 7778 !current->HasIndexedInterceptor()); |
7779 // Compute the property keys and cache them if possible. | 7779 // Compute the property keys and cache them if possible. |
7780 Handle<FixedArray> enum_keys = | 7780 Handle<FixedArray> enum_keys = |
7781 JSObject::GetEnumPropertyKeys(current, cache_enum_length); | 7781 JSObject::GetEnumPropertyKeys(current, cache_enum_length); |
7782 accumulator.AddKeys(enum_keys); | 7782 accumulator.AddKeys(enum_keys); |
7783 } else { | 7783 } else { |
7784 DCHECK(filter == INCLUDE_SYMBOLS); | 7784 DCHECK(filter == INCLUDE_SYMBOLS); |
7785 PropertyAttributes attr_filter = | 7785 PropertyAttributes attr_filter = |
7786 static_cast<PropertyAttributes>(DONT_ENUM | PRIVATE_SYMBOL); | 7786 static_cast<PropertyAttributes>(DONT_ENUM | PRIVATE_SYMBOL); |
7787 Handle<FixedArray> property_keys = isolate->factory()->NewFixedArray( | 7787 JSObject::CollectOwnElementKeys(current, &accumulator, attr_filter); |
7788 current->NumberOfOwnProperties(attr_filter)); | |
7789 current->GetOwnPropertyNames(*property_keys, 0, attr_filter); | |
7790 accumulator.AddKeys(property_keys); | |
7791 } | 7788 } |
7792 | 7789 |
7793 // Add the property keys from the interceptor. | 7790 // Add the property keys from the interceptor. |
7794 if (current->HasNamedInterceptor()) { | 7791 if (current->HasNamedInterceptor()) { |
7795 Handle<JSObject> result; | 7792 Handle<JSObject> result; |
7796 if (JSObject::GetKeysForNamedInterceptor(current, object) | 7793 if (JSObject::GetKeysForNamedInterceptor(current, object) |
7797 .ToHandle(&result)) { | 7794 .ToHandle(&result)) { |
7798 accumulator.AddKeys(result); | 7795 accumulator.AddKeys(result); |
7799 } | 7796 } |
7800 } | 7797 } |
(...skipping 9960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17761 if (cell->value() != *new_value) { | 17758 if (cell->value() != *new_value) { |
17762 cell->set_value(*new_value); | 17759 cell->set_value(*new_value); |
17763 Isolate* isolate = cell->GetIsolate(); | 17760 Isolate* isolate = cell->GetIsolate(); |
17764 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17761 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
17765 isolate, DependentCode::kPropertyCellChangedGroup); | 17762 isolate, DependentCode::kPropertyCellChangedGroup); |
17766 } | 17763 } |
17767 } | 17764 } |
17768 | 17765 |
17769 } // namespace internal | 17766 } // namespace internal |
17770 } // namespace v8 | 17767 } // namespace v8 |
OLD | NEW |