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

Unified Diff: src/compiler.h

Issue 8417035: Introduce extended mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed more comments. 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
« no previous file with comments | « src/compilation-cache.cc ('k') | src/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index ecf112072c6e8d71ead58d95f4e4a7fbd3104515..46207560d92c705e8fb53cda4513ede37de555b4 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -52,9 +52,10 @@ 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; }
+ LanguageMode language_mode() const {
+ return LanguageModeField::decode(flags_);
}
bool is_in_loop() const { return IsInLoop::decode(flags_); }
FunctionLiteral* function() const { return function_; }
@@ -76,10 +77,11 @@ 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() == CLASSIC_MODE ||
+ this->language_mode() == language_mode ||
+ language_mode == EXTENDED_MODE);
+ flags_ = LanguageModeField::update(flags_, language_mode);
}
void MarkAsInLoop() {
ASSERT(is_lazy());
@@ -189,8 +191,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 +212,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 +291,7 @@ class Compiler : public AllStatic {
static Handle<SharedFunctionInfo> CompileEval(Handle<String> source,
Handle<Context> context,
bool is_global,
- StrictModeFlag strict_mode,
+ LanguageMode language_mode,
int scope_position);
// Compile from function info (used for lazy compilation). Returns true on
« no previous file with comments | « src/compilation-cache.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698