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

Unified Diff: src/hydrogen.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 | « no previous file | src/ic/ic.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 5c6b5cd9b8c47acb482ca28b38869109b9d03433..14046b410d476ecf2173e928a960a51068901317 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -5327,7 +5327,7 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
Handle<Context> script_context = ScriptContextTable::GetContext(
script_contexts, lookup.context_index);
Handle<Object> current_value =
- FixedArray::get(script_context, lookup.context_index);
+ FixedArray::get(script_context, lookup.slot_index);
// If the values is not the hole, it will stay initialized,
// so no need to generate a check.
@@ -6488,6 +6488,16 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
}
Handle<Context> script_context =
ScriptContextTable::GetContext(script_contexts, lookup.context_index);
+
+ Handle<Object> current_value =
+ FixedArray::get(script_context, lookup.slot_index);
+
+ // If the values is not the hole, it will stay initialized,
+ // so no need to generate a check.
+ if (*current_value == *isolate()->factory()->the_hole_value()) {
+ return Bailout(kReferenceToUninitializedVariable);
+ }
+
HStoreNamedField* instr = Add<HStoreNamedField>(
Add<HConstant>(script_context),
HObjectAccess::ForContextSlot(lookup.slot_index), value);
« no previous file with comments | « no previous file | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698