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

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

Issue 203173003: Array constructor expects AllocationSite or undefined as feedback. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports. Created 6 years, 9 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/arm/builtins-arm.cc ('k') | src/arm/lithium-codegen-arm.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 3014 matching lines...) Expand 10 before | Expand all | Expand 10 after
3025 // Check that the function is really a JavaScript function. 3025 // Check that the function is really a JavaScript function.
3026 // r1: pushed function (to be verified) 3026 // r1: pushed function (to be verified)
3027 __ JumpIfSmi(r1, &non_function); 3027 __ JumpIfSmi(r1, &non_function);
3028 3028
3029 // Goto slow case if we do not have a function. 3029 // Goto slow case if we do not have a function.
3030 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); 3030 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE);
3031 __ b(ne, &slow); 3031 __ b(ne, &slow);
3032 3032
3033 if (RecordCallTarget()) { 3033 if (RecordCallTarget()) {
3034 GenerateRecordCallTarget(masm); 3034 GenerateRecordCallTarget(masm);
3035 // Type information was updated. Because we may call Array, which
3036 // expects either undefined or an AllocationSite in ebx we need
3037 // to set ebx to undefined.
3038 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
3035 } 3039 }
3036 } 3040 }
3037 3041
3038 // Fast-case: Invoke the function now. 3042 // Fast-case: Invoke the function now.
3039 // r1: pushed function 3043 // r1: pushed function
3040 ParameterCount actual(argc_); 3044 ParameterCount actual(argc_);
3041 3045
3042 if (CallAsMethod()) { 3046 if (CallAsMethod()) {
3043 if (NeedsChecks()) { 3047 if (NeedsChecks()) {
3044 // Do not transform the receiver for strict mode functions. 3048 // Do not transform the receiver for strict mode functions.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3127 // vector (Smi) 3131 // vector (Smi)
3128 Label slow, non_function_call; 3132 Label slow, non_function_call;
3129 3133
3130 // Check that the function is not a smi. 3134 // Check that the function is not a smi.
3131 __ JumpIfSmi(r1, &non_function_call); 3135 __ JumpIfSmi(r1, &non_function_call);
3132 // Check that the function is a JSFunction. 3136 // Check that the function is a JSFunction.
3133 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); 3137 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE);
3134 __ b(ne, &slow); 3138 __ b(ne, &slow);
3135 3139
3136 if (RecordCallTarget()) { 3140 if (RecordCallTarget()) {
3141 Label feedback_register_initialized;
3137 GenerateRecordCallTarget(masm); 3142 GenerateRecordCallTarget(masm);
3143
3144 // Put the AllocationSite from the feedback vector into r2, or undefined.
3145 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3));
3146 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize));
3147 __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset));
3148 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex);
3149 __ b(eq, &feedback_register_initialized);
3150 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
3151 __ bind(&feedback_register_initialized);
3152 __ AssertUndefinedOrAllocationSite(r2, r5);
3138 } 3153 }
3139 3154
3140 // Jump to the function-specific construct stub. 3155 // Jump to the function-specific construct stub.
3141 Register jmp_reg = r4; 3156 Register jmp_reg = r4;
3142 __ ldr(jmp_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 3157 __ ldr(jmp_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
3143 __ ldr(jmp_reg, FieldMemOperand(jmp_reg, 3158 __ ldr(jmp_reg, FieldMemOperand(jmp_reg,
3144 SharedFunctionInfo::kConstructStubOffset)); 3159 SharedFunctionInfo::kConstructStubOffset));
3145 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); 3160 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag));
3146 3161
3147 // r0: number of arguments 3162 // r0: number of arguments
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after
5202 } else { 5217 } else {
5203 UNREACHABLE(); 5218 UNREACHABLE();
5204 } 5219 }
5205 } 5220 }
5206 5221
5207 5222
5208 void ArrayConstructorStub::Generate(MacroAssembler* masm) { 5223 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
5209 // ----------- S t a t e ------------- 5224 // ----------- S t a t e -------------
5210 // -- r0 : argc (only if argument_count_ == ANY) 5225 // -- r0 : argc (only if argument_count_ == ANY)
5211 // -- r1 : constructor 5226 // -- r1 : constructor
5212 // -- r2 : feedback vector (fixed array or megamorphic symbol) 5227 // -- r2 : AllocationSite or undefined
5213 // -- r3 : slot index (if r2 is fixed array)
5214 // -- sp[0] : return address 5228 // -- sp[0] : return address
5215 // -- sp[4] : last argument 5229 // -- sp[4] : last argument
5216 // ----------------------------------- 5230 // -----------------------------------
5217 5231
5218 ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()),
5219 masm->isolate()->heap()->megamorphic_symbol());
5220
5221 if (FLAG_debug_code) { 5232 if (FLAG_debug_code) {
5222 // The array construct code is only set for the global and natives 5233 // The array construct code is only set for the global and natives
5223 // builtin Array functions which always have maps. 5234 // builtin Array functions which always have maps.
5224 5235
5225 // Initial map for the builtin Array function should be a map. 5236 // Initial map for the builtin Array function should be a map.
5226 __ ldr(r4, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); 5237 __ ldr(r4, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset));
5227 // Will both indicate a NULL and a Smi. 5238 // Will both indicate a NULL and a Smi.
5228 __ tst(r4, Operand(kSmiTagMask)); 5239 __ tst(r4, Operand(kSmiTagMask));
5229 __ Assert(ne, kUnexpectedInitialMapForArrayFunction); 5240 __ Assert(ne, kUnexpectedInitialMapForArrayFunction);
5230 __ CompareObjectType(r4, r4, r5, MAP_TYPE); 5241 __ CompareObjectType(r4, r4, r5, MAP_TYPE);
5231 __ Assert(eq, kUnexpectedInitialMapForArrayFunction); 5242 __ Assert(eq, kUnexpectedInitialMapForArrayFunction);
5232 5243
5233 // We should either have the megamorphic symbol in ebx or a valid 5244 // We should either have undefined in r2 or a valid AllocationSite
5234 // fixed array. 5245 __ AssertUndefinedOrAllocationSite(r2, r4);
5235 Label okay_here;
5236 Handle<Map> fixed_array_map = masm->isolate()->factory()->fixed_array_map();
5237 __ CompareRoot(r2, Heap::kMegamorphicSymbolRootIndex);
5238 __ b(eq, &okay_here);
5239 __ ldr(r4, FieldMemOperand(r2, 0));
5240 __ cmp(r4, Operand(fixed_array_map));
5241 __ Assert(eq, kExpectedFixedArrayInRegisterR2);
5242
5243 // r3 should be a smi if we don't have undefined in r2
5244 __ AssertSmi(r3);
5245
5246 __ bind(&okay_here);
5247 } 5246 }
5248 5247
5249 Label no_info; 5248 Label no_info;
5250 // Get the elements kind and case on that. 5249 // Get the elements kind and case on that.
5251 __ CompareRoot(r2, Heap::kMegamorphicSymbolRootIndex); 5250 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex);
5252 __ b(eq, &no_info); 5251 __ b(eq, &no_info);
5253 __ add(r2, r2, Operand::PointerOffsetFromSmiKey(r3));
5254 __ ldr(r2, FieldMemOperand(r2, FixedArray::kHeaderSize));
5255
5256 // If the feedback vector is undefined, or contains anything other than an
5257 // AllocationSite, call an array constructor that doesn't use AllocationSites.
5258 __ ldr(r4, FieldMemOperand(r2, 0));
5259 __ CompareRoot(r4, Heap::kAllocationSiteMapRootIndex);
5260 __ b(ne, &no_info);
5261 5252
5262 __ ldr(r3, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset)); 5253 __ ldr(r3, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset));
5263 __ SmiUntag(r3); 5254 __ SmiUntag(r3);
5264 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); 5255 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
5265 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask)); 5256 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask));
5266 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 5257 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
5267 5258
5268 __ bind(&no_info); 5259 __ bind(&no_info);
5269 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 5260 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
5270 } 5261 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
5497 MemOperand(fp, 6 * kPointerSize), 5488 MemOperand(fp, 6 * kPointerSize),
5498 NULL); 5489 NULL);
5499 } 5490 }
5500 5491
5501 5492
5502 #undef __ 5493 #undef __
5503 5494
5504 } } // namespace v8::internal 5495 } } // namespace v8::internal
5505 5496
5506 #endif // V8_TARGET_ARCH_ARM 5497 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698