Revision: 10564
Author:   [email protected]
Date:     Tue Jan 31 04:08:33 2012
Log:      Add GC handling for new field in DeoptimizedFrameInfo.

Review URL: https://chromiumcodereview.appspot.com/9301030
http://code.google.com/p/v8/source/detail?r=10564

Modified:
 /branches/bleeding_edge/src/deoptimizer.cc
 /branches/bleeding_edge/src/deoptimizer.h
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /branches/bleeding_edge/src/deoptimizer.cc  Tue Jan 31 03:22:35 2012
+++ /branches/bleeding_edge/src/deoptimizer.cc  Tue Jan 31 04:08:33 2012
@@ -1604,7 +1604,11 @@
   SetFunction(output_frame->GetFunction());
   expression_count_ = output_frame->GetExpressionCount();
   expression_stack_ = new Object*[expression_count_];
-  pc_ = output_frame->GetPc();
+  // Get the source position using the unoptimized code.
+  Address pc = reinterpret_cast<Address>(output_frame->GetPc());
+  Code* code = Code::cast(Isolate::Current()->heap()->FindCodeObject(pc));
+  source_position_ = code->SourcePosition(pc);
+
   for (int i = 0; i < expression_count_; i++) {
     SetExpression(i, output_frame->GetExpression(i));
   }
@@ -1626,6 +1630,7 @@
   delete[] expression_stack_;
   delete[] parameters_;
 }
+

 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
   v->VisitPointer(BitCast<Object**>(&function_));
=======================================
--- /branches/bleeding_edge/src/deoptimizer.h   Mon Jan 30 05:07:01 2012
+++ /branches/bleeding_edge/src/deoptimizer.h   Tue Jan 31 04:08:33 2012
@@ -749,8 +749,8 @@
     return expression_stack_[index];
   }

-  Address GetPc() {
-    return reinterpret_cast<Address>(pc_);
+  int GetSourcePosition() {
+    return source_position_;
   }

  private:
@@ -776,7 +776,7 @@
   int expression_count_;
   Object** parameters_;
   Object** expression_stack_;
-  intptr_t pc_;
+  int source_position_;

   friend class Deoptimizer;
 };
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Mon Jan 30 05:07:01 2012
+++ /branches/bleeding_edge/src/runtime.cc      Tue Jan 31 04:08:33 2012
@@ -10747,10 +10747,10 @@
         ? deoptimized_frame_->GetExpression(index)
         : frame_->GetExpression(index);
   }
-  Address GetPc() {
+  int GetSourcePosition() {
     return is_optimized_
-        ? deoptimized_frame_->GetPc()
-        : frame_->pc();
+        ? deoptimized_frame_->GetSourcePosition()
+        : frame_->LookupCode()->SourcePosition(frame_->pc());
   }

   // To inspect all the provided arguments the frame might need to be
@@ -10858,15 +10858,15 @@
   Handle<Object> frame_id(WrapFrameId(it.frame()->id()), isolate);

   // Find source position in unoptimized code.
- Handle<JSFunction> function(JSFunction::cast(frame_inspector.GetFunction()));
-  Handle<SharedFunctionInfo> shared(function->shared());
-  int position = shared->code()->SourcePosition(frame_inspector.GetPc());
+  int position = frame_inspector.GetSourcePosition();

   // Check for constructor frame. Inlined frames cannot be construct calls.
   bool inlined_frame = is_optimized && inlined_jsframe_index != 0;
   bool constructor = !inlined_frame && it.frame()->IsConstructor();

   // Get scope info and read from it for local variable information.
+ Handle<JSFunction> function(JSFunction::cast(frame_inspector.GetFunction()));
+  Handle<SharedFunctionInfo> shared(function->shared());
   Handle<ScopeInfo> scope_info(shared->scope_info());
   ASSERT(*scope_info != ScopeInfo::Empty());

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to