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

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

Issue 115857: Add more arithmetic to x64 assembler. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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/x64/assembler-x64.cc ('k') | no next file » | 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 23 matching lines...) Expand all
34 namespace internal { 34 namespace internal {
35 35
36 Condition NegateCondition(Condition cc) { 36 Condition NegateCondition(Condition cc) {
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) \
45 *pc_++ = (x)
46 44
47 45
48 void Assembler::emitl(uint32_t x) { 46 void Assembler::emitl(uint32_t x) {
49 Memory::uint32_at(pc_) = x; 47 Memory::uint32_at(pc_) = x;
50 pc_ += sizeof(uint32_t); 48 pc_ += sizeof(uint32_t);
51 } 49 }
52 50
53 51
54 void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) { 52 void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) {
55 Memory::uint64_at(pc_) = x; 53 Memory::uint64_at(pc_) = x;
56 RecordRelocInfo(rmode, x); 54 RecordRelocInfo(rmode, x);
57 } 55 }
58 56
59 57
60 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. 58 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B.
61 // REX.W is set. 59 // REX.W is set.
62 void Assembler::emit_rex_64(Register reg, Register rm_reg) { 60 void Assembler::emit_rex_64(Register reg, Register rm_reg) {
63 EMIT(0x48 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3); 61 emit(0x48 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3);
64 } 62 }
65 63
66 64
67 // The high bit of reg is used for REX.R, the high bit of op's base 65 // 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 66 // 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. 67 // is used for REX.X. REX.W is set.
70 void Assembler::emit_rex_64(Register reg, const Operand& op) { 68 void Assembler::emit_rex_64(Register reg, const Operand& op) {
71 EMIT(0x48 | (reg.code() & 0x8) >> 1 | op.rex_); 69 emit(0x48 | (reg.code() & 0x8) >> 1 | op.rex_);
72 } 70 }
73 71
74 72
75 void Assembler::set_target_address_at(byte* location, byte* value) { 73 void Assembler::set_target_address_at(byte* location, byte* value) {
76 UNIMPLEMENTED(); 74 UNIMPLEMENTED();
77 } 75 }
78 76
79 77
80 byte* Assembler::target_address_at(byte* location) { 78 byte* Assembler::target_address_at(byte* location) {
81 UNIMPLEMENTED(); 79 UNIMPLEMENTED();
82 return NULL; 80 return NULL;
83 } 81 }
84 82
85 #undef EMIT
86
87 83
88 // ----------------------------------------------------------------------------- 84 // -----------------------------------------------------------------------------
89 // Implementation of RelocInfo 85 // Implementation of RelocInfo
90 86
91 // The modes possibly affected by apply must be in kApplyMask. 87 // The modes possibly affected by apply must be in kApplyMask.
92 void RelocInfo::apply(int delta) { 88 void RelocInfo::apply(int delta) {
93 if (rmode_ == RUNTIME_ENTRY || IsCodeTarget(rmode_)) { 89 if (rmode_ == RUNTIME_ENTRY || IsCodeTarget(rmode_)) {
94 intptr_t* p = reinterpret_cast<intptr_t*>(pc_); 90 intptr_t* p = reinterpret_cast<intptr_t*>(pc_);
95 *p -= delta; // relocate entry 91 *p -= delta; // relocate entry
96 } else if (rmode_ == JS_RETURN && IsCallInstruction()) { 92 } else if (rmode_ == JS_RETURN && IsCallInstruction()) {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 ASSERT(len_ == 1 || len_ == 2); 233 ASSERT(len_ == 1 || len_ == 2);
238 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); 234 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]);
239 *p = disp; 235 *p = disp;
240 len_ += sizeof(int32_t); 236 len_ += sizeof(int32_t);
241 } 237 }
242 238
243 239
244 } } // namespace v8::internal 240 } } // namespace v8::internal
245 241
246 #endif // V8_X64_ASSEMBLER_X64_INL_H_ 242 #endif // V8_X64_ASSEMBLER_X64_INL_H_
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698