| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 } | 565 } |
| 566 } | 566 } |
| 567 // Invoke the platform-dependent code generator to do the actual | 567 // Invoke the platform-dependent code generator to do the actual |
| 568 // declaration the global variables and functions. | 568 // declaration the global variables and functions. |
| 569 DeclareGlobals(array); | 569 DeclareGlobals(array); |
| 570 } | 570 } |
| 571 } | 571 } |
| 572 | 572 |
| 573 | 573 |
| 574 void FullCodeGenerator::SetFunctionPosition(FunctionLiteral* fun) { | 574 void FullCodeGenerator::SetFunctionPosition(FunctionLiteral* fun) { |
| 575 if (FLAG_debug_info) { | 575 CodeGenerator::RecordPositions(masm_, fun->start_position()); |
| 576 CodeGenerator::RecordPositions(masm_, fun->start_position()); | |
| 577 } | |
| 578 } | 576 } |
| 579 | 577 |
| 580 | 578 |
| 581 void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) { | 579 void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) { |
| 582 if (FLAG_debug_info) { | 580 CodeGenerator::RecordPositions(masm_, fun->end_position() - 1); |
| 583 CodeGenerator::RecordPositions(masm_, fun->end_position() - 1); | |
| 584 } | |
| 585 } | 581 } |
| 586 | 582 |
| 587 | 583 |
| 588 void FullCodeGenerator::SetStatementPosition(Statement* stmt) { | 584 void FullCodeGenerator::SetStatementPosition(Statement* stmt) { |
| 589 if (FLAG_debug_info) { | |
| 590 #ifdef ENABLE_DEBUGGER_SUPPORT | 585 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 591 if (!isolate()->debugger()->IsDebuggerActive()) { | 586 if (!isolate()->debugger()->IsDebuggerActive()) { |
| 592 CodeGenerator::RecordPositions(masm_, stmt->statement_pos()); | 587 CodeGenerator::RecordPositions(masm_, stmt->statement_pos()); |
| 593 } else { | 588 } else { |
| 594 // Check if the statement will be breakable without adding a debug break | 589 // Check if the statement will be breakable without adding a debug break |
| 595 // slot. | 590 // slot. |
| 596 BreakableStatementChecker checker; | 591 BreakableStatementChecker checker; |
| 597 checker.Check(stmt); | 592 checker.Check(stmt); |
| 598 // Record the statement position right here if the statement is not | 593 // Record the statement position right here if the statement is not |
| 599 // breakable. For breakable statements the actual recording of the | 594 // breakable. For breakable statements the actual recording of the |
| 600 // position will be postponed to the breakable code (typically an IC). | 595 // position will be postponed to the breakable code (typically an IC). |
| 601 bool position_recorded = CodeGenerator::RecordPositions( | 596 bool position_recorded = CodeGenerator::RecordPositions( |
| 602 masm_, stmt->statement_pos(), !checker.is_breakable()); | 597 masm_, stmt->statement_pos(), !checker.is_breakable()); |
| 603 // If the position recording did record a new position generate a debug | 598 // If the position recording did record a new position generate a debug |
| 604 // break slot to make the statement breakable. | 599 // break slot to make the statement breakable. |
| 605 if (position_recorded) { | 600 if (position_recorded) { |
| 606 Debug::GenerateSlot(masm_); | 601 Debug::GenerateSlot(masm_); |
| 607 } | |
| 608 } | 602 } |
| 603 } |
| 609 #else | 604 #else |
| 610 CodeGenerator::RecordPositions(masm_, stmt->statement_pos()); | 605 CodeGenerator::RecordPositions(masm_, stmt->statement_pos()); |
| 611 #endif | 606 #endif |
| 612 } | |
| 613 } | 607 } |
| 614 | 608 |
| 615 | 609 |
| 616 void FullCodeGenerator::SetExpressionPosition(Expression* expr, int pos) { | 610 void FullCodeGenerator::SetExpressionPosition(Expression* expr, int pos) { |
| 617 if (FLAG_debug_info) { | |
| 618 #ifdef ENABLE_DEBUGGER_SUPPORT | 611 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 619 if (!isolate()->debugger()->IsDebuggerActive()) { | 612 if (!isolate()->debugger()->IsDebuggerActive()) { |
| 620 CodeGenerator::RecordPositions(masm_, pos); | 613 CodeGenerator::RecordPositions(masm_, pos); |
| 621 } else { | 614 } else { |
| 622 // Check if the expression will be breakable without adding a debug break | 615 // Check if the expression will be breakable without adding a debug break |
| 623 // slot. | 616 // slot. |
| 624 BreakableStatementChecker checker; | 617 BreakableStatementChecker checker; |
| 625 checker.Check(expr); | 618 checker.Check(expr); |
| 626 // Record a statement position right here if the expression is not | 619 // Record a statement position right here if the expression is not |
| 627 // breakable. For breakable expressions the actual recording of the | 620 // breakable. For breakable expressions the actual recording of the |
| 628 // position will be postponed to the breakable code (typically an IC). | 621 // position will be postponed to the breakable code (typically an IC). |
| 629 // NOTE this will record a statement position for something which might | 622 // NOTE this will record a statement position for something which might |
| 630 // not be a statement. As stepping in the debugger will only stop at | 623 // not be a statement. As stepping in the debugger will only stop at |
| 631 // statement positions this is used for e.g. the condition expression of | 624 // statement positions this is used for e.g. the condition expression of |
| 632 // a do while loop. | 625 // a do while loop. |
| 633 bool position_recorded = CodeGenerator::RecordPositions( | 626 bool position_recorded = CodeGenerator::RecordPositions( |
| 634 masm_, pos, !checker.is_breakable()); | 627 masm_, pos, !checker.is_breakable()); |
| 635 // If the position recording did record a new position generate a debug | 628 // If the position recording did record a new position generate a debug |
| 636 // break slot to make the statement breakable. | 629 // break slot to make the statement breakable. |
| 637 if (position_recorded) { | 630 if (position_recorded) { |
| 638 Debug::GenerateSlot(masm_); | 631 Debug::GenerateSlot(masm_); |
| 639 } | |
| 640 } | 632 } |
| 633 } |
| 641 #else | 634 #else |
| 642 CodeGenerator::RecordPositions(masm_, pos); | 635 CodeGenerator::RecordPositions(masm_, pos); |
| 643 #endif | 636 #endif |
| 644 } | |
| 645 } | 637 } |
| 646 | 638 |
| 647 | 639 |
| 648 void FullCodeGenerator::SetStatementPosition(int pos) { | 640 void FullCodeGenerator::SetStatementPosition(int pos) { |
| 649 if (FLAG_debug_info) { | 641 CodeGenerator::RecordPositions(masm_, pos); |
| 650 CodeGenerator::RecordPositions(masm_, pos); | |
| 651 } | |
| 652 } | 642 } |
| 653 | 643 |
| 654 | 644 |
| 655 void FullCodeGenerator::SetSourcePosition(int pos) { | 645 void FullCodeGenerator::SetSourcePosition(int pos) { |
| 656 if (FLAG_debug_info && pos != RelocInfo::kNoPosition) { | 646 if (pos != RelocInfo::kNoPosition) { |
| 657 masm_->positions_recorder()->RecordPosition(pos); | 647 masm_->positions_recorder()->RecordPosition(pos); |
| 658 } | 648 } |
| 659 } | 649 } |
| 660 | 650 |
| 661 | 651 |
| 662 // Lookup table for code generators for special runtime calls which are | 652 // Lookup table for code generators for special runtime calls which are |
| 663 // generated inline. | 653 // generated inline. |
| 664 #define INLINE_FUNCTION_GENERATOR_ADDRESS(Name, argc, ressize) \ | 654 #define INLINE_FUNCTION_GENERATOR_ADDRESS(Name, argc, ressize) \ |
| 665 &FullCodeGenerator::Emit##Name, | 655 &FullCodeGenerator::Emit##Name, |
| 666 | 656 |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 __ Drop(stack_depth); | 1281 __ Drop(stack_depth); |
| 1292 __ PopTryHandler(); | 1282 __ PopTryHandler(); |
| 1293 return 0; | 1283 return 0; |
| 1294 } | 1284 } |
| 1295 | 1285 |
| 1296 | 1286 |
| 1297 #undef __ | 1287 #undef __ |
| 1298 | 1288 |
| 1299 | 1289 |
| 1300 } } // namespace v8::internal | 1290 } } // namespace v8::internal |
| OLD | NEW |