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 2521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2532 | 2532 |
2533 __ bind(¬_array_function); | 2533 __ bind(¬_array_function); |
2534 | 2534 |
2535 CreateWeakCellStub weak_cell_stub(masm->isolate()); | 2535 CreateWeakCellStub weak_cell_stub(masm->isolate()); |
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 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { | 2541 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { |
2542 // ----------- S t a t e ------------- | 2542 __ ld(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
2543 // -- a1 : the function to call | 2543 |
2544 // -- a3 : the shared function info | |
2545 // ----------------------------------- | |
2546 // Do not transform the receiver for strict mode functions. | 2544 // Do not transform the receiver for strict mode functions. |
2547 int32_t strict_mode_function_mask = | 2545 int32_t strict_mode_function_mask = |
2548 1 << SharedFunctionInfo::kStrictModeBitWithinByte; | 2546 1 << SharedFunctionInfo::kStrictModeBitWithinByte; |
2549 // Do not transform the receiver for native (Compilerhints already in a3). | 2547 // Do not transform the receiver for native (Compilerhints already in a3). |
2550 int32_t native_mask = 1 << SharedFunctionInfo::kNativeBitWithinByte; | 2548 int32_t native_mask = 1 << SharedFunctionInfo::kNativeBitWithinByte; |
2551 | 2549 |
2552 __ lbu(a4, FieldMemOperand(a3, SharedFunctionInfo::kStrictModeByteOffset)); | 2550 __ lbu(a4, FieldMemOperand(a3, SharedFunctionInfo::kStrictModeByteOffset)); |
2553 __ And(at, a4, Operand(strict_mode_function_mask)); | 2551 __ And(at, a4, Operand(strict_mode_function_mask)); |
2554 __ Branch(cont, ne, at, Operand(zero_reg)); | 2552 __ Branch(cont, ne, at, Operand(zero_reg)); |
2555 __ lbu(a4, FieldMemOperand(a3, SharedFunctionInfo::kNativeByteOffset)); | 2553 __ lbu(a4, FieldMemOperand(a3, SharedFunctionInfo::kNativeByteOffset)); |
(...skipping 15 matching lines...) Expand all Loading... |
2571 __ mov(a0, a3); | 2569 __ mov(a0, a3); |
2572 ToObjectStub stub(masm->isolate()); | 2570 ToObjectStub stub(masm->isolate()); |
2573 __ CallStub(&stub); | 2571 __ CallStub(&stub); |
2574 __ pop(a1); | 2572 __ pop(a1); |
2575 } | 2573 } |
2576 __ Branch(USE_DELAY_SLOT, cont); | 2574 __ Branch(USE_DELAY_SLOT, cont); |
2577 __ sd(v0, MemOperand(sp, argc * kPointerSize)); | 2575 __ sd(v0, MemOperand(sp, argc * kPointerSize)); |
2578 } | 2576 } |
2579 | 2577 |
2580 | 2578 |
2581 static void EmitClassConstructorCallCheck(MacroAssembler* masm) { | |
2582 // ----------- S t a t e ------------- | |
2583 // -- a1 : the function to call | |
2584 // -- a3 : the shared function info | |
2585 // ----------------------------------- | |
2586 // ClassConstructor Check: ES6 section 9.2.1 [[Call]] | |
2587 Label non_class_constructor; | |
2588 __ lbu(a4, FieldMemOperand(a3, SharedFunctionInfo::kFunctionKindByteOffset)); | |
2589 __ And(at, a4, Operand(SharedFunctionInfo::kClassConstructorBitsWithinByte)); | |
2590 __ Branch(&non_class_constructor, eq, at, Operand(zero_reg)); | |
2591 // If we call a classConstructor Function throw a TypeError | |
2592 // indirectly via the CallFunction builtin. | |
2593 __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET); | |
2594 __ bind(&non_class_constructor); | |
2595 } | |
2596 | |
2597 | |
2598 static void CallFunctionNoFeedback(MacroAssembler* masm, | 2579 static void CallFunctionNoFeedback(MacroAssembler* masm, |
2599 int argc, bool needs_checks, | 2580 int argc, bool needs_checks, |
2600 bool call_as_method) { | 2581 bool call_as_method) { |
2601 // a1 : the function to call | 2582 // a1 : the function to call |
2602 Label slow, wrap, cont; | 2583 Label slow, wrap, cont; |
2603 | 2584 |
2604 if (needs_checks) { | 2585 if (needs_checks) { |
2605 // Check that the function is really a JavaScript function. | 2586 // Check that the function is really a JavaScript function. |
2606 // a1: pushed function (to be verified) | 2587 // a1: pushed function (to be verified) |
2607 __ JumpIfSmi(a1, &slow); | 2588 __ JumpIfSmi(a1, &slow); |
2608 | 2589 |
2609 // Goto slow case if we do not have a function. | 2590 // Goto slow case if we do not have a function. |
2610 __ GetObjectType(a1, a4, a4); | 2591 __ GetObjectType(a1, a4, a4); |
2611 __ Branch(&slow, ne, a4, Operand(JS_FUNCTION_TYPE)); | 2592 __ Branch(&slow, ne, a4, Operand(JS_FUNCTION_TYPE)); |
2612 } | 2593 } |
2613 | 2594 |
2614 __ ld(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | |
2615 EmitClassConstructorCallCheck(masm); | |
2616 | |
2617 // Fast-case: Invoke the function now. | 2595 // Fast-case: Invoke the function now. |
2618 // a1: pushed function | 2596 // a1: pushed function |
2619 ParameterCount actual(argc); | 2597 ParameterCount actual(argc); |
2620 | 2598 |
2621 if (call_as_method) { | 2599 if (call_as_method) { |
2622 if (needs_checks) { | 2600 if (needs_checks) { |
2623 EmitContinueIfStrictOrNative(masm, &cont); | 2601 EmitContinueIfStrictOrNative(masm, &cont); |
2624 } | 2602 } |
2625 | 2603 |
2626 // Compute the receiver in sloppy mode. | 2604 // Compute the receiver in sloppy mode. |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2813 __ JumpIfSmi(a1, &extra_checks_or_miss); | 2791 __ JumpIfSmi(a1, &extra_checks_or_miss); |
2814 | 2792 |
2815 // Increment the call count for monomorphic function calls. | 2793 // Increment the call count for monomorphic function calls. |
2816 __ dsrl(t0, a3, 32 - kPointerSizeLog2); | 2794 __ dsrl(t0, a3, 32 - kPointerSizeLog2); |
2817 __ Daddu(a3, a2, Operand(t0)); | 2795 __ Daddu(a3, a2, Operand(t0)); |
2818 __ ld(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); | 2796 __ ld(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); |
2819 __ Daddu(t0, t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 2797 __ Daddu(t0, t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
2820 __ sd(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); | 2798 __ sd(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); |
2821 | 2799 |
2822 __ bind(&have_js_function); | 2800 __ bind(&have_js_function); |
2823 | |
2824 __ ld(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | |
2825 EmitClassConstructorCallCheck(masm); | |
2826 | |
2827 if (CallAsMethod()) { | 2801 if (CallAsMethod()) { |
2828 EmitContinueIfStrictOrNative(masm, &cont); | 2802 EmitContinueIfStrictOrNative(masm, &cont); |
2829 // Compute the receiver in sloppy mode. | 2803 // Compute the receiver in sloppy mode. |
2830 __ ld(a3, MemOperand(sp, argc * kPointerSize)); | 2804 __ ld(a3, MemOperand(sp, argc * kPointerSize)); |
2831 | 2805 |
2832 __ JumpIfSmi(a3, &wrap); | 2806 __ JumpIfSmi(a3, &wrap); |
2833 __ GetObjectType(a3, a4, a4); | 2807 __ GetObjectType(a3, a4, a4); |
2834 __ Branch(&wrap, lt, a4, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2808 __ Branch(&wrap, lt, a4, Operand(FIRST_SPEC_OBJECT_TYPE)); |
2835 | 2809 |
2836 __ bind(&cont); | 2810 __ bind(&cont); |
(...skipping 2981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5818 MemOperand(fp, 6 * kPointerSize), NULL); | 5792 MemOperand(fp, 6 * kPointerSize), NULL); |
5819 } | 5793 } |
5820 | 5794 |
5821 | 5795 |
5822 #undef __ | 5796 #undef __ |
5823 | 5797 |
5824 } // namespace internal | 5798 } // namespace internal |
5825 } // namespace v8 | 5799 } // namespace v8 |
5826 | 5800 |
5827 #endif // V8_TARGET_ARCH_MIPS64 | 5801 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |