Chromium Code Reviews| 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> // NOLINT | 5 #include <setjmp.h> // NOLINT |
| 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_ARM) | 9 #if defined(TARGET_ARCH_ARM) |
| 10 | 10 |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 804 return 0; | 804 return 0; |
| 805 } | 805 } |
| 806 | 806 |
| 807 private: | 807 private: |
| 808 Redirection(uword external_function, | 808 Redirection(uword external_function, |
| 809 Simulator::CallKind call_kind, | 809 Simulator::CallKind call_kind, |
| 810 int argument_count) | 810 int argument_count) |
| 811 : external_function_(external_function), | 811 : external_function_(external_function), |
| 812 call_kind_(call_kind), | 812 call_kind_(call_kind), |
| 813 argument_count_(argument_count), | 813 argument_count_(argument_count), |
| 814 svc_instruction_(Instr::kSimulatorRedirectInstruction), | 814 svc_instruction_(Instr::kSimulatorRedirectInstruction) { |
| 815 next_(list_) { | 815 // Atomically prepend this element to the front of the global list. |
| 816 list_ = this; | 816 // Note: Since elements are never removed, there is no ABA issue. |
| 817 Redirection* old_list = list_; | |
| 818 do { | |
| 819 next_ = old_list; | |
|
Cutch
2015/02/06 00:47:10
consider renaming "old_list" to "list_head".
koda
2015/02/06 15:50:22
Done.
| |
| 820 old_list = reinterpret_cast<Redirection*>( | |
| 821 AtomicOperations::CompareAndSwapWord( | |
| 822 reinterpret_cast<uword*>(&list_), | |
| 823 reinterpret_cast<uword>(next_), | |
| 824 reinterpret_cast<uword>(this))); | |
| 825 } while (old_list != next_); | |
| 817 } | 826 } |
| 818 | 827 |
| 819 uword external_function_; | 828 uword external_function_; |
| 820 Simulator::CallKind call_kind_; | 829 Simulator::CallKind call_kind_; |
| 821 int argument_count_; | 830 int argument_count_; |
| 822 uint32_t svc_instruction_; | 831 uint32_t svc_instruction_; |
| 823 Redirection* next_; | 832 Redirection* next_; |
| 824 static Redirection* list_; | 833 static Redirection* list_; |
| 825 }; | 834 }; |
| 826 | 835 |
| (...skipping 3046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3873 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 3882 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
| 3874 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 3883 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
| 3875 buf->Longjmp(); | 3884 buf->Longjmp(); |
| 3876 } | 3885 } |
| 3877 | 3886 |
| 3878 } // namespace dart | 3887 } // namespace dart |
| 3879 | 3888 |
| 3880 #endif // !defined(HOST_ARCH_ARM) | 3889 #endif // !defined(HOST_ARCH_ARM) |
| 3881 | 3890 |
| 3882 #endif // defined TARGET_ARCH_ARM | 3891 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |