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

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

Issue 115816: Add immediate operands and arithmetic operations to the x64 assembler. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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/x64/assembler-x64.cc ('k') | test/cctest/test-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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 26 matching lines...) Expand all
37 return static_cast<Condition>(cc ^ 1); 37 return static_cast<Condition>(cc ^ 1);
38 } 38 }
39 39
40 40
41 // ----------------------------------------------------------------------------- 41 // -----------------------------------------------------------------------------
42 // Implementation of Assembler 42 // Implementation of Assembler
43 43
44 #define EMIT(x) \ 44 #define EMIT(x) \
45 *pc_++ = (x) 45 *pc_++ = (x)
46 46
47 void Assembler::emit(uint32_t x) { 47
48 *reinterpret_cast<uint32_t*>(pc_) = x; 48 void Assembler::emitl(uint32_t x) {
49 Memory::uint32_at(pc_) = x;
49 pc_ += sizeof(uint32_t); 50 pc_ += sizeof(uint32_t);
50 } 51 }
51 52
53
54 void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) {
55 Memory::uint64_at(pc_) = x;
56 RecordRelocInfo(rmode, x);
57 }
58
59
60 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B.
61 // REX.W is set.
52 void Assembler::emit_rex_64(Register reg, Register rm_reg) { 62 void Assembler::emit_rex_64(Register reg, Register rm_reg) {
53 EMIT(0x48 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3); 63 EMIT(0x48 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3);
54 } 64 }
55 65
56 66
67 // The high bit of reg is used for REX.R, the high bit of op's base
68 // register is used for REX.B, and the high bit of op's index register
69 // is used for REX.X. REX.W is set.
57 void Assembler::emit_rex_64(Register reg, const Operand& op) { 70 void Assembler::emit_rex_64(Register reg, const Operand& op) {
58 EMIT(0x48 | (reg.code() & 0x8) >> 1 | op.rex_); 71 EMIT(0x48 | (reg.code() & 0x8) >> 1 | op.rex_);
59 } 72 }
60 73
61 74
62 void Assembler::set_target_address_at(byte* location, byte* value) { 75 void Assembler::set_target_address_at(byte* location, byte* value) {
63 UNIMPLEMENTED(); 76 UNIMPLEMENTED();
64 } 77 }
65 78
66 79
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 ASSERT(len_ == 1 || len_ == 2); 237 ASSERT(len_ == 1 || len_ == 2);
225 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); 238 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]);
226 *p = disp; 239 *p = disp;
227 len_ += sizeof(int32_t); 240 len_ += sizeof(int32_t);
228 } 241 }
229 242
230 243
231 } } // namespace v8::internal 244 } } // namespace v8::internal
232 245
233 #endif // V8_X64_ASSEMBLER_X64_INL_H_ 246 #endif // V8_X64_ASSEMBLER_X64_INL_H_
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | test/cctest/test-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698