Index: src/ic.cc |
diff --git a/src/ic.cc b/src/ic.cc |
index e30e3253bdd736b5fec09d2b33c0d58f83651186..ad5227c52d9f7caad200b684bd3dec2b81968105 100644 |
--- a/src/ic.cc |
+++ b/src/ic.cc |
@@ -1048,6 +1048,20 @@ Object* StoreIC::Store(State state, |
return *value; |
} |
+ |
+ // Use specialized code for setting the length of arrays. |
+ if (receiver->IsJSArray() |
+ && name->Equals(Heap::length_symbol()) |
+ && receiver->AllowsSetElementsLength()) { |
+#ifdef DEBUG |
+ if (FLAG_trace_ic) PrintF("[StoreIC : +#length /array]\n"); |
+#endif |
+ Code* target = Builtins::builtin(Builtins::StoreIC_ArrayLength); |
+ set_target(target); |
+ StubCache::Set(*name, HeapObject::cast(*object)->map(), target); |
+ return receiver->SetProperty(*name, *value, NONE); |
+ } |
+ |
// Lookup the property locally in the receiver. |
if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) { |
LookupResult lookup; |
@@ -1343,6 +1357,17 @@ Object* StoreIC_Miss(Arguments args) { |
} |
+Object* StoreIC_ArrayLength(Arguments args) { |
+ NoHandleAllocation nha; |
+ |
+ ASSERT(args.length() == 2); |
+ JSObject* receiver = JSObject::cast(args[0]); |
+ Object* len = args[1]; |
+ |
+ return receiver->SetElementsLength(len); |
+} |
+ |
+ |
// Extend storage is called in a store inline cache when |
// it is necessary to extend the properties array of a |
// JSObject. |