OLD | NEW |
---|---|
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 "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
10 #include "src/compiler/pipeline.h" | 10 #include "src/compiler/pipeline.h" |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1020 } | 1020 } |
1021 | 1021 |
1022 | 1022 |
1023 void InstructionSelector::VisitThrow(Node* value) { | 1023 void InstructionSelector::VisitThrow(Node* value) { |
1024 UNIMPLEMENTED(); // TODO(titzer) | 1024 UNIMPLEMENTED(); // 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->op()->opcode() == IrOpcode::kFrameState); | 1030 DCHECK(state->opcode() == IrOpcode::kFrameState); |
1031 DCHECK_EQ(4, state->InputCount()); | |
1031 BailoutId ast_id = OpParameter<BailoutId>(state); | 1032 BailoutId ast_id = OpParameter<BailoutId>(state); |
1032 Node* parameters = state->InputAt(0); | 1033 int parameters = OpParameter<int>(state->InputAt(0)); |
1033 Node* locals = state->InputAt(1); | 1034 int locals = OpParameter<int>(state->InputAt(1)); |
1034 Node* stack = state->InputAt(2); | 1035 int stack = OpParameter<int>(state->InputAt(2)); |
1036 FrameStateDescriptor* parent = NULL; | |
1037 if (state->InputAt(3)->opcode() == IrOpcode::kFrameState) { | |
1038 parent = GetFrameStateDescriptor(state->InputAt(3)); | |
1039 } | |
1035 | 1040 |
1036 return new (instruction_zone()) | 1041 return new (instruction_zone()) |
1037 FrameStateDescriptor(ast_id, OpParameter<int>(parameters), | 1042 FrameStateDescriptor(ast_id, parameters, locals, stack, parent); |
1038 OpParameter<int>(locals), OpParameter<int>(stack)); | |
1039 } | 1043 } |
1040 | 1044 |
1041 | 1045 |
1042 static InstructionOperand* UseOrImmediate(OperandGenerator* g, Node* input) { | 1046 static InstructionOperand* UseOrImmediate(OperandGenerator* g, Node* input) { |
1043 switch (input->opcode()) { | 1047 switch (input->opcode()) { |
1044 case IrOpcode::kInt32Constant: | 1048 case IrOpcode::kInt32Constant: |
1045 case IrOpcode::kNumberConstant: | 1049 case IrOpcode::kNumberConstant: |
1046 case IrOpcode::kFloat64Constant: | 1050 case IrOpcode::kFloat64Constant: |
1047 case IrOpcode::kHeapConstant: | 1051 case IrOpcode::kHeapConstant: |
1048 return g->UseImmediate(input); | 1052 return g->UseImmediate(input); |
(...skipping 19 matching lines...) Expand all Loading... | |
1068 OperandGenerator g(this); | 1072 OperandGenerator g(this); |
1069 for (int i = 0; i < descriptor->parameters_count(); i++) { | 1073 for (int i = 0; i < descriptor->parameters_count(); i++) { |
1070 inputs->push_back(UseOrImmediate(&g, parameters->InputAt(i))); | 1074 inputs->push_back(UseOrImmediate(&g, parameters->InputAt(i))); |
1071 } | 1075 } |
1072 for (int i = 0; i < descriptor->locals_count(); i++) { | 1076 for (int i = 0; i < descriptor->locals_count(); i++) { |
1073 inputs->push_back(UseOrImmediate(&g, locals->InputAt(i))); | 1077 inputs->push_back(UseOrImmediate(&g, locals->InputAt(i))); |
1074 } | 1078 } |
1075 for (int i = 0; i < descriptor->stack_count(); i++) { | 1079 for (int i = 0; i < descriptor->stack_count(); i++) { |
1076 inputs->push_back(UseOrImmediate(&g, stack->InputAt(i))); | 1080 inputs->push_back(UseOrImmediate(&g, stack->InputAt(i))); |
1077 } | 1081 } |
1082 | |
1083 if (descriptor->parent() != NULL) { | |
Jarin
2014/08/29 15:07:07
Could you recurse first? (So that the outer guys a
sigurds
2014/09/01 08:48:18
Done.
| |
1084 AddFrameStateInputs(state->InputAt(3), inputs, descriptor->parent()); | |
1085 } | |
1078 } | 1086 } |
1079 | 1087 |
1080 | 1088 |
1081 void InstructionSelector::VisitDeoptimize(Node* deopt) { | 1089 void InstructionSelector::VisitDeoptimize(Node* deopt) { |
1082 DCHECK(deopt->op()->opcode() == IrOpcode::kDeoptimize); | 1090 DCHECK(deopt->op()->opcode() == IrOpcode::kDeoptimize); |
1083 Node* state = deopt->InputAt(0); | 1091 Node* state = deopt->InputAt(0); |
1084 FrameStateDescriptor* descriptor = GetFrameStateDescriptor(state); | 1092 FrameStateDescriptor* descriptor = GetFrameStateDescriptor(state); |
1085 int deoptimization_id = sequence()->AddDeoptimizationEntry(descriptor); | 1093 int deoptimization_id = sequence()->AddDeoptimizationEntry(descriptor); |
1086 | 1094 |
1087 InstructionOperandVector inputs(zone()); | 1095 InstructionOperandVector inputs(zone()); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1136 | 1144 |
1137 | 1145 |
1138 void InstructionSelector::VisitCall(Node* call, BasicBlock* continuation, | 1146 void InstructionSelector::VisitCall(Node* call, BasicBlock* continuation, |
1139 BasicBlock* deoptimization) {} | 1147 BasicBlock* deoptimization) {} |
1140 | 1148 |
1141 #endif // !V8_TURBOFAN_BACKEND | 1149 #endif // !V8_TURBOFAN_BACKEND |
1142 | 1150 |
1143 } // namespace compiler | 1151 } // namespace compiler |
1144 } // namespace internal | 1152 } // namespace internal |
1145 } // namespace v8 | 1153 } // namespace v8 |
OLD | NEW |