| Index: src/compiler.cc
|
| ===================================================================
|
| --- src/compiler.cc (revision 7006)
|
| +++ src/compiler.cc (working copy)
|
| @@ -558,7 +558,8 @@
|
|
|
| Handle<SharedFunctionInfo> Compiler::CompileEval(Handle<String> source,
|
| Handle<Context> context,
|
| - bool is_global) {
|
| + bool is_global,
|
| + StrictModeFlag strict_mode) {
|
| Isolate* isolate = source->GetIsolate();
|
| int source_length = source->length();
|
| isolate->counters()->total_eval_size()->Increment(source_length);
|
| @@ -571,7 +572,10 @@
|
| // the compiler and add the result to the cache.
|
| Handle<SharedFunctionInfo> result;
|
| CompilationCache* compilation_cache = isolate->compilation_cache();
|
| - result = compilation_cache->LookupEval(source, context, is_global);
|
| + result = compilation_cache->LookupEval(source,
|
| + context,
|
| + is_global,
|
| + strict_mode);
|
|
|
| if (result.is_null()) {
|
| // Create a script object describing the script to be compiled.
|
| @@ -579,10 +583,15 @@
|
| CompilationInfo info(script);
|
| info.MarkAsEval();
|
| if (is_global) info.MarkAsGlobal();
|
| + if (strict_mode == kStrictMode) info.MarkAsStrict();
|
| info.SetCallingContext(context);
|
| result = MakeFunctionInfo(&info);
|
| if (!result.is_null()) {
|
| CompilationCache* compilation_cache = isolate->compilation_cache();
|
| + // If caller is strict mode, the result must be strict as well,
|
| + // but not the other way around. Consider:
|
| + // eval("'use strict'; ...");
|
| + ASSERT(strict_mode == kNonStrictMode || result->strict_mode());
|
| compilation_cache->PutEval(source, context, is_global, result);
|
| }
|
| }
|
| @@ -779,6 +788,7 @@
|
| *lit->this_property_assignments());
|
| function_info->set_try_full_codegen(lit->try_full_codegen());
|
| function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation());
|
| + function_info->set_strict_mode(lit->strict_mode());
|
| }
|
|
|
|
|
|
|