Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index 44de7aabc3e998cf9bf7990a28b784f10b620894..282a6d87562981a3368c8a8c3e7a26e044afc443 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; |
} |
@@ -3004,38 +3004,40 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { |
static void GenerateRecordCallTarget(MacroAssembler* masm) { |
- // Cache the called function in a global property cell. Cache states |
+ // Cache the called function in a feedback vector slot. Cache states |
// are uninitialized, monomorphic (indicated by a JSFunction), and |
// 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 |
+ // sentinel, then we have in the slot 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); |
@@ -3043,43 +3045,51 @@ 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, |
- // Create an AllocationSite if we don't already have it, store it in the cell |
+ // Create an AllocationSite if we don't already have it, store it in the slot. |
{ |
FrameScope scope(masm, StackFrame::INTERNAL); |
// 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); |
} |
@@ -3087,7 +3097,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, wrap, cont; |
if (NeedsChecks()) { |
@@ -3096,7 +3107,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()) { |
@@ -3144,13 +3155,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)); |
@@ -3190,13 +3202,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()) { |
@@ -3204,7 +3217,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)); |
@@ -3212,10 +3225,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); |
@@ -5175,7 +5188,7 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm, |
__ TailCallStub(&stub); |
} else if (mode == DONT_OVERRIDE) { |
// We are going to create a holey array, but our kind is non-holey. |
- // Fix kind and retry (only if we have an allocation site in the cell). |
+ // Fix kind and retry (only if we have an allocation site in the slot). |
__ add(r3, r3, Operand(1)); |
if (FLAG_debug_code) { |
@@ -5283,7 +5296,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 |
// ----------------------------------- |
@@ -5292,21 +5306,25 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
// builtin Array functions which always have maps. |
// Initial map for the builtin Array function should be a map. |
- __ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); |
+ __ ldr(r4, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); |
// Will both indicate a NULL and a Smi. |
- __ tst(r3, Operand(kSmiTagMask)); |
+ __ tst(r4, Operand(kSmiTagMask)); |
__ Assert(ne, kUnexpectedInitialMapForArrayFunction); |
- __ CompareObjectType(r3, r3, r4, MAP_TYPE); |
+ __ CompareObjectType(r4, r4, r5, MAP_TYPE); |
__ Assert(eq, kUnexpectedInitialMapForArrayFunction); |
- // We should either have undefined in ebx or a valid cell |
+ // We should either have undefined in ebx or a valid fixed array. |
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); |
} |
@@ -5314,9 +5332,10 @@ 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 |
+ // If the feedback vector is undefined, or contains anything other than an |
// AllocationSite, call an array constructor that doesn't use AllocationSites. |
__ ldr(r4, FieldMemOperand(r2, 0)); |
__ CompareRoot(r4, Heap::kAllocationSiteMapRootIndex); |