Index: src/ic.cc |
diff --git a/src/ic.cc b/src/ic.cc |
index dfbbb9152996b86426158b6a33e94a404be2f8bf..087a959afd9fdf173f8465146ef2641ecf0a9bc0 100644 |
--- a/src/ic.cc |
+++ b/src/ic.cc |
@@ -1397,8 +1397,16 @@ MaybeObject* StoreIC::Store(State state, |
return TypeError("non_object_property_store", object, name); |
} |
- // Ignore stores where the receiver is not a JSObject. |
- if (!object->IsJSObject()) return *value; |
+ if (!object->IsJSObject()) { |
+ // The length property of string values is read-only. Throw in strict mode. |
+ if (strict_mode == kStrictMode && object->IsString() && |
+ name->Equals(Heap::length_symbol())) { |
+ return TypeError("strict_read_only_property", object, name); |
+ } |
+ // Ignore stores where the receiver is not a JSObject. |
+ return *value; |
+ } |
+ |
Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
// Check if the given name is an array index. |