Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index fc8a39a61f175947062e2f16b5343d53e1f42aa3..52d05d7eea9ecdf6559c3d015108f8c8cb6649e6 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -105,8 +105,8 @@ void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( |
void CreateAllocationSiteStub::InitializeInterfaceDescriptor( |
Isolate* isolate, |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { r2 }; |
- descriptor->register_param_count_ = 1; |
+ static Register registers[] = { r2, r3 }; |
+ descriptor->register_param_count_ = 2; |
descriptor->register_params_ = registers; |
descriptor->deoptimization_handler_ = NULL; |
} |
@@ -3022,33 +3022,35 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// megamorphic. |
// r0 : number of arguments to the construct function |
// r1 : the function to call |
- // r2 : cache cell for call target |
+ // r2 : Feedback vector |
+ // r3 : slot in feedback vector (Smi) |
Label initialize, done, miss, megamorphic, not_array_function; |
- ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
+ ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()), |
masm->isolate()->heap()->undefined_value()); |
- ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), |
+ ASSERT_EQ(*TypeFeedbackInfo::UninitializedSentinel(masm->isolate()), |
masm->isolate()->heap()->the_hole_value()); |
- // Load the cache state into r3. |
- __ ldr(r3, FieldMemOperand(r2, Cell::kValueOffset)); |
+ // Load the cache state into r4. |
+ __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
+ __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
// A monomorphic cache hit or an already megamorphic state: invoke the |
// function without changing the state. |
- __ cmp(r3, r1); |
+ __ cmp(r4, r1); |
__ 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 cell either some other function or an |
// AllocationSite. Do a map check on the object in ecx. |
- __ ldr(r5, FieldMemOperand(r3, 0)); |
+ __ ldr(r5, FieldMemOperand(r4, 0)); |
__ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
__ b(ne, &miss); |
// Make sure the function is the Array() function |
- __ LoadArrayFunction(r3); |
- __ cmp(r1, r3); |
+ __ LoadArrayFunction(r4); |
+ __ cmp(r1, r4); |
__ b(ne, &megamorphic); |
__ jmp(&done); |
@@ -3056,21 +3058,22 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// A monomorphic miss (i.e, here the cache is not uninitialized) goes |
// megamorphic. |
- __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); |
+ __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); |
__ b(eq, &initialize); |
// MegamorphicSentinel is an immortal immovable object (undefined) so no |
// write-barrier is needed. |
__ bind(&megamorphic); |
+ __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
- __ str(ip, FieldMemOperand(r2, Cell::kValueOffset)); |
+ __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
__ jmp(&done); |
// 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(r3); |
- __ cmp(r1, r3); |
+ __ LoadArrayFunction(r4); |
+ __ cmp(r1, r4); |
__ b(ne, ¬_array_function); |
// The target function is the Array constructor, |
@@ -3080,19 +3083,26 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// Arguments register must be smi-tagged to call out. |
__ SmiTag(r0); |
- __ Push(r2, r1, r0); |
+ __ Push(r3, r2, r1, r0); |
CreateAllocationSiteStub create_stub; |
__ CallStub(&create_stub); |
- __ Pop(r2, r1, r0); |
+ __ Pop(r3, r2, r1, r0); |
__ SmiUntag(r0); |
} |
__ b(&done); |
__ bind(¬_array_function); |
- __ str(r1, FieldMemOperand(r2, Cell::kValueOffset)); |
- // No need for a write barrier here - cells are rescanned. |
+ |
+ __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
+ __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
+ __ str(r1, MemOperand(r4, 0)); |
+ |
+ __ Push(r4, r2, r1); |
+ __ RecordWrite(r2, r4, r1, kLRHasNotBeenSaved, kDontSaveFPRegs, |
+ EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
+ __ Pop(r4, r2, r1); |
__ bind(&done); |
} |
@@ -3100,7 +3110,8 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
void CallFunctionStub::Generate(MacroAssembler* masm) { |
// r1 : the function to call |
- // r2 : cache cell for call target |
+ // r2 : feedback vector |
+ // r3 : (only if r2 is not undefined) slot in feedback vector (Smi) |
Label slow, non_function; |
// Check that the function is really a JavaScript function. |
@@ -3108,7 +3119,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { |
__ JumpIfSmi(r1, &non_function); |
// Goto slow case if we do not have a function. |
- __ CompareObjectType(r1, r3, r3, JS_FUNCTION_TYPE); |
+ __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); |
__ b(ne, &slow); |
if (RecordCallTarget()) { |
@@ -3127,13 +3138,14 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { |
// If there is a call target cache, mark it megamorphic in the |
// non-function case. MegamorphicSentinel is an immortal immovable |
// object (undefined) so no write barrier is needed. |
- ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
+ ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()), |
masm->isolate()->heap()->undefined_value()); |
+ __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); |
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
- __ str(ip, FieldMemOperand(r2, Cell::kValueOffset)); |
+ __ str(ip, FieldMemOperand(r5, FixedArray::kHeaderSize)); |
} |
// Check for function proxy. |
- __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); |
+ __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE)); |
__ b(ne, &non_function); |
__ push(r1); // put proxy as additional argument |
__ mov(r0, Operand(argc_ + 1, RelocInfo::NONE32)); |
@@ -3160,13 +3172,14 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { |
void CallConstructStub::Generate(MacroAssembler* masm) { |
// r0 : number of arguments |
// r1 : the function to call |
- // r2 : cache cell for call target |
+ // r2 : feedback vector |
+ // r3 : (only if r2 is not undefined) slot in feedback vector (Smi) |
Label slow, non_function_call; |
// Check that the function is not a smi. |
__ JumpIfSmi(r1, &non_function_call); |
// Check that the function is a JSFunction. |
- __ CompareObjectType(r1, r3, r3, JS_FUNCTION_TYPE); |
+ __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); |
__ b(ne, &slow); |
if (RecordCallTarget()) { |
@@ -3174,7 +3187,7 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
} |
// Jump to the function-specific construct stub. |
- Register jmp_reg = r3; |
+ Register jmp_reg = r4; |
__ ldr(jmp_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
__ ldr(jmp_reg, FieldMemOperand(jmp_reg, |
SharedFunctionInfo::kConstructStubOffset)); |
@@ -3182,10 +3195,10 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
// r0: number of arguments |
// r1: called object |
- // r3: object type |
+ // r4: object type |
Label do_call; |
__ bind(&slow); |
- __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); |
+ __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE)); |
__ b(ne, &non_function_call); |
__ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); |
__ jmp(&do_call); |
@@ -5270,7 +5283,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
// -- r0 : argc (only if argument_count_ == ANY) |
// -- r1 : constructor |
- // -- r2 : type info cell |
+ // -- r2 : feedback vector (fixed array or undefined) |
+ // -- r3 : slot index (if r2 is fixed array) |
// -- sp[0] : return address |
// -- sp[4] : last argument |
// ----------------------------------- |
@@ -5288,12 +5302,16 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
// We should either have undefined in ebx or a valid cell |
Label okay_here; |
- Handle<Map> cell_map = masm->isolate()->factory()->cell_map(); |
+ Handle<Map> fixed_array_map = masm->isolate()->factory()->fixed_array_map(); |
__ CompareRoot(r2, Heap::kUndefinedValueRootIndex); |
__ b(eq, &okay_here); |
- __ ldr(r3, FieldMemOperand(r2, 0)); |
- __ cmp(r3, Operand(cell_map)); |
- __ Assert(eq, kExpectedPropertyCellInRegisterEbx); |
+ __ ldr(r4, FieldMemOperand(r2, 0)); |
+ __ cmp(r4, Operand(fixed_array_map)); |
+ __ Assert(eq, kExpectedFixedArrayInRegisterR2); |
+ |
+ // r3 should be a smi if we don't have undefined in r2 |
+ __ AssertSmi(r3); |
+ |
__ bind(&okay_here); |
} |
@@ -5301,7 +5319,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
// Get the elements kind and case on that. |
__ CompareRoot(r2, Heap::kUndefinedValueRootIndex); |
__ b(eq, &no_info); |
- __ ldr(r2, FieldMemOperand(r2, Cell::kValueOffset)); |
+ __ add(r2, r2, Operand::PointerOffsetFromSmiKey(r3)); |
+ __ ldr(r2, FieldMemOperand(r2, FixedArray::kHeaderSize)); |
// If the type cell is undefined, or contains anything other than an |
// AllocationSite, call an array constructor that doesn't use AllocationSites. |