| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include <setjmp.h> | 5 #include <setjmp.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 #if defined(TARGET_ARCH_MIPS) | 9 #if defined(TARGET_ARCH_MIPS) |
| 10 | 10 |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 return; | 950 return; |
| 951 } | 951 } |
| 952 UnalignedAccess("double-precision floating point write", addr, instr); | 952 UnalignedAccess("double-precision floating point write", addr, instr); |
| 953 } | 953 } |
| 954 | 954 |
| 955 | 955 |
| 956 // Synchronization primitives support. | 956 // Synchronization primitives support. |
| 957 void Simulator::SetExclusiveAccess(uword addr) { | 957 void Simulator::SetExclusiveAccess(uword addr) { |
| 958 Isolate* isolate = Isolate::Current(); | 958 Isolate* isolate = Isolate::Current(); |
| 959 ASSERT(isolate != NULL); | 959 ASSERT(isolate != NULL); |
| 960 ASSERT(exclusive_access_lock_->Owner() == isolate); | 960 DEBUG_ASSERT(exclusive_access_lock_->Owner() == isolate); |
| 961 int i = 0; | 961 int i = 0; |
| 962 // Find an entry for this isolate in the exclusive access state. | 962 // Find an entry for this isolate in the exclusive access state. |
| 963 while ((i < kNumAddressTags) && | 963 while ((i < kNumAddressTags) && |
| 964 (exclusive_access_state_[i].isolate != isolate)) { | 964 (exclusive_access_state_[i].isolate != isolate)) { |
| 965 i++; | 965 i++; |
| 966 } | 966 } |
| 967 // Round-robin replacement of previously used entries. | 967 // Round-robin replacement of previously used entries. |
| 968 if (i == kNumAddressTags) { | 968 if (i == kNumAddressTags) { |
| 969 i = next_address_tag_; | 969 i = next_address_tag_; |
| 970 if (++next_address_tag_ == kNumAddressTags) { | 970 if (++next_address_tag_ == kNumAddressTags) { |
| 971 next_address_tag_ = 0; | 971 next_address_tag_ = 0; |
| 972 } | 972 } |
| 973 exclusive_access_state_[i].isolate = isolate; | 973 exclusive_access_state_[i].isolate = isolate; |
| 974 } | 974 } |
| 975 // Remember the address being reserved. | 975 // Remember the address being reserved. |
| 976 exclusive_access_state_[i].addr = addr; | 976 exclusive_access_state_[i].addr = addr; |
| 977 } | 977 } |
| 978 | 978 |
| 979 | 979 |
| 980 bool Simulator::HasExclusiveAccessAndOpen(uword addr) { | 980 bool Simulator::HasExclusiveAccessAndOpen(uword addr) { |
| 981 Isolate* isolate = Isolate::Current(); | 981 Isolate* isolate = Isolate::Current(); |
| 982 ASSERT(isolate != NULL); | 982 ASSERT(isolate != NULL); |
| 983 ASSERT(addr != 0); | 983 ASSERT(addr != 0); |
| 984 ASSERT(exclusive_access_lock_->Owner() == isolate); | 984 DEBUG_ASSERT(exclusive_access_lock_->Owner() == isolate); |
| 985 bool result = false; | 985 bool result = false; |
| 986 for (int i = 0; i < kNumAddressTags; i++) { | 986 for (int i = 0; i < kNumAddressTags; i++) { |
| 987 if (exclusive_access_state_[i].isolate == isolate) { | 987 if (exclusive_access_state_[i].isolate == isolate) { |
| 988 // Check whether the current isolates address reservation matches. | 988 // Check whether the current isolates address reservation matches. |
| 989 if (exclusive_access_state_[i].addr == addr) { | 989 if (exclusive_access_state_[i].addr == addr) { |
| 990 result = true; | 990 result = true; |
| 991 } | 991 } |
| 992 exclusive_access_state_[i].addr = 0; | 992 exclusive_access_state_[i].addr = 0; |
| 993 } else if (exclusive_access_state_[i].addr == addr) { | 993 } else if (exclusive_access_state_[i].addr == addr) { |
| 994 // Other isolates with matching address lose their reservations. | 994 // Other isolates with matching address lose their reservations. |
| (...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2349 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 2349 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
| 2350 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 2350 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
| 2351 buf->Longjmp(); | 2351 buf->Longjmp(); |
| 2352 } | 2352 } |
| 2353 | 2353 |
| 2354 } // namespace dart | 2354 } // namespace dart |
| 2355 | 2355 |
| 2356 #endif // !defined(HOST_ARCH_MIPS) | 2356 #endif // !defined(HOST_ARCH_MIPS) |
| 2357 | 2357 |
| 2358 #endif // defined TARGET_ARCH_MIPS | 2358 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |