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

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

Issue 22715004: Version 3.20.15 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Add TypedArray API and correctness patches r16033 and r16084 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 int code_size = Assembler::kCallSequenceLength + guard_bytes; 167 // Load register with immediate 64 and call through a register instructions
168 // takes up 13 bytes and int3 takes up one byte.
169 static const int kCallCodeSize = 13;
170 int code_size = kCallCodeSize + guard_bytes;
168 171
169 // Create a code patcher. 172 // Create a code patcher.
170 CodePatcher patcher(pc_, code_size); 173 CodePatcher patcher(pc_, code_size);
171 174
172 // Add a label for checking the size of the code used for returning. 175 // Add a label for checking the size of the code used for returning.
173 #ifdef DEBUG 176 #ifdef DEBUG
174 Label check_codesize; 177 Label check_codesize;
175 patcher.masm()->bind(&check_codesize); 178 patcher.masm()->bind(&check_codesize);
176 #endif 179 #endif
177 180
178 // Patch the code. 181 // Patch the code.
179 patcher.masm()->movq(r10, target, RelocInfo::NONE64); 182 patcher.masm()->movq(r10, target, RelocInfo::NONE64);
180 patcher.masm()->call(r10); 183 patcher.masm()->call(r10);
181 184
182 // Check that the size of the code generated is as expected. 185 // Check that the size of the code generated is as expected.
183 ASSERT_EQ(Assembler::kCallSequenceLength, 186 ASSERT_EQ(kCallCodeSize,
184 patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize)); 187 patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize));
185 188
186 // Add the requested number of int3 instructions after the call. 189 // Add the requested number of int3 instructions after the call.
187 for (int i = 0; i < guard_bytes; i++) { 190 for (int i = 0; i < guard_bytes; i++) {
188 patcher.masm()->int3(); 191 patcher.masm()->int3();
189 } 192 }
190 } 193 }
191 194
192 195
193 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { 196 void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
(...skipping 2916 matching lines...) Expand 10 before | Expand all | Expand 10 after
3110 bool RelocInfo::IsCodedSpecially() { 3113 bool RelocInfo::IsCodedSpecially() {
3111 // The deserializer needs to know whether a pointer is specially coded. Being 3114 // The deserializer needs to know whether a pointer is specially coded. Being
3112 // specially coded on x64 means that it is a relative 32 bit address, as used 3115 // specially coded on x64 means that it is a relative 32 bit address, as used
3113 // by branch instructions. 3116 // by branch instructions.
3114 return (1 << rmode_) & kApplyMask; 3117 return (1 << rmode_) & kApplyMask;
3115 } 3118 }
3116 3119
3117 } } // namespace v8::internal 3120 } } // namespace v8::internal
3118 3121
3119 #endif // V8_TARGET_ARCH_X64 3122 #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