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 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 all[arity - 1] = callee; | 1152 all[arity - 1] = callee; |
1153 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); | 1153 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); |
1154 return value; | 1154 return value; |
1155 } | 1155 } |
1156 | 1156 |
1157 void BytecodeGraphBuilder::VisitNew() { | 1157 void BytecodeGraphBuilder::VisitNew() { |
1158 FrameStateBeforeAndAfter states(this); | 1158 FrameStateBeforeAndAfter states(this); |
1159 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); | 1159 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); |
1160 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); | 1160 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
1161 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 1161 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
| 1162 // Slot index of 0 is used indicate no feedback slot is available. Assert |
| 1163 // the assumption that slot index 0 is never a valid feedback slot. |
| 1164 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0); |
| 1165 VectorSlotPair feedback = |
| 1166 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); |
1162 | 1167 |
1163 Node* new_target = environment()->LookupAccumulator(); | 1168 Node* new_target = environment()->LookupAccumulator(); |
1164 Node* callee = environment()->LookupRegister(callee_reg); | 1169 Node* callee = environment()->LookupRegister(callee_reg); |
1165 // TODO(turbofan): Pass the feedback here. | 1170 |
1166 const Operator* call = javascript()->CallConstruct( | 1171 const Operator* call = |
1167 static_cast<int>(arg_count) + 2, VectorSlotPair()); | 1172 javascript()->CallConstruct(static_cast<int>(arg_count) + 2, feedback); |
1168 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, | 1173 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, |
1169 arg_count + 2); | 1174 arg_count + 2); |
1170 environment()->BindAccumulator(value, &states); | 1175 environment()->BindAccumulator(value, &states); |
1171 } | 1176 } |
1172 | 1177 |
1173 void BytecodeGraphBuilder::BuildThrow() { | 1178 void BytecodeGraphBuilder::BuildThrow() { |
1174 FrameStateBeforeAndAfter states(this); | 1179 FrameStateBeforeAndAfter states(this); |
1175 Node* value = environment()->LookupAccumulator(); | 1180 Node* value = environment()->LookupAccumulator(); |
1176 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); | 1181 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); |
1177 environment()->BindAccumulator(call, &states); | 1182 environment()->BindAccumulator(call, &states); |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1945 // Phi does not exist yet, introduce one. | 1950 // Phi does not exist yet, introduce one. |
1946 value = NewPhi(inputs, value, control); | 1951 value = NewPhi(inputs, value, control); |
1947 value->ReplaceInput(inputs - 1, other); | 1952 value->ReplaceInput(inputs - 1, other); |
1948 } | 1953 } |
1949 return value; | 1954 return value; |
1950 } | 1955 } |
1951 | 1956 |
1952 } // namespace compiler | 1957 } // namespace compiler |
1953 } // namespace internal | 1958 } // namespace internal |
1954 } // namespace v8 | 1959 } // namespace v8 |
OLD | NEW |