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

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

Issue 3388004: Add support for near labels.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 3 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
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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 // Label L; // unbound label 998 // Label L; // unbound label
999 // j(cc, &L); // forward branch to unbound label 999 // j(cc, &L); // forward branch to unbound label
1000 // bind(&L); // bind label to the current pc 1000 // bind(&L); // bind label to the current pc
1001 // j(cc, &L); // backward branch to bound label 1001 // j(cc, &L); // backward branch to bound label
1002 // bind(&L); // illegal: a label may be bound only once 1002 // bind(&L); // illegal: a label may be bound only once
1003 // 1003 //
1004 // Note: The same Label can be used for forward and backward branches 1004 // Note: The same Label can be used for forward and backward branches
1005 // but it may be bound only once. 1005 // but it may be bound only once.
1006 1006
1007 void bind(Label* L); // binds an unbound label L to the current code position 1007 void bind(Label* L); // binds an unbound label L to the current code position
1008 void bind(NearLabel* L);
1008 1009
1009 // Calls 1010 // Calls
1010 // Call near relative 32-bit displacement, relative to next instruction. 1011 // Call near relative 32-bit displacement, relative to next instruction.
1011 void call(Label* L); 1012 void call(Label* L);
1012 void call(Handle<Code> target, RelocInfo::Mode rmode); 1013 void call(Handle<Code> target, RelocInfo::Mode rmode);
1013 1014
1014 // Call near absolute indirect, address in register 1015 // Call near absolute indirect, address in register
1015 void call(Register adr); 1016 void call(Register adr);
1016 1017
1017 // Call near indirect 1018 // Call near indirect
1018 void call(const Operand& operand); 1019 void call(const Operand& operand);
1019 1020
1020 // Jumps 1021 // Jumps
1021 // Jump short or near relative. 1022 // Jump short or near relative.
1022 // Use a 32-bit signed displacement. 1023 // Use a 32-bit signed displacement.
1023 void jmp(Label* L); // unconditional jump to L 1024 void jmp(Label* L); // unconditional jump to L
1024 void jmp(Handle<Code> target, RelocInfo::Mode rmode); 1025 void jmp(Handle<Code> target, RelocInfo::Mode rmode);
1025 1026
1026 // Jump near absolute indirect (r64) 1027 // Jump near absolute indirect (r64)
1027 void jmp(Register adr); 1028 void jmp(Register adr);
1028 1029
1029 // Jump near absolute indirect (m64) 1030 // Jump near absolute indirect (m64)
1030 void jmp(const Operand& src); 1031 void jmp(const Operand& src);
1031 1032
1033 // Short jump
1034 void jmp(NearLabel* L);
1035
1032 // Conditional jumps 1036 // Conditional jumps
1033 void j(Condition cc, Label* L); 1037 void j(Condition cc, Label* L);
1034 void j(Condition cc, Handle<Code> target, RelocInfo::Mode rmode); 1038 void j(Condition cc, Handle<Code> target, RelocInfo::Mode rmode);
1035 1039
1040 // Conditional short jump
1041 void j(Condition cc, NearLabel* L, Hint hint = no_hint);
1042
1036 // Floating-point operations 1043 // Floating-point operations
1037 void fld(int i); 1044 void fld(int i);
1038 1045
1039 void fld1(); 1046 void fld1();
1040 void fldz(); 1047 void fldz();
1041 void fldpi(); 1048 void fldpi();
1042 1049
1043 void fld_s(const Operand& adr); 1050 void fld_s(const Operand& adr);
1044 void fld_d(const Operand& adr); 1051 void fld_d(const Operand& adr);
1045 1052
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 1196
1190 static bool IsNop(Address addr) { return *addr == 0x90; } 1197 static bool IsNop(Address addr) { return *addr == 0x90; }
1191 1198
1192 // Avoid overflows for displacements etc. 1199 // Avoid overflows for displacements etc.
1193 static const int kMaximalBufferSize = 512*MB; 1200 static const int kMaximalBufferSize = 512*MB;
1194 static const int kMinimalBufferSize = 4*KB; 1201 static const int kMinimalBufferSize = 4*KB;
1195 1202
1196 private: 1203 private:
1197 byte* addr_at(int pos) { return buffer_ + pos; } 1204 byte* addr_at(int pos) { return buffer_ + pos; }
1198 byte byte_at(int pos) { return buffer_[pos]; } 1205 byte byte_at(int pos) { return buffer_[pos]; }
1206 void set_byte_at(int pos, byte value) { buffer_[pos] = value; }
1199 uint32_t long_at(int pos) { 1207 uint32_t long_at(int pos) {
1200 return *reinterpret_cast<uint32_t*>(addr_at(pos)); 1208 return *reinterpret_cast<uint32_t*>(addr_at(pos));
1201 } 1209 }
1202 void long_at_put(int pos, uint32_t x) { 1210 void long_at_put(int pos, uint32_t x) {
1203 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; 1211 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x;
1204 } 1212 }
1205 1213
1206 // code emission 1214 // code emission
1207 void GrowBuffer(); 1215 void GrowBuffer();
1208 1216
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 void shift_32(Register dst, Immediate shift_amount, int subcode); 1372 void shift_32(Register dst, Immediate shift_amount, int subcode);
1365 // Shift dst by cl % 64 bits. 1373 // Shift dst by cl % 64 bits.
1366 void shift(Register dst, int subcode); 1374 void shift(Register dst, int subcode);
1367 void shift_32(Register dst, int subcode); 1375 void shift_32(Register dst, int subcode);
1368 1376
1369 void emit_farith(int b1, int b2, int i); 1377 void emit_farith(int b1, int b2, int i);
1370 1378
1371 // labels 1379 // labels
1372 // void print(Label* L); 1380 // void print(Label* L);
1373 void bind_to(Label* L, int pos); 1381 void bind_to(Label* L, int pos);
1374 void link_to(Label* L, Label* appendix);
1375 1382
1376 // record reloc info for current pc_ 1383 // record reloc info for current pc_
1377 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); 1384 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0);
1378 1385
1379 friend class CodePatcher; 1386 friend class CodePatcher;
1380 friend class EnsureSpace; 1387 friend class EnsureSpace;
1381 friend class RegExpMacroAssemblerX64; 1388 friend class RegExpMacroAssemblerX64;
1382 1389
1383 // Code buffer: 1390 // Code buffer:
1384 // The buffer into which code and relocation info are generated. 1391 // The buffer into which code and relocation info are generated.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 private: 1435 private:
1429 Assembler* assembler_; 1436 Assembler* assembler_;
1430 #ifdef DEBUG 1437 #ifdef DEBUG
1431 int space_before_; 1438 int space_before_;
1432 #endif 1439 #endif
1433 }; 1440 };
1434 1441
1435 } } // namespace v8::internal 1442 } } // namespace v8::internal
1436 1443
1437 #endif // V8_X64_ASSEMBLER_X64_H_ 1444 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698