OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/frames.h" | 5 #include "src/frames.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 } | 394 } |
395 } | 395 } |
396 | 396 |
397 | 397 |
398 void StackFrame::SetReturnAddressLocationResolver( | 398 void StackFrame::SetReturnAddressLocationResolver( |
399 ReturnAddressLocationResolver resolver) { | 399 ReturnAddressLocationResolver resolver) { |
400 DCHECK(return_address_location_resolver_ == NULL); | 400 DCHECK(return_address_location_resolver_ == NULL); |
401 return_address_location_resolver_ = resolver; | 401 return_address_location_resolver_ = resolver; |
402 } | 402 } |
403 | 403 |
| 404 static bool IsInterpreterFramePc(Isolate* isolate, Address pc) { |
| 405 Code* interpreter_entry_trampoline = |
| 406 isolate->builtins()->builtin(Builtins::kInterpreterEntryTrampoline); |
| 407 Code* interpreter_bytecode_dispatch = |
| 408 isolate->builtins()->builtin(Builtins::kInterpreterEnterBytecodeDispatch); |
| 409 |
| 410 return (pc >= interpreter_entry_trampoline->instruction_start() && |
| 411 pc < interpreter_entry_trampoline->instruction_end()) || |
| 412 (pc >= interpreter_bytecode_dispatch->instruction_start() && |
| 413 pc < interpreter_bytecode_dispatch->instruction_end()); |
| 414 } |
404 | 415 |
405 StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator, | 416 StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator, |
406 State* state) { | 417 State* state) { |
407 DCHECK(state->fp != NULL); | 418 DCHECK(state->fp != NULL); |
408 | 419 |
409 if (!iterator->can_access_heap_objects_) { | 420 if (!iterator->can_access_heap_objects_) { |
410 // TODO(titzer): "can_access_heap_objects" is kind of bogus. It really | 421 // TODO(titzer): "can_access_heap_objects" is kind of bogus. It really |
411 // means that we are being called from the profiler, which can interrupt | 422 // means that we are being called from the profiler, which can interrupt |
412 // the VM with a signal at any arbitrary instruction, with essentially | 423 // the VM with a signal at any arbitrary instruction, with essentially |
413 // anything on the stack. So basically none of these checks are 100% | 424 // anything on the stack. So basically none of these checks are 100% |
414 // reliable. | 425 // reliable. |
415 #if defined(USE_SIMULATOR) | 426 #if defined(USE_SIMULATOR) |
416 MSAN_MEMORY_IS_INITIALIZED( | 427 MSAN_MEMORY_IS_INITIALIZED( |
417 state->fp + StandardFrameConstants::kContextOffset, kPointerSize); | 428 state->fp + StandardFrameConstants::kContextOffset, kPointerSize); |
418 MSAN_MEMORY_IS_INITIALIZED( | 429 MSAN_MEMORY_IS_INITIALIZED( |
419 state->fp + StandardFrameConstants::kMarkerOffset, kPointerSize); | 430 state->fp + StandardFrameConstants::kMarkerOffset, kPointerSize); |
420 #endif | 431 #endif |
421 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { | 432 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { |
422 // An adapter frame has a special SMI constant for the context and | 433 // An adapter frame has a special SMI constant for the context and |
423 // is not distinguished through the marker. | 434 // is not distinguished through the marker. |
424 return ARGUMENTS_ADAPTOR; | 435 return ARGUMENTS_ADAPTOR; |
425 } | 436 } |
426 Object* marker = | 437 Object* marker = |
427 Memory::Object_at(state->fp + StandardFrameConstants::kMarkerOffset); | 438 Memory::Object_at(state->fp + StandardFrameConstants::kMarkerOffset); |
428 if (marker->IsSmi()) { | 439 if (marker->IsSmi()) { |
429 return static_cast<StackFrame::Type>(Smi::cast(marker)->value()); | 440 return static_cast<StackFrame::Type>(Smi::cast(marker)->value()); |
| 441 } else if (FLAG_ignition && IsInterpreterFramePc(iterator->isolate(), |
| 442 *(state->pc_address))) { |
| 443 return INTERPRETED; |
430 } else { | 444 } else { |
431 return JAVA_SCRIPT; | 445 return JAVA_SCRIPT; |
432 } | 446 } |
433 } | 447 } |
434 | 448 |
435 // Look up the code object to figure out the type of the stack frame. | 449 // Look up the code object to figure out the type of the stack frame. |
436 Code* code_obj = GetContainingCode(iterator->isolate(), *(state->pc_address)); | 450 Code* code_obj = GetContainingCode(iterator->isolate(), *(state->pc_address)); |
437 | 451 |
438 Object* marker = | 452 Object* marker = |
439 Memory::Object_at(state->fp + StandardFrameConstants::kMarkerOffset); | 453 Memory::Object_at(state->fp + StandardFrameConstants::kMarkerOffset); |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1663 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1650 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1664 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1651 list.Add(frame, zone); | 1665 list.Add(frame, zone); |
1652 } | 1666 } |
1653 return list.ToVector(); | 1667 return list.ToVector(); |
1654 } | 1668 } |
1655 | 1669 |
1656 | 1670 |
1657 } // namespace internal | 1671 } // namespace internal |
1658 } // namespace v8 | 1672 } // namespace v8 |
OLD | NEW |