Index: src/builtins/x64/builtins-x64.cc |
diff --git a/src/builtins/x64/builtins-x64.cc b/src/builtins/x64/builtins-x64.cc |
index afd678fa25c353568031d0ef42050bc5de7d3e54..fb1c5982d3360c991fe2e8db5267fef3de6309d4 100644 |
--- a/src/builtins/x64/builtins-x64.cc |
+++ b/src/builtins/x64/builtins-x64.cc |
@@ -1031,6 +1031,7 @@ |
// ----------------------------------- |
// 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; |
@@ -1084,10 +1085,13 @@ |
__ movp(entry, FieldOperand(map, index, times_pointer_size, |
SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
__ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); |
- __ JumpIfSmi(entry, &try_shared); |
+ __ JumpIfSmi(entry, &maybe_call_runtime); |
// Found literals and code. Get them into the closure and return. |
__ leap(entry, FieldOperand(entry, Code::kHeaderSize)); |
+ |
+ Label install_optimized_code_and_tailcall; |
+ __ bind(&install_optimized_code_and_tailcall); |
__ movp(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); |
__ RecordWriteCodeEntryField(closure, entry, r15); |
@@ -1119,6 +1123,18 @@ |
// We found neither literals nor code. |
__ jmp(&gotta_call_runtime); |
+ |
+ __ bind(&maybe_call_runtime); |
+ |
+ // Last possibility. Check the context free optimized code map entry. |
+ __ movp(entry, FieldOperand(map, FixedArray::kHeaderSize + |
+ SharedFunctionInfo::kSharedCodeIndex)); |
+ __ movp(entry, FieldOperand(entry, WeakCell::kValueOffset)); |
+ __ JumpIfSmi(entry, &try_shared); |
+ |
+ // Store code entry in the closure. |
+ __ leap(entry, FieldOperand(entry, Code::kHeaderSize)); |
+ __ jmp(&install_optimized_code_and_tailcall); |
__ bind(&try_shared); |
// Is the full code valid? |