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

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 1424943008: [turbofan] Desugar lookup slot optimization in graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment. Created 5 years, 1 month 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/compiler/js-typed-lowering.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index 0d83d2baf1949a94def00b654b5abd74e10bcc47..60a8b4fa945d9b527db320c4f5fc54a1e0f6ab19 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -1110,122 +1110,6 @@ Reduction JSTypedLowering::ReduceJSStoreContext(Node* node) {
}
-Reduction JSTypedLowering::ReduceJSLoadDynamicGlobal(Node* node) {
- DCHECK_EQ(IrOpcode::kJSLoadDynamicGlobal, node->opcode());
- DynamicGlobalAccess const& access = DynamicGlobalAccessOf(node->op());
- Node* const vector = NodeProperties::GetValueInput(node, 0);
- Node* const context = NodeProperties::GetContextInput(node);
- Node* const state1 = NodeProperties::GetFrameStateInput(node, 0);
- Node* const state2 = NodeProperties::GetFrameStateInput(node, 1);
- Node* const effect = NodeProperties::GetEffectInput(node);
- Node* const control = NodeProperties::GetControlInput(node);
- if (access.RequiresFullCheck()) return NoChange();
-
- // Perform checks whether the fast mode applies, by looking for any extension
- // object which might shadow the optimistic declaration.
- uint32_t bitset = access.check_bitset();
- Node* check_true = control;
- Node* check_false = graph()->NewNode(common()->Merge(0));
- for (int depth = 0; bitset != 0; bitset >>= 1, depth++) {
- if ((bitset & 1) == 0) continue;
- Node* load = graph()->NewNode(
- javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false),
- context, context, effect);
- Node* check = graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()),
- load, jsgraph()->ZeroConstant());
- Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), check,
- check_true);
- Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
- Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
- check_false->AppendInput(graph()->zone(), if_false);
- NodeProperties::ChangeOp(check_false,
- common()->Merge(check_false->InputCount()));
- check_true = if_true;
- }
-
- // Fast case, because variable is not shadowed. Perform global object load.
- Node* fast = graph()->NewNode(
- javascript()->LoadGlobal(access.name(), access.feedback(),
- access.typeof_mode()),
- vector, context, state1, state2, effect, check_true);
-
- // Slow case, because variable potentially shadowed. Perform dynamic lookup.
- uint32_t check_bitset = DynamicGlobalAccess::kFullCheckRequired;
- Node* slow = graph()->NewNode(
- javascript()->LoadDynamicGlobal(access.name(), check_bitset,
- access.feedback(), access.typeof_mode()),
- vector, context, context, state1, state2, effect, check_false);
-
- // Replace value, effect and control uses accordingly.
- Node* new_control =
- graph()->NewNode(common()->Merge(2), check_true, check_false);
- Node* new_effect =
- graph()->NewNode(common()->EffectPhi(2), fast, slow, new_control);
- Node* new_value = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), fast,
- slow, new_control);
- ReplaceWithValue(node, new_value, new_effect, new_control);
- return Changed(new_value);
-}
-
-
-Reduction JSTypedLowering::ReduceJSLoadDynamicContext(Node* node) {
- DCHECK_EQ(IrOpcode::kJSLoadDynamicContext, node->opcode());
- DynamicContextAccess const& access = DynamicContextAccessOf(node->op());
- ContextAccess const& context_access = access.context_access();
- Node* const context = NodeProperties::GetContextInput(node);
- Node* const state = NodeProperties::GetFrameStateInput(node, 0);
- Node* const effect = NodeProperties::GetEffectInput(node);
- Node* const control = NodeProperties::GetControlInput(node);
- if (access.RequiresFullCheck()) return NoChange();
-
- // Perform checks whether the fast mode applies, by looking for any extension
- // object which might shadow the optimistic declaration.
- uint32_t bitset = access.check_bitset();
- Node* check_true = control;
- Node* check_false = graph()->NewNode(common()->Merge(0));
- for (int depth = 0; bitset != 0; bitset >>= 1, depth++) {
- if ((bitset & 1) == 0) continue;
- Node* load = graph()->NewNode(
- javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false),
- context, context, effect);
- Node* check = graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()),
- load, jsgraph()->ZeroConstant());
- Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), check,
- check_true);
- Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
- Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
- check_false->AppendInput(graph()->zone(), if_false);
- NodeProperties::ChangeOp(check_false,
- common()->Merge(check_false->InputCount()));
- check_true = if_true;
- }
-
- // Fast case, because variable is not shadowed. Perform context slot load.
- Node* fast =
- graph()->NewNode(javascript()->LoadContext(context_access.depth(),
- context_access.index(), false),
- context, context, effect);
-
- // Slow case, because variable potentially shadowed. Perform dynamic lookup.
- uint32_t check_bitset = DynamicContextAccess::kFullCheckRequired;
- Node* slow =
- graph()->NewNode(javascript()->LoadDynamicContext(
- access.name(), check_bitset, context_access.depth(),
- context_access.index()),
- context, context, state, effect, check_false);
-
- // Replace value, effect and control uses accordingly.
- Node* new_control =
- graph()->NewNode(common()->Merge(2), check_true, check_false);
- Node* new_effect =
- graph()->NewNode(common()->EffectPhi(2), fast, slow, new_control);
- Node* new_value = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), fast,
- slow, new_control);
- ReplaceWithValue(node, new_value, new_effect, new_control);
- return Changed(new_value);
-}
-
-
Reduction JSTypedLowering::ReduceJSConvertReceiver(Node* node) {
DCHECK_EQ(IrOpcode::kJSConvertReceiver, node->opcode());
ConvertReceiverMode mode = ConvertReceiverModeOf(node->op());
@@ -2092,10 +1976,6 @@ Reduction JSTypedLowering::Reduce(Node* node) {
return ReduceJSLoadContext(node);
case IrOpcode::kJSStoreContext:
return ReduceJSStoreContext(node);
- case IrOpcode::kJSLoadDynamicGlobal:
- return ReduceJSLoadDynamicGlobal(node);
- case IrOpcode::kJSLoadDynamicContext:
- return ReduceJSLoadDynamicContext(node);
case IrOpcode::kJSConvertReceiver:
return ReduceJSConvertReceiver(node);
case IrOpcode::kJSCreateArguments:
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698