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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
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 2497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2508 // a0 : number of arguments to the construct function | 2508 // a0 : number of arguments to the construct function |
2509 // a2 : Feedback vector | 2509 // a2 : Feedback vector |
2510 // a3 : slot in feedback vector (Smi) | 2510 // a3 : slot in feedback vector (Smi) |
2511 // a1 : the function to call | 2511 // a1 : the function to call |
2512 FrameScope scope(masm, StackFrame::INTERNAL); | 2512 FrameScope scope(masm, StackFrame::INTERNAL); |
2513 const RegList kSavedRegs = 1 << 4 | // a0 | 2513 const RegList kSavedRegs = 1 << 4 | // a0 |
2514 1 << 5 | // a1 | 2514 1 << 5 | // a1 |
2515 1 << 6 | // a2 | 2515 1 << 6 | // a2 |
2516 1 << 7; // a3 | 2516 1 << 7; // a3 |
2517 | 2517 |
2518 // Arguments register must be smi-tagged to call out. | 2518 // Number-of-arguments register must be smi-tagged to call out. |
2519 __ SmiTag(a0); | 2519 __ SmiTag(a0); |
2520 __ MultiPush(kSavedRegs); | 2520 __ MultiPush(kSavedRegs); |
2521 | 2521 |
2522 __ CallStub(stub); | 2522 __ CallStub(stub); |
2523 | 2523 |
2524 __ MultiPop(kSavedRegs); | 2524 __ MultiPop(kSavedRegs); |
2525 __ SmiUntag(a0); | 2525 __ SmiUntag(a0); |
2526 } | 2526 } |
2527 | 2527 |
2528 | 2528 |
(...skipping 12 matching lines...) Expand all Loading... |
2541 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), | 2541 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), |
2542 masm->isolate()->heap()->uninitialized_symbol()); | 2542 masm->isolate()->heap()->uninitialized_symbol()); |
2543 | 2543 |
2544 // Load the cache state into t0. | 2544 // Load the cache state into t0. |
2545 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); | 2545 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); |
2546 __ Addu(t0, a2, Operand(t0)); | 2546 __ Addu(t0, a2, Operand(t0)); |
2547 __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize)); | 2547 __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize)); |
2548 | 2548 |
2549 // A monomorphic cache hit or an already megamorphic state: invoke the | 2549 // A monomorphic cache hit or an already megamorphic state: invoke the |
2550 // function without changing the state. | 2550 // function without changing the state. |
| 2551 // We don't know if t0 is a WeakCell or a Symbol, but it's harmless to read at |
| 2552 // this position in a symbol (see static asserts in type-feedback-vector.h). |
2551 Label check_allocation_site; | 2553 Label check_allocation_site; |
2552 Register feedback_map = t1; | 2554 Register feedback_map = t1; |
2553 Register weak_value = t4; | 2555 Register weak_value = t4; |
2554 __ lw(weak_value, FieldMemOperand(t0, WeakCell::kValueOffset)); | 2556 __ lw(weak_value, FieldMemOperand(t0, WeakCell::kValueOffset)); |
2555 __ Branch(&done, eq, a1, Operand(weak_value)); | 2557 __ Branch(&done, eq, a1, Operand(weak_value)); |
2556 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); | 2558 __ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
2557 __ Branch(&done, eq, t0, Operand(at)); | 2559 __ Branch(&done, eq, t0, Operand(at)); |
2558 __ lw(feedback_map, FieldMemOperand(t0, 0)); | 2560 __ lw(feedback_map, FieldMemOperand(t0, Heap::kMapOffset)); |
2559 __ LoadRoot(at, Heap::kWeakCellMapRootIndex); | 2561 __ LoadRoot(at, Heap::kWeakCellMapRootIndex); |
2560 __ Branch(FLAG_pretenuring_call_new ? &miss : &check_allocation_site, ne, | 2562 __ Branch(FLAG_pretenuring_call_new ? &miss : &check_allocation_site, ne, |
2561 feedback_map, Operand(at)); | 2563 feedback_map, Operand(at)); |
2562 | 2564 |
2563 // If a1 is not equal to the weak cell value, and the weak cell value is | 2565 // If the weak cell is cleared, we have a new chance to become monomorphic. |
2564 // cleared, we have a new chance to become monomorphic. | |
2565 __ JumpIfSmi(weak_value, &initialize); | 2566 __ JumpIfSmi(weak_value, &initialize); |
2566 __ jmp(&megamorphic); | 2567 __ jmp(&megamorphic); |
2567 | 2568 |
2568 if (!FLAG_pretenuring_call_new) { | 2569 if (!FLAG_pretenuring_call_new) { |
2569 __ bind(&check_allocation_site); | 2570 __ bind(&check_allocation_site); |
2570 // If we came here, we need to see if we are the array function. | 2571 // If we came here, we need to see if we are the array function. |
2571 // If we didn't have a matching function, and we didn't find the megamorph | 2572 // If we didn't have a matching function, and we didn't find the megamorph |
2572 // sentinel, then we have in the slot either some other function or an | 2573 // sentinel, then we have in the slot either some other function or an |
2573 // AllocationSite. Do a map check on the object in a3. | 2574 // AllocationSite. |
2574 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | 2575 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
2575 __ Branch(&miss, ne, feedback_map, Operand(at)); | 2576 __ Branch(&miss, ne, feedback_map, Operand(at)); |
2576 | 2577 |
2577 // Make sure the function is the Array() function | 2578 // Make sure the function is the Array() function |
2578 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t0); | 2579 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t0); |
2579 __ Branch(&megamorphic, ne, a1, Operand(t0)); | 2580 __ Branch(&megamorphic, ne, a1, Operand(t0)); |
2580 __ jmp(&done); | 2581 __ jmp(&done); |
2581 } | 2582 } |
2582 | 2583 |
2583 __ bind(&miss); | 2584 __ bind(&miss); |
(...skipping 2928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5512 kStackUnwindSpace, kInvalidStackOffset, | 5513 kStackUnwindSpace, kInvalidStackOffset, |
5513 MemOperand(fp, 6 * kPointerSize), NULL); | 5514 MemOperand(fp, 6 * kPointerSize), NULL); |
5514 } | 5515 } |
5515 | 5516 |
5516 | 5517 |
5517 #undef __ | 5518 #undef __ |
5518 | 5519 |
5519 } } // namespace v8::internal | 5520 } } // namespace v8::internal |
5520 | 5521 |
5521 #endif // V8_TARGET_ARCH_MIPS | 5522 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |