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/compilation-info.h" | 7 #include "src/compilation-info.h" |
8 #include "src/compiler/bytecode-branch-analysis.h" | 8 #include "src/compiler/bytecode-branch-analysis.h" |
9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 // lowering. | 1140 // lowering. |
1141 const Operator* call = javascript()->CallRuntime(functionId, arg_count); | 1141 const Operator* call = javascript()->CallRuntime(functionId, arg_count); |
1142 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); | 1142 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); |
1143 environment()->BindAccumulator(value, &states); | 1143 environment()->BindAccumulator(value, &states); |
1144 } | 1144 } |
1145 | 1145 |
1146 Node* BytecodeGraphBuilder::ProcessCallNewArguments( | 1146 Node* BytecodeGraphBuilder::ProcessCallNewArguments( |
1147 const Operator* call_new_op, Node* callee, Node* new_target, | 1147 const Operator* call_new_op, Node* callee, Node* new_target, |
1148 interpreter::Register first_arg, size_t arity) { | 1148 interpreter::Register first_arg, size_t arity) { |
1149 Node** all = local_zone()->NewArray<Node*>(arity); | 1149 Node** all = local_zone()->NewArray<Node*>(arity); |
1150 all[0] = new_target; | 1150 all[0] = callee; |
1151 int first_arg_index = first_arg.index(); | 1151 int first_arg_index = first_arg.index(); |
1152 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { | 1152 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { |
1153 all[i] = environment()->LookupRegister( | 1153 all[i] = environment()->LookupRegister( |
1154 interpreter::Register(first_arg_index + i - 1)); | 1154 interpreter::Register(first_arg_index + i - 1)); |
1155 } | 1155 } |
1156 all[arity - 1] = callee; | 1156 all[arity - 1] = new_target; |
1157 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); | 1157 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); |
1158 return value; | 1158 return value; |
1159 } | 1159 } |
1160 | 1160 |
1161 void BytecodeGraphBuilder::VisitNew() { | 1161 void BytecodeGraphBuilder::VisitNew() { |
1162 FrameStateBeforeAndAfter states(this); | 1162 FrameStateBeforeAndAfter states(this); |
1163 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); | 1163 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); |
1164 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); | 1164 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
1165 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 1165 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
1166 // Slot index of 0 is used indicate no feedback slot is available. Assert | 1166 // Slot index of 0 is used indicate no feedback slot is available. Assert |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 // Phi does not exist yet, introduce one. | 1960 // Phi does not exist yet, introduce one. |
1961 value = NewPhi(inputs, value, control); | 1961 value = NewPhi(inputs, value, control); |
1962 value->ReplaceInput(inputs - 1, other); | 1962 value->ReplaceInput(inputs - 1, other); |
1963 } | 1963 } |
1964 return value; | 1964 return value; |
1965 } | 1965 } |
1966 | 1966 |
1967 } // namespace compiler | 1967 } // namespace compiler |
1968 } // namespace internal | 1968 } // namespace internal |
1969 } // namespace v8 | 1969 } // namespace v8 |
OLD | NEW |