Index: src/builtins/arm/builtins-arm.cc |
diff --git a/src/builtins/arm/builtins-arm.cc b/src/builtins/arm/builtins-arm.cc |
index 959ce2af671f2536910e21edec265b568f819665..3f1405cf424a040a72a098d599f87d8d5bfd08f6 100644 |
--- a/src/builtins/arm/builtins-arm.cc |
+++ b/src/builtins/arm/builtins-arm.cc |
@@ -1339,19 +1339,12 @@ void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
Register argument_count = r0; |
Register closure = r1; |
Register new_target = r3; |
- Register map = argument_count; |
- Register index = r2; |
- |
- // 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_no_stack); |
- |
__ push(argument_count); |
__ push(new_target); |
__ push(closure); |
+ Register map = argument_count; |
+ Register index = r2; |
__ ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
__ ldr(map, |
FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); |
@@ -1359,6 +1352,7 @@ void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
__ cmp(index, Operand(Smi::FromInt(2))); |
__ b(lt, &gotta_call_runtime); |
+ // Find literals. |
// r3 : native context |
// r2 : length / index |
// r0 : optimized code map |
@@ -1378,6 +1372,20 @@ 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. |
+ __ ldr(r4, MemOperand(sp, 0)); |
+ __ str(temp, FieldMemOperand(r4, JSFunction::kLiteralsOffset)); |
+ __ push(index); |
+ __ RecordWriteField(r4, JSFunction::kLiteralsOffset, temp, index, |
+ kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
+ OMIT_SMI_CHECK); |
+ __ pop(index); |
// Code available? |
Register entry = r4; |
@@ -1387,7 +1395,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. |
__ pop(closure); |
// Store code entry in the closure. |
__ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
@@ -1422,7 +1430,7 @@ void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
__ cmp(index, Operand(Smi::FromInt(1))); |
__ b(gt, &loop_top); |
- // We found no code. |
+ // We found neither literals nor code. |
__ jmp(&gotta_call_runtime); |
__ bind(&try_shared); |