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