Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: src/mips64/code-stubs-mips64.cc

Issue 1418623007: [runtime] Fix ES6 9.2.1 [[Call]] when encountering a classConstructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do not use kNear jump on x64 Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
2532 2532
2533 __ bind(&not_array_function); 2533 __ bind(&not_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
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::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
2579 static void CallFunctionNoFeedback(MacroAssembler* masm, 2598 static void CallFunctionNoFeedback(MacroAssembler* masm,
2580 int argc, bool needs_checks, 2599 int argc, bool needs_checks,
2581 bool call_as_method) { 2600 bool call_as_method) {
2582 // a1 : the function to call 2601 // a1 : the function to call
2583 Label slow, wrap, cont; 2602 Label slow, wrap, cont;
2584 2603
2585 if (needs_checks) { 2604 if (needs_checks) {
2586 // Check that the function is really a JavaScript function. 2605 // Check that the function is really a JavaScript function.
2587 // a1: pushed function (to be verified) 2606 // a1: pushed function (to be verified)
2588 __ JumpIfSmi(a1, &slow); 2607 __ JumpIfSmi(a1, &slow);
2589 2608
2590 // Goto slow case if we do not have a function. 2609 // Goto slow case if we do not have a function.
2591 __ GetObjectType(a1, a4, a4); 2610 __ GetObjectType(a1, a4, a4);
2592 __ Branch(&slow, ne, a4, Operand(JS_FUNCTION_TYPE)); 2611 __ Branch(&slow, ne, a4, Operand(JS_FUNCTION_TYPE));
2593 } 2612 }
2594 2613
2614 __ ld(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
2615 EmitClassConstructorCallCheck(masm);
2616
2595 // Fast-case: Invoke the function now. 2617 // Fast-case: Invoke the function now.
2596 // a1: pushed function 2618 // a1: pushed function
2597 ParameterCount actual(argc); 2619 ParameterCount actual(argc);
2598 2620
2599 if (call_as_method) { 2621 if (call_as_method) {
2600 if (needs_checks) { 2622 if (needs_checks) {
2601 EmitContinueIfStrictOrNative(masm, &cont); 2623 EmitContinueIfStrictOrNative(masm, &cont);
2602 } 2624 }
2603 2625
2604 // Compute the receiver in sloppy mode. 2626 // Compute the receiver in sloppy mode.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2791 __ JumpIfSmi(a1, &extra_checks_or_miss); 2813 __ JumpIfSmi(a1, &extra_checks_or_miss);
2792 2814
2793 // Increment the call count for monomorphic function calls. 2815 // Increment the call count for monomorphic function calls.
2794 __ dsrl(t0, a3, 32 - kPointerSizeLog2); 2816 __ dsrl(t0, a3, 32 - kPointerSizeLog2);
2795 __ Daddu(a3, a2, Operand(t0)); 2817 __ Daddu(a3, a2, Operand(t0));
2796 __ ld(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); 2818 __ ld(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize));
2797 __ Daddu(t0, t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); 2819 __ Daddu(t0, t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement)));
2798 __ sd(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize)); 2820 __ sd(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize));
2799 2821
2800 __ bind(&have_js_function); 2822 __ bind(&have_js_function);
2823
2824 __ ld(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
2825 EmitClassConstructorCallCheck(masm);
2826
2801 if (CallAsMethod()) { 2827 if (CallAsMethod()) {
2802 EmitContinueIfStrictOrNative(masm, &cont); 2828 EmitContinueIfStrictOrNative(masm, &cont);
2803 // Compute the receiver in sloppy mode. 2829 // Compute the receiver in sloppy mode.
2804 __ ld(a3, MemOperand(sp, argc * kPointerSize)); 2830 __ ld(a3, MemOperand(sp, argc * kPointerSize));
2805 2831
2806 __ JumpIfSmi(a3, &wrap); 2832 __ JumpIfSmi(a3, &wrap);
2807 __ GetObjectType(a3, a4, a4); 2833 __ GetObjectType(a3, a4, a4);
2808 __ Branch(&wrap, lt, a4, Operand(FIRST_SPEC_OBJECT_TYPE)); 2834 __ Branch(&wrap, lt, a4, Operand(FIRST_SPEC_OBJECT_TYPE));
2809 2835
2810 __ bind(&cont); 2836 __ bind(&cont);
(...skipping 2981 matching lines...) Expand 10 before | Expand all | Expand 10 after
5792 MemOperand(fp, 6 * kPointerSize), NULL); 5818 MemOperand(fp, 6 * kPointerSize), NULL);
5793 } 5819 }
5794 5820
5795 5821
5796 #undef __ 5822 #undef __
5797 5823
5798 } // namespace internal 5824 } // namespace internal
5799 } // namespace v8 5825 } // namespace v8
5800 5826
5801 #endif // V8_TARGET_ARCH_MIPS64 5827 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698