| Index: src/arm64/builtins-arm64.cc
 | 
| diff --git a/src/arm64/builtins-arm64.cc b/src/arm64/builtins-arm64.cc
 | 
| index e790ba33049a7173d810de0bbc7a5a3ad7b772e8..4ed33a0072a6ae8628fce88646a1fe49bcae12c0 100644
 | 
| --- a/src/arm64/builtins-arm64.cc
 | 
| +++ b/src/arm64/builtins-arm64.cc
 | 
| @@ -1177,138 +1177,6 @@
 | 
|  
 | 
|  
 | 
|  void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
 | 
| -  // ----------- S t a t e -------------
 | 
| -  //  -- x0 : argument count (preserved for callee)
 | 
| -  //  -- 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 = x13;
 | 
| -  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
 | 
| -  // x13 : 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::kOffsetToPreviousContext));
 | 
| -  __ 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::kOffsetToPreviousOsrAstId));
 | 
| -  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::kOffsetToPreviousLiterals));
 | 
| -  __ 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::kOffsetToPreviousCachedCode));
 | 
| -  __ 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));
 | 
| -  __ RecordWriteCodeEntryField(closure, entry, x5);
 | 
| -
 | 
| -  // 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, x13,
 | 
| -                      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, x13,
 | 
| -                            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));
 | 
| -  __ RecordWriteCodeEntryField(closure, entry, x5);
 | 
| -  __ Jump(entry);
 | 
| -
 | 
| -  __ Bind(&gotta_call_runtime);
 | 
|    GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy);
 | 
|  }
 | 
|  
 | 
| 
 |