OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 return NULL; | 359 return NULL; |
360 } | 360 } |
361 | 361 |
362 | 362 |
363 namespace { | 363 namespace { |
364 | 364 |
365 bool ComputeLocation(Isolate* isolate, MessageLocation* target) { | 365 bool ComputeLocation(Isolate* isolate, MessageLocation* target) { |
366 JavaScriptFrameIterator it(isolate); | 366 JavaScriptFrameIterator it(isolate); |
367 if (!it.done()) { | 367 if (!it.done()) { |
368 JavaScriptFrame* frame = it.frame(); | 368 JavaScriptFrame* frame = it.frame(); |
369 JSFunction* fun = frame->function(); | 369 Object* script = frame->function()->shared()->script(); |
370 Object* script = fun->shared()->script(); | |
371 if (script->IsScript() && | 370 if (script->IsScript() && |
372 !(Script::cast(script)->source()->IsUndefined(isolate))) { | 371 !(Script::cast(script)->source()->IsUndefined(isolate))) { |
373 Handle<Script> casted_script(Script::cast(script), isolate); | 372 Handle<Script> casted_script(Script::cast(script), isolate); |
374 // Compute the location from the function and the relocation info of the | 373 // Compute the location from the function and the relocation info of the |
375 // baseline code. For optimized code this will use the deoptimization | 374 // baseline code. For optimized code this will use the deoptimization |
376 // information to get canonical location information. | 375 // information to get canonical location information. |
377 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); | 376 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
378 it.frame()->Summarize(&frames); | 377 it.frame()->Summarize(&frames); |
379 FrameSummary& summary = frames.last(); | 378 FrameSummary& summary = frames.last(); |
379 Handle<JSFunction> function = summary.function(); | |
380 int pos = summary.abstract_code()->SourcePosition(summary.code_offset()); | 380 int pos = summary.abstract_code()->SourcePosition(summary.code_offset()); |
381 *target = MessageLocation(casted_script, pos, pos + 1, handle(fun)); | 381 *target = MessageLocation(casted_script, pos, pos + 1, function); |
Toon Verwaest
2016/11/24 12:37:45
Mmh, shouldn't it be function->shared()->script()
Michael Starzinger
2016/11/24 12:53:52
Done.
| |
382 return true; | 382 return true; |
383 } | 383 } |
384 } | 384 } |
385 return false; | 385 return false; |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { | 389 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { |
390 MessageLocation location; | 390 MessageLocation location; |
391 if (ComputeLocation(isolate, &location)) { | 391 if (ComputeLocation(isolate, &location)) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 | 534 |
535 RUNTIME_FUNCTION(Runtime_Typeof) { | 535 RUNTIME_FUNCTION(Runtime_Typeof) { |
536 HandleScope scope(isolate); | 536 HandleScope scope(isolate); |
537 DCHECK_EQ(1, args.length()); | 537 DCHECK_EQ(1, args.length()); |
538 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 538 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
539 return *Object::TypeOf(isolate, object); | 539 return *Object::TypeOf(isolate, object); |
540 } | 540 } |
541 | 541 |
542 } // namespace internal | 542 } // namespace internal |
543 } // namespace v8 | 543 } // namespace v8 |
OLD | NEW |