OLD | NEW |
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 2462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2473 // this position in a symbol (see static asserts in type-feedback-vector.h). | 2473 // this position in a symbol (see static asserts in type-feedback-vector.h). |
2474 Label check_allocation_site; | 2474 Label check_allocation_site; |
2475 Register feedback_map = a6; | 2475 Register feedback_map = a6; |
2476 Register weak_value = t0; | 2476 Register weak_value = t0; |
2477 __ ld(weak_value, FieldMemOperand(a5, WeakCell::kValueOffset)); | 2477 __ ld(weak_value, FieldMemOperand(a5, WeakCell::kValueOffset)); |
2478 __ Branch(&done, eq, a1, Operand(weak_value)); | 2478 __ Branch(&done, eq, a1, Operand(weak_value)); |
2479 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | 2479 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
2480 __ Branch(&done, eq, a5, Operand(at)); | 2480 __ Branch(&done, eq, a5, Operand(at)); |
2481 __ ld(feedback_map, FieldMemOperand(a5, HeapObject::kMapOffset)); | 2481 __ ld(feedback_map, FieldMemOperand(a5, HeapObject::kMapOffset)); |
2482 __ LoadRoot(at, Heap::kWeakCellMapRootIndex); | 2482 __ LoadRoot(at, Heap::kWeakCellMapRootIndex); |
2483 __ Branch(FLAG_pretenuring_call_new ? &miss : &check_allocation_site, ne, | 2483 __ Branch(&check_allocation_site, ne, feedback_map, Operand(at)); |
2484 feedback_map, Operand(at)); | |
2485 | 2484 |
2486 // If the weak cell is cleared, we have a new chance to become monomorphic. | 2485 // If the weak cell is cleared, we have a new chance to become monomorphic. |
2487 __ JumpIfSmi(weak_value, &initialize); | 2486 __ JumpIfSmi(weak_value, &initialize); |
2488 __ jmp(&megamorphic); | 2487 __ jmp(&megamorphic); |
2489 | 2488 |
2490 if (!FLAG_pretenuring_call_new) { | 2489 __ bind(&check_allocation_site); |
2491 __ bind(&check_allocation_site); | 2490 // If we came here, we need to see if we are the array function. |
2492 // If we came here, we need to see if we are the array function. | 2491 // If we didn't have a matching function, and we didn't find the megamorph |
2493 // If we didn't have a matching function, and we didn't find the megamorph | 2492 // sentinel, then we have in the slot either some other function or an |
2494 // sentinel, then we have in the slot either some other function or an | 2493 // AllocationSite. |
2495 // AllocationSite. | 2494 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
2496 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | 2495 __ Branch(&miss, ne, feedback_map, Operand(at)); |
2497 __ Branch(&miss, ne, feedback_map, Operand(at)); | |
2498 | 2496 |
2499 // Make sure the function is the Array() function | 2497 // Make sure the function is the Array() function |
2500 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, a5); | 2498 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, a5); |
2501 __ Branch(&megamorphic, ne, a1, Operand(a5)); | 2499 __ Branch(&megamorphic, ne, a1, Operand(a5)); |
2502 __ jmp(&done); | 2500 __ jmp(&done); |
2503 } | |
2504 | 2501 |
2505 __ bind(&miss); | 2502 __ bind(&miss); |
2506 | 2503 |
2507 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 2504 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
2508 // megamorphic. | 2505 // megamorphic. |
2509 __ LoadRoot(at, Heap::kuninitialized_symbolRootIndex); | 2506 __ LoadRoot(at, Heap::kuninitialized_symbolRootIndex); |
2510 __ Branch(&initialize, eq, a5, Operand(at)); | 2507 __ Branch(&initialize, eq, a5, Operand(at)); |
2511 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 2508 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
2512 // write-barrier is needed. | 2509 // write-barrier is needed. |
2513 __ bind(&megamorphic); | 2510 __ bind(&megamorphic); |
2514 __ dsrl(a5, a3, 32 - kPointerSizeLog2); | 2511 __ dsrl(a5, a3, 32 - kPointerSizeLog2); |
2515 __ Daddu(a5, a2, Operand(a5)); | 2512 __ Daddu(a5, a2, Operand(a5)); |
2516 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | 2513 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
2517 __ sd(at, FieldMemOperand(a5, FixedArray::kHeaderSize)); | 2514 __ sd(at, FieldMemOperand(a5, FixedArray::kHeaderSize)); |
2518 __ jmp(&done); | 2515 __ jmp(&done); |
2519 | 2516 |
2520 // An uninitialized cache is patched with the function. | 2517 // An uninitialized cache is patched with the function. |
2521 __ bind(&initialize); | 2518 __ bind(&initialize); |
2522 if (!FLAG_pretenuring_call_new) { | 2519 // Make sure the function is the Array() function. |
2523 // Make sure the function is the Array() function. | 2520 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, a5); |
2524 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, a5); | 2521 __ Branch(¬_array_function, ne, a1, Operand(a5)); |
2525 __ Branch(¬_array_function, ne, a1, Operand(a5)); | |
2526 | 2522 |
2527 // The target function is the Array constructor, | 2523 // The target function is the Array constructor, |
2528 // Create an AllocationSite if we don't already have it, store it in the | 2524 // Create an AllocationSite if we don't already have it, store it in the |
2529 // slot. | 2525 // slot. |
2530 CreateAllocationSiteStub create_stub(masm->isolate()); | 2526 CreateAllocationSiteStub create_stub(masm->isolate()); |
2531 CallStubInRecordCallTarget(masm, &create_stub, is_super); | 2527 CallStubInRecordCallTarget(masm, &create_stub, is_super); |
2532 __ Branch(&done); | 2528 __ Branch(&done); |
2533 | 2529 |
2534 __ bind(¬_array_function); | 2530 __ bind(¬_array_function); |
2535 } | |
2536 | 2531 |
2537 CreateWeakCellStub create_stub(masm->isolate()); | 2532 CreateWeakCellStub weak_cell_stub(masm->isolate()); |
2538 CallStubInRecordCallTarget(masm, &create_stub, is_super); | 2533 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); |
2539 __ bind(&done); | 2534 __ bind(&done); |
2540 } | 2535 } |
2541 | 2536 |
2542 | 2537 |
2543 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { | 2538 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { |
2544 __ ld(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 2539 __ ld(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
2545 | 2540 |
2546 // Do not transform the receiver for strict mode functions. | 2541 // Do not transform the receiver for strict mode functions. |
2547 int32_t strict_mode_function_mask = | 2542 int32_t strict_mode_function_mask = |
2548 1 << SharedFunctionInfo::kStrictModeBitWithinByte ; | 2543 1 << SharedFunctionInfo::kStrictModeBitWithinByte ; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2648 __ JumpIfSmi(a1, &non_function_call); | 2643 __ JumpIfSmi(a1, &non_function_call); |
2649 // Check that the function is a JSFunction. | 2644 // Check that the function is a JSFunction. |
2650 __ GetObjectType(a1, a5, a5); | 2645 __ GetObjectType(a1, a5, a5); |
2651 __ Branch(&slow, ne, a5, Operand(JS_FUNCTION_TYPE)); | 2646 __ Branch(&slow, ne, a5, Operand(JS_FUNCTION_TYPE)); |
2652 | 2647 |
2653 if (RecordCallTarget()) { | 2648 if (RecordCallTarget()) { |
2654 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); | 2649 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); |
2655 | 2650 |
2656 __ dsrl(at, a3, 32 - kPointerSizeLog2); | 2651 __ dsrl(at, a3, 32 - kPointerSizeLog2); |
2657 __ Daddu(a5, a2, at); | 2652 __ Daddu(a5, a2, at); |
2658 if (FLAG_pretenuring_call_new) { | 2653 Label feedback_register_initialized; |
2659 // Put the AllocationSite from the feedback vector into a2. | 2654 // Put the AllocationSite from the feedback vector into a2, or undefined. |
2660 // By adding kPointerSize we encode that we know the AllocationSite | 2655 __ ld(a2, FieldMemOperand(a5, FixedArray::kHeaderSize)); |
2661 // entry is at the feedback vector slot given by a3 + 1. | 2656 __ ld(a5, FieldMemOperand(a2, AllocationSite::kMapOffset)); |
2662 __ ld(a2, FieldMemOperand(a5, FixedArray::kHeaderSize + kPointerSize)); | 2657 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
2663 } else { | 2658 __ Branch(&feedback_register_initialized, eq, a5, Operand(at)); |
2664 Label feedback_register_initialized; | 2659 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
2665 // Put the AllocationSite from the feedback vector into a2, or undefined. | 2660 __ bind(&feedback_register_initialized); |
2666 __ ld(a2, FieldMemOperand(a5, FixedArray::kHeaderSize)); | |
2667 __ ld(a5, FieldMemOperand(a2, AllocationSite::kMapOffset)); | |
2668 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | |
2669 __ Branch(&feedback_register_initialized, eq, a5, Operand(at)); | |
2670 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | |
2671 __ bind(&feedback_register_initialized); | |
2672 } | |
2673 | 2661 |
2674 __ AssertUndefinedOrAllocationSite(a2, a5); | 2662 __ AssertUndefinedOrAllocationSite(a2, a5); |
2675 } | 2663 } |
2676 | 2664 |
2677 // Pass function as original constructor. | 2665 // Pass function as original constructor. |
2678 if (IsSuperConstructorCall()) { | 2666 if (IsSuperConstructorCall()) { |
2679 __ mov(a3, a4); | 2667 __ mov(a3, a4); |
2680 } else { | 2668 } else { |
2681 __ mov(a3, a1); | 2669 __ mov(a3, a1); |
2682 } | 2670 } |
(...skipping 3094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5777 MemOperand(fp, 6 * kPointerSize), NULL); | 5765 MemOperand(fp, 6 * kPointerSize), NULL); |
5778 } | 5766 } |
5779 | 5767 |
5780 | 5768 |
5781 #undef __ | 5769 #undef __ |
5782 | 5770 |
5783 } // namespace internal | 5771 } // namespace internal |
5784 } // namespace v8 | 5772 } // namespace v8 |
5785 | 5773 |
5786 #endif // V8_TARGET_ARCH_MIPS64 | 5774 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |