Index: src/a64/code-stubs-a64.cc |
diff --git a/src/a64/code-stubs-a64.cc b/src/a64/code-stubs-a64.cc |
index 269b97f41c17fe8d4107bceb1fbaf832977aabeb..10161746fa3eef509f2f4b03ec9aa2bb3e9254aa 100644 |
--- a/src/a64/code-stubs-a64.cc |
+++ b/src/a64/code-stubs-a64.cc |
@@ -113,18 +113,6 @@ void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( |
} |
-void CreateAllocationSiteStub::InitializeInterfaceDescriptor( |
- Isolate* isolate, |
- CodeStubInterfaceDescriptor* descriptor) { |
- // x2: feedback vector |
- // x3: call feedback slot |
- static Register registers[] = { x2, x3 }; |
- descriptor->register_param_count_ = sizeof(registers) / sizeof(registers[0]); |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = NULL; |
-} |
- |
- |
void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( |
Isolate* isolate, |
CodeStubInterfaceDescriptor* descriptor) { |
@@ -1292,7 +1280,6 @@ void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
- CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
BinaryOpICStub::GenerateAheadOfTime(isolate); |
BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); |
} |
@@ -3202,19 +3189,6 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
__ Cmp(x4, x1); |
__ B(eq, &done); |
- // If we came here, we need to see if we are the array function. |
- // If we didn't have a matching function, and we didn't find the megamorph |
- // sentinel, then we have in the slot either some other function or an |
- // AllocationSite. Do a map check on the object in ecx. |
- __ Ldr(x5, FieldMemOperand(x4, AllocationSite::kMapOffset)); |
- __ JumpIfNotRoot(x5, Heap::kAllocationSiteMapRootIndex, &miss); |
- |
- // Make sure the function is the Array() function |
- __ LoadArrayFunction(x4); |
- __ Cmp(x1, x4); |
- __ B(ne, &megamorphic); |
- __ B(&done); |
- |
__ Bind(&miss); |
// A monomorphic miss (i.e, here the cache is not uninitialized) goes |
@@ -3231,31 +3205,8 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// An uninitialized cache is patched with the function or sentinel to |
// indicate the ElementsKind if function is the Array constructor. |
__ Bind(&initialize); |
- // Make sure the function is the Array() function |
- __ LoadArrayFunction(x4); |
- __ Cmp(x1, x4); |
- __ B(ne, ¬_array_function); |
- // The target function is the Array constructor, |
- // Create an AllocationSite if we don't already have it, store it in the slot. |
- { |
- FrameScope scope(masm, StackFrame::INTERNAL); |
- CreateAllocationSiteStub create_stub; |
- |
- // Arguments register must be smi-tagged to call out. |
- __ SmiTag(x0); |
- __ Push(x0, x1, x2, x3); |
- |
- __ CallStub(&create_stub); |
- |
- __ Pop(x3, x2, x1, x0); |
- __ SmiUntag(x0); |
- } |
- __ B(&done); |
- |
- __ Bind(¬_array_function); |
// An uninitialized cache is patched with the function. |
- |
__ Add(x4, x2, Operand::UntagSmiAndScale(x3, kPointerSizeLog2)); |
// TODO(all): Does the value need to be left in x4? If not, FieldMemOperand |
// could be used to avoid this add. |
@@ -3268,7 +3219,6 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
__ Pop(x1, x2, x4); |
// TODO(all): Are x4, x2 and x1 outputs? This isn't clear. |
- |
__ Bind(&done); |
} |
@@ -3296,6 +3246,10 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { |
if (RecordCallTarget()) { |
GenerateRecordCallTarget(masm); |
+ // 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(x2, Heap::kUndefinedValueRootIndex); |
} |
} |
@@ -3401,6 +3355,12 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
if (RecordCallTarget()) { |
GenerateRecordCallTarget(masm); |
+ // Put the AllocationSite from the feedback vector into x2. |
+ // By adding kPointerSize we encode that we know the AllocationSite |
+ // entry is at the feedback vector slot given by x3 + 1. |
+ __ Add(x5, x2, Operand::UntagSmiAndScale(x3, kPointerSizeLog2)); |
+ __ Ldr(x2, FieldMemOperand(x5, FixedArray::kHeaderSize + kPointerSize)); |
+ __ AssertUndefinedOrAllocationSite(x2, x5); |
} |
// Jump to the function-specific construct stub. |
@@ -5403,14 +5363,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 undefined) |
- // -- 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; |
+ Register allocation_site = x2; |
if (FLAG_debug_code) { |
// The array construct code is only set for the global and natives |
@@ -5427,34 +5385,14 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
__ Abort(kUnexpectedInitialMapForArrayFunction); |
__ Bind(&map_ok); |
- // In feedback_vector, we expect either undefined or a valid fixed array. |
- Label okay_here; |
- Handle<Map> fixed_array_map = masm->isolate()->factory()->fixed_array_map(); |
- __ JumpIfRoot(feedback_vector, Heap::kUndefinedValueRootIndex, &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 ebx or a valid AllocationSite |
Hannes Payer (out of office)
2014/02/18 16:24:26
x10
mvstanton
2014/02/19 08:40:26
Done.
|
+ __ 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::kUndefinedValueRootIndex, &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 undefined, 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, |