Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index d31ca9e11bed6d7cec3ca8dd54eaf6e9e2790577..e7e6d2aa8c7099e5767f08f1a8cf9c9389c285f4 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -183,8 +183,8 @@ void CompilationInfo::Initialize(Isolate* isolate, |
if (FLAG_turbo_types) MarkAsTypingEnabled(); |
if (!shared_info_.is_null()) { |
- DCHECK(strict_mode() == SLOPPY); |
- SetStrictMode(shared_info_->strict_mode()); |
+ DCHECK(!is_strict(language_mode())); |
+ SetLanguageMode(shared_info_->language_mode()); |
} |
bailout_reason_ = kNoReason; |
@@ -624,7 +624,7 @@ static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, |
function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation()); |
function_info->set_allows_lazy_compilation_without_context( |
lit->AllowsLazyCompilationWithoutContext()); |
- function_info->set_strict_mode(lit->strict_mode()); |
+ function_info->set_language_mode(lit->language_mode()); |
function_info->set_uses_arguments(lit->scope()->arguments() != NULL); |
function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); |
function_info->set_ast_node_count(lit->ast_node_count()); |
@@ -693,7 +693,7 @@ MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCodeCommon( |
if (!Parser::Parse(info)) return MaybeHandle<Code>(); |
Handle<SharedFunctionInfo> shared = info->shared_info(); |
FunctionLiteral* lit = info->function(); |
- shared->set_strict_mode(lit->strict_mode()); |
+ shared->set_language_mode(lit->language_mode()); |
SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); |
MaybeDisableOptimization(shared, lit->dont_optimize_reason()); |
@@ -1216,7 +1216,7 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { |
MaybeHandle<JSFunction> Compiler::GetFunctionFromEval( |
Handle<String> source, Handle<SharedFunctionInfo> outer_info, |
- Handle<Context> context, StrictMode strict_mode, |
+ Handle<Context> context, LanguageMode language_mode, |
ParseRestriction restriction, int scope_position) { |
Isolate* isolate = source->GetIsolate(); |
int source_length = source->length(); |
@@ -1225,7 +1225,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval( |
CompilationCache* compilation_cache = isolate->compilation_cache(); |
MaybeHandle<SharedFunctionInfo> maybe_shared_info = |
- compilation_cache->LookupEval(source, outer_info, context, strict_mode, |
+ compilation_cache->LookupEval(source, outer_info, context, language_mode, |
scope_position); |
Handle<SharedFunctionInfo> shared_info; |
@@ -1234,7 +1234,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval( |
CompilationInfoWithZone info(script); |
info.MarkAsEval(); |
if (context->IsNativeContext()) info.MarkAsGlobal(); |
- info.SetStrictMode(strict_mode); |
+ info.SetLanguageMode(language_mode); |
info.SetParseRestriction(restriction); |
info.SetContext(context); |
@@ -1252,7 +1252,8 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval( |
} |
// If caller is strict mode, the result must be in strict mode as well. |
- DCHECK(strict_mode == SLOPPY || shared_info->strict_mode() == STRICT); |
+ DCHECK(!is_strict(language_mode) || |
+ is_strict(shared_info->language_mode())); |
if (!shared_info->dont_cache()) { |
compilation_cache->PutEval(source, outer_info, context, shared_info, |
scope_position); |
@@ -1345,7 +1346,10 @@ Handle<SharedFunctionInfo> Compiler::CompileScript( |
compile_options == ScriptCompiler::kProduceCodeCache) { |
info.PrepareForSerializing(); |
} |
- if (FLAG_use_strict) info.SetStrictMode(STRICT); |
+ if (FLAG_use_strict) { |
+ info.SetLanguageMode( |
+ static_cast<LanguageMode>(info.language_mode() | STRICT)); |
+ } |
result = CompileToplevel(&info); |
if (extension == NULL && !result.is_null() && !result->dont_cache()) { |
@@ -1376,7 +1380,10 @@ Handle<SharedFunctionInfo> Compiler::CompileStreamedScript( |
isolate->counters()->total_load_size()->Increment(source_length); |
isolate->counters()->total_compile_size()->Increment(source_length); |
- if (FLAG_use_strict) info->SetStrictMode(STRICT); |
+ if (FLAG_use_strict) { |
+ info->SetLanguageMode( |
+ static_cast<LanguageMode>(info->language_mode() | STRICT)); |
+ } |
// TODO(marja): FLAG_serialize_toplevel is not honoured and won't be; when the |
// real code caching lands, streaming needs to be adapted to use it. |
return CompileToplevel(info); |
@@ -1390,7 +1397,7 @@ Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo( |
CompilationInfoWithZone info(script); |
info.SetFunction(literal); |
info.PrepareForCompilation(literal->scope()); |
- info.SetStrictMode(literal->scope()->strict_mode()); |
+ info.SetLanguageMode(literal->scope()->language_mode()); |
if (outer_info->will_serialize()) info.PrepareForSerializing(); |
Isolate* isolate = info.isolate(); |