Commit 665c6449 authored by yurys@chromium.org's avatar yurys@chromium.org

Fix two CPU profiler tests on ARM and MIPS simulators

Use Simulator::get_pc instead of Simulator::get_register(pc) as the latter
will return value adjusted by Instruction::kPCReadOffset.

BUG=v8:2628
R=loislo@chromium.org, svenpanne@chromium.org

Review URL: https://codereview.chromium.org/16154004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14880 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fed3dad2
......@@ -181,6 +181,7 @@ bool LCodeGen::GeneratePrologue() {
__ add(fp, sp, Operand(2 * kPointerSize));
}
frame_is_built_ = true;
info_->AddNoFrameRange(0, masm_->pc_offset());
}
// Reserve space for the stack slots needed by the code.
......@@ -2951,8 +2952,8 @@ void LCodeGen::DoReturn(LReturn* instr) {
int no_frame_start = -1;
if (NeedsEagerFrame()) {
__ mov(sp, fp);
__ ldm(ia_w, sp, fp.bit() | lr.bit());
no_frame_start = masm_->pc_offset();
__ ldm(ia_w, sp, fp.bit() | lr.bit());
}
if (instr->has_constant_parameter_count()) {
int parameter_count = ToInteger32(instr->constant_parameter_count());
......
......@@ -2584,8 +2584,8 @@ void LCodeGen::DoReturn(LReturn* instr) {
int no_frame_start = -1;
if (NeedsEagerFrame()) {
__ mov(sp, fp);
__ Pop(ra, fp);
no_frame_start = masm_->pc_offset();
__ Pop(ra, fp);
}
if (instr->has_constant_parameter_count()) {
int parameter_count = ToInteger32(instr->constant_parameter_count());
......
......@@ -234,13 +234,11 @@ void SignalHandler::HandleProfilerSignal(int signal, siginfo_t* info,
if (sample == NULL) sample = &sample_obj;
#if defined(USE_SIMULATOR)
#if V8_TARGET_ARCH_ARM
sample->pc = reinterpret_cast<Address>(sim->get_register(Simulator::pc));
sample->pc = reinterpret_cast<Address>(sim->get_pc());
sample->sp = reinterpret_cast<Address>(sim->get_register(Simulator::sp));
#if V8_TARGET_ARCH_ARM
sample->fp = reinterpret_cast<Address>(sim->get_register(Simulator::r11));
#elif V8_TARGET_ARCH_MIPS
sample->pc = reinterpret_cast<Address>(sim->get_register(Simulator::pc));
sample->sp = reinterpret_cast<Address>(sim->get_register(Simulator::sp));
sample->fp = reinterpret_cast<Address>(sim->get_register(Simulator::fp));
#endif // V8_TARGET_ARCH_*
#else
......@@ -523,13 +521,11 @@ class SamplerThread : public Thread {
&count) == KERN_SUCCESS) {
sample->state = isolate->current_vm_state();
#if defined(USE_SIMULATOR)
#if V8_TARGET_ARCH_ARM
sample->pc = reinterpret_cast<Address>(sim->get_register(Simulator::pc));
sample->pc = reinterpret_cast<Address>(sim->get_pc());
sample->sp = reinterpret_cast<Address>(sim->get_register(Simulator::sp));
#if V8_TARGET_ARCH_ARM
sample->fp = reinterpret_cast<Address>(sim->get_register(Simulator::r11));
#elif V8_TARGET_ARCH_MIPS
sample->pc = reinterpret_cast<Address>(sim->get_register(Simulator::pc));
sample->sp = reinterpret_cast<Address>(sim->get_register(Simulator::sp));
sample->fp = reinterpret_cast<Address>(sim->get_register(Simulator::fp));
#endif
#else
......@@ -577,13 +573,11 @@ class SamplerThread : public Thread {
context.ContextFlags = CONTEXT_FULL;
if (GetThreadContext(profiled_thread, &context) != 0) {
#if defined(USE_SIMULATOR)
#if V8_TARGET_ARCH_ARM
sample->pc = reinterpret_cast<Address>(sim->get_register(Simulator::pc));
sample->pc = reinterpret_cast<Address>(sim->get_pc());
sample->sp = reinterpret_cast<Address>(sim->get_register(Simulator::sp));
#if V8_TARGET_ARCH_ARM
sample->fp = reinterpret_cast<Address>(sim->get_register(Simulator::r11));
#elif V8_TARGET_ARCH_MIPS
sample->pc = reinterpret_cast<Address>(sim->get_register(Simulator::pc));
sample->sp = reinterpret_cast<Address>(sim->get_register(Simulator::sp));
sample->fp = reinterpret_cast<Address>(sim->get_register(Simulator::fp));
#endif
#else
......
......@@ -69,15 +69,6 @@ test-serialize/DeserializeFromSecondSerializationAndRunScript2: SKIP
test-serialize/DeserializeAndRunScript2: SKIP
test-serialize/DeserializeFromSecondSerialization: SKIP
##############################################################################
[ $arch == arm || $arch == mipsel ]
# BUG(2628): Signal may come when pc is close to frame enter/exit code and on
# simulator the stack frame is not set up when it is expected to be for the pc
# value.
test-cpu-profiler/CollectCpuProfile: PASS || FAIL
test-cpu-profiler/SampleWhenFrameIsNotSetup: PASS || FAIL
##############################################################################
[ $arch == android_arm || $arch == android_ia32 ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment