Index: src/builtins/arm64/builtins-arm64.cc |
diff --git a/src/builtins/arm64/builtins-arm64.cc b/src/builtins/arm64/builtins-arm64.cc |
index fdbe09cf8de1fc47de4a598ca82e97e681ed79d4..ac2ab4782c68f2700fa14809e9d1bf463a62dd1f 100644 |
--- a/src/builtins/arm64/builtins-arm64.cc |
+++ b/src/builtins/arm64/builtins-arm64.cc |
@@ -1350,12 +1350,6 @@ void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
Register closure = x1; |
Register map = x13; |
Register index = x2; |
- |
- // Do we have a valid feedback vector? |
- __ Ldr(index, FieldMemOperand(closure, JSFunction::kLiteralsOffset)); |
- __ Ldr(index, FieldMemOperand(index, LiteralsArray::kFeedbackVectorOffset)); |
- __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex, &gotta_call_runtime); |
- |
__ Ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
__ Ldr(map, |
FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); |
@@ -1363,6 +1357,7 @@ void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
__ Cmp(index, Operand(2)); |
__ B(lt, &gotta_call_runtime); |
+ // Find literals. |
// x3 : native context |
// x2 : length / index |
// x13 : optimized code map |
@@ -1382,6 +1377,17 @@ void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
__ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); |
__ Cmp(temp, native_context); |
__ 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; |
@@ -1391,7 +1397,7 @@ void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
__ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
__ JumpIfSmi(entry, &try_shared); |
- // Found code. Get it into the closure and return. |
+ // Found literals and code. Get them into the closure and return. |
__ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
__ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); |
__ RecordWriteCodeEntryField(closure, entry, x5); |
@@ -1420,7 +1426,7 @@ void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
__ Cmp(index, Operand(1)); |
__ B(gt, &loop_top); |
- // We found no code. |
+ // We found neither literals nor code. |
__ B(&gotta_call_runtime); |
__ Bind(&try_shared); |