| Index: src/runtime/runtime-compiler.cc
|
| diff --git a/src/runtime/runtime-compiler.cc b/src/runtime/runtime-compiler.cc
|
| index 2e806facb2bd6536bb51f0000dec34ecd5c36385..88c771890e8bd55f1ef5cf73c1ca95aeef97c662 100644
|
| --- a/src/runtime/runtime-compiler.cc
|
| +++ b/src/runtime/runtime-compiler.cc
|
| @@ -347,9 +347,10 @@ bool CodeGenerationFromStringsAllowed(Isolate* isolate,
|
|
|
| RUNTIME_FUNCTION(Runtime_CompileString) {
|
| HandleScope scope(isolate);
|
| - DCHECK(args.length() == 2);
|
| + DCHECK(args.length() == 3);
|
| CONVERT_ARG_HANDLE_CHECKED(String, source, 0);
|
| CONVERT_BOOLEAN_ARG_CHECKED(function_literal_only, 1);
|
| + CONVERT_SMI_ARG_CHECKED(source_offset, 2);
|
|
|
| // Extract native context.
|
| Handle<Context> context(isolate->native_context());
|
| @@ -375,6 +376,14 @@ RUNTIME_FUNCTION(Runtime_CompileString) {
|
| isolate, fun,
|
| Compiler::GetFunctionFromEval(source, outer_info, context, SLOPPY,
|
| restriction, RelocInfo::kNoPosition));
|
| + if (function_literal_only) {
|
| + // The actual body is wrapped, which shifts line numbers.
|
| + Handle<Script> script(Script::cast(fun->shared()->script()), isolate);
|
| + if (script->line_offset() == 0) {
|
| + int line_num = Script::GetLineNumber(script, source_offset);
|
| + script->set_line_offset(Smi::FromInt(-line_num));
|
| + }
|
| + }
|
| return *fun;
|
| }
|
|
|
|
|