| OLD | NEW | 
|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 | 
| 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 2729 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2740   __ B(&done); | 2740   __ B(&done); | 
| 2741 | 2741 | 
| 2742   __ Bind(¬_array_function); | 2742   __ Bind(¬_array_function); | 
| 2743   CreateWeakCellStub weak_cell_stub(masm->isolate()); | 2743   CreateWeakCellStub weak_cell_stub(masm->isolate()); | 
| 2744   CallStubInRecordCallTarget(masm, &weak_cell_stub, argc, function, | 2744   CallStubInRecordCallTarget(masm, &weak_cell_stub, argc, function, | 
| 2745                              feedback_vector, index, orig_construct, is_super); | 2745                              feedback_vector, index, orig_construct, is_super); | 
| 2746   __ Bind(&done); | 2746   __ Bind(&done); | 
| 2747 } | 2747 } | 
| 2748 | 2748 | 
| 2749 | 2749 | 
|  | 2750 static void LoadCompilerHints(MacroAssembler* masm) { | 
|  | 2751   // ----------- S t a t e ------------- | 
|  | 2752   // -- x1 : the function to call | 
|  | 2753   // ----------------------------------- | 
|  | 2754   // Do not transform the receiver for strict mode functions. | 
|  | 2755   __ Ldr(x3, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | 
|  | 2756   __ Ldr(w4, FieldMemOperand(x3, SharedFunctionInfo::kCompilerHintsOffset)); | 
|  | 2757 } | 
|  | 2758 | 
|  | 2759 | 
| 2750 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { | 2760 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { | 
| 2751   // Do not transform the receiver for strict mode functions. | 2761   // ----------- S t a t e ------------- | 
| 2752   __ Ldr(x3, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | 2762   // -- a1 : the function to call | 
| 2753   __ Ldr(w4, FieldMemOperand(x3, SharedFunctionInfo::kCompilerHintsOffset)); | 2763   // -- x3 : the shared function info | 
|  | 2764   // -- w4 : the compiler info hints from the shared function info | 
|  | 2765   // ----------------------------------- | 
| 2754   __ Tbnz(w4, SharedFunctionInfo::kStrictModeFunction, cont); | 2766   __ Tbnz(w4, SharedFunctionInfo::kStrictModeFunction, cont); | 
| 2755 | 2767 | 
| 2756   // Do not transform the receiver for native (Compilerhints already in x3). | 2768   // Do not transform the receiver for native (Compilerhints already in x3). | 
| 2757   __ Tbnz(w4, SharedFunctionInfo::kNative, cont); | 2769   __ Tbnz(w4, SharedFunctionInfo::kNative, cont); | 
| 2758 } | 2770 } | 
| 2759 | 2771 | 
| 2760 | 2772 | 
| 2761 static void EmitSlowCase(MacroAssembler* masm, int argc) { | 2773 static void EmitSlowCase(MacroAssembler* masm, int argc) { | 
| 2762   __ Mov(x0, argc); | 2774   __ Mov(x0, argc); | 
| 2763   __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2775   __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 
| 2764 } | 2776 } | 
| 2765 | 2777 | 
| 2766 | 2778 | 
| 2767 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { | 2779 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { | 
| 2768   // Wrap the receiver and patch it back onto the stack. | 2780   // Wrap the receiver and patch it back onto the stack. | 
| 2769   { FrameScope frame_scope(masm, StackFrame::INTERNAL); | 2781   { FrameScope frame_scope(masm, StackFrame::INTERNAL); | 
| 2770     __ Push(x1); | 2782     __ Push(x1); | 
| 2771     __ Mov(x0, x3); | 2783     __ Mov(x0, x3); | 
| 2772     ToObjectStub stub(masm->isolate()); | 2784     ToObjectStub stub(masm->isolate()); | 
| 2773     __ CallStub(&stub); | 2785     __ CallStub(&stub); | 
| 2774     __ Pop(x1); | 2786     __ Pop(x1); | 
| 2775   } | 2787   } | 
| 2776   __ Poke(x0, argc * kPointerSize); | 2788   __ Poke(x0, argc * kPointerSize); | 
| 2777   __ B(cont); | 2789   __ B(cont); | 
| 2778 } | 2790 } | 
| 2779 | 2791 | 
| 2780 | 2792 | 
|  | 2793 static void EmitClassConstructorCallCheck(MacroAssembler* masm) { | 
|  | 2794   //   ----------- S t a t e ------------- | 
|  | 2795   //   -- x1 : the function to call | 
|  | 2796   //   -- x3 : the shared function info | 
|  | 2797   //   -- w4 : the shared function's compiler hints | 
|  | 2798   //   ----------------------------------- | 
|  | 2799   //   ClassConstructor Check: ES6 section 9.2.1 [[Call]] | 
|  | 2800   Label non_class_constructor; | 
|  | 2801   __ TestAndBranchIfAllClear( | 
|  | 2802       w4, (1 << SharedFunctionInfo::kIsDefaultConstructor) | | 
|  | 2803               (1 << SharedFunctionInfo::kIsSubclassConstructor) | | 
|  | 2804               (1 << SharedFunctionInfo::kIsBaseConstructor), | 
|  | 2805       &non_class_constructor); | 
|  | 2806   // If we call a classConstructor Function throw a TypeError | 
|  | 2807   // indirectly via the CallFunction builtin. | 
|  | 2808   __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET); | 
|  | 2809   __ bind(&non_class_constructor); | 
|  | 2810 } | 
|  | 2811 | 
|  | 2812 | 
| 2781 static void CallFunctionNoFeedback(MacroAssembler* masm, | 2813 static void CallFunctionNoFeedback(MacroAssembler* masm, | 
| 2782                                    int argc, bool needs_checks, | 2814                                    int argc, bool needs_checks, | 
| 2783                                    bool call_as_method) { | 2815                                    bool call_as_method) { | 
| 2784   // x1  function    the function to call | 2816   // x1  function    the function to call | 
| 2785   Register function = x1; | 2817   Register function = x1; | 
| 2786   Register type = x4; | 2818   Register type = x4; | 
| 2787   Label slow, wrap, cont; | 2819   Label slow, wrap, cont; | 
| 2788 | 2820 | 
| 2789   // TODO(jbramley): This function has a lot of unnamed registers. Name them, | 2821   // TODO(jbramley): This function has a lot of unnamed registers. Name them, | 
| 2790   // and tidy things up a bit. | 2822   // and tidy things up a bit. | 
| 2791 | 2823 | 
| 2792   if (needs_checks) { | 2824   if (needs_checks) { | 
| 2793     // Check that the function is really a JavaScript function. | 2825     // Check that the function is really a JavaScript function. | 
| 2794     __ JumpIfSmi(function, &slow); | 2826     __ JumpIfSmi(function, &slow); | 
| 2795 | 2827 | 
| 2796     // Goto slow case if we do not have a function. | 2828     // Goto slow case if we do not have a function. | 
| 2797     __ JumpIfNotObjectType(function, x10, type, JS_FUNCTION_TYPE, &slow); | 2829     __ JumpIfNotObjectType(function, x10, type, JS_FUNCTION_TYPE, &slow); | 
| 2798   } | 2830   } | 
| 2799 | 2831 | 
|  | 2832   LoadCompilerHints(masm); | 
|  | 2833   EmitClassConstructorCallCheck(masm); | 
|  | 2834 | 
| 2800   // Fast-case: Invoke the function now. | 2835   // Fast-case: Invoke the function now. | 
| 2801   // x1  function  pushed function | 2836   // x1  function  pushed function | 
| 2802   ParameterCount actual(argc); | 2837   ParameterCount actual(argc); | 
| 2803 | 2838 | 
| 2804   if (call_as_method) { | 2839   if (call_as_method) { | 
| 2805     if (needs_checks) { | 2840     if (needs_checks) { | 
| 2806       EmitContinueIfStrictOrNative(masm, &cont); | 2841       EmitContinueIfStrictOrNative(masm, &cont); | 
| 2807     } | 2842     } | 
| 2808 | 2843 | 
| 2809     // Compute the receiver in sloppy mode. | 2844     // Compute the receiver in sloppy mode. | 
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2982   // Increment the call count for monomorphic function calls. | 3017   // Increment the call count for monomorphic function calls. | 
| 2983   __ Add(feedback_vector, feedback_vector, | 3018   __ Add(feedback_vector, feedback_vector, | 
| 2984          Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 3019          Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 
| 2985   __ Add(feedback_vector, feedback_vector, | 3020   __ Add(feedback_vector, feedback_vector, | 
| 2986          Operand(FixedArray::kHeaderSize + kPointerSize)); | 3021          Operand(FixedArray::kHeaderSize + kPointerSize)); | 
| 2987   __ Ldr(index, FieldMemOperand(feedback_vector, 0)); | 3022   __ Ldr(index, FieldMemOperand(feedback_vector, 0)); | 
| 2988   __ Add(index, index, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 3023   __ Add(index, index, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 
| 2989   __ Str(index, FieldMemOperand(feedback_vector, 0)); | 3024   __ Str(index, FieldMemOperand(feedback_vector, 0)); | 
| 2990 | 3025 | 
| 2991   __ bind(&have_js_function); | 3026   __ bind(&have_js_function); | 
|  | 3027 | 
|  | 3028   LoadCompilerHints(masm); | 
|  | 3029   EmitClassConstructorCallCheck(masm); | 
|  | 3030 | 
| 2992   if (CallAsMethod()) { | 3031   if (CallAsMethod()) { | 
| 2993     EmitContinueIfStrictOrNative(masm, &cont); | 3032     EmitContinueIfStrictOrNative(masm, &cont); | 
| 2994 | 3033 | 
| 2995     // Compute the receiver in sloppy mode. | 3034     // Compute the receiver in sloppy mode. | 
| 2996     __ Peek(x3, argc * kPointerSize); | 3035     __ Peek(x3, argc * kPointerSize); | 
| 2997 | 3036 | 
| 2998     __ JumpIfSmi(x3, &wrap); | 3037     __ JumpIfSmi(x3, &wrap); | 
| 2999     __ JumpIfObjectType(x3, x10, type, FIRST_SPEC_OBJECT_TYPE, &wrap, lt); | 3038     __ JumpIfObjectType(x3, x10, type, FIRST_SPEC_OBJECT_TYPE, &wrap, lt); | 
| 3000 | 3039 | 
| 3001     __ Bind(&cont); | 3040     __ Bind(&cont); | 
| (...skipping 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6004                            MemOperand(fp, 6 * kPointerSize), NULL); | 6043                            MemOperand(fp, 6 * kPointerSize), NULL); | 
| 6005 } | 6044 } | 
| 6006 | 6045 | 
| 6007 | 6046 | 
| 6008 #undef __ | 6047 #undef __ | 
| 6009 | 6048 | 
| 6010 }  // namespace internal | 6049 }  // namespace internal | 
| 6011 }  // namespace v8 | 6050 }  // namespace v8 | 
| 6012 | 6051 | 
| 6013 #endif  // V8_TARGET_ARCH_ARM64 | 6052 #endif  // V8_TARGET_ARCH_ARM64 | 
| OLD | NEW | 
|---|