Make map check in NamedStoreHandlerCompiler::GenerateFieldTypeChecks weak.

BUG=v8:3629
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#26070}
This commit is contained in:
ulan 2015-01-15 01:43:25 -08:00 committed by Commit bot
parent e6552d4917
commit a956bf5827
7 changed files with 48 additions and 19 deletions

View File

@ -377,13 +377,17 @@ void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg,
void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type,
Register value_reg,
Label* miss_label) {
Register map_reg = scratch1();
Register scratch = scratch2();
DCHECK(!value_reg.is(map_reg));
DCHECK(!value_reg.is(scratch));
__ JumpIfSmi(value_reg, miss_label);
HeapType::Iterator<Map> it = field_type->Classes();
if (!it.Done()) {
__ ldr(scratch1(), FieldMemOperand(value_reg, HeapObject::kMapOffset));
__ ldr(map_reg, FieldMemOperand(value_reg, HeapObject::kMapOffset));
Label do_store;
while (true) {
__ CompareMap(scratch1(), it.Current(), &do_store);
__ CmpWeakValue(map_reg, Map::WeakCellForMap(it.Current()), scratch);
it.Advance();
if (it.Done()) {
__ b(ne, miss_label);

View File

@ -427,13 +427,17 @@ void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg,
void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type,
Register value_reg,
Label* miss_label) {
Register map_reg = scratch1();
Register scratch = scratch2();
DCHECK(!value_reg.is(map_reg));
DCHECK(!value_reg.is(scratch));
__ JumpIfSmi(value_reg, miss_label);
HeapType::Iterator<Map> it = field_type->Classes();
if (!it.Done()) {
__ Ldr(scratch1(), FieldMemOperand(value_reg, HeapObject::kMapOffset));
__ Ldr(map_reg, FieldMemOperand(value_reg, HeapObject::kMapOffset));
Label do_store;
while (true) {
__ CompareMap(scratch1(), it.Current());
__ CmpWeakValue(map_reg, Map::WeakCellForMap(it.Current()), scratch);
it.Advance();
if (it.Done()) {
__ B(ne, miss_label);

View File

@ -385,12 +385,17 @@ void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg,
void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type,
Register value_reg,
Label* miss_label) {
Register map_reg = scratch1();
Register scratch = scratch2();
DCHECK(!value_reg.is(map_reg));
DCHECK(!value_reg.is(scratch));
__ JumpIfSmi(value_reg, miss_label);
HeapType::Iterator<Map> it = field_type->Classes();
if (!it.Done()) {
Label do_store;
__ mov(map_reg, FieldOperand(value_reg, HeapObject::kMapOffset));
while (true) {
__ CompareMap(value_reg, it.Current());
__ CmpWeakValue(map_reg, Map::WeakCellForMap(it.Current()), scratch);
it.Advance();
if (it.Done()) {
__ j(not_equal, miss_label);

View File

@ -370,21 +370,24 @@ void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg,
void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type,
Register value_reg,
Label* miss_label) {
Register map_reg = scratch1();
Register scratch = scratch2();
DCHECK(!value_reg.is(map_reg));
DCHECK(!value_reg.is(scratch));
__ JumpIfSmi(value_reg, miss_label);
HeapType::Iterator<Map> it = field_type->Classes();
if (!it.Done()) {
__ lw(scratch1(), FieldMemOperand(value_reg, HeapObject::kMapOffset));
__ lw(map_reg, FieldMemOperand(value_reg, HeapObject::kMapOffset));
Label do_store;
Handle<Map> current;
while (true) {
// Do the CompareMap() directly within the Branch() functions.
current = it.Current();
// Compare map directly within the Branch() functions.
__ GetWeakValue(scratch, Map::WeakCellForMap(it.Current()));
it.Advance();
if (it.Done()) {
__ Branch(miss_label, ne, scratch1(), Operand(current));
__ Branch(miss_label, ne, map_reg, Operand(scratch));
break;
}
__ Branch(&do_store, eq, scratch1(), Operand(current));
__ Branch(&do_store, eq, map_reg, Operand(scratch));
}
__ bind(&do_store);
}

View File

@ -371,21 +371,24 @@ void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg,
void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type,
Register value_reg,
Label* miss_label) {
Register map_reg = scratch1();
Register scratch = scratch2();
DCHECK(!value_reg.is(map_reg));
DCHECK(!value_reg.is(scratch));
__ JumpIfSmi(value_reg, miss_label);
HeapType::Iterator<Map> it = field_type->Classes();
if (!it.Done()) {
__ ld(scratch1(), FieldMemOperand(value_reg, HeapObject::kMapOffset));
__ ld(map_reg, FieldMemOperand(value_reg, HeapObject::kMapOffset));
Label do_store;
Handle<Map> current;
while (true) {
// Do the CompareMap() directly within the Branch() functions.
current = it.Current();
// Compare map directly within the Branch() functions.
it.Advance();
__ GetWeakValue(scratch, Map::WeakCellForMap(it.Current()));
if (it.Done()) {
__ Branch(miss_label, ne, scratch1(), Operand(current));
__ Branch(miss_label, ne, map_reg, Operand(scratch));
break;
}
__ Branch(&do_store, eq, scratch1(), Operand(current));
__ Branch(&do_store, eq, map_reg, Operand(scratch));
}
__ bind(&do_store);
}

View File

@ -377,12 +377,17 @@ void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg,
void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type,
Register value_reg,
Label* miss_label) {
Register map_reg = scratch1();
Register scratch = scratch2();
DCHECK(!value_reg.is(map_reg));
DCHECK(!value_reg.is(scratch));
__ JumpIfSmi(value_reg, miss_label);
HeapType::Iterator<Map> it = field_type->Classes();
if (!it.Done()) {
Label do_store;
__ movp(map_reg, FieldOperand(value_reg, HeapObject::kMapOffset));
while (true) {
__ CompareMap(value_reg, it.Current());
__ CmpWeakValue(map_reg, Map::WeakCellForMap(it.Current()), scratch);
it.Advance();
if (it.Done()) {
__ j(not_equal, miss_label);

View File

@ -385,12 +385,17 @@ void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg,
void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(HeapType* field_type,
Register value_reg,
Label* miss_label) {
Register map_reg = scratch1();
Register scratch = scratch2();
DCHECK(!value_reg.is(map_reg));
DCHECK(!value_reg.is(scratch));
__ JumpIfSmi(value_reg, miss_label);
HeapType::Iterator<Map> it = field_type->Classes();
if (!it.Done()) {
Label do_store;
__ mov(map_reg, FieldOperand(value_reg, HeapObject::kMapOffset));
while (true) {
__ CompareMap(value_reg, it.Current());
__ CmpWeakValue(map_reg, Map::WeakCellForMap(it.Current()), scratch);
it.Advance();
if (it.Done()) {
__ j(not_equal, miss_label);