| Index: src/ic.cc
|
| ===================================================================
|
| --- src/ic.cc (revision 9531)
|
| +++ src/ic.cc (working copy)
|
| @@ -1351,7 +1351,7 @@
|
| }
|
|
|
|
|
| -static bool LookupForWrite(JSReceiver* receiver,
|
| +static bool LookupForWrite(JSObject* receiver,
|
| String* name,
|
| LookupResult* lookup) {
|
| receiver->LocalLookup(name, lookup);
|
| @@ -1359,12 +1359,10 @@
|
| 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;
|
| @@ -1376,28 +1374,28 @@
|
| 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 (!object->IsJSReceiver()) {
|
| + // 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);
|
| + }
|
| +
|
| // 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.
|
| @@ -1675,6 +1673,7 @@
|
| } else {
|
| ASSERT(receiver_map->has_dictionary_elements() ||
|
| receiver_map->has_fast_elements() ||
|
| + receiver_map->has_fast_smi_only_elements() ||
|
| receiver_map->has_fast_double_elements() ||
|
| receiver_map->has_external_array_elements());
|
| bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
|
| @@ -1690,6 +1689,7 @@
|
| Code* generic_stub) {
|
| Code* result = NULL;
|
| if (receiver->HasFastElements() ||
|
| + receiver->HasFastSmiOnlyElements() ||
|
| receiver->HasExternalArrayElements() ||
|
| receiver->HasFastDoubleElements() ||
|
| receiver->HasDictionaryElements()) {
|
|
|