| Index: src/runtime/runtime-internal.cc
|
| diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc
|
| index a2933e5bedd2ae0f5b6312433d757e4a8bccd2dc..3c78ce276f7ffb5158aca08dc2abe753423d36c7 100644
|
| --- a/src/runtime/runtime-internal.cc
|
| +++ b/src/runtime/runtime-internal.cc
|
| @@ -412,18 +412,44 @@ RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) {
|
|
|
| namespace {
|
|
|
| +bool ComputeLocation(Isolate* isolate, MessageLocation* target) {
|
| + JavaScriptFrameIterator it(isolate);
|
| + if (!it.done()) {
|
| + JavaScriptFrame* frame = it.frame();
|
| + JSFunction* fun = frame->function();
|
| + Object* script = fun->shared()->script();
|
| + if (script->IsScript() &&
|
| + !(Script::cast(script)->source()->IsUndefined())) {
|
| + Handle<Script> casted_script(Script::cast(script));
|
| + // Compute the location from the function and the relocation info of the
|
| + // baseline code. For optimized code this will use the deoptimization
|
| + // information to get canonical location information.
|
| + List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
|
| + it.frame()->Summarize(&frames);
|
| + FrameSummary& summary = frames.last();
|
| + int pos = summary.code()->SourcePosition(summary.pc());
|
| + *target = MessageLocation(casted_script, pos, pos + 1, handle(fun));
|
| + return true;
|
| + }
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +
|
| Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) {
|
| MessageLocation location;
|
| - if (isolate->ComputeLocation(&location)) {
|
| + if (ComputeLocation(isolate, &location)) {
|
| Zone zone;
|
| base::SmartPointer<ParseInfo> info(
|
| location.function()->shared()->is_function()
|
| ? new ParseInfo(&zone, location.function())
|
| : new ParseInfo(&zone, location.script()));
|
| if (Parser::ParseStatic(info.get())) {
|
| - CallPrinter printer(isolate);
|
| + CallPrinter printer(isolate, location.function()->shared()->IsBuiltin());
|
| const char* string = printer.Print(info->literal(), location.start_pos());
|
| - return isolate->factory()->NewStringFromAsciiChecked(string);
|
| + if (strlen(string) > 0) {
|
| + return isolate->factory()->NewStringFromAsciiChecked(string);
|
| + }
|
| } else {
|
| isolate->clear_pending_exception();
|
| }
|
|
|