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

Side by Side Diff: src/arm/codegen-arm.cc

Issue 1332283002: Make FlushICache part of Assembler(Base) and take Isolate as parameter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm64 PatchingAssembler that initialized its isolate with NULL :) Created 5 years, 3 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/arm/code-stubs-arm.h ('k') | src/arm/cpu-arm.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/arm/codegen-arm.h" 5 #include "src/arm/codegen-arm.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/arm/simulator-arm.h" 9 #include "src/arm/simulator-arm.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } else { 60 } else {
61 __ vmov(r0, r1, result); 61 __ vmov(r0, r1, result);
62 } 62 }
63 __ Ret(); 63 __ Ret();
64 } 64 }
65 65
66 CodeDesc desc; 66 CodeDesc desc;
67 masm.GetCode(&desc); 67 masm.GetCode(&desc);
68 DCHECK(!RelocInfo::RequiresRelocation(desc)); 68 DCHECK(!RelocInfo::RequiresRelocation(desc));
69 69
70 CpuFeatures::FlushICache(buffer, actual_size); 70 Assembler::FlushICacheWithoutIsolate(buffer, actual_size);
71 base::OS::ProtectCode(buffer, actual_size); 71 base::OS::ProtectCode(buffer, actual_size);
72 72
73 #if !defined(USE_SIMULATOR) 73 #if !defined(USE_SIMULATOR)
74 return FUNCTION_CAST<UnaryMathFunction>(buffer); 74 return FUNCTION_CAST<UnaryMathFunction>(buffer);
75 #else 75 #else
76 fast_exp_arm_machine_code = buffer; 76 fast_exp_arm_machine_code = buffer;
77 return &fast_exp_simulator; 77 return &fast_exp_simulator;
78 #endif 78 #endif
79 } 79 }
80 80
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 __ ldrh(temp1, MemOperand(src, 2, PostIndex), cs); 220 __ ldrh(temp1, MemOperand(src, 2, PostIndex), cs);
221 __ strh(temp1, MemOperand(dest, 2, PostIndex), cs); 221 __ strh(temp1, MemOperand(dest, 2, PostIndex), cs);
222 __ ldrb(temp1, MemOperand(src), ne); 222 __ ldrb(temp1, MemOperand(src), ne);
223 __ strb(temp1, MemOperand(dest), ne); 223 __ strb(temp1, MemOperand(dest), ne);
224 __ Ret(); 224 __ Ret();
225 225
226 CodeDesc desc; 226 CodeDesc desc;
227 masm.GetCode(&desc); 227 masm.GetCode(&desc);
228 DCHECK(!RelocInfo::RequiresRelocation(desc)); 228 DCHECK(!RelocInfo::RequiresRelocation(desc));
229 229
230 CpuFeatures::FlushICache(buffer, actual_size); 230 Assembler::FlushICacheWithoutIsolate(buffer, actual_size);
231 base::OS::ProtectCode(buffer, actual_size); 231 base::OS::ProtectCode(buffer, actual_size);
232 return FUNCTION_CAST<MemCopyUint8Function>(buffer); 232 return FUNCTION_CAST<MemCopyUint8Function>(buffer);
233 #endif 233 #endif
234 } 234 }
235 235
236 236
237 // Convert 8 to 16. The number of character to copy must be at least 8. 237 // Convert 8 to 16. The number of character to copy must be at least 8.
238 MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function( 238 MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function(
239 MemCopyUint16Uint8Function stub) { 239 MemCopyUint16Uint8Function stub) {
240 #if defined(USE_SIMULATOR) 240 #if defined(USE_SIMULATOR)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 __ str(temp3, MemOperand(dest, 4, PostIndex)); 307 __ str(temp3, MemOperand(dest, 4, PostIndex));
308 __ bind(&not_two); 308 __ bind(&not_two);
309 __ ldrb(temp1, MemOperand(src), ne); 309 __ ldrb(temp1, MemOperand(src), ne);
310 __ strh(temp1, MemOperand(dest), ne); 310 __ strh(temp1, MemOperand(dest), ne);
311 __ Pop(pc, r4); 311 __ Pop(pc, r4);
312 } 312 }
313 313
314 CodeDesc desc; 314 CodeDesc desc;
315 masm.GetCode(&desc); 315 masm.GetCode(&desc);
316 316
317 CpuFeatures::FlushICache(buffer, actual_size); 317 Assembler::FlushICacheWithoutIsolate(buffer, actual_size);
318 base::OS::ProtectCode(buffer, actual_size); 318 base::OS::ProtectCode(buffer, actual_size);
319 319
320 return FUNCTION_CAST<MemCopyUint16Uint8Function>(buffer); 320 return FUNCTION_CAST<MemCopyUint16Uint8Function>(buffer);
321 #endif 321 #endif
322 } 322 }
323 #endif 323 #endif
324 324
325 UnaryMathFunction CreateSqrtFunction() { 325 UnaryMathFunction CreateSqrtFunction() {
326 #if defined(USE_SIMULATOR) 326 #if defined(USE_SIMULATOR)
327 return &std::sqrt; 327 return &std::sqrt;
328 #else 328 #else
329 size_t actual_size; 329 size_t actual_size;
330 byte* buffer = 330 byte* buffer =
331 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); 331 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true));
332 if (buffer == NULL) return &std::sqrt; 332 if (buffer == NULL) return &std::sqrt;
333 333
334 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); 334 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size));
335 335
336 __ MovFromFloatParameter(d0); 336 __ MovFromFloatParameter(d0);
337 __ vsqrt(d0, d0); 337 __ vsqrt(d0, d0);
338 __ MovToFloatResult(d0); 338 __ MovToFloatResult(d0);
339 __ Ret(); 339 __ Ret();
340 340
341 CodeDesc desc; 341 CodeDesc desc;
342 masm.GetCode(&desc); 342 masm.GetCode(&desc);
343 DCHECK(!RelocInfo::RequiresRelocation(desc)); 343 DCHECK(!RelocInfo::RequiresRelocation(desc));
344 344
345 CpuFeatures::FlushICache(buffer, actual_size); 345 Assembler::FlushICacheWithoutIsolate(buffer, actual_size);
346 base::OS::ProtectCode(buffer, actual_size); 346 base::OS::ProtectCode(buffer, actual_size);
347 return FUNCTION_CAST<UnaryMathFunction>(buffer); 347 return FUNCTION_CAST<UnaryMathFunction>(buffer);
348 #endif 348 #endif
349 } 349 }
350 350
351 #undef __ 351 #undef __
352 352
353 353
354 // ------------------------------------------------------------------------- 354 // -------------------------------------------------------------------------
355 // Platform-specific RuntimeCallHelper functions. 355 // Platform-specific RuntimeCallHelper functions.
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 } 927 }
928 928
929 929
930 void Code::PatchPlatformCodeAge(Isolate* isolate, 930 void Code::PatchPlatformCodeAge(Isolate* isolate,
931 byte* sequence, 931 byte* sequence,
932 Code::Age age, 932 Code::Age age,
933 MarkingParity parity) { 933 MarkingParity parity) {
934 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); 934 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length();
935 if (age == kNoAgeCodeAge) { 935 if (age == kNoAgeCodeAge) {
936 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); 936 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence);
937 CpuFeatures::FlushICache(sequence, young_length); 937 Assembler::FlushICache(isolate, sequence, young_length);
938 } else { 938 } else {
939 Code* stub = GetCodeAgeStub(isolate, age, parity); 939 Code* stub = GetCodeAgeStub(isolate, age, parity);
940 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); 940 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize);
941 patcher.masm()->add(r0, pc, Operand(-8)); 941 patcher.masm()->add(r0, pc, Operand(-8));
942 patcher.masm()->ldr(pc, MemOperand(pc, -4)); 942 patcher.masm()->ldr(pc, MemOperand(pc, -4));
943 patcher.masm()->emit_code_stub_address(stub); 943 patcher.masm()->emit_code_stub_address(stub);
944 } 944 }
945 } 945 }
946 946
947 947
948 } // namespace internal 948 } // namespace internal
949 } // namespace v8 949 } // namespace v8
950 950
951 #endif // V8_TARGET_ARCH_ARM 951 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/arm/cpu-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698