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