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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1155543003: [turbofan] Optimized lowering of DYNAMIC_LOCAL lookup slot loads. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 years, 7 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/compiler/js-typed-lowering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 247f674981c6892183424c8da7f22bdf43d854c3..8ade929060a37a243b004f08769b6032b9377ce6 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -2772,7 +2772,7 @@ uint32_t AstGraphBuilder::ComputeBitsetForDynamicContext(Variable* variable) {
EnumSet<int, uint32_t> check_depths;
for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) {
if (s->num_heap_slots() <= 0) continue;
- if (!s->calls_sloppy_eval()) continue;
+ if (!s->calls_sloppy_eval() && s != variable->scope()) continue;
int depth = current_scope()->ContextChainLength(s);
if (depth > DynamicContextAccess::kMaxCheckDepth) {
return DynamicContextAccess::kFullCheckRequired;
@@ -3040,7 +3040,15 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
name, check_bitset, depth, local->index());
value = NewNode(op, current_context());
PrepareFrameState(value, bailout_id, combine);
- // TODO(mstarzinger): Hole checks are missing here when optimized.
+ VariableMode local_mode = local->mode();
+ if (local_mode == CONST_LEGACY) {
+ // Perform check for uninitialized legacy const variables.
+ Node* undefined = jsgraph()->UndefinedConstant();
+ value = BuildHoleCheckSilent(value, undefined, value);
+ } else if (local_mode == LET || local_mode == CONST) {
+ // Perform check for uninitialized let/const variables.
+ value = BuildHoleCheckThrow(value, local, value, bailout_id);
+ }
} else if (mode == DYNAMIC) {
uint32_t check_bitset = DynamicGlobalAccess::kFullCheckRequired;
const Operator* op = javascript()->LoadDynamicGlobal(
« no previous file with comments | « no previous file | src/compiler/js-typed-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698