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

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

Issue 181453002: Reset trunk to 3.24.35.4 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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/vm-state-inl.h ('k') | src/x64/assembler-x64.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 (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 26 matching lines...) Expand all
37 #ifndef V8_X64_ASSEMBLER_X64_H_ 37 #ifndef V8_X64_ASSEMBLER_X64_H_
38 #define V8_X64_ASSEMBLER_X64_H_ 38 #define V8_X64_ASSEMBLER_X64_H_
39 39
40 #include "serialize.h" 40 #include "serialize.h"
41 41
42 namespace v8 { 42 namespace v8 {
43 namespace internal { 43 namespace internal {
44 44
45 // Utility functions 45 // Utility functions
46 46
47 // Test whether a 64-bit value is in a specific range.
48 inline bool is_uint32(int64_t x) {
49 static const uint64_t kMaxUInt32 = V8_UINT64_C(0xffffffff);
50 return static_cast<uint64_t>(x) <= kMaxUInt32;
51 }
52
53 inline bool is_int32(int64_t x) {
54 static const int64_t kMinInt32 = -V8_INT64_C(0x80000000);
55 return is_uint32(x - kMinInt32);
56 }
57
58 inline bool uint_is_int32(uint64_t x) {
59 static const uint64_t kMaxInt32 = V8_UINT64_C(0x7fffffff);
60 return x <= kMaxInt32;
61 }
62
63 inline bool is_uint32(uint64_t x) {
64 static const uint64_t kMaxUInt32 = V8_UINT64_C(0xffffffff);
65 return x <= kMaxUInt32;
66 }
67
47 // CPU Registers. 68 // CPU Registers.
48 // 69 //
49 // 1) We would prefer to use an enum, but enum values are assignment- 70 // 1) We would prefer to use an enum, but enum values are assignment-
50 // compatible with int, which has caused code-generation bugs. 71 // compatible with int, which has caused code-generation bugs.
51 // 72 //
52 // 2) We would prefer to use a class instead of a struct but we don't like 73 // 2) We would prefer to use a class instead of a struct but we don't like
53 // the register initialization to depend on the particular initialization 74 // the register initialization to depend on the particular initialization
54 // order (which appears to be different on OS X, Linux, and Windows for the 75 // order (which appears to be different on OS X, Linux, and Windows for the
55 // installed versions of C++ we tried). Using a struct permits C-style 76 // installed versions of C++ we tried). Using a struct permits C-style
56 // "initialization". Also, the Register objects cannot be const as this 77 // "initialization". Also, the Register objects cannot be const as this
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 immediate_arithmetic_op(0x6, dst, src); 1208 immediate_arithmetic_op(0x6, dst, src);
1188 } 1209 }
1189 1210
1190 void xor_(const Operand& dst, Immediate src) { 1211 void xor_(const Operand& dst, Immediate src) {
1191 immediate_arithmetic_op(0x6, dst, src); 1212 immediate_arithmetic_op(0x6, dst, src);
1192 } 1213 }
1193 1214
1194 // Bit operations. 1215 // Bit operations.
1195 void bt(const Operand& dst, Register src); 1216 void bt(const Operand& dst, Register src);
1196 void bts(const Operand& dst, Register src); 1217 void bts(const Operand& dst, Register src);
1197 void bsrl(Register dst, Register src);
1198 1218
1199 // Miscellaneous 1219 // Miscellaneous
1200 void clc(); 1220 void clc();
1201 void cld(); 1221 void cld();
1202 void cpuid(); 1222 void cpuid();
1203 void hlt(); 1223 void hlt();
1204 void int3(); 1224 void int3();
1205 void nop(); 1225 void nop();
1206 void ret(int imm16); 1226 void ret(int imm16);
1207 void setcc(Condition cc, Register reg); 1227 void setcc(Condition cc, Register reg);
(...skipping 25 matching lines...) Expand all
1233 1253
1234 // Calls directly to the given address using a relative offset. 1254 // Calls directly to the given address using a relative offset.
1235 // Should only ever be used in Code objects for calls within the 1255 // Should only ever be used in Code objects for calls within the
1236 // same Code object. Should not be used when generating new code (use labels), 1256 // same Code object. Should not be used when generating new code (use labels),
1237 // but only when patching existing code. 1257 // but only when patching existing code.
1238 void call(Address target); 1258 void call(Address target);
1239 1259
1240 // Call near absolute indirect, address in register 1260 // Call near absolute indirect, address in register
1241 void call(Register adr); 1261 void call(Register adr);
1242 1262
1263 // Call near indirect
1264 void call(const Operand& operand);
1265
1243 // Jumps 1266 // Jumps
1244 // Jump short or near relative. 1267 // Jump short or near relative.
1245 // Use a 32-bit signed displacement. 1268 // Use a 32-bit signed displacement.
1246 // Unconditional jump to L 1269 // Unconditional jump to L
1247 void jmp(Label* L, Label::Distance distance = Label::kFar); 1270 void jmp(Label* L, Label::Distance distance = Label::kFar);
1248 void jmp(Address entry, RelocInfo::Mode rmode); 1271 void jmp(Address entry, RelocInfo::Mode rmode);
1249 void jmp(Handle<Code> target, RelocInfo::Mode rmode); 1272 void jmp(Handle<Code> target, RelocInfo::Mode rmode);
1250 1273
1251 // Jump near absolute indirect (r64) 1274 // Jump near absolute indirect (r64)
1252 void jmp(Register adr); 1275 void jmp(Register adr);
1253 1276
1277 // Jump near absolute indirect (m64)
1278 void jmp(const Operand& src);
1279
1254 // Conditional jumps 1280 // Conditional jumps
1255 void j(Condition cc, 1281 void j(Condition cc,
1256 Label* L, 1282 Label* L,
1257 Label::Distance distance = Label::kFar); 1283 Label::Distance distance = Label::kFar);
1258 void j(Condition cc, Address entry, RelocInfo::Mode rmode); 1284 void j(Condition cc, Address entry, RelocInfo::Mode rmode);
1259 void j(Condition cc, Handle<Code> target, RelocInfo::Mode rmode); 1285 void j(Condition cc, Handle<Code> target, RelocInfo::Mode rmode);
1260 1286
1261 // Floating-point operations 1287 // Floating-point operations
1262 void fld(int i); 1288 void fld(int i);
1263 1289
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 } 1492 }
1467 1493
1468 static bool IsNop(Address addr); 1494 static bool IsNop(Address addr);
1469 1495
1470 // Avoid overflows for displacements etc. 1496 // Avoid overflows for displacements etc.
1471 static const int kMaximalBufferSize = 512*MB; 1497 static const int kMaximalBufferSize = 512*MB;
1472 1498
1473 byte byte_at(int pos) { return buffer_[pos]; } 1499 byte byte_at(int pos) { return buffer_[pos]; }
1474 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } 1500 void set_byte_at(int pos, byte value) { buffer_[pos] = value; }
1475 1501
1476 protected:
1477 // Call near indirect
1478 void call(const Operand& operand);
1479
1480 // Jump near absolute indirect (m64)
1481 void jmp(const Operand& src);
1482
1483 private: 1502 private:
1484 byte* addr_at(int pos) { return buffer_ + pos; } 1503 byte* addr_at(int pos) { return buffer_ + pos; }
1485 uint32_t long_at(int pos) { 1504 uint32_t long_at(int pos) {
1486 return *reinterpret_cast<uint32_t*>(addr_at(pos)); 1505 return *reinterpret_cast<uint32_t*>(addr_at(pos));
1487 } 1506 }
1488 void long_at_put(int pos, uint32_t x) { 1507 void long_at_put(int pos, uint32_t x) {
1489 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; 1508 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x;
1490 } 1509 }
1491 1510
1492 // code emission 1511 // code emission
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 private: 1752 private:
1734 Assembler* assembler_; 1753 Assembler* assembler_;
1735 #ifdef DEBUG 1754 #ifdef DEBUG
1736 int space_before_; 1755 int space_before_;
1737 #endif 1756 #endif
1738 }; 1757 };
1739 1758
1740 } } // namespace v8::internal 1759 } } // namespace v8::internal
1741 1760
1742 #endif // V8_X64_ASSEMBLER_X64_H_ 1761 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/vm-state-inl.h ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698