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

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

Issue 2381843002: Add Smi::Zero and replace all Smi::FromInt(0) calls (Closed)
Patch Set: Mark Smi::kZero as V8_EXPORT_PRIVATE Created 4 years, 2 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/arm/builtins-arm.cc ('k') | src/builtins/builtins-array.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 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/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 // 2. Load the first argument into x2. 272 // 2. Load the first argument into x2.
273 { 273 {
274 Label no_arguments, done; 274 Label no_arguments, done;
275 __ Move(x6, x0); // Store argc in x6. 275 __ Move(x6, x0); // Store argc in x6.
276 __ Cbz(x0, &no_arguments); 276 __ Cbz(x0, &no_arguments);
277 __ Sub(x0, x0, 1); 277 __ Sub(x0, x0, 1);
278 __ Ldr(x2, MemOperand(jssp, x0, LSL, kPointerSizeLog2)); 278 __ Ldr(x2, MemOperand(jssp, x0, LSL, kPointerSizeLog2));
279 __ B(&done); 279 __ B(&done);
280 __ Bind(&no_arguments); 280 __ Bind(&no_arguments);
281 __ Mov(x2, Smi::FromInt(0)); 281 __ Mov(x2, Smi::kZero);
282 __ Bind(&done); 282 __ Bind(&done);
283 } 283 }
284 284
285 // 3. Make sure x2 is a number. 285 // 3. Make sure x2 is a number.
286 { 286 {
287 Label done_convert; 287 Label done_convert;
288 __ JumpIfSmi(x2, &done_convert); 288 __ JumpIfSmi(x2, &done_convert);
289 __ JumpIfObjectType(x2, x4, x4, HEAP_NUMBER_TYPE, &done_convert, eq); 289 __ JumpIfObjectType(x2, x4, x4, HEAP_NUMBER_TYPE, &done_convert, eq);
290 { 290 {
291 FrameScope scope(masm, StackFrame::MANUAL); 291 FrameScope scope(masm, StackFrame::MANUAL);
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 __ TailCallRuntime(Runtime::kThrowStackOverflow); 1330 __ TailCallRuntime(Runtime::kThrowStackOverflow);
1331 __ Unreachable(); 1331 __ Unreachable();
1332 } 1332 }
1333 } 1333 }
1334 1334
1335 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { 1335 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
1336 // Set the return address to the correct point in the interpreter entry 1336 // Set the return address to the correct point in the interpreter entry
1337 // trampoline. 1337 // trampoline.
1338 Smi* interpreter_entry_return_pc_offset( 1338 Smi* interpreter_entry_return_pc_offset(
1339 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); 1339 masm->isolate()->heap()->interpreter_entry_return_pc_offset());
1340 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); 1340 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::kZero);
1341 __ LoadObject(x1, masm->isolate()->builtins()->InterpreterEntryTrampoline()); 1341 __ LoadObject(x1, masm->isolate()->builtins()->InterpreterEntryTrampoline());
1342 __ Add(lr, x1, Operand(interpreter_entry_return_pc_offset->value() + 1342 __ Add(lr, x1, Operand(interpreter_entry_return_pc_offset->value() +
1343 Code::kHeaderSize - kHeapObjectTag)); 1343 Code::kHeaderSize - kHeapObjectTag));
1344 1344
1345 // Initialize the dispatch table register. 1345 // Initialize the dispatch table register.
1346 __ Mov(kInterpreterDispatchTableRegister, 1346 __ Mov(kInterpreterDispatchTableRegister,
1347 Operand(ExternalReference::interpreter_dispatch_table_address( 1347 Operand(ExternalReference::interpreter_dispatch_table_address(
1348 masm->isolate()))); 1348 masm->isolate())));
1349 1349
1350 // Get the bytecode array pointer from the frame. 1350 // Get the bytecode array pointer from the frame.
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 1856
1857 { 1857 {
1858 FrameScope scope(masm, StackFrame::INTERNAL); 1858 FrameScope scope(masm, StackFrame::INTERNAL);
1859 // Pass function as argument. 1859 // Pass function as argument.
1860 __ Push(x0); 1860 __ Push(x0);
1861 __ CallRuntime(Runtime::kCompileForOnStackReplacement); 1861 __ CallRuntime(Runtime::kCompileForOnStackReplacement);
1862 } 1862 }
1863 1863
1864 // If the code object is null, just return to the caller. 1864 // If the code object is null, just return to the caller.
1865 Label skip; 1865 Label skip;
1866 __ CompareAndBranch(x0, Smi::FromInt(0), ne, &skip); 1866 __ CompareAndBranch(x0, Smi::kZero, ne, &skip);
1867 __ Ret(); 1867 __ Ret();
1868 1868
1869 __ Bind(&skip); 1869 __ Bind(&skip);
1870 1870
1871 // Drop any potential handler frame that is be sitting on top of the actual 1871 // Drop any potential handler frame that is be sitting on top of the actual
1872 // JavaScript frame. This is the case then OSR is triggered from bytecode. 1872 // JavaScript frame. This is the case then OSR is triggered from bytecode.
1873 if (has_handler_frame) { 1873 if (has_handler_frame) {
1874 __ LeaveFrame(StackFrame::STUB); 1874 __ LeaveFrame(StackFrame::STUB);
1875 } 1875 }
1876 1876
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
2840 2840
2841 // static 2841 // static
2842 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { 2842 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) {
2843 ASM_LOCATION("Builtins::Generate_AllocateInNewSpace"); 2843 ASM_LOCATION("Builtins::Generate_AllocateInNewSpace");
2844 // ----------- S t a t e ------------- 2844 // ----------- S t a t e -------------
2845 // -- x1 : requested object size (untagged) 2845 // -- x1 : requested object size (untagged)
2846 // -- lr : return address 2846 // -- lr : return address
2847 // ----------------------------------- 2847 // -----------------------------------
2848 __ SmiTag(x1); 2848 __ SmiTag(x1);
2849 __ Push(x1); 2849 __ Push(x1);
2850 __ Move(cp, Smi::FromInt(0)); 2850 __ Move(cp, Smi::kZero);
2851 __ TailCallRuntime(Runtime::kAllocateInNewSpace); 2851 __ TailCallRuntime(Runtime::kAllocateInNewSpace);
2852 } 2852 }
2853 2853
2854 // static 2854 // static
2855 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { 2855 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) {
2856 ASM_LOCATION("Builtins::Generate_AllocateInOldSpace"); 2856 ASM_LOCATION("Builtins::Generate_AllocateInOldSpace");
2857 // ----------- S t a t e ------------- 2857 // ----------- S t a t e -------------
2858 // -- x1 : requested object size (untagged) 2858 // -- x1 : requested object size (untagged)
2859 // -- lr : return address 2859 // -- lr : return address
2860 // ----------------------------------- 2860 // -----------------------------------
2861 __ SmiTag(x1); 2861 __ SmiTag(x1);
2862 __ Move(x2, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); 2862 __ Move(x2, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE)));
2863 __ Push(x1, x2); 2863 __ Push(x1, x2);
2864 __ Move(cp, Smi::FromInt(0)); 2864 __ Move(cp, Smi::kZero);
2865 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); 2865 __ TailCallRuntime(Runtime::kAllocateInTargetSpace);
2866 } 2866 }
2867 2867
2868 // static 2868 // static
2869 void Builtins::Generate_Abort(MacroAssembler* masm) { 2869 void Builtins::Generate_Abort(MacroAssembler* masm) {
2870 ASM_LOCATION("Builtins::Generate_Abort"); 2870 ASM_LOCATION("Builtins::Generate_Abort");
2871 // ----------- S t a t e ------------- 2871 // ----------- S t a t e -------------
2872 // -- x1 : message_id as Smi 2872 // -- x1 : message_id as Smi
2873 // -- lr : return address 2873 // -- lr : return address
2874 // ----------------------------------- 2874 // -----------------------------------
2875 MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm); 2875 MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm);
2876 __ Push(x1); 2876 __ Push(x1);
2877 __ Move(cp, Smi::FromInt(0)); 2877 __ Move(cp, Smi::kZero);
2878 __ TailCallRuntime(Runtime::kAbort); 2878 __ TailCallRuntime(Runtime::kAbort);
2879 } 2879 }
2880 2880
2881 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { 2881 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
2882 ASM_LOCATION("Builtins::Generate_ArgumentsAdaptorTrampoline"); 2882 ASM_LOCATION("Builtins::Generate_ArgumentsAdaptorTrampoline");
2883 // ----------- S t a t e ------------- 2883 // ----------- S t a t e -------------
2884 // -- x0 : actual number of arguments 2884 // -- x0 : actual number of arguments
2885 // -- x1 : function (passed through to callee) 2885 // -- x1 : function (passed through to callee)
2886 // -- x2 : expected number of arguments 2886 // -- x2 : expected number of arguments
2887 // -- x3 : new target (passed through to callee) 2887 // -- x3 : new target (passed through to callee)
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
3022 __ Unreachable(); 3022 __ Unreachable();
3023 } 3023 }
3024 } 3024 }
3025 3025
3026 #undef __ 3026 #undef __
3027 3027
3028 } // namespace internal 3028 } // namespace internal
3029 } // namespace v8 3029 } // namespace v8
3030 3030
3031 #endif // V8_TARGET_ARCH_ARM 3031 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/builtins/arm/builtins-arm.cc ('k') | src/builtins/builtins-array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698