Index: src/a64/code-stubs-a64.cc |
diff --git a/src/a64/code-stubs-a64.cc b/src/a64/code-stubs-a64.cc |
index 2996df9b82d6863bb54e67739a22c9ba7415f4c8..fa8d22a873d3edf46deab080fa2e01af566748d5 100644 |
--- a/src/a64/code-stubs-a64.cc |
+++ b/src/a64/code-stubs-a64.cc |
@@ -3306,6 +3306,10 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { |
if (RecordCallTarget()) { |
GenerateRecordCallTarget(masm, x0, function, cache_cell, slot, x4, x5); |
+ // Type information was updated. Because we may call Array, which |
+ // expects either undefined or an AllocationSite in ebx we need |
+ // to set ebx to undefined. |
+ __ LoadRoot(cache_cell, Heap::kUndefinedValueRootIndex); |
} |
} |
@@ -3410,7 +3414,18 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
&slow); |
if (RecordCallTarget()) { |
+ Label feedback_register_initialized; |
GenerateRecordCallTarget(masm, x0, function, x2, x3, x4, x5); |
+ |
+ // Put the AllocationSite from the feedback vector into x2, or undefined. |
+ __ Add(x5, x2, Operand::UntagSmiAndScale(x3, kPointerSizeLog2)); |
+ __ Ldr(x2, FieldMemOperand(x5, FixedArray::kHeaderSize)); |
+ __ Ldr(x5, FieldMemOperand(x2, AllocationSite::kMapOffset)); |
+ __ JumpIfRoot(x5, Heap::kAllocationSiteMapRootIndex, |
+ &feedback_register_initialized); |
+ __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); |
+ __ bind(&feedback_register_initialized); |
+ __ AssertUndefinedOrAllocationSite(x2, x5); |
} |
// Jump to the function-specific construct stub. |
@@ -5405,17 +5420,12 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
// -- x0 : argc (only if argument_count_ == ANY) |
// -- x1 : constructor |
- // -- x2 : feedback vector (fixed array or the megamorphic symbol) |
- // -- x3 : slot index (if x2 is fixed array) |
+ // -- x2 : AllocationSite or undefined |
// -- sp[0] : return address |
// -- sp[4] : last argument |
// ----------------------------------- |
Register constructor = x1; |
- Register feedback_vector = x2; |
- Register slot_index = x3; |
- |
- ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()), |
- masm->isolate()->heap()->megamorphic_symbol()); |
+ Register allocation_site = x2; |
if (FLAG_debug_code) { |
// The array construct code is only set for the global and natives |
@@ -5432,37 +5442,15 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
__ Abort(kUnexpectedInitialMapForArrayFunction); |
__ Bind(&map_ok); |
- // In feedback_vector, we expect either the megamorphic symbol or a valid |
- // fixed array. |
- Label okay_here; |
- Handle<Map> fixed_array_map = masm->isolate()->factory()->fixed_array_map(); |
- __ JumpIfRoot(feedback_vector, Heap::kMegamorphicSymbolRootIndex, |
- &okay_here); |
- __ Ldr(x10, FieldMemOperand(feedback_vector, FixedArray::kMapOffset)); |
- __ Cmp(x10, Operand(fixed_array_map)); |
- __ Assert(eq, kExpectedFixedArrayInFeedbackVector); |
- |
- // slot_index should be a smi if we don't have undefined in feedback_vector. |
- __ AssertSmi(slot_index); |
- |
- __ Bind(&okay_here); |
+ // We should either have undefined in the allocation_site register or a |
+ // valid AllocationSite. |
+ __ AssertUndefinedOrAllocationSite(allocation_site, x10); |
} |
- Register allocation_site = x2; // Overwrites feedback_vector. |
Register kind = x3; |
Label no_info; |
// Get the elements kind and case on that. |
- __ JumpIfRoot(feedback_vector, Heap::kMegamorphicSymbolRootIndex, &no_info); |
- __ Add(feedback_vector, feedback_vector, |
- Operand::UntagSmiAndScale(slot_index, kPointerSizeLog2)); |
- __ Ldr(allocation_site, FieldMemOperand(feedback_vector, |
- FixedArray::kHeaderSize)); |
- |
- // If the feedback vector is the megamorphic symbol, or contains anything |
- // other than an AllocationSite, call an array constructor that doesn't |
- // use AllocationSites. |
- __ Ldr(x10, FieldMemOperand(allocation_site, AllocationSite::kMapOffset)); |
- __ JumpIfNotRoot(x10, Heap::kAllocationSiteMapRootIndex, &no_info); |
+ __ JumpIfRoot(allocation_site, Heap::kUndefinedValueRootIndex, &no_info); |
__ Ldrsw(kind, |
UntagSmiFieldMemOperand(allocation_site, |