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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 413 |
414 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) { | 414 void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) { |
415 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo(); | 415 Handle<TypeFeedbackInfo> info = isolate()->factory()->NewTypeFeedbackInfo(); |
416 info->set_ic_total_count(ic_total_count_); | 416 info->set_ic_total_count(ic_total_count_); |
417 DCHECK(!isolate()->heap()->InNewSpace(*info)); | 417 DCHECK(!isolate()->heap()->InNewSpace(*info)); |
418 code->set_type_feedback_info(*info); | 418 code->set_type_feedback_info(*info); |
419 } | 419 } |
420 | 420 |
421 | 421 |
422 void FullCodeGenerator::Initialize() { | 422 void FullCodeGenerator::Initialize() { |
423 InitializeAstVisitor(info_->zone()); | 423 InitializeAstVisitor(info_->isolate(), info_->zone()); |
424 // The generation of debug code must match between the snapshot code and the | 424 // The generation of debug code must match between the snapshot code and the |
425 // code that is generated later. This is assumed by the debugger when it is | 425 // code that is generated later. This is assumed by the debugger when it is |
426 // calculating PC offsets after generating a debug version of code. Therefore | 426 // calculating PC offsets after generating a debug version of code. Therefore |
427 // we disable the production of debug code in the full compiler if we are | 427 // we disable the production of debug code in the full compiler if we are |
428 // either generating a snapshot or we booted from a snapshot. | 428 // either generating a snapshot or we booted from a snapshot. |
429 generate_debug_code_ = FLAG_debug_code && | 429 generate_debug_code_ = FLAG_debug_code && |
430 !masm_->serializer_enabled() && | 430 !masm_->serializer_enabled() && |
431 !Snapshot::HaveASnapshotToStartFrom(); | 431 !Snapshot::HaveASnapshotToStartFrom(); |
432 masm_->set_emit_debug_code(generate_debug_code_); | 432 masm_->set_emit_debug_code(generate_debug_code_); |
433 masm_->set_predictable_code_size(true); | 433 masm_->set_predictable_code_size(true); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 CodeGenerator::RecordPositions(masm_, fun->end_position() - 1); | 830 CodeGenerator::RecordPositions(masm_, fun->end_position() - 1); |
831 } | 831 } |
832 | 832 |
833 | 833 |
834 void FullCodeGenerator::SetStatementPosition(Statement* stmt) { | 834 void FullCodeGenerator::SetStatementPosition(Statement* stmt) { |
835 if (!info_->is_debug()) { | 835 if (!info_->is_debug()) { |
836 CodeGenerator::RecordPositions(masm_, stmt->position()); | 836 CodeGenerator::RecordPositions(masm_, stmt->position()); |
837 } else { | 837 } else { |
838 // Check if the statement will be breakable without adding a debug break | 838 // Check if the statement will be breakable without adding a debug break |
839 // slot. | 839 // slot. |
840 BreakableStatementChecker checker(zone()); | 840 BreakableStatementChecker checker(info_->isolate(), zone()); |
841 checker.Check(stmt); | 841 checker.Check(stmt); |
842 // Record the statement position right here if the statement is not | 842 // Record the statement position right here if the statement is not |
843 // breakable. For breakable statements the actual recording of the | 843 // breakable. For breakable statements the actual recording of the |
844 // position will be postponed to the breakable code (typically an IC). | 844 // position will be postponed to the breakable code (typically an IC). |
845 bool position_recorded = CodeGenerator::RecordPositions( | 845 bool position_recorded = CodeGenerator::RecordPositions( |
846 masm_, stmt->position(), !checker.is_breakable()); | 846 masm_, stmt->position(), !checker.is_breakable()); |
847 // If the position recording did record a new position generate a debug | 847 // If the position recording did record a new position generate a debug |
848 // break slot to make the statement breakable. | 848 // break slot to make the statement breakable. |
849 if (position_recorded) { | 849 if (position_recorded) { |
850 DebugCodegen::GenerateSlot(masm_); | 850 DebugCodegen::GenerateSlot(masm_); |
851 } | 851 } |
852 } | 852 } |
853 } | 853 } |
854 | 854 |
855 | 855 |
856 void FullCodeGenerator::VisitSuperReference(SuperReference* super) { | 856 void FullCodeGenerator::VisitSuperReference(SuperReference* super) { |
857 __ CallRuntime(Runtime::kThrowUnsupportedSuperError, 0); | 857 __ CallRuntime(Runtime::kThrowUnsupportedSuperError, 0); |
858 } | 858 } |
859 | 859 |
860 | 860 |
861 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { | 861 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { |
862 if (!info_->is_debug()) { | 862 if (!info_->is_debug()) { |
863 CodeGenerator::RecordPositions(masm_, expr->position()); | 863 CodeGenerator::RecordPositions(masm_, expr->position()); |
864 } else { | 864 } else { |
865 // Check if the expression will be breakable without adding a debug break | 865 // Check if the expression will be breakable without adding a debug break |
866 // slot. | 866 // slot. |
867 BreakableStatementChecker checker(zone()); | 867 BreakableStatementChecker checker(info_->isolate(), zone()); |
868 checker.Check(expr); | 868 checker.Check(expr); |
869 // Record a statement position right here if the expression is not | 869 // Record a statement position right here if the expression is not |
870 // breakable. For breakable expressions the actual recording of the | 870 // breakable. For breakable expressions the actual recording of the |
871 // position will be postponed to the breakable code (typically an IC). | 871 // position will be postponed to the breakable code (typically an IC). |
872 // NOTE this will record a statement position for something which might | 872 // NOTE this will record a statement position for something which might |
873 // not be a statement. As stepping in the debugger will only stop at | 873 // not be a statement. As stepping in the debugger will only stop at |
874 // statement positions this is used for e.g. the condition expression of | 874 // statement positions this is used for e.g. the condition expression of |
875 // a do while loop. | 875 // a do while loop. |
876 bool position_recorded = CodeGenerator::RecordPositions( | 876 bool position_recorded = CodeGenerator::RecordPositions( |
877 masm_, expr->position(), !checker.is_breakable()); | 877 masm_, expr->position(), !checker.is_breakable()); |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 } | 1826 } |
1827 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); | 1827 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); |
1828 codegen_->scope_ = saved_scope_; | 1828 codegen_->scope_ = saved_scope_; |
1829 } | 1829 } |
1830 | 1830 |
1831 | 1831 |
1832 #undef __ | 1832 #undef __ |
1833 | 1833 |
1834 | 1834 |
1835 } } // namespace v8::internal | 1835 } } // namespace v8::internal |
OLD | NEW |