Reviewers: alph, loislo, Jakob, Sven Panne,

Description:
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

Please review this at https://codereview.chromium.org/16154004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/arm/lithium-codegen-arm.cc
  M src/mips/lithium-codegen-mips.cc
  M src/sampler.cc
  M test/cctest/cctest.status


Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index d15fe7ae2828a7c51271b6fc6a59f4d77f2b4a47..313a4fa5b2ec1f789ce0aaa9d9b0f763706d8c69 100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -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.
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 05fa79247e5fa6722fbe49f294c7a4ec10ca40ca..ee29a0ae6dba24345ec093d25fe239a6505e0737 100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -2566,8 +2566,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());
Index: src/sampler.cc
diff --git a/src/sampler.cc b/src/sampler.cc
index da186b6ce47308850eb6570821e718509169d72e..25478a61ddad530d8a5ceb80b6087adb15746c61 100644
--- a/src/sampler.cc
+++ b/src/sampler.cc
@@ -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
Index: test/cctest/cctest.status
diff --git a/test/cctest/cctest.status b/test/cctest/cctest.status
index b0451e977449ccab45f0293f3fd9361f7f243255..84a1a7095502a1c54cd1efca0aee60bdfb5f92cf 100644
--- a/test/cctest/cctest.status
+++ b/test/cctest/cctest.status
@@ -70,15 +70,6 @@ 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 ]

 # Tests crash as there is no /tmp directory in Android.


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to