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

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

Issue 1630523002: [turbofan] Switch JSForInPrepare to %ForInPrepare style. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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/compiler/js-typed-lowering.h ('k') | src/compiler/typer.cc » ('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 8fb28a600c7fe9e8ac913642c5b8ed31fb690ffe..d13355a610ec6b2a662227b1704bb16bfa17cb7d 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -2270,159 +2270,6 @@ Reduction JSTypedLowering::ReduceJSForInDone(Node* node) {
}
-Reduction JSTypedLowering::ReduceJSForInPrepare(Node* node) {
- DCHECK_EQ(IrOpcode::kJSForInPrepare, node->opcode());
- Node* receiver = NodeProperties::GetValueInput(node, 0);
- Node* context = NodeProperties::GetContextInput(node);
- Node* frame_state = NodeProperties::GetFrameStateInput(node, 0);
- Node* effect = NodeProperties::GetEffectInput(node);
- Node* control = NodeProperties::GetControlInput(node);
-
- // Get the set of properties to enumerate.
- Node* cache_type = effect = graph()->NewNode(
- javascript()->CallRuntime(Runtime::kGetPropertyNamesFast), receiver,
- context, frame_state, effect, control);
- control = graph()->NewNode(common()->IfSuccess(), cache_type);
-
- Node* receiver_map = effect =
- graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()),
- receiver, effect, control);
- Node* cache_type_map = effect =
- graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()),
- cache_type, effect, control);
- Node* meta_map = jsgraph()->HeapConstant(factory()->meta_map());
-
- // If we got a map from the GetPropertyNamesFast runtime call, we can do a
- // fast modification check. Otherwise, we got a fixed array, and we have to
- // perform a slow check on every iteration.
- Node* check0 = graph()->NewNode(simplified()->ReferenceEqual(Type::Any()),
- cache_type_map, meta_map);
- Node* branch0 =
- graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control);
-
- Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
- Node* cache_array_true0;
- Node* cache_length_true0;
- Node* cache_type_true0;
- Node* etrue0;
- {
- // Enum cache case.
- Node* cache_type_enum_length = etrue0 = graph()->NewNode(
- simplified()->LoadField(AccessBuilder::ForMapBitField3()), cache_type,
- effect, if_true0);
- cache_length_true0 = graph()->NewNode(
- simplified()->NumberBitwiseAnd(), cache_type_enum_length,
- jsgraph()->Int32Constant(Map::EnumLengthBits::kMask));
-
- Node* check1 =
- graph()->NewNode(machine()->Word32Equal(), cache_length_true0,
- jsgraph()->Int32Constant(0));
- Node* branch1 =
- graph()->NewNode(common()->Branch(BranchHint::kTrue), check1, if_true0);
-
- Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
- Node* cache_array_true1;
- Node* etrue1;
- {
- // No properties to enumerate.
- cache_array_true1 =
- jsgraph()->HeapConstant(factory()->empty_fixed_array());
- etrue1 = etrue0;
- }
-
- Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
- Node* cache_array_false1;
- Node* efalse1;
- {
- // Load the enumeration cache from the instance descriptors of {receiver}.
- Node* receiver_map_descriptors = efalse1 = graph()->NewNode(
- simplified()->LoadField(AccessBuilder::ForMapDescriptors()),
- receiver_map, etrue0, if_false1);
- Node* object_map_enum_cache = efalse1 = graph()->NewNode(
- simplified()->LoadField(AccessBuilder::ForDescriptorArrayEnumCache()),
- receiver_map_descriptors, efalse1, if_false1);
- cache_array_false1 = efalse1 = graph()->NewNode(
- simplified()->LoadField(
- AccessBuilder::ForDescriptorArrayEnumCacheBridgeCache()),
- object_map_enum_cache, efalse1, if_false1);
- }
-
- if_true0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1);
- etrue0 =
- graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_true0);
- cache_array_true0 =
- graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
- cache_array_true1, cache_array_false1, if_true0);
-
- cache_type_true0 = cache_type;
- }
-
- Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
- Node* cache_array_false0;
- Node* cache_length_false0;
- Node* cache_type_false0;
- Node* efalse0;
- {
- // FixedArray case.
- cache_type_false0 = jsgraph()->OneConstant(); // Smi means slow check
- cache_array_false0 = cache_type;
- cache_length_false0 = efalse0 = graph()->NewNode(
- simplified()->LoadField(AccessBuilder::ForFixedArrayLength()),
- cache_array_false0, effect, if_false0);
- }
-
- control = graph()->NewNode(common()->Merge(2), if_true0, if_false0);
- effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control);
- Node* cache_array =
- graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
- cache_array_true0, cache_array_false0, control);
- Node* cache_length =
- graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
- cache_length_true0, cache_length_false0, control);
- cache_type =
- graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
- cache_type_true0, cache_type_false0, control);
-
- for (auto edge : node->use_edges()) {
- Node* const use = edge.from();
- if (NodeProperties::IsEffectEdge(edge)) {
- edge.UpdateTo(effect);
- Revisit(use);
- } else {
- if (NodeProperties::IsControlEdge(edge)) {
- if (use->opcode() == IrOpcode::kIfSuccess) {
- Replace(use, control);
- } else if (use->opcode() == IrOpcode::kIfException) {
- edge.UpdateTo(cache_type_true0);
- continue;
- } else {
- UNREACHABLE();
- }
- } else {
- DCHECK(NodeProperties::IsValueEdge(edge));
- DCHECK_EQ(IrOpcode::kProjection, use->opcode());
- switch (ProjectionIndexOf(use->op())) {
- case 0:
- Replace(use, cache_type);
- break;
- case 1:
- Replace(use, cache_array);
- break;
- case 2:
- Replace(use, cache_length);
- break;
- default:
- UNREACHABLE();
- break;
- }
- }
- use->Kill();
- }
- }
- return NoChange(); // All uses were replaced already above.
-}
-
-
Reduction JSTypedLowering::ReduceJSForInNext(Node* node) {
DCHECK_EQ(IrOpcode::kJSForInNext, node->opcode());
Node* receiver = NodeProperties::GetValueInput(node, 0);
@@ -2670,8 +2517,6 @@ Reduction JSTypedLowering::Reduce(Node* node) {
return ReduceJSForInDone(node);
case IrOpcode::kJSForInNext:
return ReduceJSForInNext(node);
- case IrOpcode::kJSForInPrepare:
- return ReduceJSForInPrepare(node);
case IrOpcode::kJSForInStep:
return ReduceJSForInStep(node);
case IrOpcode::kSelect:
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698