| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 #include "register-allocator.h" | 86 #include "register-allocator.h" |
| 87 | 87 |
| 88 namespace v8 { | 88 namespace v8 { |
| 89 namespace internal { | 89 namespace internal { |
| 90 | 90 |
| 91 // Code generation can be nested. Code generation scopes form a stack | 91 // Code generation can be nested. Code generation scopes form a stack |
| 92 // of active code generators. | 92 // of active code generators. |
| 93 class CodeGeneratorScope BASE_EMBEDDED { | 93 class CodeGeneratorScope BASE_EMBEDDED { |
| 94 public: | 94 public: |
| 95 explicit CodeGeneratorScope(CodeGenerator* cgen) { | 95 explicit CodeGeneratorScope(Isolate* isolate, CodeGenerator* cgen) |
| 96 previous_ = top_; | 96 : isolate_(isolate) { |
| 97 top_ = cgen; | 97 previous_ = isolate->current_code_generator(); |
| 98 isolate->set_current_code_generator(cgen); |
| 98 } | 99 } |
| 99 | 100 |
| 100 ~CodeGeneratorScope() { | 101 ~CodeGeneratorScope() { |
| 101 top_ = previous_; | 102 isolate_->set_current_code_generator(previous_); |
| 102 } | 103 } |
| 103 | 104 |
| 104 static CodeGenerator* Current() { | 105 static CodeGenerator* Current(Isolate* isolate) { |
| 105 ASSERT(top_ != NULL); | 106 ASSERT(isolate->current_code_generator() != NULL); |
| 106 return top_; | 107 return isolate->current_code_generator(); |
| 107 } | 108 } |
| 108 | 109 |
| 109 private: | 110 private: |
| 110 static CodeGenerator* top_; | |
| 111 CodeGenerator* previous_; | 111 CodeGenerator* previous_; |
| 112 Isolate* isolate_; |
| 112 }; | 113 }; |
| 113 | 114 |
| 114 | |
| 115 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 | 115 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 |
| 116 | 116 |
| 117 // State of used registers in a virtual frame. | 117 // State of used registers in a virtual frame. |
| 118 class FrameRegisterState { | 118 class FrameRegisterState { |
| 119 public: | 119 public: |
| 120 // Captures the current state of the given frame. | 120 // Captures the current state of the given frame. |
| 121 explicit FrameRegisterState(VirtualFrame* frame); | 121 explicit FrameRegisterState(VirtualFrame* frame); |
| 122 | 122 |
| 123 // Saves the state in the stack. | 123 // Saves the state in the stack. |
| 124 void Save(MacroAssembler* masm) const; | 124 void Save(MacroAssembler* masm) const; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 #ifdef DEBUG | 236 #ifdef DEBUG |
| 237 const char* comment_; | 237 const char* comment_; |
| 238 #endif | 238 #endif |
| 239 DISALLOW_COPY_AND_ASSIGN(DeferredCode); | 239 DISALLOW_COPY_AND_ASSIGN(DeferredCode); |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 | 242 |
| 243 } } // namespace v8::internal | 243 } } // namespace v8::internal |
| 244 | 244 |
| 245 #endif // V8_CODEGEN_H_ | 245 #endif // V8_CODEGEN_H_ |
| OLD | NEW |