| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 // The generation of debug code must match between the snapshot code and the | 414 // The generation of debug code must match between the snapshot code and the |
| 415 // code that is generated later. This is assumed by the debugger when it is | 415 // code that is generated later. This is assumed by the debugger when it is |
| 416 // calculating PC offsets after generating a debug version of code. Therefore | 416 // calculating PC offsets after generating a debug version of code. Therefore |
| 417 // we disable the production of debug code in the full compiler if we are | 417 // we disable the production of debug code in the full compiler if we are |
| 418 // either generating a snapshot or we booted from a snapshot. | 418 // either generating a snapshot or we booted from a snapshot. |
| 419 generate_debug_code_ = FLAG_debug_code && | 419 generate_debug_code_ = FLAG_debug_code && |
| 420 !Serializer::enabled() && | 420 !Serializer::enabled() && |
| 421 !Snapshot::HaveASnapshotToStartFrom(); | 421 !Snapshot::HaveASnapshotToStartFrom(); |
| 422 masm_->set_emit_debug_code(generate_debug_code_); | 422 masm_->set_emit_debug_code(generate_debug_code_); |
| 423 masm_->set_predictable_code_size(true); | 423 masm_->set_predictable_code_size(true); |
| 424 InitializeAstVisitor(info_->isolate()); | 424 InitializeAstVisitor(info_->zone()); |
| 425 } | 425 } |
| 426 | 426 |
| 427 | 427 |
| 428 void FullCodeGenerator::PopulateTypeFeedbackCells(Handle<Code> code) { | 428 void FullCodeGenerator::PopulateTypeFeedbackCells(Handle<Code> code) { |
| 429 if (type_feedback_cells_.is_empty()) return; | 429 if (type_feedback_cells_.is_empty()) return; |
| 430 int length = type_feedback_cells_.length(); | 430 int length = type_feedback_cells_.length(); |
| 431 int array_size = TypeFeedbackCells::LengthOfFixedArray(length); | 431 int array_size = TypeFeedbackCells::LengthOfFixedArray(length); |
| 432 Handle<TypeFeedbackCells> cache = Handle<TypeFeedbackCells>::cast( | 432 Handle<TypeFeedbackCells> cache = Handle<TypeFeedbackCells>::cast( |
| 433 isolate()->factory()->NewFixedArray(array_size, TENURED)); | 433 isolate()->factory()->NewFixedArray(array_size, TENURED)); |
| 434 for (int i = 0; i < length; i++) { | 434 for (int i = 0; i < length; i++) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 445 } | 445 } |
| 446 | 446 |
| 447 | 447 |
| 448 void FullCodeGenerator::CallLoadIC(ContextualMode mode, TypeFeedbackId id) { | 448 void FullCodeGenerator::CallLoadIC(ContextualMode mode, TypeFeedbackId id) { |
| 449 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); | 449 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); |
| 450 CallIC(ic, mode, id); | 450 CallIC(ic, mode, id); |
| 451 } | 451 } |
| 452 | 452 |
| 453 | 453 |
| 454 void FullCodeGenerator::CallStoreIC(ContextualMode mode, TypeFeedbackId id) { | 454 void FullCodeGenerator::CallStoreIC(ContextualMode mode, TypeFeedbackId id) { |
| 455 Handle<Code> ic = StoreIC::initialize_stub(isolate(), strict_mode(), mode); | 455 Handle<Code> ic = StoreIC::initialize_stub(isolate(), strict_mode()); |
| 456 CallIC(ic, mode, id); | 456 CallIC(ic, mode, id); |
| 457 } | 457 } |
| 458 | 458 |
| 459 | 459 |
| 460 void FullCodeGenerator::RecordJSReturnSite(Call* call) { | 460 void FullCodeGenerator::RecordJSReturnSite(Call* call) { |
| 461 // We record the offset of the function return so we can rebuild the frame | 461 // We record the offset of the function return so we can rebuild the frame |
| 462 // if the function was inlined, i.e., this is the return address in the | 462 // if the function was inlined, i.e., this is the return address in the |
| 463 // inlined function's frame. | 463 // inlined function's frame. |
| 464 // | 464 // |
| 465 // The state is ignored. We defensively set it to TOS_REG, which is the | 465 // The state is ignored. We defensively set it to TOS_REG, which is the |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 } | 840 } |
| 841 | 841 |
| 842 | 842 |
| 843 void FullCodeGenerator::SetStatementPosition(Statement* stmt) { | 843 void FullCodeGenerator::SetStatementPosition(Statement* stmt) { |
| 844 #ifdef ENABLE_DEBUGGER_SUPPORT | 844 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 845 if (!isolate()->debugger()->IsDebuggerActive()) { | 845 if (!isolate()->debugger()->IsDebuggerActive()) { |
| 846 CodeGenerator::RecordPositions(masm_, stmt->position()); | 846 CodeGenerator::RecordPositions(masm_, stmt->position()); |
| 847 } else { | 847 } else { |
| 848 // Check if the statement will be breakable without adding a debug break | 848 // Check if the statement will be breakable without adding a debug break |
| 849 // slot. | 849 // slot. |
| 850 BreakableStatementChecker checker(isolate()); | 850 BreakableStatementChecker checker(zone()); |
| 851 checker.Check(stmt); | 851 checker.Check(stmt); |
| 852 // Record the statement position right here if the statement is not | 852 // Record the statement position right here if the statement is not |
| 853 // breakable. For breakable statements the actual recording of the | 853 // breakable. For breakable statements the actual recording of the |
| 854 // position will be postponed to the breakable code (typically an IC). | 854 // position will be postponed to the breakable code (typically an IC). |
| 855 bool position_recorded = CodeGenerator::RecordPositions( | 855 bool position_recorded = CodeGenerator::RecordPositions( |
| 856 masm_, stmt->position(), !checker.is_breakable()); | 856 masm_, stmt->position(), !checker.is_breakable()); |
| 857 // If the position recording did record a new position generate a debug | 857 // If the position recording did record a new position generate a debug |
| 858 // break slot to make the statement breakable. | 858 // break slot to make the statement breakable. |
| 859 if (position_recorded) { | 859 if (position_recorded) { |
| 860 Debug::GenerateSlot(masm_); | 860 Debug::GenerateSlot(masm_); |
| 861 } | 861 } |
| 862 } | 862 } |
| 863 #else | 863 #else |
| 864 CodeGenerator::RecordPositions(masm_, stmt->position()); | 864 CodeGenerator::RecordPositions(masm_, stmt->position()); |
| 865 #endif | 865 #endif |
| 866 } | 866 } |
| 867 | 867 |
| 868 | 868 |
| 869 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { | 869 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { |
| 870 #ifdef ENABLE_DEBUGGER_SUPPORT | 870 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 871 if (!isolate()->debugger()->IsDebuggerActive()) { | 871 if (!isolate()->debugger()->IsDebuggerActive()) { |
| 872 CodeGenerator::RecordPositions(masm_, expr->position()); | 872 CodeGenerator::RecordPositions(masm_, expr->position()); |
| 873 } else { | 873 } else { |
| 874 // Check if the expression will be breakable without adding a debug break | 874 // Check if the expression will be breakable without adding a debug break |
| 875 // slot. | 875 // slot. |
| 876 BreakableStatementChecker checker(isolate()); | 876 BreakableStatementChecker checker(zone()); |
| 877 checker.Check(expr); | 877 checker.Check(expr); |
| 878 // Record a statement position right here if the expression is not | 878 // Record a statement position right here if the expression is not |
| 879 // breakable. For breakable expressions the actual recording of the | 879 // breakable. For breakable expressions the actual recording of the |
| 880 // position will be postponed to the breakable code (typically an IC). | 880 // position will be postponed to the breakable code (typically an IC). |
| 881 // NOTE this will record a statement position for something which might | 881 // NOTE this will record a statement position for something which might |
| 882 // not be a statement. As stepping in the debugger will only stop at | 882 // not be a statement. As stepping in the debugger will only stop at |
| 883 // statement positions this is used for e.g. the condition expression of | 883 // statement positions this is used for e.g. the condition expression of |
| 884 // a do while loop. | 884 // a do while loop. |
| 885 bool position_recorded = CodeGenerator::RecordPositions( | 885 bool position_recorded = CodeGenerator::RecordPositions( |
| 886 masm_, expr->position(), !checker.is_breakable()); | 886 masm_, expr->position(), !checker.is_breakable()); |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1746 } | 1746 } |
| 1747 return true; | 1747 return true; |
| 1748 } | 1748 } |
| 1749 #endif // DEBUG | 1749 #endif // DEBUG |
| 1750 | 1750 |
| 1751 | 1751 |
| 1752 #undef __ | 1752 #undef __ |
| 1753 | 1753 |
| 1754 | 1754 |
| 1755 } } // namespace v8::internal | 1755 } } // namespace v8::internal |
| OLD | NEW |