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

Side by Side Diff: src/compiler/instruction-selector.cc

Issue 1134713004: [turbofan] Pass closure as node to FrameState. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/instruction-selector.h" 5 #include "src/compiler/instruction-selector.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/adapters.h" 9 #include "src/base/adapters.h"
10 #include "src/compiler/instruction-selector-impl.h" 10 #include "src/compiler/instruction-selector-impl.h"
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 1021
1022 void InstructionSelector::VisitThrow(Node* value) { 1022 void InstructionSelector::VisitThrow(Node* value) {
1023 OperandGenerator g(this); 1023 OperandGenerator g(this);
1024 Emit(kArchNop, g.NoOutput()); // TODO(titzer) 1024 Emit(kArchNop, g.NoOutput()); // TODO(titzer)
1025 } 1025 }
1026 1026
1027 1027
1028 FrameStateDescriptor* InstructionSelector::GetFrameStateDescriptor( 1028 FrameStateDescriptor* InstructionSelector::GetFrameStateDescriptor(
1029 Node* state) { 1029 Node* state) {
1030 DCHECK(state->opcode() == IrOpcode::kFrameState); 1030 DCHECK(state->opcode() == IrOpcode::kFrameState);
1031 DCHECK_EQ(5, state->InputCount()); 1031 DCHECK_EQ(6, state->InputCount());
1032 DCHECK_EQ(IrOpcode::kTypedStateValues, state->InputAt(0)->opcode()); 1032 DCHECK_EQ(IrOpcode::kTypedStateValues, state->InputAt(0)->opcode());
1033 DCHECK_EQ(IrOpcode::kTypedStateValues, state->InputAt(1)->opcode()); 1033 DCHECK_EQ(IrOpcode::kTypedStateValues, state->InputAt(1)->opcode());
1034 DCHECK_EQ(IrOpcode::kTypedStateValues, state->InputAt(2)->opcode()); 1034 DCHECK_EQ(IrOpcode::kTypedStateValues, state->InputAt(2)->opcode());
1035 FrameStateCallInfo state_info = OpParameter<FrameStateCallInfo>(state); 1035 FrameStateCallInfo state_info = OpParameter<FrameStateCallInfo>(state);
1036 1036
1037 int parameters = 1037 int parameters =
1038 static_cast<int>(StateValuesAccess(state->InputAt(0)).size()); 1038 static_cast<int>(StateValuesAccess(state->InputAt(0)).size());
1039 int locals = static_cast<int>(StateValuesAccess(state->InputAt(1)).size()); 1039 int locals = static_cast<int>(StateValuesAccess(state->InputAt(1)).size());
1040 int stack = static_cast<int>(StateValuesAccess(state->InputAt(2)).size()); 1040 int stack = static_cast<int>(StateValuesAccess(state->InputAt(2)).size());
1041 1041
1042 FrameStateDescriptor* outer_state = NULL; 1042 FrameStateDescriptor* outer_state = NULL;
1043 Node* outer_node = state->InputAt(4); 1043 Node* outer_node = state->InputAt(5);
1044 if (outer_node->opcode() == IrOpcode::kFrameState) { 1044 if (outer_node->opcode() == IrOpcode::kFrameState) {
1045 outer_state = GetFrameStateDescriptor(outer_node); 1045 outer_state = GetFrameStateDescriptor(outer_node);
1046 } 1046 }
1047 1047
1048 return new (instruction_zone()) FrameStateDescriptor( 1048 return new (instruction_zone()) FrameStateDescriptor(
1049 instruction_zone(), state_info, parameters, locals, stack, outer_state); 1049 instruction_zone(), state_info.type(), state_info.bailout_id(),
1050 state_info.state_combine(), parameters, locals, stack, outer_state);
1050 } 1051 }
1051 1052
1052 1053
1053 static InstructionOperand SlotOrImmediate(OperandGenerator* g, Node* input) { 1054 static InstructionOperand SlotOrImmediate(OperandGenerator* g, Node* input) {
1054 switch (input->opcode()) { 1055 switch (input->opcode()) {
1055 case IrOpcode::kInt32Constant: 1056 case IrOpcode::kInt32Constant:
1056 case IrOpcode::kNumberConstant: 1057 case IrOpcode::kNumberConstant:
1057 case IrOpcode::kFloat64Constant: 1058 case IrOpcode::kFloat64Constant:
1058 case IrOpcode::kHeapConstant: 1059 case IrOpcode::kHeapConstant:
1059 return g->UseImmediate(input); 1060 return g->UseImmediate(input);
1060 default: 1061 default:
1061 return g->UseUniqueSlot(input); 1062 return g->UseUniqueSlot(input);
1062 } 1063 }
1063 } 1064 }
1064 1065
1065 1066
1066 void InstructionSelector::AddFrameStateInputs( 1067 void InstructionSelector::AddFrameStateInputs(
1067 Node* state, InstructionOperandVector* inputs, 1068 Node* state, InstructionOperandVector* inputs,
1068 FrameStateDescriptor* descriptor) { 1069 FrameStateDescriptor* descriptor) {
1069 DCHECK_EQ(IrOpcode::kFrameState, state->op()->opcode()); 1070 DCHECK_EQ(IrOpcode::kFrameState, state->op()->opcode());
1070 1071
1071 if (descriptor->outer_state() != NULL) { 1072 if (descriptor->outer_state()) {
1072 AddFrameStateInputs(state->InputAt(4), inputs, descriptor->outer_state()); 1073 AddFrameStateInputs(state->InputAt(5), inputs, descriptor->outer_state());
1073 } 1074 }
1074 1075
1075 Node* parameters = state->InputAt(0); 1076 Node* parameters = state->InputAt(0);
1076 Node* locals = state->InputAt(1); 1077 Node* locals = state->InputAt(1);
1077 Node* stack = state->InputAt(2); 1078 Node* stack = state->InputAt(2);
1078 Node* context = state->InputAt(3); 1079 Node* context = state->InputAt(3);
1080 Node* function = state->InputAt(4);
1079 1081
1080 DCHECK_EQ(IrOpcode::kTypedStateValues, parameters->op()->opcode()); 1082 DCHECK_EQ(IrOpcode::kTypedStateValues, parameters->op()->opcode());
1081 DCHECK_EQ(IrOpcode::kTypedStateValues, locals->op()->opcode()); 1083 DCHECK_EQ(IrOpcode::kTypedStateValues, locals->op()->opcode());
1082 DCHECK_EQ(IrOpcode::kTypedStateValues, stack->op()->opcode()); 1084 DCHECK_EQ(IrOpcode::kTypedStateValues, stack->op()->opcode());
1083 1085
1084 DCHECK_EQ(descriptor->parameters_count(), 1086 DCHECK_EQ(descriptor->parameters_count(),
1085 StateValuesAccess(parameters).size()); 1087 StateValuesAccess(parameters).size());
1086 DCHECK_EQ(descriptor->locals_count(), StateValuesAccess(locals).size()); 1088 DCHECK_EQ(descriptor->locals_count(), StateValuesAccess(locals).size());
1087 DCHECK_EQ(descriptor->stack_count(), StateValuesAccess(stack).size()); 1089 DCHECK_EQ(descriptor->stack_count(), StateValuesAccess(stack).size());
1088 1090
1089 ZoneVector<MachineType> types(instruction_zone()); 1091 ZoneVector<MachineType> types(instruction_zone());
1090 types.reserve(descriptor->GetSize()); 1092 types.reserve(descriptor->GetSize());
1091 1093
1092 OperandGenerator g(this); 1094 OperandGenerator g(this);
1093 size_t value_index = 0; 1095 size_t value_index = 0;
1096 inputs->push_back(SlotOrImmediate(&g, function));
1097 descriptor->SetType(value_index++, kMachAnyTagged);
1094 for (StateValuesAccess::TypedNode input_node : 1098 for (StateValuesAccess::TypedNode input_node :
1095 StateValuesAccess(parameters)) { 1099 StateValuesAccess(parameters)) {
1096 inputs->push_back(SlotOrImmediate(&g, input_node.node)); 1100 inputs->push_back(SlotOrImmediate(&g, input_node.node));
1097 descriptor->SetType(value_index++, input_node.type); 1101 descriptor->SetType(value_index++, input_node.type);
1098 } 1102 }
1099 if (descriptor->HasContext()) { 1103 if (descriptor->HasContext()) {
1100 inputs->push_back(SlotOrImmediate(&g, context)); 1104 inputs->push_back(SlotOrImmediate(&g, context));
1101 descriptor->SetType(value_index++, kMachAnyTagged); 1105 descriptor->SetType(value_index++, kMachAnyTagged);
1102 } 1106 }
1103 for (StateValuesAccess::TypedNode input_node : StateValuesAccess(locals)) { 1107 for (StateValuesAccess::TypedNode input_node : StateValuesAccess(locals)) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 MachineOperatorBuilder::Flags 1147 MachineOperatorBuilder::Flags
1144 InstructionSelector::SupportedMachineOperatorFlags() { 1148 InstructionSelector::SupportedMachineOperatorFlags() {
1145 return MachineOperatorBuilder::Flag::kNoFlags; 1149 return MachineOperatorBuilder::Flag::kNoFlags;
1146 } 1150 }
1147 1151
1148 #endif // !V8_TURBOFAN_BACKEND 1152 #endif // !V8_TURBOFAN_BACKEND
1149 1153
1150 } // namespace compiler 1154 } // namespace compiler
1151 } // namespace internal 1155 } // namespace internal
1152 } // namespace v8 1156 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698