Index: src/ic/ic.cc |
diff --git a/src/ic/ic.cc b/src/ic/ic.cc |
index 537b18324d6868e29b5a494090f0b4cad59e4e26..d20d0c5b2fd40918c5bbb4207189e2123e8db6b2 100644 |
--- a/src/ic/ic.cc |
+++ b/src/ic/ic.cc |
@@ -725,13 +725,21 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) { |
ScriptContextTable::LookupResult lookup_result; |
if (ScriptContextTable::Lookup(script_contexts, str_name, &lookup_result)) { |
+ Handle<Object> result = |
+ FixedArray::get(ScriptContextTable::GetContext( |
+ script_contexts, lookup_result.context_index), |
+ lookup_result.slot_index); |
+ if (*result == *isolate()->factory()->the_hole_value()) { |
+ // Do not install stubs and stay pre-monomorphic for |
+ // uninitialized accesses. |
+ return ReferenceError("not_defined", name); |
+ } |
+ |
if (use_ic && LoadScriptContextFieldStub::Accepted(&lookup_result)) { |
LoadScriptContextFieldStub stub(isolate(), &lookup_result); |
PatchCache(name, stub.GetCode()); |
} |
- return FixedArray::get(ScriptContextTable::GetContext( |
- script_contexts, lookup_result.context_index), |
- lookup_result.slot_index); |
+ return result; |
} |
} |