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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 // The generation of debug code must match between the snapshot code and the | 410 // The generation of debug code must match between the snapshot code and the |
411 // code that is generated later. This is assumed by the debugger when it is | 411 // code that is generated later. This is assumed by the debugger when it is |
412 // calculating PC offsets after generating a debug version of code. Therefore | 412 // calculating PC offsets after generating a debug version of code. Therefore |
413 // we disable the production of debug code in the full compiler if we are | 413 // we disable the production of debug code in the full compiler if we are |
414 // either generating a snapshot or we booted from a snapshot. | 414 // either generating a snapshot or we booted from a snapshot. |
415 generate_debug_code_ = FLAG_debug_code && | 415 generate_debug_code_ = FLAG_debug_code && |
416 !Serializer::enabled() && | 416 !Serializer::enabled() && |
417 !Snapshot::HaveASnapshotToStartFrom(); | 417 !Snapshot::HaveASnapshotToStartFrom(); |
418 masm_->set_emit_debug_code(generate_debug_code_); | 418 masm_->set_emit_debug_code(generate_debug_code_); |
419 masm_->set_predictable_code_size(true); | 419 masm_->set_predictable_code_size(true); |
420 InitializeAstVisitor(info_->isolate()); | 420 InitializeAstVisitor(info_->zone()); |
421 } | 421 } |
422 | 422 |
423 | 423 |
424 void FullCodeGenerator::PopulateTypeFeedbackCells(Handle<Code> code) { | 424 void FullCodeGenerator::PopulateTypeFeedbackCells(Handle<Code> code) { |
425 if (type_feedback_cells_.is_empty()) return; | 425 if (type_feedback_cells_.is_empty()) return; |
426 int length = type_feedback_cells_.length(); | 426 int length = type_feedback_cells_.length(); |
427 int array_size = TypeFeedbackCells::LengthOfFixedArray(length); | 427 int array_size = TypeFeedbackCells::LengthOfFixedArray(length); |
428 Handle<TypeFeedbackCells> cache = Handle<TypeFeedbackCells>::cast( | 428 Handle<TypeFeedbackCells> cache = Handle<TypeFeedbackCells>::cast( |
429 isolate()->factory()->NewFixedArray(array_size, TENURED)); | 429 isolate()->factory()->NewFixedArray(array_size, TENURED)); |
430 for (int i = 0; i < length; i++) { | 430 for (int i = 0; i < length; i++) { |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 } | 825 } |
826 | 826 |
827 | 827 |
828 void FullCodeGenerator::SetStatementPosition(Statement* stmt) { | 828 void FullCodeGenerator::SetStatementPosition(Statement* stmt) { |
829 #ifdef ENABLE_DEBUGGER_SUPPORT | 829 #ifdef ENABLE_DEBUGGER_SUPPORT |
830 if (!isolate()->debugger()->IsDebuggerActive()) { | 830 if (!isolate()->debugger()->IsDebuggerActive()) { |
831 CodeGenerator::RecordPositions(masm_, stmt->position()); | 831 CodeGenerator::RecordPositions(masm_, stmt->position()); |
832 } else { | 832 } else { |
833 // Check if the statement will be breakable without adding a debug break | 833 // Check if the statement will be breakable without adding a debug break |
834 // slot. | 834 // slot. |
835 BreakableStatementChecker checker(isolate()); | 835 BreakableStatementChecker checker(zone()); |
836 checker.Check(stmt); | 836 checker.Check(stmt); |
837 // Record the statement position right here if the statement is not | 837 // Record the statement position right here if the statement is not |
838 // breakable. For breakable statements the actual recording of the | 838 // breakable. For breakable statements the actual recording of the |
839 // position will be postponed to the breakable code (typically an IC). | 839 // position will be postponed to the breakable code (typically an IC). |
840 bool position_recorded = CodeGenerator::RecordPositions( | 840 bool position_recorded = CodeGenerator::RecordPositions( |
841 masm_, stmt->position(), !checker.is_breakable()); | 841 masm_, stmt->position(), !checker.is_breakable()); |
842 // If the position recording did record a new position generate a debug | 842 // If the position recording did record a new position generate a debug |
843 // break slot to make the statement breakable. | 843 // break slot to make the statement breakable. |
844 if (position_recorded) { | 844 if (position_recorded) { |
845 Debug::GenerateSlot(masm_); | 845 Debug::GenerateSlot(masm_); |
846 } | 846 } |
847 } | 847 } |
848 #else | 848 #else |
849 CodeGenerator::RecordPositions(masm_, stmt->position()); | 849 CodeGenerator::RecordPositions(masm_, stmt->position()); |
850 #endif | 850 #endif |
851 } | 851 } |
852 | 852 |
853 | 853 |
854 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { | 854 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { |
855 #ifdef ENABLE_DEBUGGER_SUPPORT | 855 #ifdef ENABLE_DEBUGGER_SUPPORT |
856 if (!isolate()->debugger()->IsDebuggerActive()) { | 856 if (!isolate()->debugger()->IsDebuggerActive()) { |
857 CodeGenerator::RecordPositions(masm_, expr->position()); | 857 CodeGenerator::RecordPositions(masm_, expr->position()); |
858 } else { | 858 } else { |
859 // 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 |
860 // slot. | 860 // slot. |
861 BreakableStatementChecker checker(isolate()); | 861 BreakableStatementChecker checker(zone()); |
862 checker.Check(expr); | 862 checker.Check(expr); |
863 // Record a statement position right here if the expression is not | 863 // Record a statement position right here if the expression is not |
864 // breakable. For breakable expressions the actual recording of the | 864 // breakable. For breakable expressions the actual recording of the |
865 // position will be postponed to the breakable code (typically an IC). | 865 // position will be postponed to the breakable code (typically an IC). |
866 // NOTE this will record a statement position for something which might | 866 // NOTE this will record a statement position for something which might |
867 // 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 |
868 // 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 |
869 // a do while loop. | 869 // a do while loop. |
870 bool position_recorded = CodeGenerator::RecordPositions( | 870 bool position_recorded = CodeGenerator::RecordPositions( |
871 masm_, expr->position(), !checker.is_breakable()); | 871 masm_, expr->position(), !checker.is_breakable()); |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 } | 1739 } |
1740 return true; | 1740 return true; |
1741 } | 1741 } |
1742 #endif // DEBUG | 1742 #endif // DEBUG |
1743 | 1743 |
1744 | 1744 |
1745 #undef __ | 1745 #undef __ |
1746 | 1746 |
1747 | 1747 |
1748 } } // namespace v8::internal | 1748 } } // namespace v8::internal |
OLD | NEW |