Index: src/ic/ic.cc |
diff --git a/src/ic/ic.cc b/src/ic/ic.cc |
index f8c3b0669f09272ee32f029a5dc4c1fb08448b81..edc6d41d6fe83254c74e40a590012f368223b548 100644 |
--- a/src/ic/ic.cc |
+++ b/src/ic/ic.cc |
@@ -1558,6 +1558,15 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name, |
return TypeError("const_assign", object, name); |
} |
+ Handle<Object> previous_value = |
+ FixedArray::get(script_context, lookup_result.slot_index); |
+ |
+ if (*previous_value == *isolate()->factory()->the_hole_value()) { |
+ // Do not install stubs and stay pre-monomorphic for |
+ // uninitialized accesses. |
+ return ReferenceError("not_defined", name); |
+ } |
+ |
if (FLAG_use_ic && |
StoreScriptContextFieldStub::Accepted(&lookup_result)) { |
StoreScriptContextFieldStub stub(isolate(), &lookup_result); |