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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 SingletonFor(frame->GetCallerState(&state)) != NULL; | 297 SingletonFor(frame->GetCallerState(&state)) != NULL; |
298 } | 298 } |
299 | 299 |
300 | 300 |
301 bool SafeStackFrameIterator::IsValidExitFrame(Address fp) const { | 301 bool SafeStackFrameIterator::IsValidExitFrame(Address fp) const { |
302 if (!IsValidStackAddress(fp)) return false; | 302 if (!IsValidStackAddress(fp)) return false; |
303 Address sp = ExitFrame::ComputeStackPointer(fp); | 303 Address sp = ExitFrame::ComputeStackPointer(fp); |
304 if (!IsValidStackAddress(sp)) return false; | 304 if (!IsValidStackAddress(sp)) return false; |
305 StackFrame::State state; | 305 StackFrame::State state; |
306 ExitFrame::FillState(fp, sp, &state); | 306 ExitFrame::FillState(fp, sp, &state); |
307 return *state.pc_address != NULL; | 307 MSAN_MEMORY_IS_INITIALIZED(state.pc_address, sizeof(state.pc_address)); |
| 308 return *state.pc_address != nullptr; |
308 } | 309 } |
309 | 310 |
310 | 311 |
311 void SafeStackFrameIterator::Advance() { | 312 void SafeStackFrameIterator::Advance() { |
312 while (true) { | 313 while (true) { |
313 AdvanceOneFrame(); | 314 AdvanceOneFrame(); |
314 if (done()) break; | 315 if (done()) break; |
315 ExternalCallbackScope* last_callback_scope = NULL; | 316 ExternalCallbackScope* last_callback_scope = NULL; |
316 while (external_callback_scope_ != NULL && | 317 while (external_callback_scope_ != NULL && |
317 external_callback_scope_->scope_address() < frame_->fp()) { | 318 external_callback_scope_->scope_address() < frame_->fp()) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 (pc >= interpreter_bytecode_dispatch->instruction_start() && | 408 (pc >= interpreter_bytecode_dispatch->instruction_start() && |
408 pc < interpreter_bytecode_dispatch->instruction_end()) || | 409 pc < interpreter_bytecode_dispatch->instruction_end()) || |
409 (pc >= interpreter_baseline_on_return->instruction_start() && | 410 (pc >= interpreter_baseline_on_return->instruction_start() && |
410 pc < interpreter_baseline_on_return->instruction_end()); | 411 pc < interpreter_baseline_on_return->instruction_end()); |
411 } | 412 } |
412 | 413 |
413 StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator, | 414 StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator, |
414 State* state) { | 415 State* state) { |
415 DCHECK(state->fp != NULL); | 416 DCHECK(state->fp != NULL); |
416 | 417 |
417 #if defined(USE_SIMULATOR) | |
418 MSAN_MEMORY_IS_INITIALIZED( | 418 MSAN_MEMORY_IS_INITIALIZED( |
419 state->fp + CommonFrameConstants::kContextOrFrameTypeOffset, | 419 state->fp + CommonFrameConstants::kContextOrFrameTypeOffset, |
420 kPointerSize); | 420 kPointerSize); |
421 #endif | |
422 Object* marker = Memory::Object_at( | 421 Object* marker = Memory::Object_at( |
423 state->fp + CommonFrameConstants::kContextOrFrameTypeOffset); | 422 state->fp + CommonFrameConstants::kContextOrFrameTypeOffset); |
424 if (!iterator->can_access_heap_objects_) { | 423 if (!iterator->can_access_heap_objects_) { |
425 // TODO(titzer): "can_access_heap_objects" is kind of bogus. It really | 424 // TODO(titzer): "can_access_heap_objects" is kind of bogus. It really |
426 // means that we are being called from the profiler, which can interrupt | 425 // means that we are being called from the profiler, which can interrupt |
427 // the VM with a signal at any arbitrary instruction, with essentially | 426 // the VM with a signal at any arbitrary instruction, with essentially |
428 // anything on the stack. So basically none of these checks are 100% | 427 // anything on the stack. So basically none of these checks are 100% |
429 // reliable. | 428 // reliable. |
430 #if defined(USE_SIMULATOR) | |
431 MSAN_MEMORY_IS_INITIALIZED( | 429 MSAN_MEMORY_IS_INITIALIZED( |
432 state->fp + StandardFrameConstants::kFunctionOffset, kPointerSize); | 430 state->fp + StandardFrameConstants::kFunctionOffset, kPointerSize); |
433 #endif | |
434 Object* maybe_function = | 431 Object* maybe_function = |
435 Memory::Object_at(state->fp + StandardFrameConstants::kFunctionOffset); | 432 Memory::Object_at(state->fp + StandardFrameConstants::kFunctionOffset); |
436 if (!marker->IsSmi()) { | 433 if (!marker->IsSmi()) { |
437 if (maybe_function->IsSmi()) { | 434 if (maybe_function->IsSmi()) { |
438 return NONE; | 435 return NONE; |
439 } else if (FLAG_ignition && IsInterpreterFramePc(iterator->isolate(), | 436 } else if (FLAG_ignition && IsInterpreterFramePc(iterator->isolate(), |
440 *(state->pc_address))) { | 437 *(state->pc_address))) { |
441 return INTERPRETED; | 438 return INTERPRETED; |
442 } else { | 439 } else { |
443 return JAVA_SCRIPT; | 440 return JAVA_SCRIPT; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 | 597 |
601 StackFrame::Type ExitFrame::GetStateForFramePointer(Address fp, State* state) { | 598 StackFrame::Type ExitFrame::GetStateForFramePointer(Address fp, State* state) { |
602 if (fp == 0) return NONE; | 599 if (fp == 0) return NONE; |
603 Address sp = ComputeStackPointer(fp); | 600 Address sp = ComputeStackPointer(fp); |
604 FillState(fp, sp, state); | 601 FillState(fp, sp, state); |
605 DCHECK(*state->pc_address != NULL); | 602 DCHECK(*state->pc_address != NULL); |
606 return EXIT; | 603 return EXIT; |
607 } | 604 } |
608 | 605 |
609 Address ExitFrame::ComputeStackPointer(Address fp) { | 606 Address ExitFrame::ComputeStackPointer(Address fp) { |
610 #if defined(USE_SIMULATOR) | |
611 MSAN_MEMORY_IS_INITIALIZED(fp + ExitFrameConstants::kSPOffset, kPointerSize); | 607 MSAN_MEMORY_IS_INITIALIZED(fp + ExitFrameConstants::kSPOffset, kPointerSize); |
612 #endif | |
613 return Memory::Address_at(fp + ExitFrameConstants::kSPOffset); | 608 return Memory::Address_at(fp + ExitFrameConstants::kSPOffset); |
614 } | 609 } |
615 | 610 |
616 void ExitFrame::FillState(Address fp, Address sp, State* state) { | 611 void ExitFrame::FillState(Address fp, Address sp, State* state) { |
617 state->sp = sp; | 612 state->sp = sp; |
618 state->fp = fp; | 613 state->fp = fp; |
619 state->pc_address = ResolveReturnAddressLocation( | 614 state->pc_address = ResolveReturnAddressLocation( |
620 reinterpret_cast<Address*>(sp - 1 * kPCOnStackSize)); | 615 reinterpret_cast<Address*>(sp - 1 * kPCOnStackSize)); |
621 // The constant pool recorded in the exit frame is not associated | 616 // The constant pool recorded in the exit frame is not associated |
622 // with the pc in this state (the return address into a C entry | 617 // with the pc in this state (the return address into a C entry |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1791 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1797 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1792 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1798 list.Add(frame, zone); | 1793 list.Add(frame, zone); |
1799 } | 1794 } |
1800 return list.ToVector(); | 1795 return list.ToVector(); |
1801 } | 1796 } |
1802 | 1797 |
1803 | 1798 |
1804 } // namespace internal | 1799 } // namespace internal |
1805 } // namespace v8 | 1800 } // namespace v8 |
OLD | NEW |