OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/bytecode-graph-builder.h" | 5 #include "src/compiler/bytecode-graph-builder.h" |
6 | 6 |
7 #include "src/compiler/bytecode-branch-analysis.h" | 7 #include "src/compiler/bytecode-branch-analysis.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/operator-properties.h" | 9 #include "src/compiler/operator-properties.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 all[arity - 1] = callee; | 1087 all[arity - 1] = callee; |
1088 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); | 1088 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); |
1089 return value; | 1089 return value; |
1090 } | 1090 } |
1091 | 1091 |
1092 void BytecodeGraphBuilder::VisitNew() { | 1092 void BytecodeGraphBuilder::VisitNew() { |
1093 FrameStateBeforeAndAfter states(this); | 1093 FrameStateBeforeAndAfter states(this); |
1094 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); | 1094 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); |
1095 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); | 1095 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
1096 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 1096 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
| 1097 // Slot index of 0 is used indicate no feedback slot is available. Assert |
| 1098 // the assumption that slot index 0 is never a valid feedback slot. |
| 1099 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0); |
| 1100 VectorSlotPair feedback = |
| 1101 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); |
1097 | 1102 |
1098 Node* new_target = environment()->LookupAccumulator(); | 1103 Node* new_target = environment()->LookupAccumulator(); |
1099 Node* callee = environment()->LookupRegister(callee_reg); | 1104 Node* callee = environment()->LookupRegister(callee_reg); |
1100 // TODO(turbofan): Pass the feedback here. | 1105 |
1101 const Operator* call = javascript()->CallConstruct( | 1106 const Operator* call = |
1102 static_cast<int>(arg_count) + 2, VectorSlotPair()); | 1107 javascript()->CallConstruct(static_cast<int>(arg_count) + 2, feedback); |
1103 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, | 1108 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, |
1104 arg_count + 2); | 1109 arg_count + 2); |
1105 environment()->BindAccumulator(value, &states); | 1110 environment()->BindAccumulator(value, &states); |
1106 } | 1111 } |
1107 | 1112 |
1108 void BytecodeGraphBuilder::BuildThrow() { | 1113 void BytecodeGraphBuilder::BuildThrow() { |
1109 FrameStateBeforeAndAfter states(this); | 1114 FrameStateBeforeAndAfter states(this); |
1110 Node* value = environment()->LookupAccumulator(); | 1115 Node* value = environment()->LookupAccumulator(); |
1111 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); | 1116 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); |
1112 environment()->BindAccumulator(call, &states); | 1117 environment()->BindAccumulator(call, &states); |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 // Phi does not exist yet, introduce one. | 1828 // Phi does not exist yet, introduce one. |
1824 value = NewPhi(inputs, value, control); | 1829 value = NewPhi(inputs, value, control); |
1825 value->ReplaceInput(inputs - 1, other); | 1830 value->ReplaceInput(inputs - 1, other); |
1826 } | 1831 } |
1827 return value; | 1832 return value; |
1828 } | 1833 } |
1829 | 1834 |
1830 } // namespace compiler | 1835 } // namespace compiler |
1831 } // namespace internal | 1836 } // namespace internal |
1832 } // namespace v8 | 1837 } // namespace v8 |
OLD | NEW |