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

Unified Diff: src/objects.cc

Issue 22901034: Simplify logic by extracting local lookup before the switch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index d8a05eb01c528f81c29d87cb8e83482d1450b986..73c5b5f101617f4ac5261fcf02d1fb65f668b8cd 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -4091,6 +4091,11 @@ MaybeObject* JSObject::SetLocalPropertyIgnoreAttributes(
extensibility_check);
}
+ if (lookup.IsFound() &&
+ (lookup.type() == INTERCEPTOR || lookup.type() == CALLBACKS)) {
+ LocalLookupRealNamedProperty(name_raw, &lookup);
+ }
+
// Check for accessor in prototype chain removed here in clone.
if (!lookup.IsFound()) {
// Neither properties nor transitions found.
@@ -4132,31 +4137,14 @@ MaybeObject* JSObject::SetLocalPropertyIgnoreAttributes(
}
break;
case CALLBACKS:
- // Callbacks are not guaranteed to be installed on the receiver. Also
- // perform a local lookup again. Fall through.
- case INTERCEPTOR:
- self->LocalLookupRealNamedProperty(*name, &lookup);
- if (lookup.IsFound()) {
- if (lookup.IsPropertyCallbacks()) {
- result = ConvertAndSetLocalProperty(
- &lookup, *name, *value, attributes);
- } else if (lookup.IsNormal()) {
- result = self->ReplaceSlowProperty(*name, *value, attributes);
- } else {
- result = SetPropertyToFieldWithAttributes(
- &lookup, name, value, attributes);
- }
- } else {
- result = self->AddProperty(
- *name, *value, attributes, kNonStrictMode, MAY_BE_STORE_FROM_KEYED,
- extensibility_check, value_type, mode);
- }
+ result = ConvertAndSetLocalProperty(&lookup, *name, *value, attributes);
break;
case TRANSITION:
result = SetPropertyUsingTransition(&lookup, name, value, attributes);
break;
- case HANDLER:
case NONEXISTENT:
+ case HANDLER:
+ case INTERCEPTOR:
UNREACHABLE();
}
« 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