From 24bbfdfa53f2c1215f964e9a9be1b2d03701f845 Mon Sep 17 00:00:00 2001 From: "verwaest@chromium.org" Date: Wed, 28 Aug 2013 12:36:46 +0000 Subject: [PATCH] Simplify logic by extracting local lookup before the switch. R=rossberg@chromium.org Review URL: https://chromiumcodereview.appspot.com/22901034 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16395 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/objects.cc | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/src/objects.cc b/src/objects.cc index 3e4601a..2b36397 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -4093,6 +4093,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. @@ -4134,31 +4139,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(); } -- 2.7.4