Chromium Code Reviews| Index: src/ic.cc |
| diff --git a/src/ic.cc b/src/ic.cc |
| index 6d5c4dfcbfdc36e1ed9ef68a44735adb81ec9cf3..35c01a729f58e64421a8ff9c3e42076a36beb6cd 100644 |
| --- a/src/ic.cc |
| +++ b/src/ic.cc |
| @@ -1343,15 +1343,16 @@ static bool StoreICableLookup(LookupResult* lookup) { |
| } |
| -static bool LookupForWrite(JSObject* object, |
| +static bool LookupForWrite(JSReceiver* receiver, |
| String* name, |
| LookupResult* lookup) { |
| - object->LocalLookup(name, lookup); |
| + receiver->LocalLookup(name, lookup); |
| if (!StoreICableLookup(lookup)) { |
| return false; |
| } |
| if (lookup->type() == INTERCEPTOR) { |
| + JSObject* object = JSObject::cast(receiver); |
| if (object->GetNamedInterceptor()->setter()->IsUndefined()) { |
| object->LocalLookupRealNamedProperty(name, lookup); |
| return StoreICableLookup(lookup); |
| @@ -1373,7 +1374,7 @@ MaybeObject* StoreIC::Store(State state, |
| return TypeError("non_object_property_store", object, name); |
| } |
| - if (!object->IsJSObject()) { |
| + 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())) { |
| @@ -1383,6 +1384,13 @@ MaybeObject* StoreIC::Store(State state, |
| return *value; |
| } |
| + // Handle proxies. |
| + if (object->IsJSProxy()) { |
| + HandleScope scope(isolate()); |
|
Kevin Millikin (Chromium)
2011/05/30 16:32:29
The handle scope should not be needed here.
rossberg
2011/05/31 14:50:24
Done.
|
| + 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. |
| @@ -1397,7 +1405,7 @@ MaybeObject* StoreIC::Store(State state, |
| // Use specialized code for setting the length of arrays. |
| if (receiver->IsJSArray() |
| && name->Equals(isolate()->heap()->length_symbol()) |
| - && receiver->AllowsSetElementsLength()) { |
| + && JSArray::cast(*receiver)->AllowsSetElementsLength()) { |
| #ifdef DEBUG |
| if (FLAG_trace_ic) PrintF("[StoreIC : +#length /array]\n"); |
| #endif |