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

Side by Side Diff: src/builtins/s390/builtins-s390.cc

Issue 2645683002: PPC/s390: [Turbofan] Implement super calls with spread bytecode in assembly code. (Closed)
Patch Set: Created 3 years, 11 months 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/builtins/ppc/builtins-ppc.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_S390 5 #if V8_TARGET_ARCH_S390
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 RelocInfo::CODE_TARGET); 2806 RelocInfo::CODE_TARGET);
2807 } 2807 }
2808 2808
2809 // Called Construct on an Object that doesn't have a [[Construct]] internal 2809 // Called Construct on an Object that doesn't have a [[Construct]] internal
2810 // method. 2810 // method.
2811 __ bind(&non_constructor); 2811 __ bind(&non_constructor);
2812 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), 2812 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(),
2813 RelocInfo::CODE_TARGET); 2813 RelocInfo::CODE_TARGET);
2814 } 2814 }
2815 2815
2816 void Builtins::Generate_ConstructWithSpread(MacroAssembler* masm) {
2817 // ----------- S t a t e -------------
2818 // -- r2 : the number of arguments (not including the receiver)
2819 // -- r3 : the constructor to call (can be any Object)
2820 // -- r5 : the new target (either the same as the constructor or
2821 // the JSFunction on which new was invoked initially)
2822 // -----------------------------------
2823
2824 Register argc = r2;
2825 Register constructor = r3;
2826 Register new_target = r5;
2827
2828 Register scratch = r4;
2829 Register scratch2 = r8;
2830
2831 Register spread = r6;
2832 Register spread_map = r7;
2833 __ LoadP(spread, MemOperand(sp, 0));
2834 __ LoadP(spread_map, FieldMemOperand(spread, HeapObject::kMapOffset));
2835
2836 Label runtime_call, push_args;
2837 // Check that the spread is an array.
2838 __ CompareInstanceType(spread_map, scratch, JS_ARRAY_TYPE);
2839 __ bne(&runtime_call);
2840
2841 // Check that we have the original ArrayPrototype.
2842 __ LoadP(scratch, FieldMemOperand(spread_map, Map::kPrototypeOffset));
2843 __ LoadP(scratch2, NativeContextMemOperand());
2844 __ LoadP(scratch2,
2845 ContextMemOperand(scratch2, Context::INITIAL_ARRAY_PROTOTYPE_INDEX));
2846 __ CmpP(scratch, scratch2);
2847 __ bne(&runtime_call);
2848
2849 // Check that the ArrayPrototype hasn't been modified in a way that would
2850 // affect iteration.
2851 __ LoadRoot(scratch, Heap::kArrayIteratorProtectorRootIndex);
2852 __ LoadP(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
2853 __ CmpSmiLiteral(scratch, Smi::FromInt(Isolate::kProtectorValid), r0);
2854 __ bne(&runtime_call);
2855
2856 // Check that the map of the initial array iterator hasn't changed.
2857 __ LoadP(scratch2, NativeContextMemOperand());
2858 __ LoadP(scratch,
2859 ContextMemOperand(scratch2,
2860 Context::INITIAL_ARRAY_ITERATOR_PROTOTYPE_INDEX));
2861 __ LoadP(scratch, FieldMemOperand(scratch, HeapObject::kMapOffset));
2862 __ LoadP(scratch2,
2863 ContextMemOperand(
2864 scratch2, Context::INITIAL_ARRAY_ITERATOR_PROTOTYPE_MAP_INDEX));
2865 __ CmpP(scratch, scratch2);
2866 __ bne(&runtime_call);
2867
2868 // For FastPacked kinds, iteration will have the same effect as simply
2869 // accessing each property in order.
2870 Label no_protector_check;
2871 __ LoadP(scratch, FieldMemOperand(spread_map, Map::kBitField2Offset));
2872 __ DecodeField<Map::ElementsKindBits>(scratch);
2873 __ CmpP(scratch, Operand(LAST_FAST_ELEMENTS_KIND));
2874 __ bgt(&runtime_call);
2875 // For non-FastHoley kinds, we can skip the protector check.
2876 __ CmpP(scratch, Operand(FAST_SMI_ELEMENTS));
2877 __ beq(&no_protector_check);
2878 __ CmpP(scratch, Operand(FAST_ELEMENTS));
2879 __ beq(&no_protector_check);
2880 __ CmpP(scratch, Operand(FAST_DOUBLE_ELEMENTS));
2881 __ beq(&no_protector_check);
2882 // Check the ArrayProtector cell.
2883 __ LoadRoot(scratch, Heap::kArrayProtectorRootIndex);
2884 __ LoadP(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset));
2885 __ CmpSmiLiteral(scratch, Smi::FromInt(Isolate::kProtectorValid), r0);
2886 __ bne(&runtime_call);
2887
2888 __ bind(&no_protector_check);
2889 // Load the FixedArray backing store.
2890 __ LoadP(spread, FieldMemOperand(spread, JSArray::kElementsOffset));
2891 __ b(&push_args);
2892
2893 __ bind(&runtime_call);
2894 {
2895 // Call the builtin for the result of the spread.
2896 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
2897 __ SmiTag(argc);
2898 __ Push(constructor, new_target, argc, spread);
2899 __ CallRuntime(Runtime::kSpreadIterableFixed);
2900 __ LoadRR(spread, r2);
2901 __ Pop(constructor, new_target, argc);
2902 __ SmiUntag(argc);
2903 }
2904
2905 Register spread_len = r7;
2906 __ bind(&push_args);
2907 {
2908 // Pop the spread argument off the stack.
2909 __ Pop(scratch);
2910 // Calculate the new nargs including the result of the spread.
2911 __ LoadP(spread_len, FieldMemOperand(spread, FixedArray::kLengthOffset));
2912 __ SmiUntag(spread_len);
2913 // argc += spread_len - 1. Subtract 1 for the spread itself.
2914 __ AddP(argc, argc, spread_len);
2915 __ SubP(argc, argc, Operand(1));
2916 }
2917
2918 // Check for stack overflow.
2919 {
2920 // Check the stack for overflow. We are not trying to catch interruptions
2921 // (i.e. debug break and preemption) here, so check the "real stack limit".
2922 Label done;
2923 __ LoadRoot(scratch, Heap::kRealStackLimitRootIndex);
2924 // Make scratch the space we have left. The stack might already be
2925 // overflowed here which will cause scratch to become negative.
2926 __ SubP(scratch, sp, scratch);
2927 // Check if the arguments will overflow the stack.
2928 __ ShiftLeftP(r0, spread_len, Operand(kPointerSizeLog2));
2929 __ CmpP(scratch, r0);
2930 __ bgt(&done); // Signed comparison.
2931 __ TailCallRuntime(Runtime::kThrowStackOverflow);
2932 __ bind(&done);
2933 }
2934
2935 // Put the evaluated spread onto the stack as additional arguments.
2936 {
2937 __ LoadImmP(scratch, Operand::Zero());
2938 Label done, loop;
2939 __ bind(&loop);
2940 __ CmpP(scratch, spread_len);
2941 __ beq(&done);
2942 __ ShiftLeftP(r0, scratch, Operand(kPointerSizeLog2));
2943 __ AddP(scratch2, spread, r0);
2944 __ LoadP(scratch2, FieldMemOperand(scratch2, FixedArray::kHeaderSize));
2945 __ Push(scratch2);
2946 __ AddP(scratch, scratch, Operand(1));
2947 __ b(&loop);
2948 __ bind(&done);
2949 }
2950
2951 // Dispatch.
2952 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
2953 }
2954
2816 // static 2955 // static
2817 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { 2956 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) {
2818 // ----------- S t a t e ------------- 2957 // ----------- S t a t e -------------
2819 // -- r3 : requested object size (untagged) 2958 // -- r3 : requested object size (untagged)
2820 // -- lr : return address 2959 // -- lr : return address
2821 // ----------------------------------- 2960 // -----------------------------------
2822 __ SmiTag(r3); 2961 __ SmiTag(r3);
2823 __ Push(r3); 2962 __ Push(r3);
2824 __ LoadSmiLiteral(cp, Smi::kZero); 2963 __ LoadSmiLiteral(cp, Smi::kZero);
2825 __ TailCallRuntime(Runtime::kAllocateInNewSpace); 2964 __ TailCallRuntime(Runtime::kAllocateInNewSpace);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2979 __ bkpt(0); 3118 __ bkpt(0);
2980 } 3119 }
2981 } 3120 }
2982 3121
2983 #undef __ 3122 #undef __
2984 3123
2985 } // namespace internal 3124 } // namespace internal
2986 } // namespace v8 3125 } // namespace v8
2987 3126
2988 #endif // V8_TARGET_ARCH_S390 3127 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/builtins/ppc/builtins-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698