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_MIPS) | 9 #if defined(TARGET_ARCH_MIPS) |
10 | 10 |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 | 788 |
789 private: | 789 private: |
790 Redirection(uword external_function, | 790 Redirection(uword external_function, |
791 Simulator::CallKind call_kind, | 791 Simulator::CallKind call_kind, |
792 int argument_count) | 792 int argument_count) |
793 : external_function_(external_function), | 793 : external_function_(external_function), |
794 call_kind_(call_kind), | 794 call_kind_(call_kind), |
795 argument_count_(argument_count), | 795 argument_count_(argument_count), |
796 break_instruction_(Instr::kSimulatorRedirectInstruction), | 796 break_instruction_(Instr::kSimulatorRedirectInstruction), |
797 next_(list_) { | 797 next_(list_) { |
798 list_ = this; | 798 // Atomically prepend this element to the front of the global list. |
| 799 // Note: Since elements are never removed, there is no ABA issue. |
| 800 Redirection* old_list = list_; |
| 801 do { |
| 802 next_ = old_list; |
| 803 old_list = reinterpret_cast<Redirection*>( |
| 804 AtomicOperations::CompareAndSwapWord( |
| 805 reinterpret_cast<uword*>(&list_), |
| 806 reinterpret_cast<uword>(next_), |
| 807 reinterpret_cast<uword>(this))); |
| 808 } while (old_list != next_); |
799 } | 809 } |
800 | 810 |
801 uword external_function_; | 811 uword external_function_; |
802 Simulator::CallKind call_kind_; | 812 Simulator::CallKind call_kind_; |
803 int argument_count_; | 813 int argument_count_; |
804 uint32_t break_instruction_; | 814 uint32_t break_instruction_; |
805 Redirection* next_; | 815 Redirection* next_; |
806 static Redirection* list_; | 816 static Redirection* list_; |
807 }; | 817 }; |
808 | 818 |
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2488 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 2498 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
2489 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 2499 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
2490 buf->Longjmp(); | 2500 buf->Longjmp(); |
2491 } | 2501 } |
2492 | 2502 |
2493 } // namespace dart | 2503 } // namespace dart |
2494 | 2504 |
2495 #endif // !defined(HOST_ARCH_MIPS) | 2505 #endif // !defined(HOST_ARCH_MIPS) |
2496 | 2506 |
2497 #endif // defined TARGET_ARCH_MIPS | 2507 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |