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 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2422 #endif // V8_INTERPRETED_REGEXP | 2422 #endif // V8_INTERPRETED_REGEXP |
2423 } | 2423 } |
2424 | 2424 |
2425 | 2425 |
2426 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub, | 2426 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub, |
2427 bool is_super) { | 2427 bool is_super) { |
2428 // a0 : number of arguments to the construct function | 2428 // a0 : number of arguments to the construct function |
2429 // a2 : feedback vector | 2429 // a2 : feedback vector |
2430 // a3 : slot in feedback vector (Smi) | 2430 // a3 : slot in feedback vector (Smi) |
2431 // a1 : the function to call | 2431 // a1 : the function to call |
2432 // a4 : original constructor (for IsSuperConstructorCall) | 2432 // a4 : new target (for IsSuperConstructorCall) |
2433 FrameScope scope(masm, StackFrame::INTERNAL); | 2433 FrameScope scope(masm, StackFrame::INTERNAL); |
2434 const RegList kSavedRegs = 1 << 4 | // a0 | 2434 const RegList kSavedRegs = 1 << 4 | // a0 |
2435 1 << 5 | // a1 | 2435 1 << 5 | // a1 |
2436 1 << 6 | // a2 | 2436 1 << 6 | // a2 |
2437 1 << 7 | // a3 | 2437 1 << 7 | // a3 |
2438 BoolToInt(is_super) << 8; // a4 | 2438 BoolToInt(is_super) << 8; // a4 |
2439 | 2439 |
2440 | 2440 |
2441 // Number-of-arguments register must be smi-tagged to call out. | 2441 // Number-of-arguments register must be smi-tagged to call out. |
2442 __ SmiTag(a0); | 2442 __ SmiTag(a0); |
2443 __ MultiPush(kSavedRegs); | 2443 __ MultiPush(kSavedRegs); |
2444 | 2444 |
2445 __ CallStub(stub); | 2445 __ CallStub(stub); |
2446 | 2446 |
2447 __ MultiPop(kSavedRegs); | 2447 __ MultiPop(kSavedRegs); |
2448 __ SmiUntag(a0); | 2448 __ SmiUntag(a0); |
2449 } | 2449 } |
2450 | 2450 |
2451 | 2451 |
2452 static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) { | 2452 static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) { |
2453 // Cache the called function in a feedback vector slot. Cache states | 2453 // Cache the called function in a feedback vector slot. Cache states |
2454 // are uninitialized, monomorphic (indicated by a JSFunction), and | 2454 // are uninitialized, monomorphic (indicated by a JSFunction), and |
2455 // megamorphic. | 2455 // megamorphic. |
2456 // a0 : number of arguments to the construct function | 2456 // a0 : number of arguments to the construct function |
2457 // a1 : the function to call | 2457 // a1 : the function to call |
2458 // a2 : feedback vector | 2458 // a2 : feedback vector |
2459 // a3 : slot in feedback vector (Smi) | 2459 // a3 : slot in feedback vector (Smi) |
2460 // a4 : original constructor (for IsSuperConstructorCall) | 2460 // a4 : new target (for IsSuperConstructorCall) |
2461 Label initialize, done, miss, megamorphic, not_array_function; | 2461 Label initialize, done, miss, megamorphic, not_array_function; |
2462 | 2462 |
2463 DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), | 2463 DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), |
2464 masm->isolate()->heap()->megamorphic_symbol()); | 2464 masm->isolate()->heap()->megamorphic_symbol()); |
2465 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), | 2465 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), |
2466 masm->isolate()->heap()->uninitialized_symbol()); | 2466 masm->isolate()->heap()->uninitialized_symbol()); |
2467 | 2467 |
2468 // Load the cache state into a5. | 2468 // Load the cache state into a5. |
2469 __ dsrl(a5, a3, 32 - kPointerSizeLog2); | 2469 __ dsrl(a5, a3, 32 - kPointerSizeLog2); |
2470 __ Daddu(a5, a2, Operand(a5)); | 2470 __ Daddu(a5, a2, Operand(a5)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2536 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); | 2536 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); |
2537 __ bind(&done); | 2537 __ bind(&done); |
2538 } | 2538 } |
2539 | 2539 |
2540 | 2540 |
2541 void CallConstructStub::Generate(MacroAssembler* masm) { | 2541 void CallConstructStub::Generate(MacroAssembler* masm) { |
2542 // a0 : number of arguments | 2542 // a0 : number of arguments |
2543 // a1 : the function to call | 2543 // a1 : the function to call |
2544 // a2 : feedback vector | 2544 // a2 : feedback vector |
2545 // a3 : slot in feedback vector (Smi, for RecordCallTarget) | 2545 // a3 : slot in feedback vector (Smi, for RecordCallTarget) |
2546 // a4 : original constructor (for IsSuperConstructorCall) | 2546 // a4 : new target (for IsSuperConstructorCall) |
2547 | 2547 |
2548 Label non_function; | 2548 Label non_function; |
2549 // Check that the function is not a smi. | 2549 // Check that the function is not a smi. |
2550 __ JumpIfSmi(a1, &non_function); | 2550 __ JumpIfSmi(a1, &non_function); |
2551 // Check that the function is a JSFunction. | 2551 // Check that the function is a JSFunction. |
2552 __ GetObjectType(a1, a5, a5); | 2552 __ GetObjectType(a1, a5, a5); |
2553 __ Branch(&non_function, ne, a5, Operand(JS_FUNCTION_TYPE)); | 2553 __ Branch(&non_function, ne, a5, Operand(JS_FUNCTION_TYPE)); |
2554 | 2554 |
2555 if (RecordCallTarget()) { | 2555 if (RecordCallTarget()) { |
2556 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); | 2556 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); |
2557 | 2557 |
2558 __ dsrl(at, a3, 32 - kPointerSizeLog2); | 2558 __ dsrl(at, a3, 32 - kPointerSizeLog2); |
2559 __ Daddu(a5, a2, at); | 2559 __ Daddu(a5, a2, at); |
2560 Label feedback_register_initialized; | 2560 Label feedback_register_initialized; |
2561 // Put the AllocationSite from the feedback vector into a2, or undefined. | 2561 // Put the AllocationSite from the feedback vector into a2, or undefined. |
2562 __ ld(a2, FieldMemOperand(a5, FixedArray::kHeaderSize)); | 2562 __ ld(a2, FieldMemOperand(a5, FixedArray::kHeaderSize)); |
2563 __ ld(a5, FieldMemOperand(a2, AllocationSite::kMapOffset)); | 2563 __ ld(a5, FieldMemOperand(a2, AllocationSite::kMapOffset)); |
2564 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | 2564 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
2565 __ Branch(&feedback_register_initialized, eq, a5, Operand(at)); | 2565 __ Branch(&feedback_register_initialized, eq, a5, Operand(at)); |
2566 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 2566 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
2567 __ bind(&feedback_register_initialized); | 2567 __ bind(&feedback_register_initialized); |
2568 | 2568 |
2569 __ AssertUndefinedOrAllocationSite(a2, a5); | 2569 __ AssertUndefinedOrAllocationSite(a2, a5); |
2570 } | 2570 } |
2571 | 2571 |
2572 // Pass function as original constructor. | 2572 // Pass function as new target. |
2573 if (IsSuperConstructorCall()) { | 2573 if (IsSuperConstructorCall()) { |
2574 __ mov(a3, a4); | 2574 __ mov(a3, a4); |
2575 } else { | 2575 } else { |
2576 __ mov(a3, a1); | 2576 __ mov(a3, a1); |
2577 } | 2577 } |
2578 | 2578 |
2579 // Tail call to the function-specific construct stub (still in the caller | 2579 // Tail call to the function-specific construct stub (still in the caller |
2580 // context at this point). | 2580 // context at this point). |
2581 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 2581 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
2582 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset)); | 2582 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset)); |
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5074 UNREACHABLE(); | 5074 UNREACHABLE(); |
5075 } | 5075 } |
5076 } | 5076 } |
5077 | 5077 |
5078 | 5078 |
5079 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 5079 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
5080 // ----------- S t a t e ------------- | 5080 // ----------- S t a t e ------------- |
5081 // -- a0 : argc (only if argument_count() == ANY) | 5081 // -- a0 : argc (only if argument_count() == ANY) |
5082 // -- a1 : constructor | 5082 // -- a1 : constructor |
5083 // -- a2 : AllocationSite or undefined | 5083 // -- a2 : AllocationSite or undefined |
5084 // -- a3 : original constructor | 5084 // -- a3 : new target |
5085 // -- sp[0] : last argument | 5085 // -- sp[0] : last argument |
5086 // ----------------------------------- | 5086 // ----------------------------------- |
5087 | 5087 |
5088 if (FLAG_debug_code) { | 5088 if (FLAG_debug_code) { |
5089 // The array construct code is only set for the global and natives | 5089 // The array construct code is only set for the global and natives |
5090 // builtin Array functions which always have maps. | 5090 // builtin Array functions which always have maps. |
5091 | 5091 |
5092 // Initial map for the builtin Array function should be a map. | 5092 // Initial map for the builtin Array function should be a map. |
5093 __ ld(a4, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); | 5093 __ ld(a4, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); |
5094 // Will both indicate a NULL and a Smi. | 5094 // Will both indicate a NULL and a Smi. |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5672 MemOperand(fp, 6 * kPointerSize), NULL); | 5672 MemOperand(fp, 6 * kPointerSize), NULL); |
5673 } | 5673 } |
5674 | 5674 |
5675 | 5675 |
5676 #undef __ | 5676 #undef __ |
5677 | 5677 |
5678 } // namespace internal | 5678 } // namespace internal |
5679 } // namespace v8 | 5679 } // namespace v8 |
5680 | 5680 |
5681 #endif // V8_TARGET_ARCH_MIPS64 | 5681 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |