Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 10923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10934 } | 10934 } |
| 10935 | 10935 |
| 10936 | 10936 |
| 10937 intptr_t ExceptionHandlers::num_entries() const { | 10937 intptr_t ExceptionHandlers::num_entries() const { |
| 10938 return raw_ptr()->num_entries_; | 10938 return raw_ptr()->num_entries_; |
| 10939 } | 10939 } |
| 10940 | 10940 |
| 10941 | 10941 |
| 10942 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index, | 10942 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index, |
| 10943 intptr_t outer_try_index, | 10943 intptr_t outer_try_index, |
| 10944 intptr_t handler_pc, | 10944 uword handler_pc_offset, |
| 10945 bool needs_stacktrace, | 10945 bool needs_stacktrace, |
| 10946 bool has_catch_all) const { | 10946 bool has_catch_all) const { |
| 10947 ASSERT((try_index >= 0) && (try_index < num_entries())); | 10947 ASSERT((try_index >= 0) && (try_index < num_entries())); |
| 10948 NoGCScope no_gc; | 10948 NoGCScope no_gc; |
| 10949 RawExceptionHandlers::HandlerInfo* info = | 10949 RawExceptionHandlers::HandlerInfo* info = |
| 10950 UnsafeMutableNonPointer(&raw_ptr()->data()[try_index]); | 10950 UnsafeMutableNonPointer(&raw_ptr()->data()[try_index]); |
| 10951 info->outer_try_index = outer_try_index; | 10951 info->outer_try_index = outer_try_index; |
| 10952 info->handler_pc = handler_pc; | 10952 info->handler_pc_offset = handler_pc_offset; |
|
srdjan
2015/01/23 16:55:28
Could you add an assert that on 64-bit handler_pc_
Florian Schneider
2015/01/26 15:28:53
Done. I didn't use Utils::IsUint because it does n
| |
| 10953 info->needs_stacktrace = needs_stacktrace; | 10953 info->needs_stacktrace = needs_stacktrace; |
| 10954 info->has_catch_all = has_catch_all; | 10954 info->has_catch_all = has_catch_all; |
| 10955 } | 10955 } |
| 10956 | 10956 |
| 10957 void ExceptionHandlers::GetHandlerInfo( | 10957 void ExceptionHandlers::GetHandlerInfo( |
| 10958 intptr_t try_index, | 10958 intptr_t try_index, |
| 10959 RawExceptionHandlers::HandlerInfo* info) const { | 10959 RawExceptionHandlers::HandlerInfo* info) const { |
| 10960 ASSERT((try_index >= 0) && (try_index < num_entries())); | 10960 ASSERT((try_index >= 0) && (try_index < num_entries())); |
| 10961 ASSERT(info != NULL); | 10961 ASSERT(info != NULL); |
| 10962 *info = raw_ptr()->data()[try_index]; | 10962 *info = raw_ptr()->data()[try_index]; |
| 10963 } | 10963 } |
| 10964 | 10964 |
| 10965 | 10965 |
| 10966 intptr_t ExceptionHandlers::HandlerPC(intptr_t try_index) const { | 10966 uword ExceptionHandlers::HandlerPCOffset(intptr_t try_index) const { |
| 10967 ASSERT((try_index >= 0) && (try_index < num_entries())); | 10967 ASSERT((try_index >= 0) && (try_index < num_entries())); |
| 10968 return raw_ptr()->data()[try_index].handler_pc; | 10968 return raw_ptr()->data()[try_index].handler_pc_offset; |
| 10969 } | 10969 } |
| 10970 | 10970 |
| 10971 | 10971 |
| 10972 intptr_t ExceptionHandlers::OuterTryIndex(intptr_t try_index) const { | 10972 intptr_t ExceptionHandlers::OuterTryIndex(intptr_t try_index) const { |
| 10973 ASSERT((try_index >= 0) && (try_index < num_entries())); | 10973 ASSERT((try_index >= 0) && (try_index < num_entries())); |
| 10974 return raw_ptr()->data()[try_index].outer_try_index; | 10974 return raw_ptr()->data()[try_index].outer_try_index; |
| 10975 } | 10975 } |
| 10976 | 10976 |
| 10977 | 10977 |
| 10978 bool ExceptionHandlers::NeedsStacktrace(intptr_t try_index) const { | 10978 bool ExceptionHandlers::NeedsStacktrace(intptr_t try_index) const { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11046 " types) (outer %" Pd ")\n"; | 11046 " types) (outer %" Pd ")\n"; |
| 11047 const char* kFormat2 = " %d. %s\n"; | 11047 const char* kFormat2 = " %d. %s\n"; |
| 11048 intptr_t len = 1; // Trailing '\0'. | 11048 intptr_t len = 1; // Trailing '\0'. |
| 11049 for (intptr_t i = 0; i < num_entries(); i++) { | 11049 for (intptr_t i = 0; i < num_entries(); i++) { |
| 11050 GetHandlerInfo(i, &info); | 11050 GetHandlerInfo(i, &info); |
| 11051 handled_types = GetHandledTypes(i); | 11051 handled_types = GetHandledTypes(i); |
| 11052 ASSERT(!handled_types.IsNull()); | 11052 ASSERT(!handled_types.IsNull()); |
| 11053 const intptr_t num_types = handled_types.Length(); | 11053 const intptr_t num_types = handled_types.Length(); |
| 11054 len += OS::SNPrint(NULL, 0, kFormat, | 11054 len += OS::SNPrint(NULL, 0, kFormat, |
| 11055 i, | 11055 i, |
| 11056 info.handler_pc, | 11056 info.handler_pc_offset, |
| 11057 num_types, | 11057 num_types, |
| 11058 info.outer_try_index); | 11058 info.outer_try_index); |
| 11059 for (int k = 0; k < num_types; k++) { | 11059 for (int k = 0; k < num_types; k++) { |
| 11060 type ^= handled_types.At(k); | 11060 type ^= handled_types.At(k); |
| 11061 ASSERT(!type.IsNull()); | 11061 ASSERT(!type.IsNull()); |
| 11062 len += OS::SNPrint(NULL, 0, kFormat2, k, type.ToCString()); | 11062 len += OS::SNPrint(NULL, 0, kFormat2, k, type.ToCString()); |
| 11063 } | 11063 } |
| 11064 } | 11064 } |
| 11065 // Allocate the buffer. | 11065 // Allocate the buffer. |
| 11066 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len); | 11066 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 11067 // Layout the fields in the buffer. | 11067 // Layout the fields in the buffer. |
| 11068 intptr_t num_chars = 0; | 11068 intptr_t num_chars = 0; |
| 11069 for (intptr_t i = 0; i < num_entries(); i++) { | 11069 for (intptr_t i = 0; i < num_entries(); i++) { |
| 11070 GetHandlerInfo(i, &info); | 11070 GetHandlerInfo(i, &info); |
| 11071 handled_types = GetHandledTypes(i); | 11071 handled_types = GetHandledTypes(i); |
| 11072 const intptr_t num_types = handled_types.Length(); | 11072 const intptr_t num_types = handled_types.Length(); |
| 11073 num_chars += OS::SNPrint((buffer + num_chars), | 11073 num_chars += OS::SNPrint((buffer + num_chars), |
| 11074 (len - num_chars), | 11074 (len - num_chars), |
| 11075 kFormat, | 11075 kFormat, |
| 11076 i, | 11076 i, |
| 11077 info.handler_pc, | 11077 info.handler_pc_offset, |
| 11078 num_types, | 11078 num_types, |
| 11079 info.outer_try_index); | 11079 info.outer_try_index); |
| 11080 for (int k = 0; k < num_types; k++) { | 11080 for (int k = 0; k < num_types; k++) { |
| 11081 type ^= handled_types.At(k); | 11081 type ^= handled_types.At(k); |
| 11082 num_chars += OS::SNPrint((buffer + num_chars), | 11082 num_chars += OS::SNPrint((buffer + num_chars), |
| 11083 (len - num_chars), | 11083 (len - num_chars), |
| 11084 kFormat2, k, type.ToCString()); | 11084 kFormat2, k, type.ToCString()); |
| 11085 } | 11085 } |
| 11086 } | 11086 } |
| 11087 return buffer; | 11087 return buffer; |
| (...skipping 9438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20526 return tag_label.ToCString(); | 20526 return tag_label.ToCString(); |
| 20527 } | 20527 } |
| 20528 | 20528 |
| 20529 | 20529 |
| 20530 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20530 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20531 Instance::PrintJSONImpl(stream, ref); | 20531 Instance::PrintJSONImpl(stream, ref); |
| 20532 } | 20532 } |
| 20533 | 20533 |
| 20534 | 20534 |
| 20535 } // namespace dart | 20535 } // namespace dart |
| OLD | NEW |