Ensure that relocinfo's host code object is correctly reset on GC in TypeFeedbackOrac...
authorrmcilroy@chromium.org <rmcilroy@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 12 Mar 2014 17:18:49 +0000 (17:18 +0000)
committerrmcilroy@chromium.org <rmcilroy@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 12 Mar 2014 17:18:49 +0000 (17:18 +0000)
TBR=ulan@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19860 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/assembler.h
src/type-info.cc
src/type-info.h

index b6a502f72a8a4477b2d42b2fd4e0e0d817c7a16c..cbbe03c7d122b29625c2dfcc1874373c011bab0d 100644 (file)
@@ -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 c010533738fb155675c6ea6c5e82e371c3cd1877..6282ef68f90acc6f6e3b74aab049704dc6f42699 100644 (file)
@@ -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 f0994e4c7732af5d1b0c9bcb9a99baccc905ac8e..84944248ed68fdd0d778845059115a591da37e63 100644 (file)
@@ -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