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

Side by Side Diff: src/ia32/assembler-ia32.h

Issue 3427021: Fix some inconsistent formatting. (Closed)
Patch Set: Created 10 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/hashmap.h ('k') | src/list.h » ('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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // 57 //
58 // 3) By not using an enum, we are possibly preventing the compiler from 58 // 3) By not using an enum, we are possibly preventing the compiler from
59 // doing certain constant folds, which may significantly reduce the 59 // doing certain constant folds, which may significantly reduce the
60 // code generated for some assembly instructions (because they boil down 60 // code generated for some assembly instructions (because they boil down
61 // to a few constants). If this is a problem, we could change the code 61 // to a few constants). If this is a problem, we could change the code
62 // such that we use an enum in optimized mode, and the struct in debug 62 // such that we use an enum in optimized mode, and the struct in debug
63 // mode. This way we get the compile-time error checking in debug mode 63 // mode. This way we get the compile-time error checking in debug mode
64 // and best performance in optimized code. 64 // and best performance in optimized code.
65 // 65 //
66 struct Register { 66 struct Register {
67 bool is_valid() const { return 0 <= code_ && code_ < 8; } 67 bool is_valid() const { return 0 <= code_ && code_ < 8; }
68 bool is(Register reg) const { return code_ == reg.code_; } 68 bool is(Register reg) const { return code_ == reg.code_; }
69 // eax, ebx, ecx and edx are byte registers, the rest are not. 69 // eax, ebx, ecx and edx are byte registers, the rest are not.
70 bool is_byte_register() const { return code_ <= 3; } 70 bool is_byte_register() const { return code_ <= 3; }
71 int code() const { 71 int code() const {
72 ASSERT(is_valid()); 72 ASSERT(is_valid());
73 return code_; 73 return code_;
74 } 74 }
75 int bit() const { 75 int bit() const {
76 ASSERT(is_valid()); 76 ASSERT(is_valid());
77 return 1 << code_; 77 return 1 << code_;
78 } 78 }
79 79
80 // Unfortunately we can't make this private in a struct. 80 // Unfortunately we can't make this private in a struct.
81 int code_; 81 int code_;
82 }; 82 };
83 83
84 const Register eax = { 0 }; 84 const Register eax = { 0 };
85 const Register ecx = { 1 }; 85 const Register ecx = { 1 };
86 const Register edx = { 2 }; 86 const Register edx = { 2 };
87 const Register ebx = { 3 }; 87 const Register ebx = { 3 };
88 const Register esp = { 4 }; 88 const Register esp = { 4 };
89 const Register ebp = { 5 }; 89 const Register ebp = { 5 };
90 const Register esi = { 6 }; 90 const Register esi = { 6 };
91 const Register edi = { 7 }; 91 const Register edi = { 7 };
92 const Register no_reg = { -1 }; 92 const Register no_reg = { -1 };
93 93
94 94
95 struct XMMRegister { 95 struct XMMRegister {
96 bool is_valid() const { return 0 <= code_ && code_ < 8; } 96 bool is_valid() const { return 0 <= code_ && code_ < 8; }
97 int code() const { 97 int code() const {
98 ASSERT(is_valid()); 98 ASSERT(is_valid());
99 return code_; 99 return code_;
100 } 100 }
101 101
102 int code_; 102 int code_;
103 }; 103 };
104 104
105 const XMMRegister xmm0 = { 0 }; 105 const XMMRegister xmm0 = { 0 };
106 const XMMRegister xmm1 = { 1 }; 106 const XMMRegister xmm1 = { 1 };
107 const XMMRegister xmm2 = { 2 }; 107 const XMMRegister xmm2 = { 2 };
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 void RecordComment(const char* msg); 848 void RecordComment(const char* msg);
849 849
850 void RecordPosition(int pos); 850 void RecordPosition(int pos);
851 void RecordStatementPosition(int pos); 851 void RecordStatementPosition(int pos);
852 bool WriteRecordedPositions(); 852 bool WriteRecordedPositions();
853 853
854 // Writes a single word of data in the code stream. 854 // Writes a single word of data in the code stream.
855 // Used for inline tables, e.g., jump-tables. 855 // Used for inline tables, e.g., jump-tables.
856 void dd(uint32_t data, RelocInfo::Mode reloc_info); 856 void dd(uint32_t data, RelocInfo::Mode reloc_info);
857 857
858 int pc_offset() const { return pc_ - buffer_; } 858 int pc_offset() const { return pc_ - buffer_; }
859 int current_statement_position() const { return current_statement_position_; } 859 int current_statement_position() const { return current_statement_position_; }
860 int current_position() const { return current_position_; } 860 int current_position() const { return current_position_; }
861 861
862 // Check if there is less than kGap bytes available in the buffer. 862 // Check if there is less than kGap bytes available in the buffer.
863 // If this is the case, we need to grow the buffer before emitting 863 // If this is the case, we need to grow the buffer before emitting
864 // an instruction or relocation information. 864 // an instruction or relocation information.
865 inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; } 865 inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; }
866 866
867 // Get the number of bytes available in the buffer. 867 // Get the number of bytes available in the buffer.
868 inline int available_space() const { return reloc_info_writer.pos() - pc_; } 868 inline int available_space() const { return reloc_info_writer.pos() - pc_; }
869 869
870 static bool IsNop(Address addr) { return *addr == 0x90; } 870 static bool IsNop(Address addr) { return *addr == 0x90; }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 private: 978 private:
979 Assembler* assembler_; 979 Assembler* assembler_;
980 #ifdef DEBUG 980 #ifdef DEBUG
981 int space_before_; 981 int space_before_;
982 #endif 982 #endif
983 }; 983 };
984 984
985 } } // namespace v8::internal 985 } } // namespace v8::internal
986 986
987 #endif // V8_IA32_ASSEMBLER_IA32_H_ 987 #endif // V8_IA32_ASSEMBLER_IA32_H_
OLDNEW
« no previous file with comments | « src/hashmap.h ('k') | src/list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698