Load callback data from weak cell instead of embedding it in handler.
BUG=v8:3629 LOG=N Review URL: https://codereview.chromium.org/877243004 Cr-Commit-Position: refs/heads/master@{#26358}
This commit is contained in:
parent
0cd991ebc0
commit
3ea4ca9dbf
@ -2279,10 +2279,15 @@ void MacroAssembler::CmpWeakValue(Register value, Handle<WeakCell> cell,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
|
||||||
Label* miss) {
|
|
||||||
mov(value, Operand(cell));
|
mov(value, Operand(cell));
|
||||||
ldr(value, FieldMemOperand(value, WeakCell::kValueOffset));
|
ldr(value, FieldMemOperand(value, WeakCell::kValueOffset));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
||||||
|
Label* miss) {
|
||||||
|
GetWeakValue(value, cell);
|
||||||
JumpIfSmi(value, miss);
|
JumpIfSmi(value, miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,6 +924,8 @@ class MacroAssembler: public Assembler {
|
|||||||
// Compare the given value and the value of weak cell.
|
// Compare the given value and the value of weak cell.
|
||||||
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
||||||
|
|
||||||
|
void GetWeakValue(Register value, Handle<WeakCell> cell);
|
||||||
|
|
||||||
// Load the value of the weak cell in the value register. Branch to the given
|
// Load the value of the weak cell in the value register. Branch to the given
|
||||||
// miss label if the weak cell was cleared.
|
// miss label if the weak cell was cleared.
|
||||||
void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss);
|
void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss);
|
||||||
|
@ -3675,10 +3675,15 @@ void MacroAssembler::CmpWeakValue(Register value, Handle<WeakCell> cell,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
|
||||||
Label* miss) {
|
|
||||||
Mov(value, Operand(cell));
|
Mov(value, Operand(cell));
|
||||||
Ldr(value, FieldMemOperand(value, WeakCell::kValueOffset));
|
Ldr(value, FieldMemOperand(value, WeakCell::kValueOffset));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
||||||
|
Label* miss) {
|
||||||
|
GetWeakValue(value, cell);
|
||||||
JumpIfSmi(value, miss);
|
JumpIfSmi(value, miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1472,6 +1472,8 @@ class MacroAssembler : public Assembler {
|
|||||||
// Compare the given value and the value of weak cell.
|
// Compare the given value and the value of weak cell.
|
||||||
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
||||||
|
|
||||||
|
void GetWeakValue(Register value, Handle<WeakCell> cell);
|
||||||
|
|
||||||
// Load the value of the weak cell in the value register. Branch to the given
|
// Load the value of the weak cell in the value register. Branch to the given
|
||||||
// miss label if the weak cell was cleared.
|
// miss label if the weak cell was cleared.
|
||||||
void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss);
|
void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss);
|
||||||
|
@ -2403,10 +2403,15 @@ void MacroAssembler::CmpWeakValue(Register value, Handle<WeakCell> cell,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
|
||||||
Label* miss) {
|
|
||||||
mov(value, cell);
|
mov(value, cell);
|
||||||
mov(value, FieldOperand(value, WeakCell::kValueOffset));
|
mov(value, FieldOperand(value, WeakCell::kValueOffset));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
||||||
|
Label* miss) {
|
||||||
|
GetWeakValue(value, cell);
|
||||||
JumpIfSmi(value, miss);
|
JumpIfSmi(value, miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,6 +298,8 @@ class MacroAssembler: public Assembler {
|
|||||||
// Compare the given value and the value of weak cell.
|
// Compare the given value and the value of weak cell.
|
||||||
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
||||||
|
|
||||||
|
void GetWeakValue(Register value, Handle<WeakCell> cell);
|
||||||
|
|
||||||
// Load the value of the weak cell in the value register. Branch to the given
|
// Load the value of the weak cell in the value register. Branch to the given
|
||||||
// miss label if the weak cell was cleared.
|
// miss label if the weak cell was cleared.
|
||||||
void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss);
|
void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss);
|
||||||
|
@ -569,12 +569,16 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
|||||||
DCHECK(!scratch3().is(reg));
|
DCHECK(!scratch3().is(reg));
|
||||||
DCHECK(!scratch4().is(reg));
|
DCHECK(!scratch4().is(reg));
|
||||||
__ push(receiver());
|
__ push(receiver());
|
||||||
if (heap()->InNewSpace(callback->data())) {
|
// Push data from ExecutableAccessorInfo.
|
||||||
__ Move(scratch3(), callback);
|
Handle<Object> data(callback->data(), isolate());
|
||||||
__ ldr(scratch3(),
|
if (data->IsUndefined() || data->IsSmi()) {
|
||||||
FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset));
|
__ Move(scratch3(), data);
|
||||||
} else {
|
} else {
|
||||||
__ Move(scratch3(), Handle<Object>(callback->data(), isolate()));
|
Handle<WeakCell> cell =
|
||||||
|
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||||
|
// The callback is alive if this instruction is executed,
|
||||||
|
// so the weak cell is not cleared and points to data.
|
||||||
|
__ GetWeakValue(scratch3(), cell);
|
||||||
}
|
}
|
||||||
__ push(scratch3());
|
__ push(scratch3());
|
||||||
__ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex);
|
__ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex);
|
||||||
|
@ -626,12 +626,15 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
|||||||
|
|
||||||
__ Push(receiver());
|
__ Push(receiver());
|
||||||
|
|
||||||
if (heap()->InNewSpace(callback->data())) {
|
Handle<Object> data(callback->data(), isolate());
|
||||||
__ Mov(scratch3(), Operand(callback));
|
if (data->IsUndefined() || data->IsSmi()) {
|
||||||
__ Ldr(scratch3(),
|
__ Mov(scratch3(), Operand(data));
|
||||||
FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset));
|
|
||||||
} else {
|
} else {
|
||||||
__ Mov(scratch3(), Operand(Handle<Object>(callback->data(), isolate())));
|
Handle<WeakCell> cell =
|
||||||
|
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||||
|
// The callback is alive if this instruction is executed,
|
||||||
|
// so the weak cell is not cleared and points to data.
|
||||||
|
__ GetWeakValue(scratch3(), cell);
|
||||||
}
|
}
|
||||||
__ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex);
|
__ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex);
|
||||||
__ Mov(scratch2(), Operand(ExternalReference::isolate_address(isolate())));
|
__ Mov(scratch2(), Operand(ExternalReference::isolate_address(isolate())));
|
||||||
|
@ -567,12 +567,17 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
|||||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
|
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
|
||||||
__ push(receiver()); // receiver
|
__ push(receiver()); // receiver
|
||||||
// Push data from ExecutableAccessorInfo.
|
// Push data from ExecutableAccessorInfo.
|
||||||
if (isolate()->heap()->InNewSpace(callback->data())) {
|
Handle<Object> data(callback->data(), isolate());
|
||||||
DCHECK(!scratch2().is(reg));
|
if (data->IsUndefined() || data->IsSmi()) {
|
||||||
__ mov(scratch2(), Immediate(callback));
|
__ push(Immediate(data));
|
||||||
__ push(FieldOperand(scratch2(), ExecutableAccessorInfo::kDataOffset));
|
|
||||||
} else {
|
} else {
|
||||||
__ push(Immediate(Handle<Object>(callback->data(), isolate())));
|
DCHECK(!scratch2().is(reg));
|
||||||
|
Handle<WeakCell> cell =
|
||||||
|
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||||
|
// The callback is alive if this instruction is executed,
|
||||||
|
// so the weak cell is not cleared and points to data.
|
||||||
|
__ GetWeakValue(scratch2(), cell);
|
||||||
|
__ push(scratch2());
|
||||||
}
|
}
|
||||||
__ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue
|
__ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue
|
||||||
// ReturnValue default value
|
// ReturnValue default value
|
||||||
|
@ -559,12 +559,15 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
|||||||
DCHECK(!scratch3().is(reg));
|
DCHECK(!scratch3().is(reg));
|
||||||
DCHECK(!scratch4().is(reg));
|
DCHECK(!scratch4().is(reg));
|
||||||
__ push(receiver());
|
__ push(receiver());
|
||||||
if (heap()->InNewSpace(callback->data())) {
|
Handle<Object> data(callback->data(), isolate());
|
||||||
__ li(scratch3(), callback);
|
if (data->IsUndefined() || data->IsSmi()) {
|
||||||
__ lw(scratch3(),
|
__ li(scratch3(), data);
|
||||||
FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset));
|
|
||||||
} else {
|
} else {
|
||||||
__ li(scratch3(), Handle<Object>(callback->data(), isolate()));
|
Handle<WeakCell> cell =
|
||||||
|
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||||
|
// The callback is alive if this instruction is executed,
|
||||||
|
// so the weak cell is not cleared and points to data.
|
||||||
|
__ GetWeakValue(scratch3(), cell);
|
||||||
}
|
}
|
||||||
__ Subu(sp, sp, 6 * kPointerSize);
|
__ Subu(sp, sp, 6 * kPointerSize);
|
||||||
__ sw(scratch3(), MemOperand(sp, 5 * kPointerSize));
|
__ sw(scratch3(), MemOperand(sp, 5 * kPointerSize));
|
||||||
|
@ -560,12 +560,15 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
|||||||
DCHECK(!scratch3().is(reg));
|
DCHECK(!scratch3().is(reg));
|
||||||
DCHECK(!scratch4().is(reg));
|
DCHECK(!scratch4().is(reg));
|
||||||
__ push(receiver());
|
__ push(receiver());
|
||||||
if (heap()->InNewSpace(callback->data())) {
|
Handle<Object> data(callback->data(), isolate());
|
||||||
__ li(scratch3(), callback);
|
if (data->IsUndefined() || data->IsSmi()) {
|
||||||
__ ld(scratch3(),
|
__ li(scratch3(), data);
|
||||||
FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset));
|
|
||||||
} else {
|
} else {
|
||||||
__ li(scratch3(), Handle<Object>(callback->data(), isolate()));
|
Handle<WeakCell> cell =
|
||||||
|
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||||
|
// The callback is alive if this instruction is executed,
|
||||||
|
// so the weak cell is not cleared and points to data.
|
||||||
|
__ GetWeakValue(scratch3(), cell);
|
||||||
}
|
}
|
||||||
__ Dsubu(sp, sp, 6 * kPointerSize);
|
__ Dsubu(sp, sp, 6 * kPointerSize);
|
||||||
__ sd(scratch3(), MemOperand(sp, 5 * kPointerSize));
|
__ sd(scratch3(), MemOperand(sp, 5 * kPointerSize));
|
||||||
|
@ -562,13 +562,17 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
|||||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
|
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
|
||||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6);
|
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6);
|
||||||
__ Push(receiver()); // receiver
|
__ Push(receiver()); // receiver
|
||||||
if (heap()->InNewSpace(callback->data())) {
|
Handle<Object> data(callback->data(), isolate());
|
||||||
DCHECK(!scratch2().is(reg));
|
if (data->IsUndefined() || data->IsSmi()) {
|
||||||
__ Move(scratch2(), callback);
|
__ Push(data);
|
||||||
__ Push(FieldOperand(scratch2(),
|
|
||||||
ExecutableAccessorInfo::kDataOffset)); // data
|
|
||||||
} else {
|
} else {
|
||||||
__ Push(Handle<Object>(callback->data(), isolate()));
|
DCHECK(!scratch2().is(reg));
|
||||||
|
Handle<WeakCell> cell =
|
||||||
|
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||||
|
// The callback is alive if this instruction is executed,
|
||||||
|
// so the weak cell is not cleared and points to data.
|
||||||
|
__ GetWeakValue(scratch2(), cell);
|
||||||
|
__ Push(scratch2());
|
||||||
}
|
}
|
||||||
DCHECK(!kScratchRegister.is(reg));
|
DCHECK(!kScratchRegister.is(reg));
|
||||||
__ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
|
__ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
|
||||||
|
@ -568,12 +568,17 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
|||||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
|
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
|
||||||
__ push(receiver()); // receiver
|
__ push(receiver()); // receiver
|
||||||
// Push data from ExecutableAccessorInfo.
|
// Push data from ExecutableAccessorInfo.
|
||||||
if (isolate()->heap()->InNewSpace(callback->data())) {
|
Handle<Object> data(callback->data(), isolate());
|
||||||
DCHECK(!scratch2().is(reg));
|
if (data->IsUndefined() || data->IsSmi()) {
|
||||||
__ mov(scratch2(), Immediate(callback));
|
__ push(Immediate(data));
|
||||||
__ push(FieldOperand(scratch2(), ExecutableAccessorInfo::kDataOffset));
|
|
||||||
} else {
|
} else {
|
||||||
__ push(Immediate(Handle<Object>(callback->data(), isolate())));
|
DCHECK(!scratch2().is(reg));
|
||||||
|
Handle<WeakCell> cell =
|
||||||
|
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||||
|
// The callback is alive if this instruction is executed,
|
||||||
|
// so the weak cell is not cleared and points to data.
|
||||||
|
__ GetWeakValue(scratch2(), cell);
|
||||||
|
__ push(scratch2());
|
||||||
}
|
}
|
||||||
__ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue
|
__ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue
|
||||||
// ReturnValue default value
|
// ReturnValue default value
|
||||||
|
@ -2666,10 +2666,15 @@ void MacroAssembler::CmpWeakValue(Register value, Handle<WeakCell> cell,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
|
||||||
Label* miss) {
|
|
||||||
Move(value, cell, RelocInfo::EMBEDDED_OBJECT);
|
Move(value, cell, RelocInfo::EMBEDDED_OBJECT);
|
||||||
movp(value, FieldOperand(value, WeakCell::kValueOffset));
|
movp(value, FieldOperand(value, WeakCell::kValueOffset));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
||||||
|
Label* miss) {
|
||||||
|
GetWeakValue(value, cell);
|
||||||
JumpIfSmi(value, miss);
|
JumpIfSmi(value, miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -846,6 +846,8 @@ class MacroAssembler: public Assembler {
|
|||||||
// Compare the given value and the value of weak cell.
|
// Compare the given value and the value of weak cell.
|
||||||
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
||||||
|
|
||||||
|
void GetWeakValue(Register value, Handle<WeakCell> cell);
|
||||||
|
|
||||||
// Load the value of the weak cell in the value register. Branch to the given
|
// Load the value of the weak cell in the value register. Branch to the given
|
||||||
// miss label if the weak cell was cleared.
|
// miss label if the weak cell was cleared.
|
||||||
void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss);
|
void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss);
|
||||||
|
@ -2388,10 +2388,15 @@ void MacroAssembler::CmpWeakValue(Register value, Handle<WeakCell> cell,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
|
||||||
Label* miss) {
|
|
||||||
mov(value, cell);
|
mov(value, cell);
|
||||||
mov(value, FieldOperand(value, WeakCell::kValueOffset));
|
mov(value, FieldOperand(value, WeakCell::kValueOffset));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
||||||
|
Label* miss) {
|
||||||
|
GetWeakValue(value, cell);
|
||||||
JumpIfSmi(value, miss);
|
JumpIfSmi(value, miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,6 +274,7 @@ class MacroAssembler: public Assembler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch);
|
||||||
|
void GetWeakValue(Register value, Handle<WeakCell> cell);
|
||||||
void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss);
|
void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss);
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user