Commit a956bf58 authored by ulan's avatar ulan Committed by Commit bot

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}
parent e6552d49
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment