| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #ifndef RUNTIME_VM_EXCEPTIONS_H_ | 5 #ifndef RUNTIME_VM_EXCEPTIONS_H_ |
| 6 #define RUNTIME_VM_EXCEPTIONS_H_ | 6 #define RUNTIME_VM_EXCEPTIONS_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/token_position.h" | 9 #include "vm/token_position.h" |
| 10 | 10 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // The index into the ExceptionHandlers table corresponds to | 95 // The index into the ExceptionHandlers table corresponds to |
| 96 // the try_index of the handler. | 96 // the try_index of the handler. |
| 97 struct ExceptionHandlerInfo { | 97 struct ExceptionHandlerInfo { |
| 98 uint32_t handler_pc_offset; // PC offset value of handler. | 98 uint32_t handler_pc_offset; // PC offset value of handler. |
| 99 int16_t outer_try_index; // Try block index of enclosing try block. | 99 int16_t outer_try_index; // Try block index of enclosing try block. |
| 100 int8_t needs_stacktrace; // True if a stacktrace is needed. | 100 int8_t needs_stacktrace; // True if a stacktrace is needed. |
| 101 int8_t has_catch_all; // Catches all exceptions. | 101 int8_t has_catch_all; // Catches all exceptions. |
| 102 int8_t is_generated; // True if this is a generated handler. | 102 int8_t is_generated; // True if this is a generated handler. |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 | |
| 106 class CatchEntryState { | |
| 107 public: | |
| 108 enum { kCatchEntryStateIsMove = 1, kCatchEntryStateDestShift = 1 }; | |
| 109 | |
| 110 CatchEntryState() : data(NULL) {} | |
| 111 explicit CatchEntryState(intptr_t* data_) : data(data_) {} | |
| 112 // Data has the following format: | |
| 113 // 0 - number of pairs in this state | |
| 114 // 1-2 - 1st encoded src,dest pair | |
| 115 // 3-4 - 2nd pair | |
| 116 // .... | |
| 117 intptr_t* data; | |
| 118 | |
| 119 intptr_t Pairs() { return data[0]; } | |
| 120 | |
| 121 intptr_t Src(intptr_t i) { return data[1 + 2 * i]; } | |
| 122 | |
| 123 intptr_t Dest(intptr_t i) { | |
| 124 return data[2 + 2 * i] >> kCatchEntryStateDestShift; | |
| 125 } | |
| 126 | |
| 127 bool isMove(intptr_t i) { return data[2 + 2 * i] & kCatchEntryStateIsMove; } | |
| 128 }; | |
| 129 | |
| 130 } // namespace dart | 105 } // namespace dart |
| 131 | 106 |
| 132 #endif // RUNTIME_VM_EXCEPTIONS_H_ | 107 #endif // RUNTIME_VM_EXCEPTIONS_H_ |
| OLD | NEW |