Reviewers: ulan,

Message:
Ulan: this should fix the tree-closing red bots on the waterfall after my cl
r19856 landed. If you are happy with this fix then I will land it to get the bots green again, otherwise I will revert r19856 - let me know which you would
prefer?

Description:
Ensure that relocinfo's host code object is correctly reset on GC in
TypeFeedbackOracle::RelocateRelocInfos

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

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

Affected files (+10, -8 lines):
  M src/assembler.h
  M src/type-info.h
  M src/type-info.cc


Index: src/assembler.h
diff --git a/src/assembler.h b/src/assembler.h
index b6a502f72a8a4477b2d42b2fd4e0e0d817c7a16c..cbbe03c7d122b29625c2dfcc1874373c011bab0d 100644
--- a/src/assembler.h
+++ b/src/assembler.h
@@ -379,6 +379,7 @@ class RelocInfo BASE_EMBEDDED {
     return BitCast<uint64_t>(data64_);
   }
   Code* host() const { return host_; }
+  void set_host(Code* host) { host_ = host; }

   // Apply a relocation by delta bytes
   INLINE(void apply(intptr_t delta));
Index: src/type-info.cc
diff --git a/src/type-info.cc b/src/type-info.cc
index c010533738fb155675c6ea6c5e82e371c3cd1877..6282ef68f90acc6f6e3b74aab049704dc6f42699 100644
--- a/src/type-info.cc
+++ b/src/type-info.cc
@@ -434,20 +434,21 @@ void TypeFeedbackOracle::GetRelocInfos(Handle<Code> code,
 void TypeFeedbackOracle::CreateDictionary(Handle<Code> code,
                                           ZoneList<RelocInfo>* infos) {
   AllowHeapAllocation allocation_allowed;
-  byte* old_start = code->instruction_start();
+  Code* old_code = *code;
   dictionary_ =
       isolate()->factory()->NewUnseededNumberDictionary(infos->length());
-  byte* new_start = code->instruction_start();
-  RelocateRelocInfos(infos, old_start, new_start);
+  RelocateRelocInfos(infos, old_code, *code);
 }


 void TypeFeedbackOracle::RelocateRelocInfos(ZoneList<RelocInfo>* infos,
-                                            byte* old_start,
-                                            byte* new_start) {
+                                            Code* old_code,
+                                            Code* new_code) {
   for (int i = 0; i < infos->length(); i++) {
     RelocInfo* info = &(*infos)[i];
-    info->set_pc(new_start + (info->pc() - old_start));
+    info->set_host(new_code);
+    info->set_pc(new_code->instruction_start() +
+                 (info->pc() - old_code->instruction_start()));
   }
 }

Index: src/type-info.h
diff --git a/src/type-info.h b/src/type-info.h
index f0994e4c7732af5d1b0c9bcb9a99baccc905ac8e..84944248ed68fdd0d778845059115a591da37e63 100644
--- a/src/type-info.h
+++ b/src/type-info.h
@@ -130,8 +130,8 @@ class TypeFeedbackOracle: public ZoneObject {
   void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos);
   void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos);
   void RelocateRelocInfos(ZoneList<RelocInfo>* infos,
-                          byte* old_start,
-                          byte* new_start);
+                          Code* old_code,
+                          Code* new_code);
   void ProcessRelocInfos(ZoneList<RelocInfo>* infos);

   // Returns an element from the backing store. Returns undefined if


--
--
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/d/optout.

Reply via email to