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,
|
||||
Label* miss) {
|
||||
void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
|
||||
mov(value, Operand(cell));
|
||||
ldr(value, FieldMemOperand(value, WeakCell::kValueOffset));
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
||||
Label* miss) {
|
||||
GetWeakValue(value, cell);
|
||||
JumpIfSmi(value, miss);
|
||||
}
|
||||
|
||||
|
@ -924,6 +924,8 @@ class MacroAssembler: public Assembler {
|
||||
// Compare the given value and the value of weak cell.
|
||||
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
|
||||
// miss label if the weak cell was cleared.
|
||||
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,
|
||||
Label* miss) {
|
||||
void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
|
||||
Mov(value, Operand(cell));
|
||||
Ldr(value, FieldMemOperand(value, WeakCell::kValueOffset));
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
||||
Label* miss) {
|
||||
GetWeakValue(value, cell);
|
||||
JumpIfSmi(value, miss);
|
||||
}
|
||||
|
||||
|
@ -1472,6 +1472,8 @@ class MacroAssembler : public Assembler {
|
||||
// Compare the given value and the value of weak cell.
|
||||
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
|
||||
// miss label if the weak cell was cleared.
|
||||
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,
|
||||
Label* miss) {
|
||||
void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
|
||||
mov(value, cell);
|
||||
mov(value, FieldOperand(value, WeakCell::kValueOffset));
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
||||
Label* miss) {
|
||||
GetWeakValue(value, cell);
|
||||
JumpIfSmi(value, miss);
|
||||
}
|
||||
|
||||
|
@ -298,6 +298,8 @@ class MacroAssembler: public Assembler {
|
||||
// Compare the given value and the value of weak cell.
|
||||
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
|
||||
// miss label if the weak cell was cleared.
|
||||
void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss);
|
||||
|
@ -569,12 +569,16 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
DCHECK(!scratch3().is(reg));
|
||||
DCHECK(!scratch4().is(reg));
|
||||
__ push(receiver());
|
||||
if (heap()->InNewSpace(callback->data())) {
|
||||
__ Move(scratch3(), callback);
|
||||
__ ldr(scratch3(),
|
||||
FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset));
|
||||
// Push data from ExecutableAccessorInfo.
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ Move(scratch3(), data);
|
||||
} 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());
|
||||
__ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex);
|
||||
|
@ -626,12 +626,15 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
|
||||
__ Push(receiver());
|
||||
|
||||
if (heap()->InNewSpace(callback->data())) {
|
||||
__ Mov(scratch3(), Operand(callback));
|
||||
__ Ldr(scratch3(),
|
||||
FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset));
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ Mov(scratch3(), Operand(data));
|
||||
} 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);
|
||||
__ Mov(scratch2(), Operand(ExternalReference::isolate_address(isolate())));
|
||||
|
@ -567,12 +567,17 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
|
||||
__ push(receiver()); // receiver
|
||||
// Push data from ExecutableAccessorInfo.
|
||||
if (isolate()->heap()->InNewSpace(callback->data())) {
|
||||
DCHECK(!scratch2().is(reg));
|
||||
__ mov(scratch2(), Immediate(callback));
|
||||
__ push(FieldOperand(scratch2(), ExecutableAccessorInfo::kDataOffset));
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ push(Immediate(data));
|
||||
} 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
|
||||
// ReturnValue default value
|
||||
|
@ -559,12 +559,15 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
DCHECK(!scratch3().is(reg));
|
||||
DCHECK(!scratch4().is(reg));
|
||||
__ push(receiver());
|
||||
if (heap()->InNewSpace(callback->data())) {
|
||||
__ li(scratch3(), callback);
|
||||
__ lw(scratch3(),
|
||||
FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset));
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ li(scratch3(), data);
|
||||
} 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);
|
||||
__ sw(scratch3(), MemOperand(sp, 5 * kPointerSize));
|
||||
|
@ -560,12 +560,15 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
DCHECK(!scratch3().is(reg));
|
||||
DCHECK(!scratch4().is(reg));
|
||||
__ push(receiver());
|
||||
if (heap()->InNewSpace(callback->data())) {
|
||||
__ li(scratch3(), callback);
|
||||
__ ld(scratch3(),
|
||||
FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset));
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ li(scratch3(), data);
|
||||
} 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);
|
||||
__ sd(scratch3(), MemOperand(sp, 5 * kPointerSize));
|
||||
|
@ -562,13 +562,17 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6);
|
||||
__ Push(receiver()); // receiver
|
||||
if (heap()->InNewSpace(callback->data())) {
|
||||
DCHECK(!scratch2().is(reg));
|
||||
__ Move(scratch2(), callback);
|
||||
__ Push(FieldOperand(scratch2(),
|
||||
ExecutableAccessorInfo::kDataOffset)); // data
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ Push(data);
|
||||
} 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));
|
||||
__ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
|
||||
|
@ -568,12 +568,17 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5);
|
||||
__ push(receiver()); // receiver
|
||||
// Push data from ExecutableAccessorInfo.
|
||||
if (isolate()->heap()->InNewSpace(callback->data())) {
|
||||
DCHECK(!scratch2().is(reg));
|
||||
__ mov(scratch2(), Immediate(callback));
|
||||
__ push(FieldOperand(scratch2(), ExecutableAccessorInfo::kDataOffset));
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ push(Immediate(data));
|
||||
} 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
|
||||
// ReturnValue default value
|
||||
|
@ -2666,10 +2666,15 @@ void MacroAssembler::CmpWeakValue(Register value, Handle<WeakCell> cell,
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
||||
Label* miss) {
|
||||
void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
|
||||
Move(value, cell, RelocInfo::EMBEDDED_OBJECT);
|
||||
movp(value, FieldOperand(value, WeakCell::kValueOffset));
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
||||
Label* miss) {
|
||||
GetWeakValue(value, cell);
|
||||
JumpIfSmi(value, miss);
|
||||
}
|
||||
|
||||
|
@ -846,6 +846,8 @@ class MacroAssembler: public Assembler {
|
||||
// Compare the given value and the value of weak cell.
|
||||
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
|
||||
// miss label if the weak cell was cleared.
|
||||
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,
|
||||
Label* miss) {
|
||||
void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
|
||||
mov(value, cell);
|
||||
mov(value, FieldOperand(value, WeakCell::kValueOffset));
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell,
|
||||
Label* miss) {
|
||||
GetWeakValue(value, cell);
|
||||
JumpIfSmi(value, miss);
|
||||
}
|
||||
|
||||
|
@ -274,6 +274,7 @@ class MacroAssembler: public Assembler {
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user