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