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

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

Issue 2385123002: [ignition] Fix building lookup graph when search depth is 0 (Closed)
Patch Set: Remove singleton merge when there is no slow path Created 4 years, 2 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 | test/mjsunit/regress/regress-crbug-652186-global.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/bytecode-graph-builder.cc
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index c07aa742cc11cb36ccc15599c646455c61523abb..d26ff93e3f2373fb4d230e0950f36b5bd4ff9b2d 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -896,8 +896,6 @@ BytecodeGraphBuilder::Environment* BytecodeGraphBuilder::CheckContextExtensions(
// Output environment where the context has an extension
Environment* slow_environment = nullptr;
- DCHECK_GT(depth, 0u);
-
// We only need to check up to the last-but-one depth, because the an eval in
// the same scope as the variable itself has no way of shadowing it.
for (uint32_t d = 0; d < depth; d++) {
@@ -931,7 +929,9 @@ BytecodeGraphBuilder::Environment* BytecodeGraphBuilder::CheckContextExtensions(
}
}
- DCHECK_NOT_NULL(slow_environment);
+ // The depth can be zero, in which case no slow-path checks are built, and the
+ // slow path environment can be null.
+ DCHECK(depth == 0 || slow_environment != nullptr);
return slow_environment;
}
@@ -949,28 +949,33 @@ void BytecodeGraphBuilder::BuildLdaLookupContextSlot(TypeofMode typeof_mode) {
const Operator* op = javascript()->LoadContext(depth, slot_index, false);
Node* context = environment()->Context();
environment()->BindAccumulator(NewNode(op, context));
- NewMerge();
}
- Environment* fast_environment = environment();
- // Slow path, do a runtime load lookup.
- set_environment(slow_environment);
- {
- FrameStateBeforeAndAfter states(this);
+ // Only build the slow path if there were any slow-path checks.
+ if (slow_environment != nullptr) {
+ // Add a merge to the fast environment.
+ NewMerge();
+ Environment* fast_environment = environment();
- Node* name =
- jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
+ // Slow path, do a runtime load lookup.
+ set_environment(slow_environment);
+ {
+ FrameStateBeforeAndAfter states(this);
- const Operator* op =
- javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF
- ? Runtime::kLoadLookupSlot
- : Runtime::kLoadLookupSlotInsideTypeof);
- Node* value = NewNode(op, name);
- environment()->BindAccumulator(value, &states);
- }
+ Node* name = jsgraph()->Constant(
+ bytecode_iterator().GetConstantForIndexOperand(0));
+
+ const Operator* op =
+ javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF
+ ? Runtime::kLoadLookupSlot
+ : Runtime::kLoadLookupSlotInsideTypeof);
+ Node* value = NewNode(op, name);
+ environment()->BindAccumulator(value, &states);
+ }
- fast_environment->Merge(environment());
- set_environment(fast_environment);
+ fast_environment->Merge(environment());
+ set_environment(fast_environment);
+ }
}
void BytecodeGraphBuilder::VisitLdaLookupContextSlot() {
@@ -993,29 +998,33 @@ void BytecodeGraphBuilder::BuildLdaLookupGlobalSlot(TypeofMode typeof_mode) {
Node* node =
BuildLoadGlobal(bytecode_iterator().GetIndexOperand(1), typeof_mode);
environment()->BindAccumulator(node, &states);
+ }
+ // Only build the slow path if there were any slow-path checks.
+ if (slow_environment != nullptr) {
+ // Add a merge to the fast environment.
NewMerge();
- }
- Environment* fast_environment = environment();
+ Environment* fast_environment = environment();
- // Slow path, do a runtime load lookup.
- set_environment(slow_environment);
- {
- FrameStateBeforeAndAfter states(this);
+ // Slow path, do a runtime load lookup.
+ set_environment(slow_environment);
+ {
+ FrameStateBeforeAndAfter states(this);
- Node* name =
- jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
+ Node* name = jsgraph()->Constant(
+ bytecode_iterator().GetConstantForIndexOperand(0));
- const Operator* op =
- javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF
- ? Runtime::kLoadLookupSlot
- : Runtime::kLoadLookupSlotInsideTypeof);
- Node* value = NewNode(op, name);
- environment()->BindAccumulator(value, &states);
- }
+ const Operator* op =
+ javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF
+ ? Runtime::kLoadLookupSlot
+ : Runtime::kLoadLookupSlotInsideTypeof);
+ Node* value = NewNode(op, name);
+ environment()->BindAccumulator(value, &states);
+ }
- fast_environment->Merge(environment());
- set_environment(fast_environment);
+ fast_environment->Merge(environment());
+ set_environment(fast_environment);
+ }
}
void BytecodeGraphBuilder::VisitLdaLookupGlobalSlot() {
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-652186-global.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698