OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
8 #include "src/compiler/graph-inl.h" | 8 #include "src/compiler/graph-inl.h" |
9 #include "src/compiler/js-generic-lowering.h" | 9 #include "src/compiler/js-generic-lowering.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node, | 215 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node, |
216 Runtime::FunctionId f, | 216 Runtime::FunctionId f, |
217 int nargs_override) { | 217 int nargs_override) { |
218 Operator::Properties properties = node->op()->properties(); | 218 Operator::Properties properties = node->op()->properties(); |
219 const Runtime::Function* fun = Runtime::FunctionForId(f); | 219 const Runtime::Function* fun = Runtime::FunctionForId(f); |
220 int nargs = (nargs_override < 0) ? fun->nargs : nargs_override; | 220 int nargs = (nargs_override < 0) ? fun->nargs : nargs_override; |
221 CallDescriptor* desc = | 221 CallDescriptor* desc = |
222 linkage()->GetRuntimeCallDescriptor(f, nargs, properties); | 222 linkage()->GetRuntimeCallDescriptor(f, nargs, properties); |
223 Node* ref = ExternalConstant(ExternalReference(f, isolate())); | 223 Node* ref = ExternalConstant(ExternalReference(f, isolate())); |
224 Node* arity = Int32Constant(nargs); | 224 Node* arity = Int32Constant(nargs); |
225 if (!centrystub_constant_.is_set()) { | 225 PatchInsertInput(node, 0, jsgraph()->CEntryStubConstant()); |
226 centrystub_constant_.set(CodeConstant(CEntryStub(isolate(), 1).GetCode())); | |
227 } | |
228 PatchInsertInput(node, 0, centrystub_constant_.get()); | |
229 PatchInsertInput(node, nargs + 1, ref); | 226 PatchInsertInput(node, nargs + 1, ref); |
230 PatchInsertInput(node, nargs + 2, arity); | 227 PatchInsertInput(node, nargs + 2, arity); |
231 PatchOperator(node, common()->Call(desc)); | 228 PatchOperator(node, common()->Call(desc)); |
232 } | 229 } |
233 | 230 |
234 | 231 |
235 void JSGenericLowering::LowerBranch(Node* node) { | 232 void JSGenericLowering::LowerBranch(Node* node) { |
236 if (!info()->is_typing_enabled()) { | 233 if (!info()->is_typing_enabled()) { |
237 // TODO(mstarzinger): If typing is enabled then simplified lowering will | 234 // TODO(mstarzinger): If typing is enabled then simplified lowering will |
238 // have inserted the correct ChangeBoolToBit, otherwise we need to perform | 235 // have inserted the correct ChangeBoolToBit, otherwise we need to perform |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 393 |
397 | 394 |
398 void JSGenericLowering::LowerJSCallRuntime(Node* node) { | 395 void JSGenericLowering::LowerJSCallRuntime(Node* node) { |
399 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); | 396 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); |
400 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); | 397 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); |
401 } | 398 } |
402 | 399 |
403 } // namespace compiler | 400 } // namespace compiler |
404 } // namespace internal | 401 } // namespace internal |
405 } // namespace v8 | 402 } // namespace v8 |
OLD | NEW |