| 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/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 6609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6620 } | 6620 } |
| 6621 UNREACHABLE(); | 6621 UNREACHABLE(); |
| 6622 return ""; | 6622 return ""; |
| 6623 } | 6623 } |
| 6624 | 6624 |
| 6625 | 6625 |
| 6626 const char* PcDescriptors::ToCString() const { | 6626 const char* PcDescriptors::ToCString() const { |
| 6627 if (Length() == 0) { | 6627 if (Length() == 0) { |
| 6628 return "No pc descriptors\n"; | 6628 return "No pc descriptors\n"; |
| 6629 } | 6629 } |
| 6630 const char* kFormat = "0x%x\t%s\t%ld\t%ld\t%ld\n"; | 6630 const char* kFormat = |
| 6631 "0x%" PRIxPTR "\t%s\t%" PRIdPTR "\t%" PRIdPTR "\t%" PRIdPTR "\n"; |
| 6631 // First compute the buffer size required. | 6632 // First compute the buffer size required. |
| 6632 intptr_t len = 0; | 6633 intptr_t len = 1; // Trailing '\0'. |
| 6633 for (intptr_t i = 0; i < Length(); i++) { | 6634 for (intptr_t i = 0; i < Length(); i++) { |
| 6634 const intptr_t multi_purpose_index = DescriptorKind(i) == kDeoptIndex ? | 6635 const intptr_t multi_purpose_index = DescriptorKind(i) == kDeoptIndex ? |
| 6635 DeoptIndex(i) : TryIndex(i); | 6636 DeoptIndex(i) : TryIndex(i); |
| 6636 len += OS::SNPrint(NULL, 0, kFormat, | 6637 len += OS::SNPrint(NULL, 0, kFormat, |
| 6637 PC(i), KindAsStr(i), NodeId(i), TokenIndex(i), multi_purpose_index); | 6638 PC(i), KindAsStr(i), NodeId(i), TokenIndex(i), multi_purpose_index); |
| 6638 } | 6639 } |
| 6639 // Allocate the buffer. | 6640 // Allocate the buffer. |
| 6640 char* buffer = reinterpret_cast<char*>( | 6641 char* buffer = reinterpret_cast<char*>( |
| 6641 Isolate::Current()->current_zone()->Allocate(len + 1)); | 6642 Isolate::Current()->current_zone()->Allocate(len)); |
| 6642 // Layout the fields in the buffer. | 6643 // Layout the fields in the buffer. |
| 6643 intptr_t index = 0; | 6644 intptr_t index = 0; |
| 6644 for (intptr_t i = 0; i < Length(); i++) { | 6645 for (intptr_t i = 0; i < Length(); i++) { |
| 6645 const intptr_t multi_purpose_index = DescriptorKind(i) == kDeoptIndex ? | 6646 const intptr_t multi_purpose_index = DescriptorKind(i) == kDeoptIndex ? |
| 6646 DeoptIndex(i) : TryIndex(i); | 6647 DeoptIndex(i) : TryIndex(i); |
| 6647 index += OS::SNPrint((buffer + index), (len - index), kFormat, | 6648 index += OS::SNPrint((buffer + index), (len - index), kFormat, |
| 6648 PC(i), KindAsStr(i), NodeId(i), TokenIndex(i), multi_purpose_index); | 6649 PC(i), KindAsStr(i), NodeId(i), TokenIndex(i), multi_purpose_index); |
| 6649 } | 6650 } |
| 6650 return buffer; | 6651 return buffer; |
| 6651 } | 6652 } |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6893 } | 6894 } |
| 6894 return result.raw(); | 6895 return result.raw(); |
| 6895 } | 6896 } |
| 6896 | 6897 |
| 6897 | 6898 |
| 6898 const char* ExceptionHandlers::ToCString() const { | 6899 const char* ExceptionHandlers::ToCString() const { |
| 6899 if (Length() == 0) { | 6900 if (Length() == 0) { |
| 6900 return "No exception handlers\n"; | 6901 return "No exception handlers\n"; |
| 6901 } | 6902 } |
| 6902 // First compute the buffer size required. | 6903 // First compute the buffer size required. |
| 6903 intptr_t len = 0; | 6904 const char* kFormat = "%" PRIdPTR " => 0x%" PRIxPTR "\n"; |
| 6905 intptr_t len = 1; // Trailing '\0'. |
| 6904 for (intptr_t i = 0; i < Length(); i++) { | 6906 for (intptr_t i = 0; i < Length(); i++) { |
| 6905 len += OS::SNPrint(NULL, 0, "%ld => 0x%x\n", | 6907 len += OS::SNPrint(NULL, 0, kFormat, TryIndex(i), HandlerPC(i)); |
| 6906 TryIndex(i), HandlerPC(i)); | |
| 6907 } | 6908 } |
| 6908 // Allocate the buffer. | 6909 // Allocate the buffer. |
| 6909 char* buffer = reinterpret_cast<char*>( | 6910 char* buffer = reinterpret_cast<char*>( |
| 6910 Isolate::Current()->current_zone()->Allocate(len + 1)); | 6911 Isolate::Current()->current_zone()->Allocate(len)); |
| 6911 // Layout the fields in the buffer. | 6912 // Layout the fields in the buffer. |
| 6912 intptr_t index = 0; | 6913 intptr_t index = 0; |
| 6913 for (intptr_t i = 0; i < Length(); i++) { | 6914 for (intptr_t i = 0; i < Length(); i++) { |
| 6914 index += OS::SNPrint((buffer + index), | 6915 index += OS::SNPrint((buffer + index), |
| 6915 (len - index), | 6916 (len - index), |
| 6916 "%ld => 0x%x\n", | 6917 kFormat, |
| 6917 TryIndex(i), | 6918 TryIndex(i), |
| 6918 HandlerPC(i)); | 6919 HandlerPC(i)); |
| 6919 } | 6920 } |
| 6920 return buffer; | 6921 return buffer; |
| 6921 } | 6922 } |
| 6922 | 6923 |
| 6923 | 6924 |
| 6924 intptr_t DeoptInfo::Length() const { | 6925 intptr_t DeoptInfo::Length() const { |
| 6925 return Smi::Value(raw_ptr()->length_); | 6926 return Smi::Value(raw_ptr()->length_); |
| 6926 } | 6927 } |
| (...skipping 4149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11076 const String& str = String::Handle(pattern()); | 11077 const String& str = String::Handle(pattern()); |
| 11077 const char* format = "JSRegExp: pattern=%s flags=%s"; | 11078 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 11078 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 11079 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 11079 char* chars = reinterpret_cast<char*>( | 11080 char* chars = reinterpret_cast<char*>( |
| 11080 Isolate::Current()->current_zone()->Allocate(len + 1)); | 11081 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 11081 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 11082 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 11082 return chars; | 11083 return chars; |
| 11083 } | 11084 } |
| 11084 | 11085 |
| 11085 } // namespace dart | 11086 } // namespace dart |
| OLD | NEW |