Register dependent codes before populating deoptimization data, which can cause GC.

R=mstarzinger@chromium.org

BUG=crash on nosnap-debug with stress-compaction

Review URL: https://chromiumcodereview.appspot.com/12256038

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13669 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ulan@chromium.org 2013-02-14 13:48:20 +00:00
parent 250ebdc2be
commit 817ce7285f
10 changed files with 116 additions and 30 deletions

View File

@ -83,6 +83,9 @@ void LCodeGen::FinishCode(Handle<Code> code) {
ASSERT(is_done());
code->set_stack_slots(GetStackSlotCount());
code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
if (FLAG_weak_embedded_maps_in_optimized_code) {
RegisterDependentCodeForEmbeddedMaps(code);
}
PopulateDeoptimizationData(code);
}
@ -864,6 +867,31 @@ void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) {
}
void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) {
ZoneList<Handle<Map> > maps(1, zone());
int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
RelocInfo::Mode mode = it.rinfo()->rmode();
if (mode == RelocInfo::EMBEDDED_OBJECT &&
it.rinfo()->target_object()->IsMap()) {
Handle<Map> map(Map::cast(it.rinfo()->target_object()));
if (map->CanTransition()) {
maps.Add(map, zone());
}
}
}
#ifdef VERIFY_HEAP
// This disables verification of weak embedded maps after full GC.
// AddDependentCode can cause a GC, which would observe the state where
// this code is not yet in the depended code lists of the embedded maps.
NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps;
#endif
for (int i = 0; i < maps.length(); i++) {
maps.at(i)->AddDependentCode(code);
}
}
void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
int length = deoptimizations_.length();
if (length == 0) return;

View File

@ -281,6 +281,7 @@ class LCodeGen BASE_EMBEDDED {
bool is_uint32,
int arguments_index,
int arguments_count);
void RegisterDependentCodeForEmbeddedMaps(Handle<Code> code);
void PopulateDeoptimizationData(Handle<Code> code);
int DefineDeoptimizationLiteral(Handle<Object> literal);

View File

@ -96,6 +96,9 @@ void LCodeGen::FinishCode(Handle<Code> code) {
ASSERT(is_done());
code->set_stack_slots(GetStackSlotCount());
code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
if (FLAG_weak_embedded_maps_in_optimized_code) {
RegisterDependentCodeForEmbeddedMaps(code);
}
PopulateDeoptimizationData(code);
if (!info()->IsStub()) {
Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code);
@ -896,6 +899,31 @@ void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) {
}
void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) {
ZoneList<Handle<Map> > maps(1, zone());
int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
RelocInfo::Mode mode = it.rinfo()->rmode();
if (mode == RelocInfo::EMBEDDED_OBJECT &&
it.rinfo()->target_object()->IsMap()) {
Handle<Map> map(Map::cast(it.rinfo()->target_object()));
if (map->CanTransition()) {
maps.Add(map, zone());
}
}
}
#ifdef VERIFY_HEAP
// This disables verification of weak embedded maps after full GC.
// AddDependentCode can cause a GC, which would observe the state where
// this code is not yet in the depended code lists of the embedded maps.
NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps;
#endif
for (int i = 0; i < maps.length(); i++) {
maps.at(i)->AddDependentCode(code);
}
}
void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
int length = deoptimizations_.length();
if (length == 0) return;

View File

@ -262,6 +262,7 @@ class LCodeGen BASE_EMBEDDED {
bool is_uint32,
int arguments_index,
int arguments_count);
void RegisterDependentCodeForEmbeddedMaps(Handle<Code> code);
void PopulateDeoptimizationData(Handle<Code> code);
int DefineDeoptimizationLiteral(Handle<Object> literal);

View File

@ -457,9 +457,6 @@ Handle<Code> LChunk::Codegen(Code::Kind kind) {
Handle<Code> code =
CodeGenerator::MakeCodeEpilogue(&assembler, flags, info());
generator.FinishCode(code);
if (FLAG_weak_embedded_maps_in_optimized_code) {
RegisterDependentCodeForEmbeddedMaps(code);
}
CodeGenerator::PrintCode(code, info());
return code;
}
@ -467,31 +464,6 @@ Handle<Code> LChunk::Codegen(Code::Kind kind) {
}
void LChunk::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) {
ZoneList<Handle<Map> > maps(1, zone());
int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
RelocInfo::Mode mode = it.rinfo()->rmode();
if (mode == RelocInfo::EMBEDDED_OBJECT &&
it.rinfo()->target_object()->IsMap()) {
Handle<Map> map(Map::cast(it.rinfo()->target_object()));
if (map->CanTransition()) {
maps.Add(map, zone());
}
}
}
#ifdef VERIFY_HEAP
// This disables verification of weak embedded maps after full GC.
// AddDependentCode can cause a GC, which would observe the state where
// this code is not yet in the depended code lists of the embedded maps.
NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps;
#endif
for (int i = 0; i < maps.length(); i++) {
maps.at(i)->AddDependentCode(code);
}
}
void LChunk::set_allocated_double_registers(BitVector* allocated_registers) {
allocated_double_registers_ = allocated_registers;
BitVector* doubles = allocated_double_registers();

View File

@ -694,8 +694,6 @@ class LChunk: public ZoneObject {
protected:
LChunk(CompilationInfo* info, HGraph* graph);
void RegisterDependentCodeForEmbeddedMaps(Handle<Code> code);
int spill_slot_count_;
private:

View File

@ -84,6 +84,9 @@ void LCodeGen::FinishCode(Handle<Code> code) {
ASSERT(is_done());
code->set_stack_slots(GetStackSlotCount());
code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
if (FLAG_weak_embedded_maps_in_optimized_code) {
RegisterDependentCodeForEmbeddedMaps(code);
}
PopulateDeoptimizationData(code);
}
@ -846,6 +849,31 @@ void LCodeGen::DeoptimizeIf(Condition cc,
}
void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) {
ZoneList<Handle<Map> > maps(1, zone());
int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
RelocInfo::Mode mode = it.rinfo()->rmode();
if (mode == RelocInfo::EMBEDDED_OBJECT &&
it.rinfo()->target_object()->IsMap()) {
Handle<Map> map(Map::cast(it.rinfo()->target_object()));
if (map->CanTransition()) {
maps.Add(map, zone());
}
}
}
#ifdef VERIFY_HEAP
// This disables verification of weak embedded maps after full GC.
// AddDependentCode can cause a GC, which would observe the state where
// this code is not yet in the depended code lists of the embedded maps.
NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps;
#endif
for (int i = 0; i < maps.length(); i++) {
maps.at(i)->AddDependentCode(code);
}
}
void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
int length = deoptimizations_.length();
if (length == 0) return;

View File

@ -275,6 +275,7 @@ class LCodeGen BASE_EMBEDDED {
bool is_uint32,
int arguments_index,
int arguments_count);
void RegisterDependentCodeForEmbeddedMaps(Handle<Code> code);
void PopulateDeoptimizationData(Handle<Code> code);
int DefineDeoptimizationLiteral(Handle<Object> literal);

View File

@ -88,6 +88,9 @@ void LCodeGen::FinishCode(Handle<Code> code) {
ASSERT(is_done());
code->set_stack_slots(GetStackSlotCount());
code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
if (FLAG_weak_embedded_maps_in_optimized_code) {
RegisterDependentCodeForEmbeddedMaps(code);
}
PopulateDeoptimizationData(code);
}
@ -757,6 +760,31 @@ void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) {
}
void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) {
ZoneList<Handle<Map> > maps(1, zone());
int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
RelocInfo::Mode mode = it.rinfo()->rmode();
if (mode == RelocInfo::EMBEDDED_OBJECT &&
it.rinfo()->target_object()->IsMap()) {
Handle<Map> map(Map::cast(it.rinfo()->target_object()));
if (map->CanTransition()) {
maps.Add(map, zone());
}
}
}
#ifdef VERIFY_HEAP
// This disables verification of weak embedded maps after full GC.
// AddDependentCode can cause a GC, which would observe the state where
// this code is not yet in the depended code lists of the embedded maps.
NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps;
#endif
for (int i = 0; i < maps.length(); i++) {
maps.at(i)->AddDependentCode(code);
}
}
void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
int length = deoptimizations_.length();
if (length == 0) return;

View File

@ -242,6 +242,7 @@ class LCodeGen BASE_EMBEDDED {
bool is_uint32,
int arguments_index,
int arguments_count);
void RegisterDependentCodeForEmbeddedMaps(Handle<Code> code);
void PopulateDeoptimizationData(Handle<Code> code);
int DefineDeoptimizationLiteral(Handle<Object> literal);