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

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

Issue 2950773002: [turbofan] Introduce new JSCallWithArrayLike operator. (Closed)
Patch Set: REBASE Created 3 years, 6 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 | « no previous file | src/builtins/arm64/builtins-arm64.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_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/assembler-inl.h" 7 #include "src/assembler-inl.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/counters.h" 9 #include "src/counters.h"
10 #include "src/debug/debug.h" 10 #include "src/debug/debug.h"
(...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2)); 1923 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2));
1924 __ str(r5, MemOperand(sp, 0)); 1924 __ str(r5, MemOperand(sp, 0));
1925 } 1925 }
1926 1926
1927 // ----------- S t a t e ------------- 1927 // ----------- S t a t e -------------
1928 // -- r2 : argArray 1928 // -- r2 : argArray
1929 // -- r1 : receiver 1929 // -- r1 : receiver
1930 // -- sp[0] : thisArg 1930 // -- sp[0] : thisArg
1931 // ----------------------------------- 1931 // -----------------------------------
1932 1932
1933 // 2. Make sure the receiver is actually callable. 1933 // 2. We don't need to check explicitly for callable receiver here,
1934 Label receiver_not_callable; 1934 // since that's the first thing the Call/CallWithArrayLike builtins
1935 __ JumpIfSmi(r1, &receiver_not_callable); 1935 // will do.
1936 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset));
1937 __ ldrb(r4, FieldMemOperand(r4, Map::kBitFieldOffset));
1938 __ tst(r4, Operand(1 << Map::kIsCallable));
1939 __ b(eq, &receiver_not_callable);
1940 1936
1941 // 3. Tail call with no arguments if argArray is null or undefined. 1937 // 3. Tail call with no arguments if argArray is null or undefined.
1942 Label no_arguments; 1938 Label no_arguments;
1943 __ JumpIfRoot(r2, Heap::kNullValueRootIndex, &no_arguments); 1939 __ JumpIfRoot(r2, Heap::kNullValueRootIndex, &no_arguments);
1944 __ JumpIfRoot(r2, Heap::kUndefinedValueRootIndex, &no_arguments); 1940 __ JumpIfRoot(r2, Heap::kUndefinedValueRootIndex, &no_arguments);
1945 1941
1946 // 4a. Apply the receiver to the given argArray. 1942 // 4a. Apply the receiver to the given argArray.
1947 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), 1943 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(),
1948 RelocInfo::CODE_TARGET); 1944 RelocInfo::CODE_TARGET);
1949 1945
1950 // 4b. The argArray is either null or undefined, so we tail call without any 1946 // 4b. The argArray is either null or undefined, so we tail call without any
1951 // arguments to the receiver. 1947 // arguments to the receiver.
1952 __ bind(&no_arguments); 1948 __ bind(&no_arguments);
1953 { 1949 {
1954 __ mov(r0, Operand(0)); 1950 __ mov(r0, Operand(0));
1955 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 1951 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1956 } 1952 }
1957
1958 // 4c. The receiver is not callable, throw an appropriate TypeError.
1959 __ bind(&receiver_not_callable);
1960 {
1961 __ str(r1, MemOperand(sp, 0));
1962 __ TailCallRuntime(Runtime::kThrowApplyNonFunction);
1963 }
1964 } 1953 }
1965 1954
1966 // static 1955 // static
1967 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { 1956 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) {
1968 // 1. Make sure we have at least one argument. 1957 // 1. Make sure we have at least one argument.
1969 // r0: actual number of arguments 1958 // r0: actual number of arguments
1970 { 1959 {
1971 Label done; 1960 Label done;
1972 __ cmp(r0, Operand::Zero()); 1961 __ cmp(r0, Operand::Zero());
1973 __ b(ne, &done); 1962 __ b(ne, &done);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2)); 2020 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2));
2032 __ str(r5, MemOperand(sp, 0)); 2021 __ str(r5, MemOperand(sp, 0));
2033 } 2022 }
2034 2023
2035 // ----------- S t a t e ------------- 2024 // ----------- S t a t e -------------
2036 // -- r2 : argumentsList 2025 // -- r2 : argumentsList
2037 // -- r1 : target 2026 // -- r1 : target
2038 // -- sp[0] : thisArgument 2027 // -- sp[0] : thisArgument
2039 // ----------------------------------- 2028 // -----------------------------------
2040 2029
2041 // 2. Make sure the target is actually callable. 2030 // 2. We don't need to check explicitly for callable target here,
2042 Label target_not_callable; 2031 // since that's the first thing the Call/CallWithArrayLike builtins
2043 __ JumpIfSmi(r1, &target_not_callable); 2032 // will do.
2044 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset));
2045 __ ldrb(r4, FieldMemOperand(r4, Map::kBitFieldOffset));
2046 __ tst(r4, Operand(1 << Map::kIsCallable));
2047 __ b(eq, &target_not_callable);
2048 2033
2049 // 3a. Apply the target to the given argumentsList. 2034 // 3. Apply the target to the given argumentsList.
2050 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), 2035 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(),
2051 RelocInfo::CODE_TARGET); 2036 RelocInfo::CODE_TARGET);
2052
2053 // 3b. The target is not callable, throw an appropriate TypeError.
2054 __ bind(&target_not_callable);
2055 {
2056 __ str(r1, MemOperand(sp, 0));
2057 __ TailCallRuntime(Runtime::kThrowApplyNonFunction);
2058 }
2059 } 2037 }
2060 2038
2061 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { 2039 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) {
2062 // ----------- S t a t e ------------- 2040 // ----------- S t a t e -------------
2063 // -- r0 : argc 2041 // -- r0 : argc
2064 // -- sp[0] : new.target (optional) 2042 // -- sp[0] : new.target (optional)
2065 // -- sp[4] : argumentsList 2043 // -- sp[4] : argumentsList
2066 // -- sp[8] : target 2044 // -- sp[8] : target
2067 // -- sp[12] : receiver 2045 // -- sp[12] : receiver
2068 // ----------------------------------- 2046 // -----------------------------------
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
2930 } 2908 }
2931 // Now jump to the instructions of the returned code object. 2909 // Now jump to the instructions of the returned code object.
2932 __ Jump(r8); 2910 __ Jump(r8);
2933 } 2911 }
2934 #undef __ 2912 #undef __
2935 2913
2936 } // namespace internal 2914 } // namespace internal
2937 } // namespace v8 2915 } // namespace v8
2938 2916
2939 #endif // V8_TARGET_ARCH_ARM 2917 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/builtins/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698