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

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

Issue 21721002: Make some constants' meaning clear for X64 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed danno's comments Created 7 years, 4 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.h ('k') | src/x64/assembler-x64-inl.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 delete memory; 157 delete memory;
158 } 158 }
159 159
160 160
161 // ----------------------------------------------------------------------------- 161 // -----------------------------------------------------------------------------
162 // Implementation of RelocInfo 162 // Implementation of RelocInfo
163 163
164 // Patch the code at the current PC with a call to the target address. 164 // Patch the code at the current PC with a call to the target address.
165 // Additional guard int3 instructions can be added if required. 165 // Additional guard int3 instructions can be added if required.
166 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) { 166 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) {
167 // Load register with immediate 64 and call through a register instructions 167 int code_size = Assembler::kCallSequenceLength + guard_bytes;
168 // takes up 13 bytes and int3 takes up one byte.
169 static const int kCallCodeSize = 13;
170 int code_size = kCallCodeSize + guard_bytes;
171 168
172 // Create a code patcher. 169 // Create a code patcher.
173 CodePatcher patcher(pc_, code_size); 170 CodePatcher patcher(pc_, code_size);
174 171
175 // Add a label for checking the size of the code used for returning. 172 // Add a label for checking the size of the code used for returning.
176 #ifdef DEBUG 173 #ifdef DEBUG
177 Label check_codesize; 174 Label check_codesize;
178 patcher.masm()->bind(&check_codesize); 175 patcher.masm()->bind(&check_codesize);
179 #endif 176 #endif
180 177
181 // Patch the code. 178 // Patch the code.
182 patcher.masm()->movq(r10, target, RelocInfo::NONE64); 179 patcher.masm()->movq(r10, target, RelocInfo::NONE64);
183 patcher.masm()->call(r10); 180 patcher.masm()->call(r10);
184 181
185 // Check that the size of the code generated is as expected. 182 // Check that the size of the code generated is as expected.
186 ASSERT_EQ(kCallCodeSize, 183 ASSERT_EQ(Assembler::kCallSequenceLength,
187 patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize)); 184 patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize));
188 185
189 // Add the requested number of int3 instructions after the call. 186 // Add the requested number of int3 instructions after the call.
190 for (int i = 0; i < guard_bytes; i++) { 187 for (int i = 0; i < guard_bytes; i++) {
191 patcher.masm()->int3(); 188 patcher.masm()->int3();
192 } 189 }
193 } 190 }
194 191
195 192
196 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { 193 void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
(...skipping 2916 matching lines...) Expand 10 before | Expand all | Expand 10 after
3113 bool RelocInfo::IsCodedSpecially() { 3110 bool RelocInfo::IsCodedSpecially() {
3114 // The deserializer needs to know whether a pointer is specially coded. Being 3111 // The deserializer needs to know whether a pointer is specially coded. Being
3115 // specially coded on x64 means that it is a relative 32 bit address, as used 3112 // specially coded on x64 means that it is a relative 32 bit address, as used
3116 // by branch instructions. 3113 // by branch instructions.
3117 return (1 << rmode_) & kApplyMask; 3114 return (1 << rmode_) & kApplyMask;
3118 } 3115 }
3119 3116
3120 } } // namespace v8::internal 3117 } } // namespace v8::internal
3121 3118
3122 #endif // V8_TARGET_ARCH_X64 3119 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.h ('k') | src/x64/assembler-x64-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698