| 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 2485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2496 __ Branch(&done); | 2496 __ Branch(&done); |
| 2497 | 2497 |
| 2498 __ bind(¬_array_function); | 2498 __ bind(¬_array_function); |
| 2499 CreateWeakCellStub weak_cell_stub(masm->isolate()); | 2499 CreateWeakCellStub weak_cell_stub(masm->isolate()); |
| 2500 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); | 2500 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); |
| 2501 __ bind(&done); | 2501 __ bind(&done); |
| 2502 } | 2502 } |
| 2503 | 2503 |
| 2504 | 2504 |
| 2505 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { | 2505 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { |
| 2506 // ----------- S t a t e ------------- | 2506 __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
| 2507 // -- a1 : the function to call | |
| 2508 // -- a3 : the function's shared function info | |
| 2509 // ----------------------------------- | |
| 2510 __ lw(t0, FieldMemOperand(a3, SharedFunctionInfo::kCompilerHintsOffset)); | 2507 __ lw(t0, FieldMemOperand(a3, SharedFunctionInfo::kCompilerHintsOffset)); |
| 2511 | 2508 |
| 2512 // Do not transform the receiver for strict mode functions. | 2509 // Do not transform the receiver for strict mode functions. |
| 2513 int32_t strict_mode_function_mask = | 2510 int32_t strict_mode_function_mask = |
| 2514 1 << (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize); | 2511 1 << (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize); |
| 2515 // Do not transform the receiver for native (Compilerhints already in a3). | 2512 // Do not transform the receiver for native (Compilerhints already in a3). |
| 2516 int32_t native_mask = 1 << (SharedFunctionInfo::kNative + kSmiTagSize); | 2513 int32_t native_mask = 1 << (SharedFunctionInfo::kNative + kSmiTagSize); |
| 2517 __ And(at, t0, Operand(strict_mode_function_mask | native_mask)); | 2514 __ And(at, t0, Operand(strict_mode_function_mask | native_mask)); |
| 2518 __ Branch(cont, ne, at, Operand(zero_reg)); | 2515 __ Branch(cont, ne, at, Operand(zero_reg)); |
| 2519 } | 2516 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2532 __ mov(a0, a3); | 2529 __ mov(a0, a3); |
| 2533 ToObjectStub stub(masm->isolate()); | 2530 ToObjectStub stub(masm->isolate()); |
| 2534 __ CallStub(&stub); | 2531 __ CallStub(&stub); |
| 2535 __ pop(a1); | 2532 __ pop(a1); |
| 2536 } | 2533 } |
| 2537 __ Branch(USE_DELAY_SLOT, cont); | 2534 __ Branch(USE_DELAY_SLOT, cont); |
| 2538 __ sw(v0, MemOperand(sp, argc * kPointerSize)); | 2535 __ sw(v0, MemOperand(sp, argc * kPointerSize)); |
| 2539 } | 2536 } |
| 2540 | 2537 |
| 2541 | 2538 |
| 2542 static void EmitClassConstructorCallCheck(MacroAssembler* masm) { | |
| 2543 // ----------- S t a t e ------------- | |
| 2544 // -- a1 : the function to call | |
| 2545 // -- a3 : the function's shared function info | |
| 2546 // ----------------------------------- | |
| 2547 // ClassConstructor Check: ES6 section 9.2.1 [[Call]] | |
| 2548 Label non_class_constructor; | |
| 2549 // Check whether the current function is a classConstructor. | |
| 2550 __ lbu(t0, FieldMemOperand(a3, SharedFunctionInfo::kFunctionKindByteOffset)); | |
| 2551 __ And(at, t0, Operand(SharedFunctionInfo::kClassConstructorBitsWithinByte)); | |
| 2552 __ Branch(&non_class_constructor, eq, at, Operand(zero_reg)); | |
| 2553 // Step: 2, If we call a classConstructor Function throw a TypeError. | |
| 2554 __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET); | |
| 2555 __ bind(&non_class_constructor); | |
| 2556 } | |
| 2557 | |
| 2558 | |
| 2559 static void CallFunctionNoFeedback(MacroAssembler* masm, | 2539 static void CallFunctionNoFeedback(MacroAssembler* masm, |
| 2560 int argc, bool needs_checks, | 2540 int argc, bool needs_checks, |
| 2561 bool call_as_method) { | 2541 bool call_as_method) { |
| 2562 // a1 : the function to call | 2542 // a1 : the function to call |
| 2563 Label slow, wrap, cont; | 2543 Label slow, wrap, cont; |
| 2564 | 2544 |
| 2565 if (needs_checks) { | 2545 if (needs_checks) { |
| 2566 // Check that the function is really a JavaScript function. | 2546 // Check that the function is really a JavaScript function. |
| 2567 // a1: pushed function (to be verified) | 2547 // a1: pushed function (to be verified) |
| 2568 __ JumpIfSmi(a1, &slow); | 2548 __ JumpIfSmi(a1, &slow); |
| 2569 | 2549 |
| 2570 // Goto slow case if we do not have a function. | 2550 // Goto slow case if we do not have a function. |
| 2571 __ GetObjectType(a1, t0, t0); | 2551 __ GetObjectType(a1, t0, t0); |
| 2572 __ Branch(&slow, ne, t0, Operand(JS_FUNCTION_TYPE)); | 2552 __ Branch(&slow, ne, t0, Operand(JS_FUNCTION_TYPE)); |
| 2573 } | 2553 } |
| 2574 | 2554 |
| 2575 __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | |
| 2576 EmitClassConstructorCallCheck(masm); | |
| 2577 | |
| 2578 // Fast-case: Invoke the function now. | 2555 // Fast-case: Invoke the function now. |
| 2579 // a1: pushed function | 2556 // a1: pushed function |
| 2580 ParameterCount actual(argc); | 2557 ParameterCount actual(argc); |
| 2581 | 2558 |
| 2582 if (call_as_method) { | 2559 if (call_as_method) { |
| 2583 if (needs_checks) { | 2560 if (needs_checks) { |
| 2584 EmitContinueIfStrictOrNative(masm, &cont); | 2561 EmitContinueIfStrictOrNative(masm, &cont); |
| 2585 } | 2562 } |
| 2586 | 2563 |
| 2587 // Compute the receiver in sloppy mode. | 2564 // Compute the receiver in sloppy mode. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2735 __ JumpIfSmi(a1, &extra_checks_or_miss); | 2712 __ JumpIfSmi(a1, &extra_checks_or_miss); |
| 2736 | 2713 |
| 2737 // Increment the call count for monomorphic function calls. | 2714 // Increment the call count for monomorphic function calls. |
| 2738 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); | 2715 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); |
| 2739 __ Addu(at, a2, Operand(at)); | 2716 __ Addu(at, a2, Operand(at)); |
| 2740 __ lw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize)); | 2717 __ lw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize)); |
| 2741 __ Addu(a3, a3, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 2718 __ Addu(a3, a3, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
| 2742 __ sw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize)); | 2719 __ sw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize)); |
| 2743 | 2720 |
| 2744 __ bind(&have_js_function); | 2721 __ bind(&have_js_function); |
| 2745 | |
| 2746 __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | |
| 2747 EmitClassConstructorCallCheck(masm); | |
| 2748 | |
| 2749 if (CallAsMethod()) { | 2722 if (CallAsMethod()) { |
| 2750 EmitContinueIfStrictOrNative(masm, &cont); | 2723 EmitContinueIfStrictOrNative(masm, &cont); |
| 2751 // Compute the receiver in sloppy mode. | 2724 // Compute the receiver in sloppy mode. |
| 2752 __ lw(a3, MemOperand(sp, argc * kPointerSize)); | 2725 __ lw(a3, MemOperand(sp, argc * kPointerSize)); |
| 2753 | 2726 |
| 2754 __ JumpIfSmi(a3, &wrap); | 2727 __ JumpIfSmi(a3, &wrap); |
| 2755 __ GetObjectType(a3, t0, t0); | 2728 __ GetObjectType(a3, t0, t0); |
| 2756 __ Branch(&wrap, lt, t0, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2729 __ Branch(&wrap, lt, t0, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 2757 | 2730 |
| 2758 __ bind(&cont); | 2731 __ bind(&cont); |
| (...skipping 3027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5786 MemOperand(fp, 6 * kPointerSize), NULL); | 5759 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5787 } | 5760 } |
| 5788 | 5761 |
| 5789 | 5762 |
| 5790 #undef __ | 5763 #undef __ |
| 5791 | 5764 |
| 5792 } // namespace internal | 5765 } // namespace internal |
| 5793 } // namespace v8 | 5766 } // namespace v8 |
| 5794 | 5767 |
| 5795 #endif // V8_TARGET_ARCH_MIPS | 5768 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |