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

Unified Diff: src/parser.cc

Issue 6286043: Direct call to eval passes strict mode through. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Extra argument to Resolve*Eval* Created 9 years, 11 months 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/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index c0976988ea3c077800842816c03981ee5cf7b248..58fa1d10e7ae8a21c11883daa185a2833bea6603 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -616,7 +616,8 @@ Parser::Parser(Handle<Script> script,
FunctionLiteral* Parser::ParseProgram(Handle<String> source,
- bool in_global_context) {
+ bool in_global_context,
+ bool strict_mode) {
CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
HistogramTimerScope timer(&Counters::parse);
@@ -632,17 +633,18 @@ FunctionLiteral* Parser::ParseProgram(Handle<String> source,
ExternalTwoByteStringUC16CharacterStream stream(
Handle<ExternalTwoByteString>::cast(source), 0, source->length());
scanner_.Initialize(&stream);
- return DoParseProgram(source, in_global_context, &zone_scope);
+ return DoParseProgram(source, in_global_context, strict_mode, &zone_scope);
} else {
GenericStringUC16CharacterStream stream(source, 0, source->length());
scanner_.Initialize(&stream);
- return DoParseProgram(source, in_global_context, &zone_scope);
+ return DoParseProgram(source, in_global_context, strict_mode, &zone_scope);
}
}
FunctionLiteral* Parser::DoParseProgram(Handle<String> source,
bool in_global_context,
+ bool strict_mode,
ZoneScope* zone_scope) {
ASSERT(target_stack_ == NULL);
if (pre_data_ != NULL) pre_data_->Initialize();
@@ -662,6 +664,7 @@ FunctionLiteral* Parser::DoParseProgram(Handle<String> source,
LexicalScope lexical_scope(&this->top_scope_, &this->with_nesting_level_,
scope);
TemporaryScope temp_scope(&this->temp_scope_);
+ if (strict_mode) temp_scope.EnableStrictMode();
Martin Maly 2011/02/02 23:56:22 Restore strict mode (the eval call path)
ZoneList<Statement*>* body = new ZoneList<Statement*>(16);
bool ok = true;
int beg_loc = scanner().location().beg_pos;
@@ -747,6 +750,10 @@ FunctionLiteral* Parser::ParseLazy(Handle<SharedFunctionInfo> info,
scope);
TemporaryScope temp_scope(&this->temp_scope_);
+ if (info->strict_mode()) {
+ temp_scope.EnableStrictMode();
+ }
Martin Maly 2011/02/02 23:56:22 In lazy compilation, strict flag is stored on Shar
Lasse Reichstein 2011/02/03 12:36:01 Is it only for lazily compiled functions that the
Martin Maly 2011/02/04 01:02:34 All SharedFunctionInfo have the correct strict mod
+
FunctionLiteralType type =
info->is_expression() ? EXPRESSION : DECLARATION;
bool ok = true;
@@ -5025,7 +5032,9 @@ bool ParserApi::Parse(CompilationInfo* info) {
ASSERT(Top::has_pending_exception());
} else {
Handle<String> source = Handle<String>(String::cast(script->source()));
- result = parser.ParseProgram(source, info->is_global());
+ result = parser.ParseProgram(source,
+ info->is_global(),
+ info->is_strict());
}
}

Powered by Google App Engine
This is Rietveld 408576698