| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
| 6 | 6 |
| 7 #include "src/ast/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 VisitForStackValue(args->at(0)); | 554 VisitForStackValue(args->at(0)); |
| 555 VisitForStackValue(args->at(1)); | 555 VisitForStackValue(args->at(1)); |
| 556 VisitForStackValue(args->at(2)); | 556 VisitForStackValue(args->at(2)); |
| 557 __ CallStub(&stub); | 557 __ CallStub(&stub); |
| 558 RestoreContext(); | 558 RestoreContext(); |
| 559 OperandStackDepthDecrement(3); | 559 OperandStackDepthDecrement(3); |
| 560 context()->Plug(result_register()); | 560 context()->Plug(result_register()); |
| 561 } | 561 } |
| 562 | 562 |
| 563 | 563 |
| 564 void FullCodeGenerator::EmitRegExpExec(CallRuntime* expr) { | |
| 565 // Load the arguments on the stack and call the stub. | |
| 566 RegExpExecStub stub(isolate()); | |
| 567 ZoneList<Expression*>* args = expr->arguments(); | |
| 568 DCHECK(args->length() == 4); | |
| 569 VisitForStackValue(args->at(0)); | |
| 570 VisitForStackValue(args->at(1)); | |
| 571 VisitForStackValue(args->at(2)); | |
| 572 VisitForStackValue(args->at(3)); | |
| 573 __ CallStub(&stub); | |
| 574 OperandStackDepthDecrement(4); | |
| 575 context()->Plug(result_register()); | |
| 576 } | |
| 577 | |
| 578 | |
| 579 void FullCodeGenerator::EmitIntrinsicAsStubCall(CallRuntime* expr, | 564 void FullCodeGenerator::EmitIntrinsicAsStubCall(CallRuntime* expr, |
| 580 const Callable& callable) { | 565 const Callable& callable) { |
| 581 ZoneList<Expression*>* args = expr->arguments(); | 566 ZoneList<Expression*>* args = expr->arguments(); |
| 582 int param_count = callable.descriptor().GetRegisterParameterCount(); | 567 int param_count = callable.descriptor().GetRegisterParameterCount(); |
| 583 DCHECK_EQ(args->length(), param_count); | 568 DCHECK_EQ(args->length(), param_count); |
| 584 | 569 |
| 585 if (param_count > 0) { | 570 if (param_count > 0) { |
| 586 int last = param_count - 1; | 571 int last = param_count - 1; |
| 587 // Put all but last arguments on stack. | 572 // Put all but last arguments on stack. |
| 588 for (int i = 0; i < last; i++) { | 573 for (int i = 0; i < last; i++) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 600 } | 585 } |
| 601 __ Call(callable.code(), RelocInfo::CODE_TARGET); | 586 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
| 602 | 587 |
| 603 // Reload the context register after the call as i.e. TurboFan code stubs | 588 // Reload the context register after the call as i.e. TurboFan code stubs |
| 604 // won't preserve the context register. | 589 // won't preserve the context register. |
| 605 LoadFromFrameField(StandardFrameConstants::kContextOffset, | 590 LoadFromFrameField(StandardFrameConstants::kContextOffset, |
| 606 context_register()); | 591 context_register()); |
| 607 context()->Plug(result_register()); | 592 context()->Plug(result_register()); |
| 608 } | 593 } |
| 609 | 594 |
| 610 void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) { | |
| 611 EmitIntrinsicAsStubCall(expr, CodeFactory::NumberToString(isolate())); | |
| 612 } | |
| 613 | |
| 614 | 595 |
| 615 void FullCodeGenerator::EmitToString(CallRuntime* expr) { | 596 void FullCodeGenerator::EmitToString(CallRuntime* expr) { |
| 616 EmitIntrinsicAsStubCall(expr, CodeFactory::ToString(isolate())); | 597 EmitIntrinsicAsStubCall(expr, CodeFactory::ToString(isolate())); |
| 617 } | 598 } |
| 618 | 599 |
| 619 | 600 |
| 620 void FullCodeGenerator::EmitToLength(CallRuntime* expr) { | 601 void FullCodeGenerator::EmitToLength(CallRuntime* expr) { |
| 621 EmitIntrinsicAsStubCall(expr, CodeFactory::ToLength(isolate())); | 602 EmitIntrinsicAsStubCall(expr, CodeFactory::ToLength(isolate())); |
| 622 } | 603 } |
| 623 | 604 |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 | 1593 |
| 1613 const FeedbackVectorSpec* FullCodeGenerator::feedback_vector_spec() const { | 1594 const FeedbackVectorSpec* FullCodeGenerator::feedback_vector_spec() const { |
| 1614 return literal()->feedback_vector_spec(); | 1595 return literal()->feedback_vector_spec(); |
| 1615 } | 1596 } |
| 1616 | 1597 |
| 1617 #undef __ | 1598 #undef __ |
| 1618 | 1599 |
| 1619 | 1600 |
| 1620 } // namespace internal | 1601 } // namespace internal |
| 1621 } // namespace v8 | 1602 } // namespace v8 |
| OLD | NEW |