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

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

Powered by Google App Engine
This is Rietveld 408576698