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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 all[arity - 1] = callee; | 1089 all[arity - 1] = callee; |
1090 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); | 1090 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); |
1091 return value; | 1091 return value; |
1092 } | 1092 } |
1093 | 1093 |
1094 void BytecodeGraphBuilder::VisitNew() { | 1094 void BytecodeGraphBuilder::VisitNew() { |
1095 FrameStateBeforeAndAfter states(this); | 1095 FrameStateBeforeAndAfter states(this); |
1096 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); | 1096 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); |
1097 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); | 1097 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
1098 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 1098 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
| 1099 // Slot index of 0 is used indicate no feedback slot is available. Assert |
| 1100 // the assumption that slot index 0 is never a valid feedback slot. |
| 1101 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0); |
| 1102 VectorSlotPair feedback = |
| 1103 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); |
1099 | 1104 |
1100 Node* new_target = environment()->LookupAccumulator(); | 1105 Node* new_target = environment()->LookupAccumulator(); |
1101 Node* callee = environment()->LookupRegister(callee_reg); | 1106 Node* callee = environment()->LookupRegister(callee_reg); |
1102 // TODO(turbofan): Pass the feedback here. | 1107 |
1103 const Operator* call = javascript()->CallConstruct( | 1108 const Operator* call = |
1104 static_cast<int>(arg_count) + 2, VectorSlotPair()); | 1109 javascript()->CallConstruct(static_cast<int>(arg_count) + 2, feedback); |
1105 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, | 1110 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, |
1106 arg_count + 2); | 1111 arg_count + 2); |
1107 environment()->BindAccumulator(value, &states); | 1112 environment()->BindAccumulator(value, &states); |
1108 } | 1113 } |
1109 | 1114 |
1110 void BytecodeGraphBuilder::BuildThrow() { | 1115 void BytecodeGraphBuilder::BuildThrow() { |
1111 FrameStateBeforeAndAfter states(this); | 1116 FrameStateBeforeAndAfter states(this); |
1112 Node* value = environment()->LookupAccumulator(); | 1117 Node* value = environment()->LookupAccumulator(); |
1113 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); | 1118 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); |
1114 environment()->BindAccumulator(call, &states); | 1119 environment()->BindAccumulator(call, &states); |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1832 // Phi does not exist yet, introduce one. | 1837 // Phi does not exist yet, introduce one. |
1833 value = NewPhi(inputs, value, control); | 1838 value = NewPhi(inputs, value, control); |
1834 value->ReplaceInput(inputs - 1, other); | 1839 value->ReplaceInput(inputs - 1, other); |
1835 } | 1840 } |
1836 return value; | 1841 return value; |
1837 } | 1842 } |
1838 | 1843 |
1839 } // namespace compiler | 1844 } // namespace compiler |
1840 } // namespace internal | 1845 } // namespace internal |
1841 } // namespace v8 | 1846 } // namespace v8 |
OLD | NEW |