Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: src/ic/ic.cc

Issue 1001323002: Implement TDZ in StoreIC for top-level lexicals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Hydrogen fixes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.cc ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/hydrogen.cc ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698