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

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

Issue 1489413006: Revert of Provide call counts for constructor calls, surface them as a vector IC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/mips/interface-descriptors-mips.cc ('k') | src/mips64/interface-descriptors-mips64.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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after
2444 2444
2445 static void GenerateRecordCallTarget(MacroAssembler* masm) { 2445 static void GenerateRecordCallTarget(MacroAssembler* masm) {
2446 // Cache the called function in a feedback vector slot. Cache states 2446 // Cache the called function in a feedback vector slot. Cache states
2447 // are uninitialized, monomorphic (indicated by a JSFunction), and 2447 // are uninitialized, monomorphic (indicated by a JSFunction), and
2448 // megamorphic. 2448 // megamorphic.
2449 // a0 : number of arguments to the construct function 2449 // a0 : number of arguments to the construct function
2450 // a1 : the function to call 2450 // a1 : the function to call
2451 // a2 : feedback vector 2451 // a2 : feedback vector
2452 // a3 : slot in feedback vector (Smi) 2452 // a3 : slot in feedback vector (Smi)
2453 Label initialize, done, miss, megamorphic, not_array_function; 2453 Label initialize, done, miss, megamorphic, not_array_function;
2454 Label done_increment_count;
2455 2454
2456 DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), 2455 DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()),
2457 masm->isolate()->heap()->megamorphic_symbol()); 2456 masm->isolate()->heap()->megamorphic_symbol());
2458 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), 2457 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()),
2459 masm->isolate()->heap()->uninitialized_symbol()); 2458 masm->isolate()->heap()->uninitialized_symbol());
2460 2459
2461 // Load the cache state into a5. 2460 // Load the cache state into a5.
2462 __ dsrl(a5, a3, 32 - kPointerSizeLog2); 2461 __ dsrl(a5, a3, 32 - kPointerSizeLog2);
2463 __ Daddu(a5, a2, Operand(a5)); 2462 __ Daddu(a5, a2, Operand(a5));
2464 __ ld(a5, FieldMemOperand(a5, FixedArray::kHeaderSize)); 2463 __ ld(a5, FieldMemOperand(a5, FixedArray::kHeaderSize));
2465 2464
2466 // A monomorphic cache hit or an already megamorphic state: invoke the 2465 // A monomorphic cache hit or an already megamorphic state: invoke the
2467 // function without changing the state. 2466 // function without changing the state.
2468 // We don't know if a5 is a WeakCell or a Symbol, but it's harmless to read at 2467 // We don't know if a5 is a WeakCell or a Symbol, but it's harmless to read at
2469 // this position in a symbol (see static asserts in type-feedback-vector.h). 2468 // this position in a symbol (see static asserts in type-feedback-vector.h).
2470 Label check_allocation_site; 2469 Label check_allocation_site;
2471 Register feedback_map = a6; 2470 Register feedback_map = a6;
2472 Register weak_value = t0; 2471 Register weak_value = t0;
2473 __ ld(weak_value, FieldMemOperand(a5, WeakCell::kValueOffset)); 2472 __ ld(weak_value, FieldMemOperand(a5, WeakCell::kValueOffset));
2474 __ Branch(&done_increment_count, eq, a1, Operand(weak_value)); 2473 __ Branch(&done, eq, a1, Operand(weak_value));
2475 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); 2474 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
2476 __ Branch(&done, eq, a5, Operand(at)); 2475 __ Branch(&done, eq, a5, Operand(at));
2477 __ ld(feedback_map, FieldMemOperand(a5, HeapObject::kMapOffset)); 2476 __ ld(feedback_map, FieldMemOperand(a5, HeapObject::kMapOffset));
2478 __ LoadRoot(at, Heap::kWeakCellMapRootIndex); 2477 __ LoadRoot(at, Heap::kWeakCellMapRootIndex);
2479 __ Branch(&check_allocation_site, ne, feedback_map, Operand(at)); 2478 __ Branch(&check_allocation_site, ne, feedback_map, Operand(at));
2480 2479
2481 // If the weak cell is cleared, we have a new chance to become monomorphic. 2480 // If the weak cell is cleared, we have a new chance to become monomorphic.
2482 __ JumpIfSmi(weak_value, &initialize); 2481 __ JumpIfSmi(weak_value, &initialize);
2483 __ jmp(&megamorphic); 2482 __ jmp(&megamorphic);
2484 2483
2485 __ bind(&check_allocation_site); 2484 __ bind(&check_allocation_site);
2486 // If we came here, we need to see if we are the array function. 2485 // If we came here, we need to see if we are the array function.
2487 // If we didn't have a matching function, and we didn't find the megamorph 2486 // If we didn't have a matching function, and we didn't find the megamorph
2488 // sentinel, then we have in the slot either some other function or an 2487 // sentinel, then we have in the slot either some other function or an
2489 // AllocationSite. 2488 // AllocationSite.
2490 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); 2489 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
2491 __ Branch(&miss, ne, feedback_map, Operand(at)); 2490 __ Branch(&miss, ne, feedback_map, Operand(at));
2492 2491
2493 // Make sure the function is the Array() function 2492 // Make sure the function is the Array() function
2494 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, a5); 2493 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, a5);
2495 __ Branch(&megamorphic, ne, a1, Operand(a5)); 2494 __ Branch(&megamorphic, ne, a1, Operand(a5));
2496 __ jmp(&done_increment_count); 2495 __ jmp(&done);
2497 2496
2498 __ bind(&miss); 2497 __ bind(&miss);
2499 2498
2500 // A monomorphic miss (i.e, here the cache is not uninitialized) goes 2499 // A monomorphic miss (i.e, here the cache is not uninitialized) goes
2501 // megamorphic. 2500 // megamorphic.
2502 __ LoadRoot(at, Heap::kuninitialized_symbolRootIndex); 2501 __ LoadRoot(at, Heap::kuninitialized_symbolRootIndex);
2503 __ Branch(&initialize, eq, a5, Operand(at)); 2502 __ Branch(&initialize, eq, a5, Operand(at));
2504 // MegamorphicSentinel is an immortal immovable object (undefined) so no 2503 // MegamorphicSentinel is an immortal immovable object (undefined) so no
2505 // write-barrier is needed. 2504 // write-barrier is needed.
2506 __ bind(&megamorphic); 2505 __ bind(&megamorphic);
2507 __ dsrl(a5, a3, 32 - kPointerSizeLog2); 2506 __ dsrl(a5, a3, 32 - kPointerSizeLog2);
2508 __ Daddu(a5, a2, Operand(a5)); 2507 __ Daddu(a5, a2, Operand(a5));
2509 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); 2508 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex);
2510 __ sd(at, FieldMemOperand(a5, FixedArray::kHeaderSize)); 2509 __ sd(at, FieldMemOperand(a5, FixedArray::kHeaderSize));
2511 __ jmp(&done); 2510 __ jmp(&done);
2512 2511
2513 // An uninitialized cache is patched with the function. 2512 // An uninitialized cache is patched with the function.
2514 __ bind(&initialize); 2513 __ bind(&initialize);
2515
2516 // Initialize the call counter.
2517 __ dsrl(at, a3, 32 - kPointerSizeLog2);
2518 __ Daddu(at, a2, Operand(at));
2519 __ li(t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement)));
2520 __ sd(t0, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize));
2521
2522 // Make sure the function is the Array() function. 2514 // Make sure the function is the Array() function.
2523 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, a5); 2515 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, a5);
2524 __ Branch(&not_array_function, ne, a1, Operand(a5)); 2516 __ Branch(&not_array_function, ne, a1, Operand(a5));
2525 2517
2526 // The target function is the Array constructor, 2518 // The target function is the Array constructor,
2527 // Create an AllocationSite if we don't already have it, store it in the 2519 // Create an AllocationSite if we don't already have it, store it in the
2528 // slot. 2520 // slot.
2529 CreateAllocationSiteStub create_stub(masm->isolate()); 2521 CreateAllocationSiteStub create_stub(masm->isolate());
2530 CallStubInRecordCallTarget(masm, &create_stub); 2522 CallStubInRecordCallTarget(masm, &create_stub);
2531 __ Branch(&done); 2523 __ Branch(&done);
2532 2524
2533 __ bind(&not_array_function); 2525 __ bind(&not_array_function);
2534 2526
2535 CreateWeakCellStub weak_cell_stub(masm->isolate()); 2527 CreateWeakCellStub weak_cell_stub(masm->isolate());
2536 CallStubInRecordCallTarget(masm, &weak_cell_stub); 2528 CallStubInRecordCallTarget(masm, &weak_cell_stub);
2537 __ Branch(&done);
2538
2539 __ bind(&done_increment_count);
2540 __ dsrl(a5, a3, 32 - kPointerSizeLog2);
2541 __ Daddu(a5, a2, Operand(a5));
2542 __ ld(t0, FieldMemOperand(a5, FixedArray::kHeaderSize + kPointerSize));
2543 __ Daddu(t0, t0,
2544 Operand(Smi::FromInt(ConstructICNexus::kCallCountIncrement)));
2545 __ sd(t0, FieldMemOperand(a5, FixedArray::kHeaderSize + kPointerSize));
2546
2547 __ bind(&done); 2529 __ bind(&done);
2548 } 2530 }
2549 2531
2550 2532
2551 void ConstructICStub::Generate(MacroAssembler* masm) { 2533 void CallConstructStub::Generate(MacroAssembler* masm) {
2552 // a0 : number of arguments 2534 // a0 : number of arguments
2553 // a1 : the function to call 2535 // a1 : the function to call
2554 // a2 : feedback vector 2536 // a2 : feedback vector
2555 // a3 : slot in feedback vector (Smi, for RecordCallTarget) 2537 // a3 : slot in feedback vector (Smi, for RecordCallTarget)
2556 2538
2557 Label non_function; 2539 Label non_function;
2558 // Check that the function is not a smi. 2540 // Check that the function is not a smi.
2559 __ JumpIfSmi(a1, &non_function); 2541 __ JumpIfSmi(a1, &non_function);
2560 // Check that the function is a JSFunction. 2542 // Check that the function is a JSFunction.
2561 __ GetObjectType(a1, a5, a5); 2543 __ GetObjectType(a1, a5, a5);
(...skipping 3052 matching lines...) Expand 10 before | Expand all | Expand 10 after
5614 MemOperand(fp, 6 * kPointerSize), NULL); 5596 MemOperand(fp, 6 * kPointerSize), NULL);
5615 } 5597 }
5616 5598
5617 5599
5618 #undef __ 5600 #undef __
5619 5601
5620 } // namespace internal 5602 } // namespace internal
5621 } // namespace v8 5603 } // namespace v8
5622 5604
5623 #endif // V8_TARGET_ARCH_MIPS64 5605 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/interface-descriptors-mips.cc ('k') | src/mips64/interface-descriptors-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698