Index: src/arm64/builtins-arm64.cc |
diff --git a/src/arm64/builtins-arm64.cc b/src/arm64/builtins-arm64.cc |
index 5ffdc5d54e93ebba298c201ebffb8956773614c8..eb36c1bf4a258d09397f1d93b70286eabccba99a 100644 |
--- a/src/arm64/builtins-arm64.cc |
+++ b/src/arm64/builtins-arm64.cc |
@@ -1116,135 +1116,6 @@ |
void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
- // ----------- S t a t e ------------- |
- // -- x3 : new target (preserved for callee) |
- // -- x1 : target function (preserved for callee) |
- // ----------------------------------- |
- // First lookup code, maybe we don't need to compile! |
- Label gotta_call_runtime; |
- Label maybe_call_runtime; |
- Label try_shared; |
- Label loop_top, loop_bottom; |
- |
- Register closure = x1; |
- Register new_target = x3; |
- Register map = x0; |
- Register index = x2; |
- __ Ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
- __ Ldr(map, |
- FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); |
- __ Ldrsw(index, UntagSmiFieldMemOperand(map, FixedArray::kLengthOffset)); |
- __ Cmp(index, Operand(2)); |
- __ B(lt, &gotta_call_runtime); |
- |
- // Find literals. |
- // x3 : native context |
- // x2 : length / index |
- // x0 : optimized code map |
- // stack[0] : new target |
- // stack[4] : closure |
- Register native_context = x4; |
- __ Ldr(native_context, NativeContextMemOperand()); |
- |
- __ Bind(&loop_top); |
- Register temp = x5; |
- Register array_pointer = x6; |
- |
- // Does the native context match? |
- __ Add(array_pointer, map, Operand(index, LSL, kPointerSizeLog2)); |
- __ Ldr(temp, FieldMemOperand(array_pointer, |
- SharedFunctionInfo::OffsetToPreviousContext())); |
- __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); |
- __ Cmp(temp, native_context); |
- __ B(ne, &loop_bottom); |
- // OSR id set to none? |
- __ Ldr(temp, FieldMemOperand(array_pointer, |
- SharedFunctionInfo::OffsetToPreviousOsrAstId())); |
- const int bailout_id = BailoutId::None().ToInt(); |
- __ Cmp(temp, Operand(Smi::FromInt(bailout_id))); |
- __ B(ne, &loop_bottom); |
- // Literals available? |
- __ Ldr(temp, FieldMemOperand(array_pointer, |
- SharedFunctionInfo::OffsetToPreviousLiterals())); |
- __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); |
- __ JumpIfSmi(temp, &gotta_call_runtime); |
- |
- // Save the literals in the closure. |
- __ Str(temp, FieldMemOperand(closure, JSFunction::kLiteralsOffset)); |
- __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, x7, |
- kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- |
- // Code available? |
- Register entry = x7; |
- __ Ldr(entry, |
- FieldMemOperand(array_pointer, |
- SharedFunctionInfo::OffsetToPreviousCachedCode())); |
- __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
- __ JumpIfSmi(entry, &maybe_call_runtime); |
- |
- // Found literals and code. Get them into the closure and return. |
- __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
- |
- Label install_optimized_code_and_tailcall; |
- __ Bind(&install_optimized_code_and_tailcall); |
- __ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); |
- |
- // Link the closure into the optimized function list. |
- // x7 : code entry |
- // x4 : native context |
- // x1 : closure |
- __ Ldr(x8, |
- ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); |
- __ Str(x8, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset)); |
- __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, x8, x0, |
- kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- const int function_list_offset = |
- Context::SlotOffset(Context::OPTIMIZED_FUNCTIONS_LIST); |
- __ Str(closure, |
- ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); |
- __ Mov(x5, closure); |
- __ RecordWriteContextSlot(native_context, function_list_offset, x5, x0, |
- kLRHasNotBeenSaved, kDontSaveFPRegs); |
- __ Jump(entry); |
- |
- __ Bind(&loop_bottom); |
- __ Sub(index, index, Operand(SharedFunctionInfo::kEntryLength)); |
- __ Cmp(index, Operand(1)); |
- __ B(gt, &loop_top); |
- |
- // We found neither literals nor code. |
- __ B(&gotta_call_runtime); |
- |
- __ Bind(&maybe_call_runtime); |
- |
- // Last possibility. Check the context free optimized code map entry. |
- __ Ldr(entry, FieldMemOperand(map, FixedArray::kHeaderSize + |
- SharedFunctionInfo::kSharedCodeIndex)); |
- __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
- __ JumpIfSmi(entry, &try_shared); |
- |
- // Store code entry in the closure. |
- __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
- __ B(&install_optimized_code_and_tailcall); |
- |
- __ Bind(&try_shared); |
- // Is the full code valid? |
- __ Ldr(entry, |
- FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
- __ Ldr(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); |
- __ Ldr(x5, FieldMemOperand(entry, Code::kFlagsOffset)); |
- __ and_(x5, x5, Operand(Code::KindField::kMask)); |
- __ Mov(x5, Operand(x5, LSR, Code::KindField::kShift)); |
- __ Cmp(x5, Operand(Code::BUILTIN)); |
- __ B(eq, &gotta_call_runtime); |
- // Yes, install the full code. |
- __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
- __ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); |
- __ Jump(entry); |
- |
- __ Bind(&gotta_call_runtime); |
CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
GenerateTailCallToReturnedCode(masm); |
} |