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