Commit 81c4a422 authored by ulan's avatar ulan Committed by Commit bot

Use weak cells in CheckPropertyCell.

BUG=v8:3629
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#26379}
parent 79cad15c
......@@ -201,7 +201,8 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell(
Register scratch, Label* miss) {
Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
DCHECK(cell->value()->IsTheHole());
__ mov(scratch, Operand(cell));
Handle<WeakCell> weak_cell = masm->isolate()->factory()->NewWeakCell(cell);
__ LoadWeakValue(scratch, weak_cell, miss);
__ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
__ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
__ cmp(scratch, ip);
......
......@@ -111,7 +111,8 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell(
Register scratch, Label* miss) {
Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
DCHECK(cell->value()->IsTheHole());
__ Mov(scratch, Operand(cell));
Handle<WeakCell> weak_cell = masm->isolate()->factory()->NewWeakCell(cell);
__ LoadWeakValue(scratch, weak_cell, miss);
__ Ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
__ JumpIfNotRoot(scratch, Heap::kTheHoleValueRootIndex, miss);
}
......
......@@ -227,14 +227,11 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell(
Register scratch, Label* miss) {
Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
DCHECK(cell->value()->IsTheHole());
Handle<Oddball> the_hole = masm->isolate()->factory()->the_hole_value();
if (masm->serializer_enabled()) {
__ mov(scratch, Immediate(cell));
__ cmp(FieldOperand(scratch, PropertyCell::kValueOffset),
Immediate(the_hole));
} else {
__ cmp(Operand::ForCell(cell), Immediate(the_hole));
}
Factory* factory = masm->isolate()->factory();
Handle<WeakCell> weak_cell = factory->NewWeakCell(cell);
__ LoadWeakValue(scratch, weak_cell, miss);
__ cmp(FieldOperand(scratch, PropertyCell::kValueOffset),
Immediate(factory->the_hole_value()));
__ j(not_equal, miss);
}
......
......@@ -197,7 +197,8 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell(
Register scratch, Label* miss) {
Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
DCHECK(cell->value()->IsTheHole());
__ li(scratch, Operand(cell));
Handle<WeakCell> weak_cell = masm->isolate()->factory()->NewWeakCell(cell);
__ LoadWeakValue(scratch, weak_cell, miss);
__ lw(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
__ LoadRoot(at, Heap::kTheHoleValueRootIndex);
__ Branch(miss, ne, scratch, Operand(at));
......
......@@ -198,7 +198,8 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell(
Register scratch, Label* miss) {
Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
DCHECK(cell->value()->IsTheHole());
__ li(scratch, Operand(cell));
Handle<WeakCell> weak_cell = masm->isolate()->factory()->NewWeakCell(cell);
__ LoadWeakValue(scratch, weak_cell, miss);
__ ld(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
__ LoadRoot(at, Heap::kTheHoleValueRootIndex);
__ Branch(miss, ne, scratch, Operand(at));
......
......@@ -206,9 +206,10 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell(
Register scratch, Label* miss) {
Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
DCHECK(cell->value()->IsTheHole());
__ Move(scratch, cell);
__ Cmp(FieldOperand(scratch, Cell::kValueOffset),
masm->isolate()->factory()->the_hole_value());
Factory* factory = masm->isolate()->factory();
Handle<WeakCell> weak_cell = factory->NewWeakCell(cell);
__ LoadWeakValue(scratch, weak_cell, miss);
__ Cmp(FieldOperand(scratch, Cell::kValueOffset), factory->the_hole_value());
__ j(not_equal, miss);
}
......
......@@ -227,14 +227,11 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell(
Register scratch, Label* miss) {
Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
DCHECK(cell->value()->IsTheHole());
Handle<Oddball> the_hole = masm->isolate()->factory()->the_hole_value();
if (masm->serializer_enabled()) {
__ mov(scratch, Immediate(cell));
__ cmp(FieldOperand(scratch, PropertyCell::kValueOffset),
Immediate(the_hole));
} else {
__ cmp(Operand::ForCell(cell), Immediate(the_hole));
}
Factory* factory = masm->isolate()->factory();
Handle<WeakCell> weak_cell = factory->NewWeakCell(cell);
__ LoadWeakValue(scratch, weak_cell, miss);
__ cmp(FieldOperand(scratch, PropertyCell::kValueOffset),
Immediate(factory->the_hole_value()));
__ j(not_equal, miss);
}
......
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