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

Side by Side Diff: src/arm64/macro-assembler-arm64.h

Issue 268353005: ARM64: Fix and improve MacroAssembler::Printf. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Reorganise Simulator::DoPrintf as suggested. Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/arm64/instructions-arm64.h ('k') | src/arm64/macro-assembler-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 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 #ifndef V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ 5 #ifndef V8_ARM64_MACRO_ASSEMBLER_ARM64_H_
6 #define V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ 6 #define V8_ARM64_MACRO_ASSEMBLER_ARM64_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "v8globals.h" 10 #include "v8globals.h"
(...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 1911
1912 static CPURegList DefaultTmpList(); 1912 static CPURegList DefaultTmpList();
1913 static CPURegList DefaultFPTmpList(); 1913 static CPURegList DefaultFPTmpList();
1914 1914
1915 // Like printf, but print at run-time from generated code. 1915 // Like printf, but print at run-time from generated code.
1916 // 1916 //
1917 // The caller must ensure that arguments for floating-point placeholders 1917 // The caller must ensure that arguments for floating-point placeholders
1918 // (such as %e, %f or %g) are FPRegisters, and that arguments for integer 1918 // (such as %e, %f or %g) are FPRegisters, and that arguments for integer
1919 // placeholders are Registers. 1919 // placeholders are Registers.
1920 // 1920 //
1921 // A maximum of four arguments may be given to any single Printf call. The 1921 // At the moment it is only possible to print the value of csp if it is the
1922 // arguments must be of the same type, but they do not need to have the same 1922 // current stack pointer. Otherwise, the MacroAssembler will automatically
1923 // size. 1923 // update csp on every push (using BumpSystemStackPointer), so determining its
1924 // value is difficult.
1924 // 1925 //
1925 // The following registers cannot be printed: 1926 // Format placeholders that refer to more than one argument, or to a specific
1926 // StackPointer(), csp. 1927 // argument, are not supported. This includes formats like "%1$d" or "%.*d".
1927 // 1928 //
1928 // This function automatically preserves caller-saved registers so that 1929 // This function automatically preserves caller-saved registers so that
1929 // calling code can use Printf at any point without having to worry about 1930 // calling code can use Printf at any point without having to worry about
1930 // corruption. The preservation mechanism generates a lot of code. If this is 1931 // corruption. The preservation mechanism generates a lot of code. If this is
1931 // a problem, preserve the important registers manually and then call 1932 // a problem, preserve the important registers manually and then call
1932 // PrintfNoPreserve. Callee-saved registers are not used by Printf, and are 1933 // PrintfNoPreserve. Callee-saved registers are not used by Printf, and are
1933 // implicitly preserved. 1934 // implicitly preserved.
1934 //
1935 // This function assumes (and asserts) that the current stack pointer is
1936 // callee-saved, not caller-saved. This is most likely the case anyway, as a
1937 // caller-saved stack pointer doesn't make a lot of sense.
1938 void Printf(const char * format, 1935 void Printf(const char * format,
1939 const CPURegister& arg0 = NoCPUReg, 1936 CPURegister arg0 = NoCPUReg,
1940 const CPURegister& arg1 = NoCPUReg, 1937 CPURegister arg1 = NoCPUReg,
1941 const CPURegister& arg2 = NoCPUReg, 1938 CPURegister arg2 = NoCPUReg,
1942 const CPURegister& arg3 = NoCPUReg); 1939 CPURegister arg3 = NoCPUReg);
1943 1940
1944 // Like Printf, but don't preserve any caller-saved registers, not even 'lr'. 1941 // Like Printf, but don't preserve any caller-saved registers, not even 'lr'.
1945 // 1942 //
1946 // The return code from the system printf call will be returned in x0. 1943 // The return code from the system printf call will be returned in x0.
1947 void PrintfNoPreserve(const char * format, 1944 void PrintfNoPreserve(const char * format,
1948 const CPURegister& arg0 = NoCPUReg, 1945 const CPURegister& arg0 = NoCPUReg,
1949 const CPURegister& arg1 = NoCPUReg, 1946 const CPURegister& arg1 = NoCPUReg,
1950 const CPURegister& arg2 = NoCPUReg, 1947 const CPURegister& arg2 = NoCPUReg,
1951 const CPURegister& arg3 = NoCPUReg); 1948 const CPURegister& arg3 = NoCPUReg);
1952 1949
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 void PrepareForPop(Operand total_size); 2024 void PrepareForPop(Operand total_size);
2028 2025
2029 void PrepareForPush(int count, int size) { PrepareForPush(count * size); } 2026 void PrepareForPush(int count, int size) { PrepareForPush(count * size); }
2030 void PrepareForPop(int count, int size) { PrepareForPop(count * size); } 2027 void PrepareForPop(int count, int size) { PrepareForPop(count * size); }
2031 2028
2032 // Call Printf. On a native build, a simple call will be generated, but if the 2029 // Call Printf. On a native build, a simple call will be generated, but if the
2033 // simulator is being used then a suitable pseudo-instruction is used. The 2030 // simulator is being used then a suitable pseudo-instruction is used. The
2034 // arguments and stack (csp) must be prepared by the caller as for a normal 2031 // arguments and stack (csp) must be prepared by the caller as for a normal
2035 // AAPCS64 call to 'printf'. 2032 // AAPCS64 call to 'printf'.
2036 // 2033 //
2037 // The 'type' argument specifies the type of the optional arguments. 2034 // The 'args' argument should point to an array of variable arguments in their
2038 void CallPrintf(CPURegister::RegisterType type = CPURegister::kNoRegister); 2035 // proper PCS registers (and in calling order). The argument registers can
2036 // have mixed types. The format string (x0) should not be included.
2037 void CallPrintf(int arg_count = 0, const CPURegister * args = NULL);
2039 2038
2040 // Helper for throwing exceptions. Compute a handler address and jump to 2039 // Helper for throwing exceptions. Compute a handler address and jump to
2041 // it. See the implementation for register usage. 2040 // it. See the implementation for register usage.
2042 void JumpToHandlerEntry(Register exception, 2041 void JumpToHandlerEntry(Register exception,
2043 Register object, 2042 Register object,
2044 Register state, 2043 Register state,
2045 Register scratch1, 2044 Register scratch1,
2046 Register scratch2); 2045 Register scratch2);
2047 2046
2048 // Helper for implementing JumpIfNotInNewSpace and JumpIfInNewSpace. 2047 // Helper for implementing JumpIfNotInNewSpace and JumpIfInNewSpace.
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 #error "Unsupported option" 2283 #error "Unsupported option"
2285 #define CODE_COVERAGE_STRINGIFY(x) #x 2284 #define CODE_COVERAGE_STRINGIFY(x) #x
2286 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) 2285 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
2287 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) 2286 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
2288 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> 2287 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm->
2289 #else 2288 #else
2290 #define ACCESS_MASM(masm) masm-> 2289 #define ACCESS_MASM(masm) masm->
2291 #endif 2290 #endif
2292 2291
2293 #endif // V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ 2292 #endif // V8_ARM64_MACRO_ASSEMBLER_ARM64_H_
OLDNEW
« no previous file with comments | « src/arm64/instructions-arm64.h ('k') | src/arm64/macro-assembler-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698