Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 0ca56984ad0497a857ba9ea3f4406902e20b52d1..c1e1459ffb1b23271710ad5679c2bc8f01a086aa 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -4700,12 +4700,15 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// Special handling of the Array() function, which caches not only the |
// monomorphic Array function but the initial ElementsKind with special |
// sentinels |
- Handle<Object> terminal_kind_sentinel = |
- TypeFeedbackCells::MonomorphicArraySentinel(isolate, |
- LAST_FAST_ELEMENTS_KIND); |
__ JumpIfNotSmi(ecx, &miss); |
- __ cmp(ecx, Immediate(terminal_kind_sentinel)); |
- __ j(above, &miss); |
+ if (FLAG_debug_code) { |
+ Handle<Object> terminal_kind_sentinel = |
+ TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(), |
+ LAST_FAST_ELEMENTS_KIND); |
+ __ cmp(ecx, Immediate(terminal_kind_sentinel)); |
+ __ Assert(less_equal, "Array function sentinel is not an ElementsKind"); |
+ } |
+ |
// Load the global or builtins object from the current context |
__ LoadGlobalContext(ecx); |
// Make sure the function is the Array() function |
@@ -7793,6 +7796,10 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm) { |
__ cmp(ebx, Immediate(undefined_sentinel)); |
__ j(equal, &normal_sequence); |
+ // The type cell may have gone megamorphic, don't overwrite if so |
+ __ mov(ecx, FieldOperand(ebx, kPointerSize)); |
+ __ JumpIfNotSmi(ecx, &normal_sequence); |
+ |
// Save the resulting elements kind in type info |
__ SmiTag(edx); |
__ mov(FieldOperand(ebx, kPointerSize), edx); |
@@ -7822,10 +7829,10 @@ static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { |
TERMINAL_FAST_ELEMENTS_KIND); |
for (int i = 0; i <= to_index; ++i) { |
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
- T stub(kind, false); |
+ T stub(kind); |
stub.GetCode(isolate)->set_is_pregenerated(true); |
if (AllocationSiteInfo::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { |
- T stub1(kind, true); |
+ T stub1(kind, CONTEXT_CHECK_REQUIRED, DISABLE_ALLOCATION_SITES); |
stub1.GetCode(isolate)->set_is_pregenerated(true); |
} |
} |