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

Side by Side Diff: src/objects.cc

Issue 1408163005: [es6] Partially implement Reflect.getOwnPropertyDescriptor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/objects.h ('k') | src/property-descriptor.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 // 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 6590 matching lines...) Expand 10 before | Expand all | Expand 10 after
6601 isolate->Throw(*isolate->factory()->NewTypeError( 6601 isolate->Throw(*isolate->factory()->NewTypeError(
6602 MessageTemplate::kStrictDeleteProperty, 6602 MessageTemplate::kStrictDeleteProperty,
6603 isolate->factory()->NewNumberFromUint(actual_new_len - 1), a)); 6603 isolate->factory()->NewNumberFromUint(actual_new_len - 1), a));
6604 } 6604 }
6605 return success; 6605 return success;
6606 } 6606 }
6607 6607
6608 6608
6609 // static 6609 // static
6610 bool JSReceiver::GetOwnPropertyDescriptor(Isolate* isolate, 6610 bool JSReceiver::GetOwnPropertyDescriptor(Isolate* isolate,
6611 Handle<JSObject> object, 6611 Handle<JSReceiver> object,
6612 Handle<Object> key, 6612 Handle<Object> key,
6613 PropertyDescriptor* desc) { 6613 PropertyDescriptor* desc) {
6614 bool success = false; 6614 bool success = false;
6615 DCHECK(key->IsName() || key->IsNumber()); // |key| is a PropertyKey... 6615 DCHECK(key->IsName() || key->IsNumber()); // |key| is a PropertyKey...
6616 LookupIterator it = LookupIterator::PropertyOrElement( 6616 LookupIterator it = LookupIterator::PropertyOrElement(
6617 isolate, object, key, &success, LookupIterator::HIDDEN); 6617 isolate, object, key, &success, LookupIterator::HIDDEN);
6618 DCHECK(success); // ...so creating a LookupIterator can't fail. 6618 DCHECK(success); // ...so creating a LookupIterator can't fail.
6619 return GetOwnPropertyDescriptor(&it, desc); 6619 return GetOwnPropertyDescriptor(&it, desc);
6620 } 6620 }
6621 6621
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
6665 desc->set_get(handle(accessors->GetComponent(ACCESSOR_GETTER), isolate)); 6665 desc->set_get(handle(accessors->GetComponent(ACCESSOR_GETTER), isolate));
6666 // 6b. Set D.[[Set]] to the value of X's [[Set]] attribute. 6666 // 6b. Set D.[[Set]] to the value of X's [[Set]] attribute.
6667 desc->set_set(handle(accessors->GetComponent(ACCESSOR_SETTER), isolate)); 6667 desc->set_set(handle(accessors->GetComponent(ACCESSOR_SETTER), isolate));
6668 } 6668 }
6669 6669
6670 // 7. Set D.[[Enumerable]] to the value of X's [[Enumerable]] attribute. 6670 // 7. Set D.[[Enumerable]] to the value of X's [[Enumerable]] attribute.
6671 desc->set_enumerable((attrs & DONT_ENUM) == 0); 6671 desc->set_enumerable((attrs & DONT_ENUM) == 0);
6672 // 8. Set D.[[Configurable]] to the value of X's [[Configurable]] attribute. 6672 // 8. Set D.[[Configurable]] to the value of X's [[Configurable]] attribute.
6673 desc->set_configurable((attrs & DONT_DELETE) == 0); 6673 desc->set_configurable((attrs & DONT_DELETE) == 0);
6674 // 9. Return D. 6674 // 9. Return D.
6675 DCHECK(PropertyDescriptor::IsAccessorDescriptor(desc) !=
6676 PropertyDescriptor::IsDataDescriptor(desc));
6675 return true; 6677 return true;
6676 } 6678 }
6677 6679
6678 6680
6679 bool JSObject::ReferencesObjectFromElements(FixedArray* elements, 6681 bool JSObject::ReferencesObjectFromElements(FixedArray* elements,
6680 ElementsKind kind, 6682 ElementsKind kind,
6681 Object* object) { 6683 Object* object) {
6682 DCHECK(IsFastObjectElementsKind(kind) || 6684 DCHECK(IsFastObjectElementsKind(kind) ||
6683 kind == DICTIONARY_ELEMENTS); 6685 kind == DICTIONARY_ELEMENTS);
6684 if (IsFastObjectElementsKind(kind)) { 6686 if (IsFastObjectElementsKind(kind)) {
(...skipping 11246 matching lines...) Expand 10 before | Expand all | Expand 10 after
17931 if (cell->value() != *new_value) { 17933 if (cell->value() != *new_value) {
17932 cell->set_value(*new_value); 17934 cell->set_value(*new_value);
17933 Isolate* isolate = cell->GetIsolate(); 17935 Isolate* isolate = cell->GetIsolate();
17934 cell->dependent_code()->DeoptimizeDependentCodeGroup( 17936 cell->dependent_code()->DeoptimizeDependentCodeGroup(
17935 isolate, DependentCode::kPropertyCellChangedGroup); 17937 isolate, DependentCode::kPropertyCellChangedGroup);
17936 } 17938 }
17937 } 17939 }
17938 17940
17939 } // namespace internal 17941 } // namespace internal
17940 } // namespace v8 17942 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/property-descriptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698