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

Side by Side Diff: src/objects.cc

Issue 1412823003: GetOwnPropertyDescriptor: API-style accessors can throw, check for that. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | no next file » | 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 6599 matching lines...) Expand 10 before | Expand all | Expand 10 after
6610 DCHECK(!isolate->has_pending_exception()); 6610 DCHECK(!isolate->has_pending_exception());
6611 6611
6612 // 3. Let D be a newly created Property Descriptor with no fields. 6612 // 3. Let D be a newly created Property Descriptor with no fields.
6613 DCHECK(desc->is_empty()); 6613 DCHECK(desc->is_empty());
6614 // 4. Let X be O's own property whose key is P. 6614 // 4. Let X be O's own property whose key is P.
6615 // 5. If X is a data property, then 6615 // 5. If X is a data property, then
6616 bool is_accessor_pair = it->state() == LookupIterator::ACCESSOR && 6616 bool is_accessor_pair = it->state() == LookupIterator::ACCESSOR &&
6617 it->GetAccessors()->IsAccessorPair(); 6617 it->GetAccessors()->IsAccessorPair();
6618 if (!is_accessor_pair) { 6618 if (!is_accessor_pair) {
6619 // 5a. Set D.[[Value]] to the value of X's [[Value]] attribute. 6619 // 5a. Set D.[[Value]] to the value of X's [[Value]] attribute.
6620 Handle<Object> value = JSObject::GetProperty(it).ToHandleChecked(); 6620 Handle<Object> value;
6621 if (!JSObject::GetProperty(it).ToHandle(&value)) {
6622 DCHECK(isolate->has_pending_exception());
6623 return false;
6624 }
6621 desc->set_value(value); 6625 desc->set_value(value);
6622 // 5b. Set D.[[Writable]] to the value of X's [[Writable]] attribute 6626 // 5b. Set D.[[Writable]] to the value of X's [[Writable]] attribute
6623 desc->set_writable((attrs & READ_ONLY) == 0); 6627 desc->set_writable((attrs & READ_ONLY) == 0);
6624 } else { 6628 } else {
6625 // 6. Else X is an accessor property, so 6629 // 6. Else X is an accessor property, so
6626 Handle<AccessorPair> accessors = 6630 Handle<AccessorPair> accessors =
6627 Handle<AccessorPair>::cast(it->GetAccessors()); 6631 Handle<AccessorPair>::cast(it->GetAccessors());
6628 // 6a. Set D.[[Get]] to the value of X's [[Get]] attribute. 6632 // 6a. Set D.[[Get]] to the value of X's [[Get]] attribute.
6629 desc->set_get(handle(accessors->GetComponent(ACCESSOR_GETTER), isolate)); 6633 desc->set_get(handle(accessors->GetComponent(ACCESSOR_GETTER), isolate));
6630 // 6b. Set D.[[Set]] to the value of X's [[Set]] attribute. 6634 // 6b. Set D.[[Set]] to the value of X's [[Set]] attribute.
(...skipping 11241 matching lines...) Expand 10 before | Expand all | Expand 10 after
17872 if (cell->value() != *new_value) { 17876 if (cell->value() != *new_value) {
17873 cell->set_value(*new_value); 17877 cell->set_value(*new_value);
17874 Isolate* isolate = cell->GetIsolate(); 17878 Isolate* isolate = cell->GetIsolate();
17875 cell->dependent_code()->DeoptimizeDependentCodeGroup( 17879 cell->dependent_code()->DeoptimizeDependentCodeGroup(
17876 isolate, DependentCode::kPropertyCellChangedGroup); 17880 isolate, DependentCode::kPropertyCellChangedGroup);
17877 } 17881 }
17878 } 17882 }
17879 17883
17880 } // namespace internal 17884 } // namespace internal
17881 } // namespace v8 17885 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698