| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 26 matching lines...) Expand all Loading... |
| 37 // of Visitor and that the following methods are available publicly: | 37 // of Visitor and that the following methods are available publicly: |
| 38 // CodeGenerator::MakeCode | 38 // CodeGenerator::MakeCode |
| 39 // CodeGenerator::SetFunctionInfo | 39 // CodeGenerator::SetFunctionInfo |
| 40 // CodeGenerator::AddDeferred | 40 // CodeGenerator::AddDeferred |
| 41 // CodeGenerator::masm | 41 // CodeGenerator::masm |
| 42 // | 42 // |
| 43 // These methods are either used privately by the shared code or implemented as | 43 // These methods are either used privately by the shared code or implemented as |
| 44 // shared code: | 44 // shared code: |
| 45 // CodeGenerator::CodeGenerator | 45 // CodeGenerator::CodeGenerator |
| 46 // CodeGenerator::~CodeGenerator | 46 // CodeGenerator::~CodeGenerator |
| 47 // CodeGenerator::SetFrame |
| 47 // CodeGenerator::ProcessDeferred | 48 // CodeGenerator::ProcessDeferred |
| 48 // CodeGenerator::GenCode | 49 // CodeGenerator::GenCode |
| 49 // CodeGenerator::BuildBoilerplate | 50 // CodeGenerator::BuildBoilerplate |
| 50 // CodeGenerator::ComputeCallInitialize | 51 // CodeGenerator::ComputeCallInitialize |
| 51 // CodeGenerator::ComputeCallInitializeInLoop | 52 // CodeGenerator::ComputeCallInitializeInLoop |
| 52 // CodeGenerator::ProcessDeclarations | 53 // CodeGenerator::ProcessDeclarations |
| 53 // CodeGenerator::DeclareGlobals | 54 // CodeGenerator::DeclareGlobals |
| 54 // CodeGenerator::CheckForInlineRuntimeCall | 55 // CodeGenerator::CheckForInlineRuntimeCall |
| 55 // CodeGenerator::GenerateFastCaseSwitchStatement | 56 // CodeGenerator::GenerateFastCaseSwitchStatement |
| 56 // CodeGenerator::GenerateFastCaseSwitchCases | 57 // CodeGenerator::GenerateFastCaseSwitchCases |
| (...skipping 17 matching lines...) Expand all Loading... |
| 74 // moment, this doesn't work for the extensions in Google3, | 75 // moment, this doesn't work for the extensions in Google3, |
| 75 // and we can only run the tests with --nolazy. | 76 // and we can only run the tests with --nolazy. |
| 76 | 77 |
| 77 | 78 |
| 78 // Deferred code objects are small pieces of code that are compiled | 79 // Deferred code objects are small pieces of code that are compiled |
| 79 // out of line. They are used to defer the compilation of uncommon | 80 // out of line. They are used to defer the compilation of uncommon |
| 80 // paths thereby avoiding expensive jumps around uncommon code parts. | 81 // paths thereby avoiding expensive jumps around uncommon code parts. |
| 81 class DeferredCode: public ZoneObject { | 82 class DeferredCode: public ZoneObject { |
| 82 public: | 83 public: |
| 83 explicit DeferredCode(CodeGenerator* generator); | 84 explicit DeferredCode(CodeGenerator* generator); |
| 84 virtual ~DeferredCode() { } | 85 virtual ~DeferredCode() {} |
| 85 | 86 |
| 86 virtual void Generate() = 0; | 87 virtual void Generate() = 0; |
| 87 | 88 |
| 88 MacroAssembler* masm() const { return masm_; } | 89 MacroAssembler* masm() const { return masm_; } |
| 89 CodeGenerator* generator() const { return generator_; } | 90 CodeGenerator* generator() const { return generator_; } |
| 90 | 91 |
| 91 JumpTarget* enter() { return &enter_; } | 92 // Emit a conditional branch to the code entry. |
| 92 JumpTarget* exit() { return &exit_; } | 93 void BranchTo(Condition cc); |
| 94 |
| 95 // Bind the exit target of the code. |
| 96 void BindExit(); |
| 97 |
| 98 // Emit an exit from the code if the exit target is bound. |
| 99 void ExitIfBound(); |
| 100 |
| 101 Label* enter() { return &enter_; } |
| 102 |
| 103 VirtualFrame* frame() { return frame_; } |
| 104 void clear_frame() { frame_ = NULL; } |
| 105 |
| 106 RegisterFile* registers() { return ®isters_; } |
| 93 | 107 |
| 94 int statement_position() const { return statement_position_; } | 108 int statement_position() const { return statement_position_; } |
| 95 int position() const { return position_; } | 109 int position() const { return position_; } |
| 96 | 110 |
| 97 #ifdef DEBUG | 111 #ifdef DEBUG |
| 98 void set_comment(const char* comment) { comment_ = comment; } | 112 void set_comment(const char* comment) { comment_ = comment; } |
| 99 const char* comment() const { return comment_; } | 113 const char* comment() const { return comment_; } |
| 100 #else | 114 #else |
| 101 inline void set_comment(const char* comment) { } | 115 inline void set_comment(const char* comment) { } |
| 102 const char* comment() const { return ""; } | 116 const char* comment() const { return ""; } |
| 103 #endif | 117 #endif |
| 104 | 118 |
| 105 protected: | 119 protected: |
| 106 // The masm_ field is manipulated when compiling stubs with the | 120 // The masm_ field is manipulated when compiling stubs with the |
| 107 // BEGIN_STUB and END_STUB macros. For that reason, it cannot be | 121 // BEGIN_STUB and END_STUB macros. For that reason, it cannot be |
| 108 // constant. | 122 // constant. |
| 109 MacroAssembler* masm_; | 123 MacroAssembler* masm_; |
| 110 | 124 |
| 111 private: | 125 private: |
| 112 CodeGenerator* const generator_; | 126 CodeGenerator* const generator_; |
| 113 JumpTarget enter_; | 127 |
| 128 // The entry is a label, paired with a known frame and a known global |
| 129 // register file. It is not a jump target because it doesn't use any of |
| 130 // the jump target's branch or bind machinery. |
| 131 Label enter_; |
| 132 VirtualFrame* frame_; |
| 133 RegisterFile registers_; |
| 134 |
| 135 // The exit target is a regular jump target. |
| 114 JumpTarget exit_; | 136 JumpTarget exit_; |
| 137 |
| 115 int statement_position_; | 138 int statement_position_; |
| 116 int position_; | 139 int position_; |
| 117 #ifdef DEBUG | 140 #ifdef DEBUG |
| 118 const char* comment_; | 141 const char* comment_; |
| 119 #endif | 142 #endif |
| 120 DISALLOW_COPY_AND_ASSIGN(DeferredCode); | 143 DISALLOW_COPY_AND_ASSIGN(DeferredCode); |
| 121 }; | 144 }; |
| 122 | 145 |
| 123 | 146 |
| 124 // RuntimeStub models code stubs calling entry points in the Runtime class. | 147 // RuntimeStub models code stubs calling entry points in the Runtime class. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 PrintF("ArgumentsAccessStub (type %d)\n", type_); | 304 PrintF("ArgumentsAccessStub (type %d)\n", type_); |
| 282 } | 305 } |
| 283 #endif | 306 #endif |
| 284 }; | 307 }; |
| 285 | 308 |
| 286 | 309 |
| 287 } // namespace internal | 310 } // namespace internal |
| 288 } // namespace v8 | 311 } // namespace v8 |
| 289 | 312 |
| 290 #endif // V8_CODEGEN_H_ | 313 #endif // V8_CODEGEN_H_ |
| OLD | NEW |