Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: src/compiler.h

Issue 8417035: Introduce extended mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased version. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index bedf5eebb9469d59278bbb4d311f84c7ac7ac9d4..106425188b25a271aa445e675ac2db633d9ac1fe 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -52,9 +52,11 @@ class CompilationInfo BASE_EMBEDDED {
bool is_lazy() const { return IsLazy::decode(flags_); }
bool is_eval() const { return IsEval::decode(flags_); }
bool is_global() const { return IsGlobal::decode(flags_); }
- bool is_strict_mode() const { return strict_mode_flag() == kStrictMode; }
- StrictModeFlag strict_mode_flag() const {
- return StrictModeFlagField::decode(flags_);
+ bool is_classic_mode() const { return language_mode() == CLASSIC_MODE; }
+ bool is_extended_mode() const { return language_mode() == EXTENDED_MODE; }
+ bool is_strict_or_extended_mode() const { return !is_classic_mode(); }
rossberg 2011/11/08 15:02:46 Same here.
Steven 2011/11/08 16:13:49 Done.
+ LanguageMode language_mode() const {
+ return LanguageModeField::decode(flags_);
}
bool is_in_loop() const { return IsInLoop::decode(flags_); }
FunctionLiteral* function() const { return function_; }
@@ -76,10 +78,13 @@ class CompilationInfo BASE_EMBEDDED {
ASSERT(!is_lazy());
flags_ |= IsGlobal::encode(true);
}
- void SetStrictModeFlag(StrictModeFlag strict_mode_flag) {
- ASSERT(StrictModeFlagField::decode(flags_) == kNonStrictMode ||
- StrictModeFlagField::decode(flags_) == strict_mode_flag);
- flags_ = StrictModeFlagField::update(flags_, strict_mode_flag);
+ void SetLanguageMode(LanguageMode language_mode) {
+ ASSERT(this->language_mode() != STRICT_MODE ||
+ language_mode == STRICT_MODE ||
+ language_mode == EXTENDED_MODE);
+ ASSERT(this->language_mode() != EXTENDED_MODE ||
+ language_mode == EXTENDED_MODE);
rossberg 2011/11/08 15:02:46 All this asserts is this->language_mode() <= langu
Steven 2011/11/08 16:13:49 Done.
+ flags_ = LanguageModeField::update(flags_, language_mode);
}
void MarkAsInLoop() {
ASSERT(is_lazy());
@@ -189,8 +194,8 @@ class CompilationInfo BASE_EMBEDDED {
MarkAsNative();
}
if (!shared_info_.is_null()) {
- ASSERT(strict_mode_flag() == kNonStrictMode);
- SetStrictModeFlag(shared_info_->strict_mode_flag());
+ ASSERT(language_mode() == CLASSIC_MODE);
+ SetLanguageMode(shared_info_->language_mode());
}
}
@@ -210,7 +215,7 @@ class CompilationInfo BASE_EMBEDDED {
// Flags that can be set for lazy compilation.
class IsInLoop: public BitField<bool, 3, 1> {};
// Strict mode - used in eager compilation.
- class StrictModeFlagField: public BitField<StrictModeFlag, 4, 1> {};
+ class LanguageModeField: public BitField<LanguageMode, 4, 2> {};
// Is this a function from our natives.
class IsNative: public BitField<bool, 6, 1> {};
// Is this code being compiled with support for deoptimization..
@@ -289,7 +294,7 @@ class Compiler : public AllStatic {
static Handle<SharedFunctionInfo> CompileEval(Handle<String> source,
Handle<Context> context,
bool is_global,
- StrictModeFlag strict_mode);
+ LanguageMode language_mode);
// Compile from function info (used for lazy compilation). Returns true on
// success and false if the compilation resulted in a stack overflow.

Powered by Google App Engine
This is Rietveld 408576698