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

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

Issue 967323002: Refactor BreakLocationIterator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: static_cast instead Created 5 years, 9 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
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/x64/debug-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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/x64/assembler-x64.h" 5 #include "src/x64/assembler-x64.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 #if V8_TARGET_ARCH_X64 9 #if V8_TARGET_ARCH_X64
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 void CpuFeatures::PrintTarget() { } 101 void CpuFeatures::PrintTarget() { }
102 void CpuFeatures::PrintFeatures() { 102 void CpuFeatures::PrintFeatures() {
103 printf("SSE3=%d SSE4_1=%d SAHF=%d AVX=%d FMA3=%d ATOM=%d\n", 103 printf("SSE3=%d SSE4_1=%d SAHF=%d AVX=%d FMA3=%d ATOM=%d\n",
104 CpuFeatures::IsSupported(SSE3), CpuFeatures::IsSupported(SSE4_1), 104 CpuFeatures::IsSupported(SSE3), CpuFeatures::IsSupported(SSE4_1),
105 CpuFeatures::IsSupported(SAHF), CpuFeatures::IsSupported(AVX), 105 CpuFeatures::IsSupported(SAHF), CpuFeatures::IsSupported(AVX),
106 CpuFeatures::IsSupported(FMA3), CpuFeatures::IsSupported(ATOM)); 106 CpuFeatures::IsSupported(FMA3), CpuFeatures::IsSupported(ATOM));
107 } 107 }
108 108
109 109
110 // ----------------------------------------------------------------------------- 110 // -----------------------------------------------------------------------------
111 // Implementation of RelocInfo
112
113 // Patch the code at the current PC with a call to the target address.
114 // Additional guard int3 instructions can be added if required.
115 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) {
116 int code_size = Assembler::kCallSequenceLength + guard_bytes;
117
118 // Create a code patcher.
119 CodePatcher patcher(pc_, code_size);
120
121 // Add a label for checking the size of the code used for returning.
122 #ifdef DEBUG
123 Label check_codesize;
124 patcher.masm()->bind(&check_codesize);
125 #endif
126
127 // Patch the code.
128 patcher.masm()->movp(kScratchRegister, reinterpret_cast<void*>(target),
129 Assembler::RelocInfoNone());
130 patcher.masm()->call(kScratchRegister);
131
132 // Check that the size of the code generated is as expected.
133 DCHECK_EQ(Assembler::kCallSequenceLength,
134 patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize));
135
136 // Add the requested number of int3 instructions after the call.
137 for (int i = 0; i < guard_bytes; i++) {
138 patcher.masm()->int3();
139 }
140 }
141
142
143 void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
144 // Patch the code at the current address with the supplied instructions.
145 for (int i = 0; i < instruction_count; i++) {
146 *(pc_ + i) = *(instructions + i);
147 }
148
149 // Indicate that code has changed.
150 CpuFeatures::FlushICache(pc_, instruction_count);
151 }
152
153
154 // -----------------------------------------------------------------------------
155 // Register constants. 111 // Register constants.
156 112
157 const int 113 const int
158 Register::kRegisterCodeByAllocationIndex[kMaxNumAllocatableRegisters] = { 114 Register::kRegisterCodeByAllocationIndex[kMaxNumAllocatableRegisters] = {
159 // rax, rbx, rdx, rcx, rsi, rdi, r8, r9, r11, r12, r14, r15 115 // rax, rbx, rdx, rcx, rsi, rdi, r8, r9, r11, r12, r14, r15
160 0, 3, 2, 1, 6, 7, 8, 9, 11, 12, 14, 15 116 0, 3, 2, 1, 6, 7, 8, 9, 11, 12, 14, 15
161 }; 117 };
162 118
163 const int Register::kAllocationIndexByRegisterCode[kNumRegisters] = { 119 const int Register::kAllocationIndexByRegisterCode[kNumRegisters] = {
164 0, 3, 2, 1, -1, -1, 4, 5, 6, 7, -1, 8, 9, -1, 10, 11 120 0, 3, 2, 1, -1, -1, 4, 5, 6, 7, -1, 8, 9, -1, 10, 11
(...skipping 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3457 3413
3458 3414
3459 bool RelocInfo::IsInConstantPool() { 3415 bool RelocInfo::IsInConstantPool() {
3460 return false; 3416 return false;
3461 } 3417 }
3462 3418
3463 3419
3464 } } // namespace v8::internal 3420 } } // namespace v8::internal
3465 3421
3466 #endif // V8_TARGET_ARCH_X64 3422 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/x64/debug-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698