Index: src/builtins/ia32/builtins-ia32.cc |
diff --git a/src/builtins/ia32/builtins-ia32.cc b/src/builtins/ia32/builtins-ia32.cc |
index 74b181246b49cf4f0c8f81c2785f0c9c985d4868..29df50a0c7f9bb280dc28eb2b271a043095e703b 100644 |
--- a/src/builtins/ia32/builtins-ia32.cc |
+++ b/src/builtins/ia32/builtins-ia32.cc |
@@ -1055,6 +1055,7 @@ |
// ----------------------------------- |
// First lookup code, maybe we don't need to compile! |
Label gotta_call_runtime, gotta_call_runtime_no_stack; |
+ Label maybe_call_runtime; |
Label try_shared; |
Label loop_top, loop_bottom; |
@@ -1117,12 +1118,15 @@ |
__ mov(entry, FieldOperand(map, index, times_half_pointer_size, |
SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
__ mov(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. |
__ pop(closure); |
// Store code entry in the closure. |
__ lea(entry, FieldOperand(entry, Code::kHeaderSize)); |
+ |
+ Label install_optimized_code_and_tailcall; |
+ __ bind(&install_optimized_code_and_tailcall); |
__ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); |
__ RecordWriteCodeEntryField(closure, entry, eax); |
@@ -1156,8 +1160,20 @@ |
// We found neither literals nor code. |
__ jmp(&gotta_call_runtime); |
+ __ bind(&maybe_call_runtime); |
+ __ pop(closure); |
+ |
+ // Last possibility. Check the context free optimized code map entry. |
+ __ mov(entry, FieldOperand(map, FixedArray::kHeaderSize + |
+ SharedFunctionInfo::kSharedCodeIndex)); |
+ __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset)); |
+ __ JumpIfSmi(entry, &try_shared); |
+ |
+ // Store code entry in the closure. |
+ __ lea(entry, FieldOperand(entry, Code::kHeaderSize)); |
+ __ jmp(&install_optimized_code_and_tailcall); |
+ |
__ bind(&try_shared); |
- __ pop(closure); |
__ pop(new_target); |
__ pop(argument_count); |
// Is the full code valid? |