Chromium Code Reviews| Index: src/ia32/code-stubs-ia32.cc |
| diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
| index 48b59996e9350e1a6dec91aad205d62f2f3edb76..e459da7335c66b5f91beee9dc8d798d66fe0f272 100644 |
| --- a/src/ia32/code-stubs-ia32.cc |
| +++ b/src/ia32/code-stubs-ia32.cc |
| @@ -110,8 +110,8 @@ void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( |
| void CreateAllocationSiteStub::InitializeInterfaceDescriptor( |
| Isolate* isolate, |
| CodeStubInterfaceDescriptor* descriptor) { |
| - static Register registers[] = { ebx }; |
| - descriptor->register_param_count_ = 1; |
| + static Register registers[] = { ebx, edx }; |
| + descriptor->register_param_count_ = 2; |
| descriptor->register_params_ = registers; |
| descriptor->deoptimization_handler_ = NULL; |
| } |
| @@ -2459,20 +2459,22 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
| // are uninitialized, monomorphic (indicated by a JSFunction), and |
| // megamorphic. |
| // eax : number of arguments to the construct function |
| - // ebx : cache cell for call target |
| + // ebx : Feedback vector |
|
danno
2014/01/28 08:27:17
Boy, I wish we would generate all the code here an
|
| + // edx : slot in feedback vector (Smi) |
| // edi : the function to call |
| Isolate* isolate = masm->isolate(); |
| Label initialize, done, miss, megamorphic, not_array_function; |
| // Load the cache state into ecx. |
| - __ mov(ecx, FieldOperand(ebx, Cell::kValueOffset)); |
| + __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
| + FixedArray::kHeaderSize)); |
| // A monomorphic cache hit or an already megamorphic state: invoke the |
| // function without changing the state. |
| __ cmp(ecx, edi); |
| - __ j(equal, &done); |
| - __ cmp(ecx, Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); |
| - __ j(equal, &done); |
| + __ j(equal, &done, Label::kFar); |
| + __ cmp(ecx, Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); |
| + __ j(equal, &done, Label::kFar); |
| // 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 |
| @@ -2489,20 +2491,21 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
| __ cmp(edi, Operand(ecx, |
| Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); |
| __ j(not_equal, &megamorphic); |
| - __ jmp(&done); |
| + __ jmp(&done, Label::kFar); |
| __ bind(&miss); |
| // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| // megamorphic. |
| - __ cmp(ecx, Immediate(TypeFeedbackCells::UninitializedSentinel(isolate))); |
| + __ cmp(ecx, Immediate(TypeFeedbackInfo::UninitializedSentinel(isolate))); |
| __ j(equal, &initialize); |
| // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| // write-barrier is needed. |
| __ bind(&megamorphic); |
| - __ mov(FieldOperand(ebx, Cell::kValueOffset), |
| - Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); |
| - __ jmp(&done, Label::kNear); |
| + __ mov(FieldOperand(ebx, edx, times_half_pointer_size, |
| + FixedArray::kHeaderSize), |
| + Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); |
| + __ jmp(&done, Label::kFar); |
| // An uninitialized cache is patched with the function or sentinel to |
| // indicate the ElementsKind if function is the Array constructor. |
| @@ -2522,12 +2525,14 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
| __ SmiTag(eax); |
| __ push(eax); |
| __ push(edi); |
| + __ push(edx); |
| __ push(ebx); |
| CreateAllocationSiteStub create_stub; |
| __ CallStub(&create_stub); |
| __ pop(ebx); |
| + __ pop(edx); |
| __ pop(edi); |
| __ pop(eax); |
| __ SmiUntag(eax); |
| @@ -2535,15 +2540,26 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
| __ jmp(&done); |
| __ bind(¬_array_function); |
| - __ mov(FieldOperand(ebx, Cell::kValueOffset), edi); |
| - // No need for a write barrier here - cells are rescanned. |
| + __ mov(FieldOperand(ebx, edx, times_half_pointer_size, |
| + FixedArray::kHeaderSize), |
| + edi); |
| + // We won't need edx or ebx anymore, just save edi |
| + __ push(edi); |
| + __ push(ebx); |
| + __ push(edx); |
| + __ RecordWriteArray(ebx, edi, edx, kDontSaveFPRegs, |
| + EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
| + __ pop(edx); |
| + __ pop(ebx); |
| + __ pop(edi); |
| __ bind(&done); |
| } |
| void CallFunctionStub::Generate(MacroAssembler* masm) { |
| - // ebx : cache cell for call target |
| + // ebx : feedback vector |
| + // edx : (only if ebx is not undefined) slot in feedback vector (Smi) |
| // edi : the function to call |
| Isolate* isolate = masm->isolate(); |
| Label slow, non_function; |
| @@ -2570,8 +2586,9 @@ 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. |
| - __ mov(FieldOperand(ebx, Cell::kValueOffset), |
| - Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); |
| + __ mov(FieldOperand(ebx, edx, times_half_pointer_size, |
| + FixedArray::kHeaderSize), |
| + Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); |
| } |
| // Check for function proxy. |
| __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); |
| @@ -2601,7 +2618,8 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { |
| void CallConstructStub::Generate(MacroAssembler* masm) { |
| // eax : number of arguments |
| - // ebx : cache cell for call target |
| + // ebx : feedback vector |
| + // edx : (only if ebx is not undefined) slot in feedback vector (Smi) |
| // edi : constructor function |
| Label slow, non_function_call; |
| @@ -5241,7 +5259,8 @@ void ArrayConstructorStub::GenerateDispatchToArrayStub( |
| void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
| // ----------- S t a t e ------------- |
| // -- eax : argc (only if argument_count_ == ANY) |
| - // -- ebx : type info cell |
| + // -- ebx : feedback vector |
| + // -- edx : slot index |
| // -- edi : constructor |
| // -- esp[0] : return address |
| // -- esp[4] : last argument |
| @@ -5264,10 +5283,11 @@ 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(); |
| __ cmp(ebx, Immediate(undefined_sentinel)); |
| __ j(equal, &okay_here); |
| - __ cmp(FieldOperand(ebx, 0), Immediate(cell_map)); |
| + __ cmp(FieldOperand(ebx, 0), Immediate(fixed_array_map)); |
| + // TODO(mvstanton): change this message below. |
| __ Assert(equal, kExpectedPropertyCellInRegisterEbx); |
| __ bind(&okay_here); |
| } |
| @@ -5277,7 +5297,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
| // AllocationSite, call an array constructor that doesn't use AllocationSites. |
| __ cmp(ebx, Immediate(undefined_sentinel)); |
| __ j(equal, &no_info); |
| - __ mov(ebx, FieldOperand(ebx, Cell::kValueOffset)); |
| + __ mov(ebx, FieldOperand(ebx, edx, times_half_pointer_size, |
| + FixedArray::kHeaderSize)); |
| __ cmp(FieldOperand(ebx, 0), Immediate( |
| masm->isolate()->factory()->allocation_site_map())); |
| __ j(not_equal, &no_info); |