OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION); | 341 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION); |
342 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); | 342 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); |
343 code->set_optimizable(info->IsOptimizable() && | 343 code->set_optimizable(info->IsOptimizable() && |
344 !info->function()->dont_optimize() && | 344 !info->function()->dont_optimize() && |
345 info->function()->scope()->AllowsLazyCompilation()); | 345 info->function()->scope()->AllowsLazyCompilation()); |
346 cgen.PopulateDeoptimizationData(code); | 346 cgen.PopulateDeoptimizationData(code); |
347 cgen.PopulateTypeFeedbackInfo(code); | 347 cgen.PopulateTypeFeedbackInfo(code); |
348 code->set_has_deoptimization_support(info->HasDeoptimizationSupport()); | 348 code->set_has_deoptimization_support(info->HasDeoptimizationSupport()); |
349 code->set_handler_table(*cgen.handler_table()); | 349 code->set_handler_table(*cgen.handler_table()); |
350 #ifdef ENABLE_DEBUGGER_SUPPORT | |
351 code->set_compiled_optimizable(info->IsOptimizable()); | 350 code->set_compiled_optimizable(info->IsOptimizable()); |
352 #endif // ENABLE_DEBUGGER_SUPPORT | |
353 code->set_allow_osr_at_loop_nesting_level(0); | 351 code->set_allow_osr_at_loop_nesting_level(0); |
354 code->set_profiler_ticks(0); | 352 code->set_profiler_ticks(0); |
355 code->set_back_edge_table_offset(table_offset); | 353 code->set_back_edge_table_offset(table_offset); |
356 code->set_back_edges_patched_for_osr(false); | 354 code->set_back_edges_patched_for_osr(false); |
357 CodeGenerator::PrintCode(code, info); | 355 CodeGenerator::PrintCode(code, info); |
358 info->SetCode(code); | 356 info->SetCode(code); |
359 #ifdef ENABLE_GDB_JIT_INTERFACE | 357 #ifdef ENABLE_GDB_JIT_INTERFACE |
360 if (FLAG_gdbjit) { | 358 if (FLAG_gdbjit) { |
361 GDBJITLineInfo* lineinfo = | 359 GDBJITLineInfo* lineinfo = |
362 masm.positions_recorder()->DetachGDBJITLineInfo(); | 360 masm.positions_recorder()->DetachGDBJITLineInfo(); |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 CodeGenerator::RecordPositions(masm_, fun->start_position()); | 824 CodeGenerator::RecordPositions(masm_, fun->start_position()); |
827 } | 825 } |
828 | 826 |
829 | 827 |
830 void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) { | 828 void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) { |
831 CodeGenerator::RecordPositions(masm_, fun->end_position() - 1); | 829 CodeGenerator::RecordPositions(masm_, fun->end_position() - 1); |
832 } | 830 } |
833 | 831 |
834 | 832 |
835 void FullCodeGenerator::SetStatementPosition(Statement* stmt) { | 833 void FullCodeGenerator::SetStatementPosition(Statement* stmt) { |
836 #ifdef ENABLE_DEBUGGER_SUPPORT | |
837 if (!isolate()->debugger()->IsDebuggerActive()) { | 834 if (!isolate()->debugger()->IsDebuggerActive()) { |
838 CodeGenerator::RecordPositions(masm_, stmt->position()); | 835 CodeGenerator::RecordPositions(masm_, stmt->position()); |
839 } else { | 836 } else { |
840 // Check if the statement will be breakable without adding a debug break | 837 // Check if the statement will be breakable without adding a debug break |
841 // slot. | 838 // slot. |
842 BreakableStatementChecker checker(zone()); | 839 BreakableStatementChecker checker(zone()); |
843 checker.Check(stmt); | 840 checker.Check(stmt); |
844 // Record the statement position right here if the statement is not | 841 // Record the statement position right here if the statement is not |
845 // breakable. For breakable statements the actual recording of the | 842 // breakable. For breakable statements the actual recording of the |
846 // position will be postponed to the breakable code (typically an IC). | 843 // position will be postponed to the breakable code (typically an IC). |
847 bool position_recorded = CodeGenerator::RecordPositions( | 844 bool position_recorded = CodeGenerator::RecordPositions( |
848 masm_, stmt->position(), !checker.is_breakable()); | 845 masm_, stmt->position(), !checker.is_breakable()); |
849 // If the position recording did record a new position generate a debug | 846 // If the position recording did record a new position generate a debug |
850 // break slot to make the statement breakable. | 847 // break slot to make the statement breakable. |
851 if (position_recorded) { | 848 if (position_recorded) { |
852 Debug::GenerateSlot(masm_); | 849 Debug::GenerateSlot(masm_); |
853 } | 850 } |
854 } | 851 } |
855 #else | |
856 CodeGenerator::RecordPositions(masm_, stmt->position()); | |
857 #endif | |
858 } | 852 } |
859 | 853 |
860 | 854 |
861 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { | 855 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { |
862 #ifdef ENABLE_DEBUGGER_SUPPORT | |
863 if (!isolate()->debugger()->IsDebuggerActive()) { | 856 if (!isolate()->debugger()->IsDebuggerActive()) { |
864 CodeGenerator::RecordPositions(masm_, expr->position()); | 857 CodeGenerator::RecordPositions(masm_, expr->position()); |
865 } else { | 858 } else { |
866 // Check if the expression will be breakable without adding a debug break | 859 // Check if the expression will be breakable without adding a debug break |
867 // slot. | 860 // slot. |
868 BreakableStatementChecker checker(zone()); | 861 BreakableStatementChecker checker(zone()); |
869 checker.Check(expr); | 862 checker.Check(expr); |
870 // Record a statement position right here if the expression is not | 863 // Record a statement position right here if the expression is not |
871 // breakable. For breakable expressions the actual recording of the | 864 // breakable. For breakable expressions the actual recording of the |
872 // position will be postponed to the breakable code (typically an IC). | 865 // position will be postponed to the breakable code (typically an IC). |
873 // NOTE this will record a statement position for something which might | 866 // NOTE this will record a statement position for something which might |
874 // not be a statement. As stepping in the debugger will only stop at | 867 // not be a statement. As stepping in the debugger will only stop at |
875 // statement positions this is used for e.g. the condition expression of | 868 // statement positions this is used for e.g. the condition expression of |
876 // a do while loop. | 869 // a do while loop. |
877 bool position_recorded = CodeGenerator::RecordPositions( | 870 bool position_recorded = CodeGenerator::RecordPositions( |
878 masm_, expr->position(), !checker.is_breakable()); | 871 masm_, expr->position(), !checker.is_breakable()); |
879 // If the position recording did record a new position generate a debug | 872 // If the position recording did record a new position generate a debug |
880 // break slot to make the statement breakable. | 873 // break slot to make the statement breakable. |
881 if (position_recorded) { | 874 if (position_recorded) { |
882 Debug::GenerateSlot(masm_); | 875 Debug::GenerateSlot(masm_); |
883 } | 876 } |
884 } | 877 } |
885 #else | |
886 CodeGenerator::RecordPositions(masm_, expr->position()); | |
887 #endif | |
888 } | 878 } |
889 | 879 |
890 | 880 |
891 void FullCodeGenerator::SetStatementPosition(int pos) { | 881 void FullCodeGenerator::SetStatementPosition(int pos) { |
892 CodeGenerator::RecordPositions(masm_, pos); | 882 CodeGenerator::RecordPositions(masm_, pos); |
893 } | 883 } |
894 | 884 |
895 | 885 |
896 void FullCodeGenerator::SetSourcePosition(int pos) { | 886 void FullCodeGenerator::SetSourcePosition(int pos) { |
897 if (pos != RelocInfo::kNoPosition) { | 887 if (pos != RelocInfo::kNoPosition) { |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 // Execute the finally block on the way out. Clobber the unpredictable | 1489 // Execute the finally block on the way out. Clobber the unpredictable |
1500 // value in the result register with one that's safe for GC because the | 1490 // value in the result register with one that's safe for GC because the |
1501 // finally block will unconditionally preserve the result register on the | 1491 // finally block will unconditionally preserve the result register on the |
1502 // stack. | 1492 // stack. |
1503 ClearAccumulator(); | 1493 ClearAccumulator(); |
1504 __ Call(&finally_entry); | 1494 __ Call(&finally_entry); |
1505 } | 1495 } |
1506 | 1496 |
1507 | 1497 |
1508 void FullCodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { | 1498 void FullCodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { |
1509 #ifdef ENABLE_DEBUGGER_SUPPORT | |
1510 Comment cmnt(masm_, "[ DebuggerStatement"); | 1499 Comment cmnt(masm_, "[ DebuggerStatement"); |
1511 SetStatementPosition(stmt); | 1500 SetStatementPosition(stmt); |
1512 | 1501 |
1513 __ DebugBreak(); | 1502 __ DebugBreak(); |
1514 // Ignore the return value. | 1503 // Ignore the return value. |
1515 #endif | |
1516 } | 1504 } |
1517 | 1505 |
1518 | 1506 |
1519 void FullCodeGenerator::VisitCaseClause(CaseClause* clause) { | 1507 void FullCodeGenerator::VisitCaseClause(CaseClause* clause) { |
1520 UNREACHABLE(); | 1508 UNREACHABLE(); |
1521 } | 1509 } |
1522 | 1510 |
1523 | 1511 |
1524 void FullCodeGenerator::VisitConditional(Conditional* expr) { | 1512 void FullCodeGenerator::VisitConditional(Conditional* expr) { |
1525 Comment cmnt(masm_, "[ Conditional"); | 1513 Comment cmnt(masm_, "[ Conditional"); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 } | 1718 } |
1731 return true; | 1719 return true; |
1732 } | 1720 } |
1733 #endif // DEBUG | 1721 #endif // DEBUG |
1734 | 1722 |
1735 | 1723 |
1736 #undef __ | 1724 #undef __ |
1737 | 1725 |
1738 | 1726 |
1739 } } // namespace v8::internal | 1727 } } // namespace v8::internal |
OLD | NEW |