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