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 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 all[arity - 1] = callee; | 1053 all[arity - 1] = callee; |
1054 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); | 1054 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); |
1055 return value; | 1055 return value; |
1056 } | 1056 } |
1057 | 1057 |
1058 void BytecodeGraphBuilder::VisitNew() { | 1058 void BytecodeGraphBuilder::VisitNew() { |
1059 FrameStateBeforeAndAfter states(this); | 1059 FrameStateBeforeAndAfter states(this); |
1060 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); | 1060 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); |
1061 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); | 1061 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
1062 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 1062 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
| 1063 // Slot index of 0 is used indicate no feedback slot is available. Assert |
| 1064 // the assumption that slot index 0 is never a valid feedback slot. |
| 1065 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0); |
| 1066 VectorSlotPair feedback = |
| 1067 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); |
1063 | 1068 |
1064 Node* new_target = environment()->LookupAccumulator(); | 1069 Node* new_target = environment()->LookupAccumulator(); |
1065 Node* callee = environment()->LookupRegister(callee_reg); | 1070 Node* callee = environment()->LookupRegister(callee_reg); |
1066 // TODO(turbofan): Pass the feedback here. | 1071 |
1067 const Operator* call = javascript()->CallConstruct( | 1072 const Operator* call = |
1068 static_cast<int>(arg_count) + 2, VectorSlotPair()); | 1073 javascript()->CallConstruct(static_cast<int>(arg_count) + 2, feedback); |
1069 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, | 1074 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, |
1070 arg_count + 2); | 1075 arg_count + 2); |
1071 environment()->BindAccumulator(value, &states); | 1076 environment()->BindAccumulator(value, &states); |
1072 } | 1077 } |
1073 | 1078 |
1074 void BytecodeGraphBuilder::BuildThrow() { | 1079 void BytecodeGraphBuilder::BuildThrow() { |
1075 FrameStateBeforeAndAfter states(this); | 1080 FrameStateBeforeAndAfter states(this); |
1076 Node* value = environment()->LookupAccumulator(); | 1081 Node* value = environment()->LookupAccumulator(); |
1077 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); | 1082 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); |
1078 environment()->BindAccumulator(call, &states); | 1083 environment()->BindAccumulator(call, &states); |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 // Phi does not exist yet, introduce one. | 1789 // Phi does not exist yet, introduce one. |
1785 value = NewPhi(inputs, value, control); | 1790 value = NewPhi(inputs, value, control); |
1786 value->ReplaceInput(inputs - 1, other); | 1791 value->ReplaceInput(inputs - 1, other); |
1787 } | 1792 } |
1788 return value; | 1793 return value; |
1789 } | 1794 } |
1790 | 1795 |
1791 } // namespace compiler | 1796 } // namespace compiler |
1792 } // namespace internal | 1797 } // namespace internal |
1793 } // namespace v8 | 1798 } // namespace v8 |
OLD | NEW |