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/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 isolate(), GetHoleyElementsKind(elements_kind), override_mode); | 443 isolate(), GetHoleyElementsKind(elements_kind), override_mode); |
444 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 444 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
445 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), 2, | 445 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), 2, |
446 CallDescriptor::kNeedsFrameState); | 446 CallDescriptor::kNeedsFrameState); |
447 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode())); | 447 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode())); |
448 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site)); | 448 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site)); |
449 node->InsertInput(graph()->zone(), 3, jsgraph()->Int32Constant(1)); | 449 node->InsertInput(graph()->zone(), 3, jsgraph()->Int32Constant(1)); |
450 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant()); | 450 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant()); |
451 NodeProperties::ChangeOp(node, common()->Call(desc)); | 451 NodeProperties::ChangeOp(node, common()->Call(desc)); |
452 } else { | 452 } else { |
453 ArrayNArgumentsConstructorStub stub(isolate(), elements_kind, | 453 ArrayNArgumentsConstructorStub stub(isolate()); |
454 override_mode); | |
455 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 454 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
456 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), | 455 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), |
457 arity + 1, CallDescriptor::kNeedsFrameState); | 456 arity + 1, CallDescriptor::kNeedsFrameState); |
458 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode())); | 457 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode())); |
459 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site)); | 458 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site)); |
460 node->InsertInput(graph()->zone(), 3, jsgraph()->Int32Constant(arity)); | 459 node->InsertInput(graph()->zone(), 3, jsgraph()->Int32Constant(arity)); |
461 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant()); | 460 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant()); |
462 NodeProperties::ChangeOp(node, common()->Call(desc)); | 461 NodeProperties::ChangeOp(node, common()->Call(desc)); |
463 } | 462 } |
464 } else { | 463 } else { |
465 Node* new_target = node->InputAt(1); | 464 Node* new_target = node->InputAt(1); |
466 Node* type_info = site.is_null() ? jsgraph()->UndefinedConstant() | 465 Node* type_info = site.is_null() ? jsgraph()->UndefinedConstant() |
467 : jsgraph()->HeapConstant(site); | 466 : jsgraph()->HeapConstant(site); |
468 node->RemoveInput(1); | 467 node->RemoveInput(1); |
469 node->InsertInput(zone(), 1 + arity, new_target); | 468 node->InsertInput(zone(), 1 + arity, new_target); |
470 node->InsertInput(zone(), 2 + arity, type_info); | 469 node->InsertInput(zone(), 2 + arity, type_info); |
471 ReplaceWithRuntimeCall(node, Runtime::kNewArray, arity + 3); | 470 ReplaceWithRuntimeCall(node, Runtime::kArrayConstructor, arity + 3); |
472 } | 471 } |
473 } | 472 } |
474 | 473 |
475 | 474 |
476 void JSGenericLowering::LowerJSCreateClosure(Node* node) { | 475 void JSGenericLowering::LowerJSCreateClosure(Node* node) { |
477 CreateClosureParameters const& p = CreateClosureParametersOf(node->op()); | 476 CreateClosureParameters const& p = CreateClosureParametersOf(node->op()); |
478 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 477 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
479 Handle<SharedFunctionInfo> const shared_info = p.shared_info(); | 478 Handle<SharedFunctionInfo> const shared_info = p.shared_info(); |
480 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(shared_info)); | 479 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(shared_info)); |
481 | 480 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 } | 740 } |
742 | 741 |
743 | 742 |
744 MachineOperatorBuilder* JSGenericLowering::machine() const { | 743 MachineOperatorBuilder* JSGenericLowering::machine() const { |
745 return jsgraph()->machine(); | 744 return jsgraph()->machine(); |
746 } | 745 } |
747 | 746 |
748 } // namespace compiler | 747 } // namespace compiler |
749 } // namespace internal | 748 } // namespace internal |
750 } // namespace v8 | 749 } // namespace v8 |
OLD | NEW |