Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 96d07a859b296b5223d7355f56d1fbb591535b17..3a8da10520214b64711692c5155e6c8b3b8e5d1d 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -7553,7 +7553,8 @@ static MaybeObject* Runtime_CompileString(Arguments args) { |
Handle<Context> context(Top::context()->global_context()); |
Handle<SharedFunctionInfo> shared = Compiler::CompileEval(source, |
context, |
- true); |
+ true, |
+ kNonStrictMode); |
if (shared.is_null()) return Failure::Exception(); |
Handle<JSFunction> fun = |
Factory::NewFunctionFromSharedFunctionInfo(shared, context, NOT_TENURED); |
@@ -7562,13 +7563,15 @@ static MaybeObject* Runtime_CompileString(Arguments args) { |
static ObjectPair CompileGlobalEval(Handle<String> source, |
- Handle<Object> receiver) { |
+ Handle<Object> receiver, |
+ StrictModeFlag mode) { |
// Deal with a normal eval call with a string argument. Compile it |
// and return the compiled function bound in the local context. |
Handle<SharedFunctionInfo> shared = Compiler::CompileEval( |
source, |
Handle<Context>(Top::context()), |
- Top::context()->IsGlobalContext()); |
+ Top::context()->IsGlobalContext(), |
+ mode); |
if (shared.is_null()) return MakePair(Failure::Exception(), NULL); |
Handle<JSFunction> compiled = Factory::NewFunctionFromSharedFunctionInfo( |
shared, |
@@ -7579,7 +7582,7 @@ static ObjectPair CompileGlobalEval(Handle<String> source, |
static ObjectPair Runtime_ResolvePossiblyDirectEval(Arguments args) { |
- ASSERT(args.length() == 3); |
+ ASSERT(args.length() == 4); |
if (!args[0]->IsJSFunction()) { |
return MakePair(Top::ThrowIllegalOperation(), NULL); |
} |
@@ -7643,12 +7646,16 @@ static ObjectPair Runtime_ResolvePossiblyDirectEval(Arguments args) { |
return MakePair(*callee, Top::context()->global()->global_receiver()); |
} |
- return CompileGlobalEval(args.at<String>(1), args.at<Object>(2)); |
+ ASSERT(args[3]->IsSmi()); |
+ return CompileGlobalEval(args.at<String>(1), |
+ args.at<Object>(2), |
+ static_cast<StrictModeFlag>( |
+ Smi::cast(args[3])->value())); |
} |
static ObjectPair Runtime_ResolvePossiblyDirectEvalNoLookup(Arguments args) { |
- ASSERT(args.length() == 3); |
+ ASSERT(args.length() == 4); |
if (!args[0]->IsJSFunction()) { |
return MakePair(Top::ThrowIllegalOperation(), NULL); |
} |
@@ -7663,7 +7670,11 @@ static ObjectPair Runtime_ResolvePossiblyDirectEvalNoLookup(Arguments args) { |
return MakePair(*callee, Top::context()->global()->global_receiver()); |
} |
- return CompileGlobalEval(args.at<String>(1), args.at<Object>(2)); |
+ ASSERT(args[3]->IsSmi()); |
+ return CompileGlobalEval(args.at<String>(1), |
+ args.at<Object>(2), |
+ static_cast<StrictModeFlag>( |
+ Smi::cast(args[3])->value())); |
} |
@@ -9800,10 +9811,14 @@ static MaybeObject* Runtime_DebugEvaluate(Arguments args) { |
Handle<String> function_source = |
Factory::NewStringFromAscii(Vector<const char>(source_str, |
source_str_length)); |
+ |
+ // Currently, the eval code will be executed in non-strict mode, |
+ // even in the strict code context. |
Handle<SharedFunctionInfo> shared = |
Compiler::CompileEval(function_source, |
context, |
- context->IsGlobalContext()); |
+ context->IsGlobalContext(), |
+ kNonStrictMode); |
if (shared.is_null()) return Failure::Exception(); |
Handle<JSFunction> compiled_function = |
Factory::NewFunctionFromSharedFunctionInfo(shared, context); |
@@ -9885,10 +9900,10 @@ static MaybeObject* Runtime_DebugEvaluateGlobal(Arguments args) { |
} |
// Compile the source to be evaluated. |
+ // Currently, the eval code will be executed in non-strict mode, |
+ // even in the strict code context. |
Handle<SharedFunctionInfo> shared = |
- Compiler::CompileEval(source, |
- context, |
- is_global); |
+ Compiler::CompileEval(source, context, is_global, kNonStrictMode); |
if (shared.is_null()) return Failure::Exception(); |
Handle<JSFunction> compiled_function = |
Handle<JSFunction>(Factory::NewFunctionFromSharedFunctionInfo(shared, |