Chromium Code Reviews| Index: src/runtime.cc |
| diff --git a/src/runtime.cc b/src/runtime.cc |
| index 96d07a859b296b5223d7355f56d1fbb591535b17..d2bdf57c70e59738a571c20dd48a4ef2f91e314c 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, |
| + false); |
|
Lasse Reichstein
2011/02/03 12:10:41
Passing too many boolean literals (some say one is
Martin Maly
2011/02/04 01:02:34
Done.
|
| 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, |
| + bool is_strict) { |
| // 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(), |
| + is_strict); |
| if (shared.is_null()) return MakePair(Failure::Exception(), NULL); |
| Handle<JSFunction> compiled = Factory::NewFunctionFromSharedFunctionInfo( |
| shared, |
| @@ -7590,13 +7593,11 @@ static ObjectPair Runtime_ResolvePossiblyDirectEval(Arguments args) { |
| // Compute the calling context. |
| Handle<Context> context = Handle<Context>(Top::context()); |
| -#ifdef DEBUG |
| // Make sure Top::context() agrees with the old code that traversed |
| // the stack frames to compute the context. |
| StackFrameLocator locator; |
| JavaScriptFrame* frame = locator.FindJavaScriptFrame(0); |
| ASSERT(Context::cast(frame->context()) == *context); |
| -#endif |
| // Find where the 'eval' symbol is bound. It is unaliased only if |
| // it is bound in the global context. |
| @@ -7643,7 +7644,10 @@ static ObjectPair Runtime_ResolvePossiblyDirectEval(Arguments args) { |
| return MakePair(*callee, Top::context()->global()->global_receiver()); |
| } |
| - return CompileGlobalEval(args.at<String>(1), args.at<Object>(2)); |
| + Handle<JSFunction> caller(JSFunction::cast(frame->function())); |
|
Martin Maly
2011/02/02 05:07:26
Alternative to walking the stack frames is passing
Mads Ager (chromium)
2011/02/02 10:30:03
When you are compiling the caller you know whether
Martin Maly
2011/02/02 23:56:22
Done.
|
| + return CompileGlobalEval(args.at<String>(1), |
| + args.at<Object>(2), |
| + caller->shared()->strict_mode()); |
| } |
| @@ -7663,7 +7667,13 @@ static ObjectPair Runtime_ResolvePossiblyDirectEvalNoLookup(Arguments args) { |
| return MakePair(*callee, Top::context()->global()->global_receiver()); |
| } |
| - return CompileGlobalEval(args.at<String>(1), args.at<Object>(2)); |
| + StackFrameLocator locator; |
| + JavaScriptFrame* frame = locator.FindJavaScriptFrame(0); |
|
Martin Maly
2011/02/02 05:07:26
Alternative to walking the stack frames is passing
Mads Ager (chromium)
2011/02/02 10:30:03
I would go for the additional argument here too.
Martin Maly
2011/02/02 23:56:22
Done.
|
| + Handle<JSFunction> caller(JSFunction::cast(frame->function())); |
| + |
| + return CompileGlobalEval(args.at<String>(1), |
| + args.at<Object>(2), |
| + caller->shared()->strict_mode()); |
| } |
| @@ -9803,7 +9813,8 @@ static MaybeObject* Runtime_DebugEvaluate(Arguments args) { |
| Handle<SharedFunctionInfo> shared = |
| Compiler::CompileEval(function_source, |
| context, |
| - context->IsGlobalContext()); |
| + context->IsGlobalContext(), |
| + false); |
|
Martin Maly
2011/02/02 05:07:26
Need to follow up with debugger folks what the rig
|
| if (shared.is_null()) return Failure::Exception(); |
| Handle<JSFunction> compiled_function = |
| Factory::NewFunctionFromSharedFunctionInfo(shared, context); |
| @@ -9886,9 +9897,7 @@ static MaybeObject* Runtime_DebugEvaluateGlobal(Arguments args) { |
| // Compile the source to be evaluated. |
| Handle<SharedFunctionInfo> shared = |
| - Compiler::CompileEval(source, |
| - context, |
| - is_global); |
| + Compiler::CompileEval(source, context, is_global, false); |
|
Martin Maly
2011/02/02 05:07:26
ditto, follow up with debugger folks what the righ
|
| if (shared.is_null()) return Failure::Exception(); |
| Handle<JSFunction> compiled_function = |
| Handle<JSFunction>(Factory::NewFunctionFromSharedFunctionInfo(shared, |