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

Unified Diff: src/lookup.cc

Issue 1943303002: Make it possible to set a getter and a setter at the same time (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/lookup.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index 7cc2666f964f7eca3f3ad3e4d521ab9f2362b82f..6c73244843908b6396f58afd3175d9c1b8763a13 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -370,11 +370,10 @@ void LookupIterator::Delete() {
state_ = NOT_FOUND;
}
-
void LookupIterator::TransitionToAccessorProperty(
- AccessorComponent component, Handle<Object> accessor,
+ Handle<Object> getter, Handle<Object> setter,
PropertyAttributes attributes) {
- DCHECK(!accessor->IsNull());
+ DCHECK(!getter->IsNull() || !setter->IsNull());
// Can only be called when the receiver is a JSObject. JSProxy has to be
// handled via a trap. Adding properties to primitive values is not
// observable.
@@ -393,7 +392,7 @@ void LookupIterator::TransitionToAccessorProperty(
IsFound() ? static_cast<int>(number_) : DescriptorArray::kNotFound;
Handle<Map> new_map = Map::TransitionToAccessorProperty(
- old_map, name_, descriptor, component, accessor, attributes);
+ isolate_, old_map, name_, descriptor, getter, setter, attributes);
bool simple_transition = new_map->GetBackPointer() == receiver->map();
JSObject::MigrateToMap(receiver, new_map);
@@ -413,18 +412,18 @@ void LookupIterator::TransitionToAccessorProperty(
if (state() == ACCESSOR && GetAccessors()->IsAccessorPair()) {
pair = Handle<AccessorPair>::cast(GetAccessors());
// If the component and attributes are identical, nothing has to be done.
- if (pair->get(component) == *accessor) {
+ if (pair->Equals(*getter, *setter)) {
if (property_details().attributes() == attributes) {
if (!IsElement()) JSObject::ReoptimizeIfPrototype(receiver);
return;
}
} else {
pair = AccessorPair::Copy(pair);
- pair->set(component, *accessor);
+ pair->SetComponents(*getter, *setter);
}
} else {
pair = factory()->NewAccessorPair();
- pair->set(component, *accessor);
+ pair->SetComponents(*getter, *setter);
}
TransitionToAccessorPair(pair, attributes);
« no previous file with comments | « src/lookup.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698