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/compiler/js-generic-lowering.h" | 5 #include "src/compiler/js-generic-lowering.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/builtins/builtins-constructor.h" | 8 #include "src/builtins/builtins-constructor.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 node->ReplaceInput(Descriptor::kName, jsgraph()->HeapConstant(p.name())); | 284 node->ReplaceInput(Descriptor::kName, jsgraph()->HeapConstant(p.name())); |
285 node->ReplaceInput(Descriptor::kValue, value); | 285 node->ReplaceInput(Descriptor::kValue, value); |
286 node->ReplaceInput(Descriptor::kSlot, | 286 node->ReplaceInput(Descriptor::kSlot, |
287 jsgraph()->SmiConstant(p.feedback().index())); | 287 jsgraph()->SmiConstant(p.feedback().index())); |
288 node->ReplaceInput(Descriptor::kVector, vector); | 288 node->ReplaceInput(Descriptor::kVector, vector); |
289 node->ReplaceInput(7, effect); | 289 node->ReplaceInput(7, effect); |
290 ReplaceWithStubCall(node, callable, flags); | 290 ReplaceWithStubCall(node, callable, flags); |
291 } | 291 } |
292 | 292 |
293 void JSGenericLowering::LowerJSStoreDataPropertyInLiteral(Node* node) { | 293 void JSGenericLowering::LowerJSStoreDataPropertyInLiteral(Node* node) { |
294 DataPropertyParameters const& p = DataPropertyParametersOf(node->op()); | 294 FeedbackParameter const& p = FeedbackParameterOf(node->op()); |
295 node->InsertInputs(zone(), 4, 2); | 295 node->InsertInputs(zone(), 4, 2); |
296 node->ReplaceInput(4, jsgraph()->HeapConstant(p.feedback().vector())); | 296 node->ReplaceInput(4, jsgraph()->HeapConstant(p.feedback().vector())); |
297 node->ReplaceInput(5, jsgraph()->SmiConstant(p.feedback().index())); | 297 node->ReplaceInput(5, jsgraph()->SmiConstant(p.feedback().index())); |
298 ReplaceWithRuntimeCall(node, Runtime::kDefineDataPropertyInLiteral); | 298 ReplaceWithRuntimeCall(node, Runtime::kDefineDataPropertyInLiteral); |
299 } | 299 } |
300 | 300 |
301 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { | 301 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { |
302 LanguageMode language_mode = OpParameter<LanguageMode>(node); | 302 LanguageMode language_mode = OpParameter<LanguageMode>(node); |
303 ReplaceWithRuntimeCall(node, is_strict(language_mode) | 303 ReplaceWithRuntimeCall(node, is_strict(language_mode) |
304 ? Runtime::kDeleteProperty_Strict | 304 ? Runtime::kDeleteProperty_Strict |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 Node* receiver = jsgraph()->UndefinedConstant(); | 521 Node* receiver = jsgraph()->UndefinedConstant(); |
522 node->RemoveInput(arg_count + 1); // Drop new target. | 522 node->RemoveInput(arg_count + 1); // Drop new target. |
523 node->InsertInput(zone(), 0, stub_code); | 523 node->InsertInput(zone(), 0, stub_code); |
524 node->InsertInput(zone(), 2, new_target); | 524 node->InsertInput(zone(), 2, new_target); |
525 node->InsertInput(zone(), 3, stub_arity); | 525 node->InsertInput(zone(), 3, stub_arity); |
526 node->InsertInput(zone(), 4, receiver); | 526 node->InsertInput(zone(), 4, receiver); |
527 NodeProperties::ChangeOp(node, common()->Call(desc)); | 527 NodeProperties::ChangeOp(node, common()->Call(desc)); |
528 } | 528 } |
529 | 529 |
530 void JSGenericLowering::LowerJSConstructWithSpread(Node* node) { | 530 void JSGenericLowering::LowerJSConstructWithSpread(Node* node) { |
531 SpreadWithArityParameters const& p = SpreadWithArityParametersOf(node->op()); | 531 SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op()); |
532 int const arg_count = static_cast<int>(p.arity() - 2); | 532 int const arg_count = static_cast<int>(p.arity() - 2); |
533 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 533 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
534 Callable callable = CodeFactory::ConstructWithSpread(isolate()); | 534 Callable callable = CodeFactory::ConstructWithSpread(isolate()); |
535 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 535 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
536 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); | 536 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); |
537 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 537 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
538 Node* stub_arity = jsgraph()->Int32Constant(arg_count); | 538 Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
539 Node* new_target = node->InputAt(arg_count + 1); | 539 Node* new_target = node->InputAt(arg_count + 1); |
540 Node* receiver = jsgraph()->UndefinedConstant(); | 540 Node* receiver = jsgraph()->UndefinedConstant(); |
541 node->RemoveInput(arg_count + 1); // Drop new target. | 541 node->RemoveInput(arg_count + 1); // Drop new target. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 574 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
575 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); | 575 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); |
576 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 576 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
577 Node* stub_arity = jsgraph()->Int32Constant(arg_count); | 577 Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
578 node->InsertInput(zone(), 0, stub_code); | 578 node->InsertInput(zone(), 0, stub_code); |
579 node->InsertInput(zone(), 2, stub_arity); | 579 node->InsertInput(zone(), 2, stub_arity); |
580 NodeProperties::ChangeOp(node, common()->Call(desc)); | 580 NodeProperties::ChangeOp(node, common()->Call(desc)); |
581 } | 581 } |
582 | 582 |
583 void JSGenericLowering::LowerJSCallWithSpread(Node* node) { | 583 void JSGenericLowering::LowerJSCallWithSpread(Node* node) { |
584 SpreadWithArityParameters const& p = SpreadWithArityParametersOf(node->op()); | 584 SpreadWithArityParameter const& p = SpreadWithArityParameterOf(node->op()); |
585 int const arg_count = static_cast<int>(p.arity() - 2); | 585 int const arg_count = static_cast<int>(p.arity() - 2); |
586 Callable callable = CodeFactory::CallWithSpread(isolate()); | 586 Callable callable = CodeFactory::CallWithSpread(isolate()); |
587 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 587 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
588 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 588 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
589 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); | 589 isolate(), zone(), callable.descriptor(), arg_count + 1, flags); |
590 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 590 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
591 Node* stub_arity = jsgraph()->Int32Constant(arg_count); | 591 Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
592 node->InsertInput(zone(), 0, stub_code); | 592 node->InsertInput(zone(), 0, stub_code); |
593 node->InsertInput(zone(), 2, stub_arity); | 593 node->InsertInput(zone(), 2, stub_arity); |
594 NodeProperties::ChangeOp(node, common()->Call(desc)); | 594 NodeProperties::ChangeOp(node, common()->Call(desc)); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 } | 706 } |
707 | 707 |
708 | 708 |
709 MachineOperatorBuilder* JSGenericLowering::machine() const { | 709 MachineOperatorBuilder* JSGenericLowering::machine() const { |
710 return jsgraph()->machine(); | 710 return jsgraph()->machine(); |
711 } | 711 } |
712 | 712 |
713 } // namespace compiler | 713 } // namespace compiler |
714 } // namespace internal | 714 } // namespace internal |
715 } // namespace v8 | 715 } // namespace v8 |
OLD | NEW |