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

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

Issue 1442643009: Rename original constructor to new target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 1 month 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
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/interface-descriptors-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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 #endif // V8_INTERPRETED_REGEXP 2262 #endif // V8_INTERPRETED_REGEXP
2263 } 2263 }
2264 2264
2265 2265
2266 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub, 2266 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub,
2267 bool is_super) { 2267 bool is_super) {
2268 // r0 : number of arguments to the construct function 2268 // r0 : number of arguments to the construct function
2269 // r1 : the function to call 2269 // r1 : the function to call
2270 // r2 : feedback vector 2270 // r2 : feedback vector
2271 // r3 : slot in feedback vector (Smi) 2271 // r3 : slot in feedback vector (Smi)
2272 // r4 : original constructor (for IsSuperConstructorCall) 2272 // r4 : new target (for IsSuperConstructorCall)
2273 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 2273 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
2274 2274
2275 // Number-of-arguments register must be smi-tagged to call out. 2275 // Number-of-arguments register must be smi-tagged to call out.
2276 __ SmiTag(r0); 2276 __ SmiTag(r0);
2277 __ Push(r3, r2, r1, r0); 2277 __ Push(r3, r2, r1, r0);
2278 if (is_super) { 2278 if (is_super) {
2279 __ Push(r4); 2279 __ Push(r4);
2280 } 2280 }
2281 2281
2282 __ CallStub(stub); 2282 __ CallStub(stub);
2283 2283
2284 if (is_super) { 2284 if (is_super) {
2285 __ Pop(r4); 2285 __ Pop(r4);
2286 } 2286 }
2287 __ Pop(r3, r2, r1, r0); 2287 __ Pop(r3, r2, r1, r0);
2288 __ SmiUntag(r0); 2288 __ SmiUntag(r0);
2289 } 2289 }
2290 2290
2291 2291
2292 static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) { 2292 static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) {
2293 // Cache the called function in a feedback vector slot. Cache states 2293 // Cache the called function in a feedback vector slot. Cache states
2294 // are uninitialized, monomorphic (indicated by a JSFunction), and 2294 // are uninitialized, monomorphic (indicated by a JSFunction), and
2295 // megamorphic. 2295 // megamorphic.
2296 // r0 : number of arguments to the construct function 2296 // r0 : number of arguments to the construct function
2297 // r1 : the function to call 2297 // r1 : the function to call
2298 // r2 : feedback vector 2298 // r2 : feedback vector
2299 // r3 : slot in feedback vector (Smi) 2299 // r3 : slot in feedback vector (Smi)
2300 // r4 : original constructor (for IsSuperConstructorCall) 2300 // r4 : new target (for IsSuperConstructorCall)
2301 Label initialize, done, miss, megamorphic, not_array_function; 2301 Label initialize, done, miss, megamorphic, not_array_function;
2302 2302
2303 DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), 2303 DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()),
2304 masm->isolate()->heap()->megamorphic_symbol()); 2304 masm->isolate()->heap()->megamorphic_symbol());
2305 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), 2305 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()),
2306 masm->isolate()->heap()->uninitialized_symbol()); 2306 masm->isolate()->heap()->uninitialized_symbol());
2307 2307
2308 // Load the cache state into r5. 2308 // Load the cache state into r5.
2309 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); 2309 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3));
2310 __ ldr(r5, FieldMemOperand(r5, FixedArray::kHeaderSize)); 2310 __ ldr(r5, FieldMemOperand(r5, FixedArray::kHeaderSize));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); 2377 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super);
2378 __ bind(&done); 2378 __ bind(&done);
2379 } 2379 }
2380 2380
2381 2381
2382 void CallConstructStub::Generate(MacroAssembler* masm) { 2382 void CallConstructStub::Generate(MacroAssembler* masm) {
2383 // r0 : number of arguments 2383 // r0 : number of arguments
2384 // r1 : the function to call 2384 // r1 : the function to call
2385 // r2 : feedback vector 2385 // r2 : feedback vector
2386 // r3 : slot in feedback vector (Smi, for RecordCallTarget) 2386 // r3 : slot in feedback vector (Smi, for RecordCallTarget)
2387 // r4 : original constructor (for IsSuperConstructorCall) 2387 // r4 : new target (for IsSuperConstructorCall)
2388 2388
2389 Label non_function; 2389 Label non_function;
2390 // Check that the function is not a smi. 2390 // Check that the function is not a smi.
2391 __ JumpIfSmi(r1, &non_function); 2391 __ JumpIfSmi(r1, &non_function);
2392 // Check that the function is a JSFunction. 2392 // Check that the function is a JSFunction.
2393 __ CompareObjectType(r1, r5, r5, JS_FUNCTION_TYPE); 2393 __ CompareObjectType(r1, r5, r5, JS_FUNCTION_TYPE);
2394 __ b(ne, &non_function); 2394 __ b(ne, &non_function);
2395 2395
2396 if (RecordCallTarget()) { 2396 if (RecordCallTarget()) {
2397 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); 2397 GenerateRecordCallTarget(masm, IsSuperConstructorCall());
2398 2398
2399 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); 2399 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3));
2400 Label feedback_register_initialized; 2400 Label feedback_register_initialized;
2401 // Put the AllocationSite from the feedback vector into r2, or undefined. 2401 // Put the AllocationSite from the feedback vector into r2, or undefined.
2402 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize)); 2402 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize));
2403 __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset)); 2403 __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset));
2404 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); 2404 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex);
2405 __ b(eq, &feedback_register_initialized); 2405 __ b(eq, &feedback_register_initialized);
2406 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); 2406 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
2407 __ bind(&feedback_register_initialized); 2407 __ bind(&feedback_register_initialized);
2408 2408
2409 __ AssertUndefinedOrAllocationSite(r2, r5); 2409 __ AssertUndefinedOrAllocationSite(r2, r5);
2410 } 2410 }
2411 2411
2412 // Pass function as original constructor. 2412 // Pass function as new target.
2413 if (IsSuperConstructorCall()) { 2413 if (IsSuperConstructorCall()) {
2414 __ mov(r3, r4); 2414 __ mov(r3, r4);
2415 } else { 2415 } else {
2416 __ mov(r3, r1); 2416 __ mov(r3, r1);
2417 } 2417 }
2418 2418
2419 // Tail call to the function-specific construct stub (still in the caller 2419 // Tail call to the function-specific construct stub (still in the caller
2420 // context at this point). 2420 // context at this point).
2421 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 2421 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
2422 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kConstructStubOffset)); 2422 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kConstructStubOffset));
(...skipping 2413 matching lines...) Expand 10 before | Expand all | Expand 10 after
4836 UNREACHABLE(); 4836 UNREACHABLE();
4837 } 4837 }
4838 } 4838 }
4839 4839
4840 4840
4841 void ArrayConstructorStub::Generate(MacroAssembler* masm) { 4841 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
4842 // ----------- S t a t e ------------- 4842 // ----------- S t a t e -------------
4843 // -- r0 : argc (only if argument_count() == ANY) 4843 // -- r0 : argc (only if argument_count() == ANY)
4844 // -- r1 : constructor 4844 // -- r1 : constructor
4845 // -- r2 : AllocationSite or undefined 4845 // -- r2 : AllocationSite or undefined
4846 // -- r3 : original constructor 4846 // -- r3 : new target
4847 // -- sp[0] : return address 4847 // -- sp[0] : return address
4848 // -- sp[4] : last argument 4848 // -- sp[4] : last argument
4849 // ----------------------------------- 4849 // -----------------------------------
4850 4850
4851 if (FLAG_debug_code) { 4851 if (FLAG_debug_code) {
4852 // The array construct code is only set for the global and natives 4852 // The array construct code is only set for the global and natives
4853 // builtin Array functions which always have maps. 4853 // builtin Array functions which always have maps.
4854 4854
4855 // Initial map for the builtin Array function should be a map. 4855 // Initial map for the builtin Array function should be a map.
4856 __ ldr(r4, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); 4856 __ ldr(r4, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset));
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
5447 MemOperand(fp, 6 * kPointerSize), NULL); 5447 MemOperand(fp, 6 * kPointerSize), NULL);
5448 } 5448 }
5449 5449
5450 5450
5451 #undef __ 5451 #undef __
5452 5452
5453 } // namespace internal 5453 } // namespace internal
5454 } // namespace v8 5454 } // namespace v8
5455 5455
5456 #endif // V8_TARGET_ARCH_ARM 5456 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698