OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ | 5 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ |
6 #define V8_ARM64_SIMULATOR_ARM64_H_ | 6 #define V8_ARM64_SIMULATOR_ARM64_H_ |
7 | 7 |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 2262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2273 static const uintptr_t kExclusiveTaggedAddrMask = ~((1 << 11) - 1); | 2273 static const uintptr_t kExclusiveTaggedAddrMask = ~((1 << 11) - 1); |
2274 | 2274 |
2275 class LocalMonitor { | 2275 class LocalMonitor { |
2276 public: | 2276 public: |
2277 LocalMonitor(); | 2277 LocalMonitor(); |
2278 | 2278 |
2279 // These functions manage the state machine for the local monitor, but do | 2279 // These functions manage the state machine for the local monitor, but do |
2280 // not actually perform loads and stores. NotifyStoreExcl only returns | 2280 // not actually perform loads and stores. NotifyStoreExcl only returns |
2281 // true if the exclusive store is allowed; the global monitor will still | 2281 // true if the exclusive store is allowed; the global monitor will still |
2282 // have to be checked to see whether the memory should be updated. | 2282 // have to be checked to see whether the memory should be updated. |
2283 void NotifyLoad(uintptr_t addr); | 2283 void NotifyLoad(); |
2284 void NotifyLoadExcl(uintptr_t addr, TransactionSize size); | 2284 void NotifyLoadExcl(uintptr_t addr, TransactionSize size); |
2285 void NotifyStore(uintptr_t addr); | 2285 void NotifyStore(); |
2286 bool NotifyStoreExcl(uintptr_t addr, TransactionSize size); | 2286 bool NotifyStoreExcl(uintptr_t addr, TransactionSize size); |
2287 | 2287 |
2288 private: | 2288 private: |
2289 void Clear(); | 2289 void Clear(); |
2290 | 2290 |
2291 MonitorAccess access_state_; | 2291 MonitorAccess access_state_; |
2292 uintptr_t tagged_addr_; | 2292 uintptr_t tagged_addr_; |
2293 TransactionSize size_; | 2293 TransactionSize size_; |
2294 }; | 2294 }; |
2295 | 2295 |
2296 class GlobalMonitor { | 2296 class GlobalMonitor { |
2297 public: | 2297 public: |
2298 GlobalMonitor(); | 2298 GlobalMonitor(); |
2299 | 2299 |
2300 class Processor { | 2300 class Processor { |
2301 public: | 2301 public: |
2302 Processor(); | 2302 Processor(); |
2303 | 2303 |
2304 private: | 2304 private: |
2305 friend class GlobalMonitor; | 2305 friend class GlobalMonitor; |
2306 // These functions manage the state machine for the global monitor, but do | 2306 // These functions manage the state machine for the global monitor, but do |
2307 // not actually perform loads and stores. | 2307 // not actually perform loads and stores. |
2308 void Clear_Locked(); | 2308 void Clear_Locked(); |
2309 void NotifyLoadExcl_Locked(uintptr_t addr); | 2309 void NotifyLoadExcl_Locked(uintptr_t addr); |
2310 void NotifyStore_Locked(uintptr_t addr, bool is_requesting_processor); | 2310 void NotifyStore_Locked(bool is_requesting_processor); |
2311 bool NotifyStoreExcl_Locked(uintptr_t addr, bool is_requesting_processor); | 2311 bool NotifyStoreExcl_Locked(uintptr_t addr, bool is_requesting_processor); |
2312 | 2312 |
2313 MonitorAccess access_state_; | 2313 MonitorAccess access_state_; |
2314 uintptr_t tagged_addr_; | 2314 uintptr_t tagged_addr_; |
2315 Processor* next_; | 2315 Processor* next_; |
2316 Processor* prev_; | 2316 Processor* prev_; |
2317 // A stxr can fail due to background cache evictions. Rather than | 2317 // A stxr can fail due to background cache evictions. Rather than |
2318 // simulating this, we'll just occasionally introduce cases where an | 2318 // simulating this, we'll just occasionally introduce cases where an |
2319 // exclusive store fails. This will happen once after every | 2319 // exclusive store fails. This will happen once after every |
2320 // kMaxFailureCounter exclusive stores. | 2320 // kMaxFailureCounter exclusive stores. |
2321 static const int kMaxFailureCounter = 5; | 2321 static const int kMaxFailureCounter = 5; |
2322 int failure_counter_; | 2322 int failure_counter_; |
2323 }; | 2323 }; |
2324 | 2324 |
2325 // Exposed so it can be accessed by Simulator::{Read,Write}Ex*. | 2325 // Exposed so it can be accessed by Simulator::{Read,Write}Ex*. |
2326 base::Mutex mutex; | 2326 base::Mutex mutex; |
2327 | 2327 |
2328 void NotifyLoadExcl_Locked(uintptr_t addr, Processor* processor); | 2328 void NotifyLoadExcl_Locked(uintptr_t addr, Processor* processor); |
2329 void NotifyStore_Locked(uintptr_t addr, Processor* processor); | 2329 void NotifyStore_Locked(Processor* processor); |
2330 bool NotifyStoreExcl_Locked(uintptr_t addr, Processor* processor); | 2330 bool NotifyStoreExcl_Locked(uintptr_t addr, Processor* processor); |
2331 | 2331 |
2332 // Called when the simulator is destroyed. | 2332 // Called when the simulator is destroyed. |
2333 void RemoveProcessor(Processor* processor); | 2333 void RemoveProcessor(Processor* processor); |
2334 | 2334 |
2335 private: | 2335 private: |
2336 bool IsProcessorInLinkedList_Locked(Processor* processor) const; | 2336 bool IsProcessorInLinkedList_Locked(Processor* processor) const; |
2337 void PrependProcessor_Locked(Processor* processor); | 2337 void PrependProcessor_Locked(Processor* processor); |
2338 | 2338 |
2339 Processor* head_; | 2339 Processor* head_; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 Simulator::current(isolate)->PopAddress(); | 2440 Simulator::current(isolate)->PopAddress(); |
2441 } | 2441 } |
2442 }; | 2442 }; |
2443 | 2443 |
2444 #endif // !defined(USE_SIMULATOR) | 2444 #endif // !defined(USE_SIMULATOR) |
2445 | 2445 |
2446 } // namespace internal | 2446 } // namespace internal |
2447 } // namespace v8 | 2447 } // namespace v8 |
2448 | 2448 |
2449 #endif // V8_ARM64_SIMULATOR_ARM64_H_ | 2449 #endif // V8_ARM64_SIMULATOR_ARM64_H_ |
OLD | NEW |