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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 } | 994 } |
995 | 995 |
996 | 996 |
997 void InstructionSelector::VisitThrow(Node* value) { | 997 void InstructionSelector::VisitThrow(Node* value) { |
998 UNIMPLEMENTED(); // TODO(titzer) | 998 UNIMPLEMENTED(); // TODO(titzer) |
999 } | 999 } |
1000 | 1000 |
1001 | 1001 |
1002 FrameStateDescriptor* InstructionSelector::GetFrameStateDescriptor( | 1002 FrameStateDescriptor* InstructionSelector::GetFrameStateDescriptor( |
1003 Node* state) { | 1003 Node* state) { |
1004 DCHECK(state->opcode() == IrOpcode::kFrameState); | 1004 DCHECK(state->op()->opcode() == IrOpcode::kFrameState); |
1005 DCHECK_EQ(5, state->InputCount()); | |
1006 FrameStateCallInfo state_info = OpParameter<FrameStateCallInfo>(state); | 1005 FrameStateCallInfo state_info = OpParameter<FrameStateCallInfo>(state); |
1007 int parameters = OpParameter<int>(state->InputAt(0)); | 1006 Node* parameters = state->InputAt(0); |
1008 int locals = OpParameter<int>(state->InputAt(1)); | 1007 Node* locals = state->InputAt(1); |
1009 int stack = OpParameter<int>(state->InputAt(2)); | 1008 Node* stack = state->InputAt(2); |
1010 | |
1011 FrameStateDescriptor* outer_state = NULL; | |
1012 Node* outer_node = state->InputAt(4); | |
1013 if (outer_node->opcode() == IrOpcode::kFrameState) { | |
1014 outer_state = GetFrameStateDescriptor(outer_node); | |
1015 } | |
1016 | 1009 |
1017 return new (instruction_zone()) | 1010 return new (instruction_zone()) |
1018 FrameStateDescriptor(state_info, parameters, locals, stack, outer_state); | 1011 FrameStateDescriptor(state_info, OpParameter<int>(parameters), |
| 1012 OpParameter<int>(locals), OpParameter<int>(stack)); |
1019 } | 1013 } |
1020 | 1014 |
1021 | 1015 |
1022 static InstructionOperand* UseOrImmediate(OperandGenerator* g, Node* input) { | 1016 static InstructionOperand* UseOrImmediate(OperandGenerator* g, Node* input) { |
1023 switch (input->opcode()) { | 1017 switch (input->opcode()) { |
1024 case IrOpcode::kInt32Constant: | 1018 case IrOpcode::kInt32Constant: |
1025 case IrOpcode::kNumberConstant: | 1019 case IrOpcode::kNumberConstant: |
1026 case IrOpcode::kFloat64Constant: | 1020 case IrOpcode::kFloat64Constant: |
1027 case IrOpcode::kHeapConstant: | 1021 case IrOpcode::kHeapConstant: |
1028 return g->UseImmediate(input); | 1022 return g->UseImmediate(input); |
1029 default: | 1023 default: |
1030 return g->UseUnique(input); | 1024 return g->UseUnique(input); |
1031 } | 1025 } |
1032 } | 1026 } |
1033 | 1027 |
1034 | 1028 |
1035 void InstructionSelector::AddFrameStateInputs( | 1029 void InstructionSelector::AddFrameStateInputs( |
1036 Node* state, InstructionOperandVector* inputs, | 1030 Node* state, InstructionOperandVector* inputs, |
1037 FrameStateDescriptor* descriptor) { | 1031 FrameStateDescriptor* descriptor) { |
1038 DCHECK_EQ(IrOpcode::kFrameState, state->op()->opcode()); | 1032 DCHECK_EQ(IrOpcode::kFrameState, state->op()->opcode()); |
1039 | 1033 |
1040 if (descriptor->outer_state() != NULL) { | |
1041 AddFrameStateInputs(state->InputAt(4), inputs, descriptor->outer_state()); | |
1042 } | |
1043 | |
1044 Node* parameters = state->InputAt(0); | 1034 Node* parameters = state->InputAt(0); |
1045 Node* locals = state->InputAt(1); | 1035 Node* locals = state->InputAt(1); |
1046 Node* stack = state->InputAt(2); | 1036 Node* stack = state->InputAt(2); |
1047 Node* context = state->InputAt(3); | 1037 Node* context = state->InputAt(3); |
1048 | 1038 |
1049 DCHECK_EQ(IrOpcode::kStateValues, parameters->op()->opcode()); | 1039 DCHECK_EQ(IrOpcode::kStateValues, parameters->op()->opcode()); |
1050 DCHECK_EQ(IrOpcode::kStateValues, locals->op()->opcode()); | 1040 DCHECK_EQ(IrOpcode::kStateValues, locals->op()->opcode()); |
1051 DCHECK_EQ(IrOpcode::kStateValues, stack->op()->opcode()); | 1041 DCHECK_EQ(IrOpcode::kStateValues, stack->op()->opcode()); |
1052 | 1042 |
1053 DCHECK_EQ(descriptor->parameters_count(), parameters->InputCount()); | 1043 DCHECK_EQ(descriptor->parameters_count(), parameters->InputCount()); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 | 1096 |
1107 | 1097 |
1108 void InstructionSelector::VisitCall(Node* call, BasicBlock* continuation, | 1098 void InstructionSelector::VisitCall(Node* call, BasicBlock* continuation, |
1109 BasicBlock* deoptimization) {} | 1099 BasicBlock* deoptimization) {} |
1110 | 1100 |
1111 #endif // !V8_TURBOFAN_BACKEND | 1101 #endif // !V8_TURBOFAN_BACKEND |
1112 | 1102 |
1113 } // namespace compiler | 1103 } // namespace compiler |
1114 } // namespace internal | 1104 } // namespace internal |
1115 } // namespace v8 | 1105 } // namespace v8 |
OLD | NEW |