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 } | 1089 } |
1090 | 1090 |
1091 void BytecodeGraphBuilder::VisitCallRuntimeForPair() { | 1091 void BytecodeGraphBuilder::VisitCallRuntimeForPair() { |
1092 BuildCallRuntimeForPair(); | 1092 BuildCallRuntimeForPair(); |
1093 } | 1093 } |
1094 | 1094 |
1095 void BytecodeGraphBuilder::VisitCallRuntimeForPairWide() { | 1095 void BytecodeGraphBuilder::VisitCallRuntimeForPairWide() { |
1096 BuildCallRuntimeForPair(); | 1096 BuildCallRuntimeForPair(); |
1097 } | 1097 } |
1098 | 1098 |
| 1099 void BytecodeGraphBuilder::BuildInvokeIntrinsic() { |
| 1100 FrameStateBeforeAndAfter states(this); |
| 1101 Runtime::FunctionId functionId = |
| 1102 static_cast<Runtime::FunctionId>(bytecode_iterator().GetIndexOperand(0)); |
| 1103 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
| 1104 int arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
| 1105 |
| 1106 // Create node to perform the runtime call. |
| 1107 const Operator* call = javascript()->CallRuntime(functionId, arg_count); |
| 1108 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); |
| 1109 environment()->BindAccumulator(value, &states); |
| 1110 } |
| 1111 |
| 1112 void BytecodeGraphBuilder::VisitInvokeIntrinsic() { BuildInvokeIntrinsic(); } |
| 1113 |
| 1114 void BytecodeGraphBuilder::VisitInvokeIntrinsicWide() { |
| 1115 BuildInvokeIntrinsic(); |
| 1116 } |
| 1117 |
1099 Node* BytecodeGraphBuilder::ProcessCallNewArguments( | 1118 Node* BytecodeGraphBuilder::ProcessCallNewArguments( |
1100 const Operator* call_new_op, Node* callee, Node* new_target, | 1119 const Operator* call_new_op, Node* callee, Node* new_target, |
1101 interpreter::Register first_arg, size_t arity) { | 1120 interpreter::Register first_arg, size_t arity) { |
1102 Node** all = local_zone()->NewArray<Node*>(arity); | 1121 Node** all = local_zone()->NewArray<Node*>(arity); |
1103 all[0] = new_target; | 1122 all[0] = new_target; |
1104 int first_arg_index = first_arg.index(); | 1123 int first_arg_index = first_arg.index(); |
1105 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { | 1124 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { |
1106 all[i] = environment()->LookupRegister( | 1125 all[i] = environment()->LookupRegister( |
1107 interpreter::Register(first_arg_index + i - 1)); | 1126 interpreter::Register(first_arg_index + i - 1)); |
1108 } | 1127 } |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 // Phi does not exist yet, introduce one. | 1775 // Phi does not exist yet, introduce one. |
1757 value = NewPhi(inputs, value, control); | 1776 value = NewPhi(inputs, value, control); |
1758 value->ReplaceInput(inputs - 1, other); | 1777 value->ReplaceInput(inputs - 1, other); |
1759 } | 1778 } |
1760 return value; | 1779 return value; |
1761 } | 1780 } |
1762 | 1781 |
1763 } // namespace compiler | 1782 } // namespace compiler |
1764 } // namespace internal | 1783 } // namespace internal |
1765 } // namespace v8 | 1784 } // namespace v8 |
OLD | NEW |