Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 172383003: Revert "Second attempt at introducing a premonomorphic state in the call" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/a64/code-stubs-a64.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 3005
3006 3006
3007 static void GenerateRecordCallTarget(MacroAssembler* masm) { 3007 static void GenerateRecordCallTarget(MacroAssembler* masm) {
3008 // Cache the called function in a feedback vector slot. Cache states 3008 // Cache the called function in a feedback vector slot. Cache states
3009 // are uninitialized, monomorphic (indicated by a JSFunction), and 3009 // are uninitialized, monomorphic (indicated by a JSFunction), and
3010 // megamorphic. 3010 // megamorphic.
3011 // r0 : number of arguments to the construct function 3011 // r0 : number of arguments to the construct function
3012 // r1 : the function to call 3012 // r1 : the function to call
3013 // r2 : Feedback vector 3013 // r2 : Feedback vector
3014 // r3 : slot in feedback vector (Smi) 3014 // r3 : slot in feedback vector (Smi)
3015 Label check_array, initialize_array, initialize_non_array, megamorphic, done; 3015 Label initialize, done, miss, megamorphic, not_array_function;
3016 3016
3017 ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()), 3017 ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()),
3018 masm->isolate()->heap()->undefined_value()); 3018 masm->isolate()->heap()->undefined_value());
3019 Heap::RootListIndex kMegamorphicRootIndex = Heap::kUndefinedValueRootIndex;
3020 ASSERT_EQ(*TypeFeedbackInfo::UninitializedSentinel(masm->isolate()), 3019 ASSERT_EQ(*TypeFeedbackInfo::UninitializedSentinel(masm->isolate()),
3021 masm->isolate()->heap()->the_hole_value()); 3020 masm->isolate()->heap()->the_hole_value());
3022 Heap::RootListIndex kUninitializedRootIndex = Heap::kTheHoleValueRootIndex;
3023 ASSERT_EQ(*TypeFeedbackInfo::PremonomorphicSentinel(masm->isolate()),
3024 masm->isolate()->heap()->null_value());
3025 Heap::RootListIndex kPremonomorphicRootIndex = Heap::kNullValueRootIndex;
3026 3021
3027 // Load the cache state into r4. 3022 // Load the cache state into r4.
3028 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); 3023 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3));
3029 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); 3024 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize));
3030 3025
3031 // A monomorphic cache hit or an already megamorphic state: invoke the 3026 // A monomorphic cache hit or an already megamorphic state: invoke the
3032 // function without changing the state. 3027 // function without changing the state.
3033 __ cmp(r4, r1); 3028 __ cmp(r4, r1);
3034 __ b(eq, &done); 3029 __ b(eq, &done);
3035 __ CompareRoot(r4, kMegamorphicRootIndex);
3036 __ b(eq, &done);
3037 3030
3038 // Check if we're dealing with the Array function or not. 3031 // If we came here, we need to see if we are the array function.
3039 __ LoadArrayFunction(r5); 3032 // If we didn't have a matching function, and we didn't find the megamorph
3040 __ cmp(r1, r5); 3033 // sentinel, then we have in the slot either some other function or an
3041 __ b(eq, &check_array); 3034 // AllocationSite. Do a map check on the object in ecx.
3035 __ ldr(r5, FieldMemOperand(r4, 0));
3036 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex);
3037 __ b(ne, &miss);
3042 3038
3043 // Non-array cache: Check the cache state. 3039 // Make sure the function is the Array() function
3044 __ CompareRoot(r4, kPremonomorphicRootIndex); 3040 __ LoadArrayFunction(r4);
3045 __ b(eq, &initialize_non_array); 3041 __ cmp(r1, r4);
3046 __ CompareRoot(r4, kUninitializedRootIndex);
3047 __ b(ne, &megamorphic); 3042 __ b(ne, &megamorphic);
3043 __ jmp(&done);
3048 3044
3049 // Non-array cache: Uninitialized -> premonomorphic. The sentinel is an 3045 __ bind(&miss);
3050 // immortal immovable object (null) so no write-barrier is needed. 3046
3047 // A monomorphic miss (i.e, here the cache is not uninitialized) goes
3048 // megamorphic.
3049 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex);
3050 __ b(eq, &initialize);
3051 // MegamorphicSentinel is an immortal immovable object (undefined) so no
3052 // write-barrier is needed.
3053 __ bind(&megamorphic);
3051 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); 3054 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3));
3052 __ LoadRoot(ip, kPremonomorphicRootIndex); 3055 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3053 __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); 3056 __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize));
3054 __ jmp(&done); 3057 __ jmp(&done);
3055 3058
3056 // Array cache: Check the cache state to see if we're in a monomorphic 3059 // An uninitialized cache is patched with the function or sentinel to
3057 // state where the state object is an AllocationSite object. 3060 // indicate the ElementsKind if function is the Array constructor.
3058 __ bind(&check_array); 3061 __ bind(&initialize);
3059 __ ldr(r5, FieldMemOperand(r4, 0)); 3062 // Make sure the function is the Array() function
3060 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); 3063 __ LoadArrayFunction(r4);
3061 __ b(eq, &done); 3064 __ cmp(r1, r4);
3065 __ b(ne, &not_array_function);
3062 3066
3063 // Array cache: Uninitialized or premonomorphic -> monomorphic. 3067 // The target function is the Array constructor,
3064 __ CompareRoot(r4, kUninitializedRootIndex); 3068 // Create an AllocationSite if we don't already have it, store it in the slot.
3065 __ b(eq, &initialize_array);
3066 __ CompareRoot(r4, kPremonomorphicRootIndex);
3067 __ b(eq, &initialize_array);
3068
3069 // Both caches: Monomorphic -> megamorphic. The sentinel is an
3070 // immortal immovable object (undefined) so no write-barrier is needed.
3071 __ bind(&megamorphic);
3072 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3));
3073 __ LoadRoot(ip, kMegamorphicRootIndex);
3074 __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize));
3075 __ jmp(&done);
3076
3077 // Array cache: Uninitialized or premonomorphic -> monomorphic.
3078 __ bind(&initialize_array);
3079 { 3069 {
3080 FrameScope scope(masm, StackFrame::INTERNAL); 3070 FrameScope scope(masm, StackFrame::INTERNAL);
3081 3071
3082 // Arguments register must be smi-tagged to call out. 3072 // Arguments register must be smi-tagged to call out.
3083 __ SmiTag(r0); 3073 __ SmiTag(r0);
3084 __ Push(r3, r2, r1, r0); 3074 __ Push(r3, r2, r1, r0);
3085 3075
3086 CreateAllocationSiteStub create_stub; 3076 CreateAllocationSiteStub create_stub;
3087 __ CallStub(&create_stub); 3077 __ CallStub(&create_stub);
3088 3078
3089 __ Pop(r3, r2, r1, r0); 3079 __ Pop(r3, r2, r1, r0);
3090 __ SmiUntag(r0); 3080 __ SmiUntag(r0);
3091 } 3081 }
3092 __ b(&done); 3082 __ b(&done);
3093 3083
3094 // Non-array cache: Premonomorphic -> monomorphic. 3084 __ bind(&not_array_function);
3095 __ bind(&initialize_non_array); 3085
3096 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); 3086 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3));
3097 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 3087 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
3098 __ str(r1, MemOperand(r4, 0)); 3088 __ str(r1, MemOperand(r4, 0));
3099 3089
3100 __ Push(r4, r2, r1); 3090 __ Push(r4, r2, r1);
3101 __ RecordWrite(r2, r4, r1, kLRHasNotBeenSaved, kDontSaveFPRegs, 3091 __ RecordWrite(r2, r4, r1, kLRHasNotBeenSaved, kDontSaveFPRegs,
3102 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 3092 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
3103 __ Pop(r4, r2, r1); 3093 __ Pop(r4, r2, r1);
3104 3094
3105 __ bind(&done); 3095 __ bind(&done);
(...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after
5590 MemOperand(fp, 6 * kPointerSize), 5580 MemOperand(fp, 6 * kPointerSize),
5591 NULL); 5581 NULL);
5592 } 5582 }
5593 5583
5594 5584
5595 #undef __ 5585 #undef __
5596 5586
5597 } } // namespace v8::internal 5587 } } // namespace v8::internal
5598 5588
5599 #endif // V8_TARGET_ARCH_ARM 5589 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/a64/code-stubs-a64.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698