From 2a9df4c822edcf59ab63aa4faa04b8f10e88ad67 Mon Sep 17 00:00:00 2001 From: "rmcilroy@chromium.org" Date: Wed, 12 Mar 2014 17:18:49 +0000 Subject: [PATCH] Ensure that relocinfo's host code object is correctly reset on GC in TypeFeedbackOracle::RelocateRelocInfos 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 | 1 + src/type-info.cc | 13 +++++++------ src/type-info.h | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/assembler.h b/src/assembler.h index b6a502f..cbbe03c 100644 --- a/src/assembler.h +++ b/src/assembler.h @@ -379,6 +379,7 @@ class RelocInfo BASE_EMBEDDED { return BitCast(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)); diff --git a/src/type-info.cc b/src/type-info.cc index c010533..6282ef6 100644 --- a/src/type-info.cc +++ b/src/type-info.cc @@ -434,20 +434,21 @@ void TypeFeedbackOracle::GetRelocInfos(Handle code, void TypeFeedbackOracle::CreateDictionary(Handle code, ZoneList* 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* 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())); } } diff --git a/src/type-info.h b/src/type-info.h index f0994e4..8494424 100644 --- a/src/type-info.h +++ b/src/type-info.h @@ -130,8 +130,8 @@ class TypeFeedbackOracle: public ZoneObject { void GetRelocInfos(Handle code, ZoneList* infos); void CreateDictionary(Handle code, ZoneList* infos); void RelocateRelocInfos(ZoneList* infos, - byte* old_start, - byte* new_start); + Code* old_code, + Code* new_code); void ProcessRelocInfos(ZoneList* infos); // Returns an element from the backing store. Returns undefined if -- 2.7.4