Index: src/ic.cc |
diff --git a/src/ic.cc b/src/ic.cc |
index 0d0b93570bca0087efb7cdd589c3112575170878..6ec8683b27abad6aad3ebc415ca06da604efbf5b 100644 |
--- a/src/ic.cc |
+++ b/src/ic.cc |
@@ -1365,7 +1365,7 @@ static bool StoreICableLookup(LookupResult* lookup) { |
} |
-static bool LookupForWrite(JSReceiver* receiver, |
+static bool LookupForWrite(JSObject* receiver, |
String* name, |
LookupResult* lookup) { |
receiver->LocalLookup(name, lookup); |
@@ -1373,12 +1373,10 @@ static bool LookupForWrite(JSReceiver* receiver, |
return false; |
} |
- if (lookup->type() == INTERCEPTOR) { |
- JSObject* object = JSObject::cast(receiver); |
- if (object->GetNamedInterceptor()->setter()->IsUndefined()) { |
- object->LocalLookupRealNamedProperty(name, lookup); |
- return StoreICableLookup(lookup); |
- } |
+ if (lookup->type() == INTERCEPTOR && |
+ receiver->GetNamedInterceptor()->setter()->IsUndefined()) { |
+ receiver->LocalLookupRealNamedProperty(name, lookup); |
+ return StoreICableLookup(lookup); |
} |
return true; |
@@ -1390,28 +1388,28 @@ MaybeObject* StoreIC::Store(State state, |
Handle<Object> object, |
Handle<String> name, |
Handle<Object> value) { |
- // If the object is undefined or null it's illegal to try to set any |
- // properties on it; throw a TypeError in that case. |
- if (object->IsUndefined() || object->IsNull()) { |
- return TypeError("non_object_property_store", object, name); |
- } |
+ if (!object->IsJSObject()) { |
+ // Handle proxies. |
+ if (object->IsJSProxy()) { |
+ return JSProxy::cast(*object)-> |
+ SetProperty(*name, *value, NONE, strict_mode); |
+ } |
+ |
+ // If the object is undefined or null it's illegal to try to set any |
+ // properties on it; throw a TypeError in that case. |
+ if (object->IsUndefined() || object->IsNull()) { |
+ return TypeError("non_object_property_store", object, name); |
+ } |
- if (!object->IsJSReceiver()) { |
// The length property of string values is read-only. Throw in strict mode. |
if (strict_mode == kStrictMode && object->IsString() && |
name->Equals(isolate()->heap()->length_symbol())) { |
return TypeError("strict_read_only_property", object, name); |
} |
- // Ignore stores where the receiver is not a JSObject. |
+ // Ignore other stores where the receiver is not a JSObject. |
return *value; |
} |
- // Handle proxies. |
- if (object->IsJSProxy()) { |
- return JSReceiver::cast(*object)-> |
- SetProperty(*name, *value, NONE, strict_mode); |
- } |
- |
Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
// Check if the given name is an array index. |