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/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 } | 608 } |
609 | 609 |
610 void FullCodeGenerator::EmitHasProperty() { | 610 void FullCodeGenerator::EmitHasProperty() { |
611 Callable callable = CodeFactory::HasProperty(isolate()); | 611 Callable callable = CodeFactory::HasProperty(isolate()); |
612 PopOperand(callable.descriptor().GetRegisterParameter(1)); | 612 PopOperand(callable.descriptor().GetRegisterParameter(1)); |
613 PopOperand(callable.descriptor().GetRegisterParameter(0)); | 613 PopOperand(callable.descriptor().GetRegisterParameter(0)); |
614 __ Call(callable.code(), RelocInfo::CODE_TARGET); | 614 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
615 RestoreContext(); | 615 RestoreContext(); |
616 } | 616 } |
617 | 617 |
618 bool RecordStatementPosition(MacroAssembler* masm, int pos) { | 618 void RecordStatementPosition(MacroAssembler* masm, int pos) { |
619 if (pos == RelocInfo::kNoPosition) return false; | 619 if (pos == RelocInfo::kNoPosition) return; |
620 return masm->positions_recorder()->RecordStatementPosition(pos); | 620 masm->positions_recorder()->RecordStatementPosition(pos); |
| 621 } |
| 622 |
| 623 void RecordPosition(MacroAssembler* masm, int pos) { |
| 624 if (pos == RelocInfo::kNoPosition) return; |
| 625 masm->positions_recorder()->RecordPosition(pos); |
621 } | 626 } |
622 | 627 |
623 | 628 |
624 bool RecordPosition(MacroAssembler* masm, int pos) { | |
625 if (pos == RelocInfo::kNoPosition) return false; | |
626 return masm->positions_recorder()->RecordPosition(pos); | |
627 } | |
628 | |
629 | |
630 void FullCodeGenerator::SetFunctionPosition(FunctionLiteral* fun) { | 629 void FullCodeGenerator::SetFunctionPosition(FunctionLiteral* fun) { |
631 RecordPosition(masm_, fun->start_position()); | 630 RecordPosition(masm_, fun->start_position()); |
632 } | 631 } |
633 | 632 |
634 | 633 |
635 void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) { | 634 void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) { |
636 // For default constructors, start position equals end position, and there | 635 // For default constructors, start position equals end position, and there |
637 // is no source code besides the class literal. | 636 // is no source code besides the class literal. |
638 int pos = std::max(fun->start_position(), fun->end_position() - 1); | 637 int pos = std::max(fun->start_position(), fun->end_position() - 1); |
639 RecordStatementPosition(masm_, pos); | 638 RecordStatementPosition(masm_, pos); |
640 if (info_->is_debug()) { | 639 if (info_->is_debug()) { |
641 // Always emit a debug break slot before a return. | 640 // Always emit a debug break slot before a return. |
642 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); | 641 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); |
643 } | 642 } |
644 } | 643 } |
645 | 644 |
646 | 645 |
647 void FullCodeGenerator::SetStatementPosition( | 646 void FullCodeGenerator::SetStatementPosition( |
648 Statement* stmt, FullCodeGenerator::InsertBreak insert_break) { | 647 Statement* stmt, FullCodeGenerator::InsertBreak insert_break) { |
649 if (stmt->position() == RelocInfo::kNoPosition) return; | 648 if (stmt->position() == RelocInfo::kNoPosition) return; |
650 bool recorded = RecordStatementPosition(masm_, stmt->position()); | 649 RecordStatementPosition(masm_, stmt->position()); |
651 if (recorded && insert_break == INSERT_BREAK && info_->is_debug() && | 650 if (insert_break == INSERT_BREAK && info_->is_debug() && |
652 !stmt->IsDebuggerStatement()) { | 651 !stmt->IsDebuggerStatement()) { |
653 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); | 652 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); |
654 } | 653 } |
655 } | 654 } |
656 | 655 |
657 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { | 656 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { |
658 if (expr->position() == RelocInfo::kNoPosition) return; | 657 if (expr->position() == RelocInfo::kNoPosition) return; |
659 RecordPosition(masm_, expr->position()); | 658 RecordPosition(masm_, expr->position()); |
660 } | 659 } |
661 | 660 |
662 | 661 |
663 void FullCodeGenerator::SetExpressionAsStatementPosition(Expression* expr) { | 662 void FullCodeGenerator::SetExpressionAsStatementPosition(Expression* expr) { |
664 if (expr->position() == RelocInfo::kNoPosition) return; | 663 if (expr->position() == RelocInfo::kNoPosition) return; |
665 bool recorded = RecordStatementPosition(masm_, expr->position()); | 664 RecordStatementPosition(masm_, expr->position()); |
666 if (recorded && info_->is_debug()) { | 665 if (info_->is_debug()) { |
667 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); | 666 DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); |
668 } | 667 } |
669 } | 668 } |
670 | 669 |
671 void FullCodeGenerator::SetCallPosition(Expression* expr, | 670 void FullCodeGenerator::SetCallPosition(Expression* expr, |
672 TailCallMode tail_call_mode) { | 671 TailCallMode tail_call_mode) { |
673 if (expr->position() == RelocInfo::kNoPosition) return; | 672 if (expr->position() == RelocInfo::kNoPosition) return; |
674 RecordPosition(masm_, expr->position()); | 673 RecordPosition(masm_, expr->position()); |
675 if (info_->is_debug()) { | 674 if (info_->is_debug()) { |
676 RelocInfo::Mode mode = (tail_call_mode == TailCallMode::kAllow) | 675 RelocInfo::Mode mode = (tail_call_mode == TailCallMode::kAllow) |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1987 return var->scope()->is_nonlinear() || | 1986 return var->scope()->is_nonlinear() || |
1988 var->initializer_position() >= proxy->position(); | 1987 var->initializer_position() >= proxy->position(); |
1989 } | 1988 } |
1990 | 1989 |
1991 | 1990 |
1992 #undef __ | 1991 #undef __ |
1993 | 1992 |
1994 | 1993 |
1995 } // namespace internal | 1994 } // namespace internal |
1996 } // namespace v8 | 1995 } // namespace v8 |
OLD | NEW |