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

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

Issue 1057613003: Code cleanup in GenerateRecordCallTarget. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Slight comment improvement. Created 5 years, 8 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
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 2356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2367 } 2367 }
2368 2368
2369 2369
2370 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { 2370 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
2371 // r0 : number of arguments to the construct function 2371 // r0 : number of arguments to the construct function
2372 // r2 : Feedback vector 2372 // r2 : Feedback vector
2373 // r3 : slot in feedback vector (Smi) 2373 // r3 : slot in feedback vector (Smi)
2374 // r1 : the function to call 2374 // r1 : the function to call
2375 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 2375 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
2376 2376
2377 // Arguments register must be smi-tagged to call out. 2377 // Number-of-arguments register must be smi-tagged to call out.
2378 __ SmiTag(r0); 2378 __ SmiTag(r0);
2379 __ Push(r3, r2, r1, r0); 2379 __ Push(r3, r2, r1, r0);
2380 2380
2381 __ CallStub(stub); 2381 __ CallStub(stub);
2382 2382
2383 __ Pop(r3, r2, r1, r0); 2383 __ Pop(r3, r2, r1, r0);
2384 __ SmiUntag(r0); 2384 __ SmiUntag(r0);
2385 } 2385 }
2386 2386
2387 2387
(...skipping 11 matching lines...) Expand all
2399 masm->isolate()->heap()->megamorphic_symbol()); 2399 masm->isolate()->heap()->megamorphic_symbol());
2400 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), 2400 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()),
2401 masm->isolate()->heap()->uninitialized_symbol()); 2401 masm->isolate()->heap()->uninitialized_symbol());
2402 2402
2403 // Load the cache state into r4. 2403 // Load the cache state into r4.
2404 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); 2404 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3));
2405 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); 2405 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize));
2406 2406
2407 // A monomorphic cache hit or an already megamorphic state: invoke the 2407 // A monomorphic cache hit or an already megamorphic state: invoke the
2408 // function without changing the state. 2408 // function without changing the state.
2409 // We don't know if r4 is a WeakCell or a Symbol, but it's harmless to read at
2410 // this position in a symbol (see static asserts in type-feedback-vector.h).
2409 Label check_allocation_site; 2411 Label check_allocation_site;
2410 Register feedback_map = r5; 2412 Register feedback_map = r5;
2411 Register weak_value = r8; 2413 Register weak_value = r8;
2412 __ ldr(weak_value, FieldMemOperand(r4, WeakCell::kValueOffset)); 2414 __ ldr(weak_value, FieldMemOperand(r4, WeakCell::kValueOffset));
2413 __ cmp(r1, weak_value); 2415 __ cmp(r1, weak_value);
2414 __ b(eq, &done); 2416 __ b(eq, &done);
2415 __ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex); 2417 __ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex);
2416 __ b(eq, &done); 2418 __ b(eq, &done);
2417 __ ldr(feedback_map, FieldMemOperand(r4, 0)); 2419 __ ldr(feedback_map, FieldMemOperand(r4, HeapObject::kMapOffset));
2418 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex); 2420 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex);
2419 __ b(ne, FLAG_pretenuring_call_new ? &miss : &check_allocation_site); 2421 __ b(ne, FLAG_pretenuring_call_new ? &miss : &check_allocation_site);
2420 2422
2421 // If r1 is not equal to the weak cell value, and the weak cell value is 2423 // If the weak cell is cleared, we have a new chance to become monomorphic.
2422 // cleared, we have a new chance to become monomorphic.
2423 __ JumpIfSmi(weak_value, &initialize); 2424 __ JumpIfSmi(weak_value, &initialize);
2424 __ jmp(&megamorphic); 2425 __ jmp(&megamorphic);
2425 2426
2426 if (!FLAG_pretenuring_call_new) { 2427 if (!FLAG_pretenuring_call_new) {
2427 __ bind(&check_allocation_site); 2428 __ bind(&check_allocation_site);
2428 // If we came here, we need to see if we are the array function. 2429 // If we came here, we need to see if we are the array function.
2429 // If we didn't have a matching function, and we didn't find the megamorph 2430 // If we didn't have a matching function, and we didn't find the megamorph
2430 // sentinel, then we have in the slot either some other function or an 2431 // sentinel, then we have in the slot either some other function or an
2431 // AllocationSite. Do a map check on the object in ecx. 2432 // AllocationSite.
2432 __ CompareRoot(feedback_map, Heap::kAllocationSiteMapRootIndex); 2433 __ CompareRoot(feedback_map, Heap::kAllocationSiteMapRootIndex);
2433 __ b(ne, &miss); 2434 __ b(ne, &miss);
2434 2435
2435 // Make sure the function is the Array() function 2436 // Make sure the function is the Array() function
2436 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); 2437 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4);
2437 __ cmp(r1, r4); 2438 __ cmp(r1, r4);
2438 __ b(ne, &megamorphic); 2439 __ b(ne, &megamorphic);
2439 __ jmp(&done); 2440 __ jmp(&done);
2440 } 2441 }
2441 2442
(...skipping 2856 matching lines...) Expand 10 before | Expand all | Expand 10 after
5298 kStackUnwindSpace, NULL, 5299 kStackUnwindSpace, NULL,
5299 MemOperand(fp, 6 * kPointerSize), NULL); 5300 MemOperand(fp, 6 * kPointerSize), NULL);
5300 } 5301 }
5301 5302
5302 5303
5303 #undef __ 5304 #undef __
5304 5305
5305 } } // namespace v8::internal 5306 } } // namespace v8::internal
5306 5307
5307 #endif // V8_TARGET_ARCH_ARM 5308 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698