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

Side by Side Diff: src/assembler.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/assembler.h ('k') | src/deoptimizer.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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "src/cpu-profiler.h" 47 #include "src/cpu-profiler.h"
48 #include "src/debug/debug.h" 48 #include "src/debug/debug.h"
49 #include "src/deoptimizer.h" 49 #include "src/deoptimizer.h"
50 #include "src/execution.h" 50 #include "src/execution.h"
51 #include "src/ic/ic.h" 51 #include "src/ic/ic.h"
52 #include "src/ic/stub-cache.h" 52 #include "src/ic/stub-cache.h"
53 #include "src/regexp/jsregexp.h" 53 #include "src/regexp/jsregexp.h"
54 #include "src/regexp/regexp-macro-assembler.h" 54 #include "src/regexp/regexp-macro-assembler.h"
55 #include "src/regexp/regexp-stack.h" 55 #include "src/regexp/regexp-stack.h"
56 #include "src/runtime/runtime.h" 56 #include "src/runtime/runtime.h"
57 #include "src/simulator.h" // For flushing instruction cache.
57 #include "src/snapshot/serialize.h" 58 #include "src/snapshot/serialize.h"
58 #include "src/token.h" 59 #include "src/token.h"
59 60
60 #if V8_TARGET_ARCH_IA32 61 #if V8_TARGET_ARCH_IA32
61 #include "src/ia32/assembler-ia32-inl.h" // NOLINT 62 #include "src/ia32/assembler-ia32-inl.h" // NOLINT
62 #elif V8_TARGET_ARCH_X64 63 #elif V8_TARGET_ARCH_X64
63 #include "src/x64/assembler-x64-inl.h" // NOLINT 64 #include "src/x64/assembler-x64-inl.h" // NOLINT
64 #elif V8_TARGET_ARCH_ARM64 65 #elif V8_TARGET_ARCH_ARM64
65 #include "src/arm64/assembler-arm64-inl.h" // NOLINT 66 #include "src/arm64/assembler-arm64-inl.h" // NOLINT
66 #elif V8_TARGET_ARCH_ARM 67 #elif V8_TARGET_ARCH_ARM
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 149
149 pc_ = buffer_; 150 pc_ = buffer_;
150 } 151 }
151 152
152 153
153 AssemblerBase::~AssemblerBase() { 154 AssemblerBase::~AssemblerBase() {
154 if (own_buffer_) DeleteArray(buffer_); 155 if (own_buffer_) DeleteArray(buffer_);
155 } 156 }
156 157
157 158
159 void AssemblerBase::FlushICache(Isolate* isolate, void* start, size_t size) {
160 if (size == 0) return;
161 if (CpuFeatures::IsSupported(COHERENT_CACHE)) return;
162
163 #if defined(USE_SIMULATOR)
164 Simulator::FlushICache(isolate->simulator_i_cache(), start, size);
165 #else
166 CpuFeatures::FlushICache(start, size);
167 #endif // USE_SIMULATOR
168 }
169
170
171 void AssemblerBase::FlushICacheWithoutIsolate(void* start, size_t size) {
172 // Ideally we would just call Isolate::Current() here. However, this flushes
173 // out issues because we usually only need the isolate when in the simulator.
174 Isolate* isolate;
175 #if defined(USE_SIMULATOR)
176 isolate = Isolate::Current();
177 #else
178 isolate = nullptr;
179 #endif // USE_SIMULATOR
180 FlushICache(isolate, start, size);
181 }
182
183
158 // ----------------------------------------------------------------------------- 184 // -----------------------------------------------------------------------------
159 // Implementation of PredictableCodeSizeScope 185 // Implementation of PredictableCodeSizeScope
160 186
161 PredictableCodeSizeScope::PredictableCodeSizeScope(AssemblerBase* assembler) 187 PredictableCodeSizeScope::PredictableCodeSizeScope(AssemblerBase* assembler)
162 : PredictableCodeSizeScope(assembler, -1) {} 188 : PredictableCodeSizeScope(assembler, -1) {}
163 189
164 190
165 PredictableCodeSizeScope::PredictableCodeSizeScope(AssemblerBase* assembler, 191 PredictableCodeSizeScope::PredictableCodeSizeScope(AssemblerBase* assembler,
166 int expected_size) 192 int expected_size)
167 : assembler_(assembler), 193 : assembler_(assembler),
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 ExternalReference ExternalReference:: 1043 ExternalReference ExternalReference::
1018 store_buffer_overflow_function(Isolate* isolate) { 1044 store_buffer_overflow_function(Isolate* isolate) {
1019 return ExternalReference(Redirect( 1045 return ExternalReference(Redirect(
1020 isolate, 1046 isolate,
1021 FUNCTION_ADDR(StoreBuffer::StoreBufferOverflow))); 1047 FUNCTION_ADDR(StoreBuffer::StoreBufferOverflow)));
1022 } 1048 }
1023 1049
1024 1050
1025 ExternalReference ExternalReference::flush_icache_function(Isolate* isolate) { 1051 ExternalReference ExternalReference::flush_icache_function(Isolate* isolate) {
1026 return ExternalReference( 1052 return ExternalReference(
1027 Redirect(isolate, FUNCTION_ADDR(CpuFeatures::FlushICache))); 1053 Redirect(isolate, FUNCTION_ADDR(Assembler::FlushICacheWithoutIsolate)));
1028 } 1054 }
1029 1055
1030 1056
1031 ExternalReference ExternalReference::delete_handle_scope_extensions( 1057 ExternalReference ExternalReference::delete_handle_scope_extensions(
1032 Isolate* isolate) { 1058 Isolate* isolate) {
1033 return ExternalReference(Redirect( 1059 return ExternalReference(Redirect(
1034 isolate, 1060 isolate,
1035 FUNCTION_ADDR(HandleScope::DeleteExtensions))); 1061 FUNCTION_ADDR(HandleScope::DeleteExtensions)));
1036 } 1062 }
1037 1063
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 1846
1821 1847
1822 void Assembler::DataAlign(int m) { 1848 void Assembler::DataAlign(int m) {
1823 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); 1849 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m));
1824 while ((pc_offset() & (m - 1)) != 0) { 1850 while ((pc_offset() & (m - 1)) != 0) {
1825 db(0); 1851 db(0);
1826 } 1852 }
1827 } 1853 }
1828 } // namespace internal 1854 } // namespace internal
1829 } // namespace v8 1855 } // namespace v8
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698