Index: src/codegen.h |
=================================================================== |
--- src/codegen.h (revision 1960) |
+++ src/codegen.h (working copy) |
@@ -86,9 +86,27 @@ |
#include "arm/codegen-arm.h" |
#endif |
+#include "register-allocator.h" |
+ |
namespace v8 { namespace internal { |
+// Code generation can be nested. Code generation scopes form a stack |
+// of active code generators. |
+class CodeGeneratorScope BASE_EMBEDDED { |
+ public: |
+ explicit CodeGeneratorScope(CodeGenerator* cgen) { |
+ previous = Result::cgen_; |
Kevin Millikin (Chromium)
2009/05/15 10:50:49
Does the static top code generator belong to the R
Mads Ager (chromium)
2009/05/15 11:05:25
Good point. I moved it to the CodeGeneratorScope.
|
+ Result::cgen_ = cgen; |
+ } |
+ ~CodeGeneratorScope() { |
+ Result::cgen_ = previous; |
+ } |
+ private: |
+ CodeGenerator* previous; |
+}; |
+ |
+ |
// Use lazy compilation; defaults to true. |
// NOTE: Do not remove non-lazy compilation until we can properly |
// install extensions with lazy compilation enabled. At the |