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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 2428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2439 // this position in a symbol (see static asserts in type-feedback-vector.h). | 2439 // this position in a symbol (see static asserts in type-feedback-vector.h). |
2440 Label check_allocation_site; | 2440 Label check_allocation_site; |
2441 Register feedback_map = t1; | 2441 Register feedback_map = t1; |
2442 Register weak_value = t4; | 2442 Register weak_value = t4; |
2443 __ lw(weak_value, FieldMemOperand(t2, WeakCell::kValueOffset)); | 2443 __ lw(weak_value, FieldMemOperand(t2, WeakCell::kValueOffset)); |
2444 __ Branch(&done, eq, a1, Operand(weak_value)); | 2444 __ Branch(&done, eq, a1, Operand(weak_value)); |
2445 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | 2445 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
2446 __ Branch(&done, eq, t2, Operand(at)); | 2446 __ Branch(&done, eq, t2, Operand(at)); |
2447 __ lw(feedback_map, FieldMemOperand(t2, HeapObject::kMapOffset)); | 2447 __ lw(feedback_map, FieldMemOperand(t2, HeapObject::kMapOffset)); |
2448 __ LoadRoot(at, Heap::kWeakCellMapRootIndex); | 2448 __ LoadRoot(at, Heap::kWeakCellMapRootIndex); |
2449 __ Branch(FLAG_pretenuring_call_new ? &miss : &check_allocation_site, ne, | 2449 __ Branch(&check_allocation_site, ne, feedback_map, Operand(at)); |
2450 feedback_map, Operand(at)); | |
2451 | 2450 |
2452 // If the weak cell is cleared, we have a new chance to become monomorphic. | 2451 // If the weak cell is cleared, we have a new chance to become monomorphic. |
2453 __ JumpIfSmi(weak_value, &initialize); | 2452 __ JumpIfSmi(weak_value, &initialize); |
2454 __ jmp(&megamorphic); | 2453 __ jmp(&megamorphic); |
2455 | 2454 |
2456 if (!FLAG_pretenuring_call_new) { | 2455 __ bind(&check_allocation_site); |
2457 __ bind(&check_allocation_site); | 2456 // If we came here, we need to see if we are the array function. |
2458 // If we came here, we need to see if we are the array function. | 2457 // If we didn't have a matching function, and we didn't find the megamorph |
2459 // If we didn't have a matching function, and we didn't find the megamorph | 2458 // sentinel, then we have in the slot either some other function or an |
2460 // sentinel, then we have in the slot either some other function or an | 2459 // AllocationSite. |
2461 // AllocationSite. | 2460 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
2462 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | 2461 __ Branch(&miss, ne, feedback_map, Operand(at)); |
2463 __ Branch(&miss, ne, feedback_map, Operand(at)); | |
2464 | 2462 |
2465 // Make sure the function is the Array() function | 2463 // Make sure the function is the Array() function |
2466 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t2); | 2464 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t2); |
2467 __ Branch(&megamorphic, ne, a1, Operand(t2)); | 2465 __ Branch(&megamorphic, ne, a1, Operand(t2)); |
2468 __ jmp(&done); | 2466 __ jmp(&done); |
2469 } | |
2470 | 2467 |
2471 __ bind(&miss); | 2468 __ bind(&miss); |
2472 | 2469 |
2473 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 2470 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
2474 // megamorphic. | 2471 // megamorphic. |
2475 __ LoadRoot(at, Heap::kuninitialized_symbolRootIndex); | 2472 __ LoadRoot(at, Heap::kuninitialized_symbolRootIndex); |
2476 __ Branch(&initialize, eq, t2, Operand(at)); | 2473 __ Branch(&initialize, eq, t2, Operand(at)); |
2477 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 2474 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
2478 // write-barrier is needed. | 2475 // write-barrier is needed. |
2479 __ bind(&megamorphic); | 2476 __ bind(&megamorphic); |
2480 __ sll(t2, a3, kPointerSizeLog2 - kSmiTagSize); | 2477 __ sll(t2, a3, kPointerSizeLog2 - kSmiTagSize); |
2481 __ Addu(t2, a2, Operand(t2)); | 2478 __ Addu(t2, a2, Operand(t2)); |
2482 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | 2479 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
2483 __ sw(at, FieldMemOperand(t2, FixedArray::kHeaderSize)); | 2480 __ sw(at, FieldMemOperand(t2, FixedArray::kHeaderSize)); |
2484 __ jmp(&done); | 2481 __ jmp(&done); |
2485 | 2482 |
2486 // An uninitialized cache is patched with the function. | 2483 // An uninitialized cache is patched with the function. |
2487 __ bind(&initialize); | 2484 __ bind(&initialize); |
2488 if (!FLAG_pretenuring_call_new) { | 2485 // Make sure the function is the Array() function. |
2489 // Make sure the function is the Array() function. | 2486 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t2); |
2490 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t2); | 2487 __ Branch(¬_array_function, ne, a1, Operand(t2)); |
2491 __ Branch(¬_array_function, ne, a1, Operand(t2)); | |
2492 | 2488 |
2493 // The target function is the Array constructor, | 2489 // The target function is the Array constructor, |
2494 // Create an AllocationSite if we don't already have it, store it in the | 2490 // Create an AllocationSite if we don't already have it, store it in the |
2495 // slot. | 2491 // slot. |
2496 CreateAllocationSiteStub create_stub(masm->isolate()); | 2492 CreateAllocationSiteStub create_stub(masm->isolate()); |
2497 CallStubInRecordCallTarget(masm, &create_stub, is_super); | 2493 CallStubInRecordCallTarget(masm, &create_stub, is_super); |
2498 __ Branch(&done); | 2494 __ Branch(&done); |
2499 | 2495 |
2500 __ bind(¬_array_function); | 2496 __ bind(¬_array_function); |
2501 } | 2497 CreateWeakCellStub weak_cell_stub(masm->isolate()); |
2502 | 2498 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); |
2503 CreateWeakCellStub create_stub(masm->isolate()); | |
2504 CallStubInRecordCallTarget(masm, &create_stub, is_super); | |
2505 __ bind(&done); | 2499 __ bind(&done); |
2506 } | 2500 } |
2507 | 2501 |
2508 | 2502 |
2509 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { | 2503 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { |
2510 __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 2504 __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
2511 __ lw(t0, FieldMemOperand(a3, SharedFunctionInfo::kCompilerHintsOffset)); | 2505 __ lw(t0, FieldMemOperand(a3, SharedFunctionInfo::kCompilerHintsOffset)); |
2512 | 2506 |
2513 // Do not transform the receiver for strict mode functions. | 2507 // Do not transform the receiver for strict mode functions. |
2514 int32_t strict_mode_function_mask = | 2508 int32_t strict_mode_function_mask = |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2612 __ JumpIfSmi(a1, &non_function_call); | 2606 __ JumpIfSmi(a1, &non_function_call); |
2613 // Check that the function is a JSFunction. | 2607 // Check that the function is a JSFunction. |
2614 __ GetObjectType(a1, t1, t1); | 2608 __ GetObjectType(a1, t1, t1); |
2615 __ Branch(&slow, ne, t1, Operand(JS_FUNCTION_TYPE)); | 2609 __ Branch(&slow, ne, t1, Operand(JS_FUNCTION_TYPE)); |
2616 | 2610 |
2617 if (RecordCallTarget()) { | 2611 if (RecordCallTarget()) { |
2618 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); | 2612 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); |
2619 | 2613 |
2620 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); | 2614 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); |
2621 __ Addu(t1, a2, at); | 2615 __ Addu(t1, a2, at); |
2622 if (FLAG_pretenuring_call_new) { | 2616 Label feedback_register_initialized; |
2623 // Put the AllocationSite from the feedback vector into a2. | 2617 // Put the AllocationSite from the feedback vector into a2, or undefined. |
2624 // By adding kPointerSize we encode that we know the AllocationSite | 2618 __ lw(a2, FieldMemOperand(t1, FixedArray::kHeaderSize)); |
2625 // entry is at the feedback vector slot given by a3 + 1. | 2619 __ lw(t1, FieldMemOperand(a2, AllocationSite::kMapOffset)); |
2626 __ lw(a2, FieldMemOperand(t1, FixedArray::kHeaderSize + kPointerSize)); | 2620 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
2627 } else { | 2621 __ Branch(&feedback_register_initialized, eq, t1, Operand(at)); |
2628 Label feedback_register_initialized; | 2622 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
2629 // Put the AllocationSite from the feedback vector into a2, or undefined. | 2623 __ bind(&feedback_register_initialized); |
2630 __ lw(a2, FieldMemOperand(t1, FixedArray::kHeaderSize)); | |
2631 __ lw(t1, FieldMemOperand(a2, AllocationSite::kMapOffset)); | |
2632 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | |
2633 __ Branch(&feedback_register_initialized, eq, t1, Operand(at)); | |
2634 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | |
2635 __ bind(&feedback_register_initialized); | |
2636 } | |
2637 | 2624 |
2638 __ AssertUndefinedOrAllocationSite(a2, t1); | 2625 __ AssertUndefinedOrAllocationSite(a2, t1); |
2639 } | 2626 } |
2640 | 2627 |
2641 // Pass function as original constructor. | 2628 // Pass function as original constructor. |
2642 if (IsSuperConstructorCall()) { | 2629 if (IsSuperConstructorCall()) { |
2643 __ mov(a3, t0); | 2630 __ mov(a3, t0); |
2644 } else { | 2631 } else { |
2645 __ mov(a3, a1); | 2632 __ mov(a3, a1); |
2646 } | 2633 } |
(...skipping 3104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5751 MemOperand(fp, 6 * kPointerSize), NULL); | 5738 MemOperand(fp, 6 * kPointerSize), NULL); |
5752 } | 5739 } |
5753 | 5740 |
5754 | 5741 |
5755 #undef __ | 5742 #undef __ |
5756 | 5743 |
5757 } // namespace internal | 5744 } // namespace internal |
5758 } // namespace v8 | 5745 } // namespace v8 |
5759 | 5746 |
5760 #endif // V8_TARGET_ARCH_MIPS | 5747 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |