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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 namespace v8 { | 95 namespace v8 { |
96 namespace internal { | 96 namespace internal { |
97 | 97 |
98 | 98 |
99 // Code generation can be nested. Code generation scopes form a stack | 99 // Code generation can be nested. Code generation scopes form a stack |
100 // of active code generators. | 100 // of active code generators. |
101 class CodeGeneratorScope BASE_EMBEDDED { | 101 class CodeGeneratorScope BASE_EMBEDDED { |
102 public: | 102 public: |
103 explicit CodeGeneratorScope(CodeGenerator* cgen) { | 103 explicit CodeGeneratorScope(CodeGenerator* cgen) { |
104 previous_ = top_; | 104 CodeGeneratorData& code_generator_data = v8_context()->code_generator_data_; |
105 top_ = cgen; | 105 previous_ = code_generator_data.top_; |
| 106 code_generator_data.top_ = cgen; |
106 } | 107 } |
107 | 108 |
108 ~CodeGeneratorScope() { | 109 ~CodeGeneratorScope() { |
109 top_ = previous_; | 110 v8_context()->code_generator_data_.top_ = previous_; |
110 } | 111 } |
111 | 112 |
112 static CodeGenerator* Current() { | 113 static CodeGenerator* Current() { |
113 ASSERT(top_ != NULL); | 114 CodeGeneratorData& code_generator_data = v8_context()->code_generator_data_; |
114 return top_; | 115 ASSERT(code_generator_data.top_ != NULL); |
| 116 return code_generator_data.top_; |
115 } | 117 } |
116 | 118 |
117 private: | 119 private: |
118 static CodeGenerator* top_; | |
119 CodeGenerator* previous_; | 120 CodeGenerator* previous_; |
120 }; | 121 }; |
121 | 122 |
122 | 123 |
123 // Deferred code objects are small pieces of code that are compiled | 124 // Deferred code objects are small pieces of code that are compiled |
124 // out of line. They are used to defer the compilation of uncommon | 125 // out of line. They are used to defer the compilation of uncommon |
125 // paths thereby avoiding expensive jumps around uncommon code parts. | 126 // paths thereby avoiding expensive jumps around uncommon code parts. |
126 class DeferredCode: public ZoneObject { | 127 class DeferredCode: public ZoneObject { |
127 public: | 128 public: |
128 DeferredCode(); | 129 DeferredCode(); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 PrintF("ArgumentsAccessStub (type %d)\n", type_); | 419 PrintF("ArgumentsAccessStub (type %d)\n", type_); |
419 } | 420 } |
420 #endif | 421 #endif |
421 }; | 422 }; |
422 | 423 |
423 | 424 |
424 } // namespace internal | 425 } // namespace internal |
425 } // namespace v8 | 426 } // namespace v8 |
426 | 427 |
427 #endif // V8_CODEGEN_H_ | 428 #endif // V8_CODEGEN_H_ |
OLD | NEW |