Reviewers: Michael Starzinger,
Description:
[strong] Keep language mode consistent
[email protected]
BUG=v8:4312
LOG=N
Please review this at https://codereview.chromium.org/1240273002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+9, -9 lines):
M src/compiler/js-operator.cc
M src/parser.cc
M src/preparser.cc
Index: src/compiler/js-operator.cc
diff --git a/src/compiler/js-operator.cc b/src/compiler/js-operator.cc
index
b2b9cc41665b0a10bfd2b08d98f67478b8f35496..6a5bdfd69219dda85d691a80e6238fded8603a19
100644
--- a/src/compiler/js-operator.cc
+++ b/src/compiler/js-operator.cc
@@ -512,7 +512,7 @@ CACHED_OP_LIST(CACHED)
return &cache_.k##Name##StrictOperator; \
case STRONG: \
return &cache_.k##Name##StrongOperator; \
- case STRONG_BIT: \
+ default: \
break; /* %*!%^$#@ */ \
} \
UNREACHABLE(); \
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index
c1ae28577974f5e91f9aa87864bdcd7b6886e46c..357291c39aa02fccb3af2ec576006bb5ed861327
100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -346,7 +346,7 @@ FunctionLiteral* Parser::DefaultConstructor(bool
call_super, Scope* scope,
: FunctionKind::kDefaultBaseConstructor;
Scope* function_scope = NewScope(scope, FUNCTION_SCOPE, kind);
function_scope->SetLanguageMode(
- static_cast<LanguageMode>(language_mode | STRICT_BIT));
+ static_cast<LanguageMode>(language_mode | STRICT));
// Set start and end position to the same value
function_scope->set_start_position(pos);
function_scope->set_end_position(pos);
@@ -1327,12 +1327,12 @@ void*
Parser::ParseStatementList(ZoneList<Statement*>* body, int end_token,
// / "use strong" directives, do the strict mode changes only
once.
if (is_sloppy(scope_->language_mode())) {
scope_->SetLanguageMode(static_cast<LanguageMode>(
- scope_->language_mode() | STRICT_BIT));
+ scope_->language_mode() | STRICT));
}
if (use_strong_found) {
scope_->SetLanguageMode(static_cast<LanguageMode>(
- scope_->language_mode() | STRONG_BIT));
+ scope_->language_mode() | STRONG));
}
// Because declarations in strict eval code don't leak into the
scope
// of the eval call, it is likely that functions declared in
strict
@@ -1432,7 +1432,7 @@ void*
Parser::ParseModuleItemList(ZoneList<Statement*>* body, bool* ok) {
DCHECK(scope_->is_module_scope());
scope_->SetLanguageMode(
- static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT));
+ static_cast<LanguageMode>(scope_->language_mode() | STRICT));
while (peek() != Token::EOS) {
Statement* stat = ParseModuleItem(CHECK_OK);
@@ -4514,7 +4514,7 @@ ClassLiteral* Parser::ParseClassLiteral(const
AstRawString* name,
Scope* block_scope = NewScope(scope_, BLOCK_SCOPE);
BlockState block_state(&scope_, block_scope);
scope_->SetLanguageMode(
- static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT));
+ static_cast<LanguageMode>(scope_->language_mode() | STRICT));
scope_->SetScopeName(name);
VariableProxy* proxy = NULL;
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index
2ea770849ed832302c9cac526bdbc3d9004b21d6..a26b2a8975052eb71f4b27f69b8dc238ccfe91c4
100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -253,10 +253,10 @@ void PreParser::ParseStatementList(int end_token,
bool* ok,
if (directive_prologue) {
if (statement.IsUseStrictLiteral()) {
scope_->SetLanguageMode(
- static_cast<LanguageMode>(scope_->language_mode() |
STRICT_BIT));
+ static_cast<LanguageMode>(scope_->language_mode() | STRICT));
} else if (statement.IsUseStrongLiteral() && allow_strong_mode()) {
scope_->SetLanguageMode(static_cast<LanguageMode>(
- scope_->language_mode() | STRICT_BIT | STRONG_BIT));
+ scope_->language_mode() | STRONG));
} else if (!statement.IsStringLiteral()) {
directive_prologue = false;
}
@@ -1151,7 +1151,7 @@ PreParserExpression PreParser::ParseClassLiteral(
Scope* scope = NewScope(scope_, BLOCK_SCOPE);
BlockState block_state(&scope_, scope);
scope_->SetLanguageMode(
- static_cast<LanguageMode>(class_language_mode | STRICT_BIT));
+ static_cast<LanguageMode>(class_language_mode | STRICT));
// TODO(marja): Make PreParser use scope names too.
// scope_->SetScopeName(name);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.