Commit 71180e54 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

Don't embed CompileLazyDeoptimizedCode

This changes the CompileLazyDeoptimizedCode call to use the standard
builtin calling sequence, which (for optimized code) creates an
inlined off-heap trampoline instead of embedding a CODE_TARGET.

Drive-by: Add missing conditional jump handling to masm::Jump. It was
missing only for the case of inlined trampolines.

Bug: v8:7777
Change-Id: Id79a10ba99fd97c1b3351774b9ecf5adf10ee6d4
Reviewed-on: https://chromium-review.googlesource.com/c/1382460
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58389}
parent b9e1f5ac
...@@ -691,12 +691,8 @@ void CodeGenerator::BailoutIfDeoptimized() { ...@@ -691,12 +691,8 @@ void CodeGenerator::BailoutIfDeoptimized() {
__ ldr(scratch, __ ldr(scratch,
FieldMemOperand(scratch, CodeDataContainer::kKindSpecificFlagsOffset)); FieldMemOperand(scratch, CodeDataContainer::kKindSpecificFlagsOffset));
__ tst(scratch, Operand(1 << Code::kMarkedForDeoptimizationBit)); __ tst(scratch, Operand(1 << Code::kMarkedForDeoptimizationBit));
// Ensure we're not serializing (otherwise we'd need to use an indirection to __ Jump(BUILTIN_CODE(isolate(), CompileLazyDeoptimizedCode),
// access the builtin below). RelocInfo::CODE_TARGET, ne);
DCHECK(!isolate()->ShouldLoadConstantsFromRootList());
Handle<Code> code = isolate()->builtins()->builtin_handle(
Builtins::kCompileLazyDeoptimizedCode);
__ Jump(code, RelocInfo::CODE_TARGET, ne);
} }
void CodeGenerator::GenerateSpeculationPoisonFromCodeStartRegister() { void CodeGenerator::GenerateSpeculationPoisonFromCodeStartRegister() {
......
...@@ -570,12 +570,8 @@ void CodeGenerator::BailoutIfDeoptimized() { ...@@ -570,12 +570,8 @@ void CodeGenerator::BailoutIfDeoptimized() {
FieldMemOperand(scratch, CodeDataContainer::kKindSpecificFlagsOffset)); FieldMemOperand(scratch, CodeDataContainer::kKindSpecificFlagsOffset));
Label not_deoptimized; Label not_deoptimized;
__ Tbz(scratch, Code::kMarkedForDeoptimizationBit, &not_deoptimized); __ Tbz(scratch, Code::kMarkedForDeoptimizationBit, &not_deoptimized);
// Ensure we're not serializing (otherwise we'd need to use an indirection to __ Jump(BUILTIN_CODE(isolate(), CompileLazyDeoptimizedCode),
// access the builtin below). RelocInfo::CODE_TARGET);
DCHECK(!isolate()->ShouldLoadConstantsFromRootList());
Handle<Code> code = isolate()->builtins()->builtin_handle(
Builtins::kCompileLazyDeoptimizedCode);
__ Jump(code, RelocInfo::CODE_TARGET);
__ Bind(&not_deoptimized); __ Bind(&not_deoptimized);
} }
......
...@@ -606,12 +606,12 @@ void CodeGenerator::BailoutIfDeoptimized() { ...@@ -606,12 +606,12 @@ void CodeGenerator::BailoutIfDeoptimized() {
__ test(FieldOperand(eax, CodeDataContainer::kKindSpecificFlagsOffset), __ test(FieldOperand(eax, CodeDataContainer::kKindSpecificFlagsOffset),
Immediate(1 << Code::kMarkedForDeoptimizationBit)); Immediate(1 << Code::kMarkedForDeoptimizationBit));
__ pop(eax); // Restore eax. __ pop(eax); // Restore eax.
// Ensure we're not serializing (otherwise we'd need to use an indirection to
// access the builtin below). Label skip;
DCHECK(!isolate()->ShouldLoadConstantsFromRootList()); __ j(zero, &skip);
Handle<Code> code = isolate()->builtins()->builtin_handle( __ Jump(BUILTIN_CODE(isolate(), CompileLazyDeoptimizedCode),
Builtins::kCompileLazyDeoptimizedCode); RelocInfo::CODE_TARGET);
__ j(not_zero, code, RelocInfo::CODE_TARGET); __ bind(&skip);
} }
void CodeGenerator::GenerateSpeculationPoisonFromCodeStartRegister() { void CodeGenerator::GenerateSpeculationPoisonFromCodeStartRegister() {
......
...@@ -606,12 +606,8 @@ void CodeGenerator::BailoutIfDeoptimized() { ...@@ -606,12 +606,8 @@ void CodeGenerator::BailoutIfDeoptimized() {
CodeDataContainer::kKindSpecificFlagsOffset)); CodeDataContainer::kKindSpecificFlagsOffset));
__ And(kScratchReg, kScratchReg, __ And(kScratchReg, kScratchReg,
Operand(1 << Code::kMarkedForDeoptimizationBit)); Operand(1 << Code::kMarkedForDeoptimizationBit));
// Ensure we're not serializing (otherwise we'd need to use an indirection to __ Jump(BUILTIN_CODE(isolate(), CompileLazyDeoptimizedCode),
// access the builtin below). RelocInfo::CODE_TARGET, ne, kScratchReg, Operand(zero_reg));
DCHECK(!isolate()->ShouldLoadConstantsFromRootList());
Handle<Code> code = isolate()->builtins()->builtin_handle(
Builtins::kCompileLazyDeoptimizedCode);
__ Jump(code, RelocInfo::CODE_TARGET, ne, kScratchReg, Operand(zero_reg));
} }
void CodeGenerator::GenerateSpeculationPoisonFromCodeStartRegister() { void CodeGenerator::GenerateSpeculationPoisonFromCodeStartRegister() {
......
...@@ -577,12 +577,8 @@ void CodeGenerator::BailoutIfDeoptimized() { ...@@ -577,12 +577,8 @@ void CodeGenerator::BailoutIfDeoptimized() {
CodeDataContainer::kKindSpecificFlagsOffset)); CodeDataContainer::kKindSpecificFlagsOffset));
__ And(kScratchReg, kScratchReg, __ And(kScratchReg, kScratchReg,
Operand(1 << Code::kMarkedForDeoptimizationBit)); Operand(1 << Code::kMarkedForDeoptimizationBit));
// Ensure we're not serializing (otherwise we'd need to use an indirection to __ Jump(BUILTIN_CODE(isolate(), CompileLazyDeoptimizedCode),
// access the builtin below). RelocInfo::CODE_TARGET, ne, kScratchReg, Operand(zero_reg));
DCHECK(!isolate()->ShouldLoadConstantsFromRootList());
Handle<Code> code = isolate()->builtins()->builtin_handle(
Builtins::kCompileLazyDeoptimizedCode);
__ Jump(code, RelocInfo::CODE_TARGET, ne, kScratchReg, Operand(zero_reg));
} }
void CodeGenerator::GenerateSpeculationPoisonFromCodeStartRegister() { void CodeGenerator::GenerateSpeculationPoisonFromCodeStartRegister() {
......
...@@ -656,12 +656,8 @@ void CodeGenerator::BailoutIfDeoptimized() { ...@@ -656,12 +656,8 @@ void CodeGenerator::BailoutIfDeoptimized() {
Operand(kJavaScriptCallCodeStartRegister, offset)); Operand(kJavaScriptCallCodeStartRegister, offset));
__ testl(FieldOperand(rbx, CodeDataContainer::kKindSpecificFlagsOffset), __ testl(FieldOperand(rbx, CodeDataContainer::kKindSpecificFlagsOffset),
Immediate(1 << Code::kMarkedForDeoptimizationBit)); Immediate(1 << Code::kMarkedForDeoptimizationBit));
// Ensure we're not serializing (otherwise we'd need to use an indirection to __ Jump(BUILTIN_CODE(isolate(), CompileLazyDeoptimizedCode),
// access the builtin below). RelocInfo::CODE_TARGET, not_zero);
DCHECK(!isolate()->ShouldLoadConstantsFromRootList());
Handle<Code> code = isolate()->builtins()->builtin_handle(
Builtins::kCompileLazyDeoptimizedCode);
__ j(not_zero, code, RelocInfo::CODE_TARGET);
} }
void CodeGenerator::GenerateSpeculationPoisonFromCodeStartRegister() { void CodeGenerator::GenerateSpeculationPoisonFromCodeStartRegister() {
......
...@@ -1646,6 +1646,11 @@ void TurboAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode, ...@@ -1646,6 +1646,11 @@ void TurboAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode,
int builtin_index = Builtins::kNoBuiltinId; int builtin_index = Builtins::kNoBuiltinId;
if (isolate()->builtins()->IsBuiltinHandle(code_object, &builtin_index) && if (isolate()->builtins()->IsBuiltinHandle(code_object, &builtin_index) &&
Builtins::IsIsolateIndependent(builtin_index)) { Builtins::IsIsolateIndependent(builtin_index)) {
Label skip;
if (cc != always) {
if (cc == never) return;
j(NegateCondition(cc), &skip, Label::kNear);
}
// Inline the trampoline. // Inline the trampoline.
RecordCommentForOffHeapTrampoline(builtin_index); RecordCommentForOffHeapTrampoline(builtin_index);
CHECK_NE(builtin_index, Builtins::kNoBuiltinId); CHECK_NE(builtin_index, Builtins::kNoBuiltinId);
...@@ -1653,6 +1658,7 @@ void TurboAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode, ...@@ -1653,6 +1658,7 @@ void TurboAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode,
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
Move(kScratchRegister, entry, RelocInfo::OFF_HEAP_TARGET); Move(kScratchRegister, entry, RelocInfo::OFF_HEAP_TARGET);
jmp(kScratchRegister); jmp(kScratchRegister);
bind(&skip);
return; return;
} }
} }
......
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