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

Side by Side Diff: src/objects.cc

Issue 1409613004: Use C++ implementation of Object.definePropert{y,ies} (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix GetKeys regression after df8970a8c Created 5 years, 2 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
« no previous file with comments | « src/js/v8natives.js ('k') | src/property-descriptor.cc » ('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 // 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
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))); 6519 isolate->factory()->NewNumberFromUint(actual_new_len - 1), a));
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
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 JSObject::CollectOwnElementKeys(current, &accumulator, attr_filter); 7787 Handle<FixedArray> property_keys = isolate->factory()->NewFixedArray(
7788 current->NumberOfOwnProperties(attr_filter));
7789 current->GetOwnPropertyNames(*property_keys, 0, attr_filter);
7790 accumulator.AddKeys(property_keys);
7788 } 7791 }
7789 7792
7790 // Add the property keys from the interceptor. 7793 // Add the property keys from the interceptor.
7791 if (current->HasNamedInterceptor()) { 7794 if (current->HasNamedInterceptor()) {
7792 Handle<JSObject> result; 7795 Handle<JSObject> result;
7793 if (JSObject::GetKeysForNamedInterceptor(current, object) 7796 if (JSObject::GetKeysForNamedInterceptor(current, object)
7794 .ToHandle(&result)) { 7797 .ToHandle(&result)) {
7795 accumulator.AddKeys(result); 7798 accumulator.AddKeys(result);
7796 } 7799 }
7797 } 7800 }
(...skipping 9960 matching lines...) Expand 10 before | Expand all | Expand 10 after
17758 if (cell->value() != *new_value) { 17761 if (cell->value() != *new_value) {
17759 cell->set_value(*new_value); 17762 cell->set_value(*new_value);
17760 Isolate* isolate = cell->GetIsolate(); 17763 Isolate* isolate = cell->GetIsolate();
17761 cell->dependent_code()->DeoptimizeDependentCodeGroup( 17764 cell->dependent_code()->DeoptimizeDependentCodeGroup(
17762 isolate, DependentCode::kPropertyCellChangedGroup); 17765 isolate, DependentCode::kPropertyCellChangedGroup);
17763 } 17766 }
17764 } 17767 }
17765 17768
17766 } // namespace internal 17769 } // namespace internal
17767 } // namespace v8 17770 } // namespace v8
OLDNEW
« no previous file with comments | « src/js/v8natives.js ('k') | src/property-descriptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698