| 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" |
| 11 #include "vm/bootstrap.h" | 11 #include "vm/bootstrap.h" |
| 12 #include "vm/datastream.h" | 12 #include "vm/datastream.h" |
| 13 #include "vm/deopt_instructions.h" |
| 13 #include "vm/code_generator.h" | 14 #include "vm/code_generator.h" |
| 14 #include "vm/code_patcher.h" | 15 #include "vm/code_patcher.h" |
| 15 #include "vm/compiler.h" | 16 #include "vm/compiler.h" |
| 16 #include "vm/compiler_stats.h" | 17 #include "vm/compiler_stats.h" |
| 17 #include "vm/class_finalizer.h" | 18 #include "vm/class_finalizer.h" |
| 18 #include "vm/dart.h" | 19 #include "vm/dart.h" |
| 19 #include "vm/dart_api_state.h" | 20 #include "vm/dart_api_state.h" |
| 20 #include "vm/dart_entry.h" | 21 #include "vm/dart_entry.h" |
| 21 #include "vm/debuginfo.h" | 22 #include "vm/debuginfo.h" |
| 22 #include "vm/double_conversion.h" | 23 #include "vm/double_conversion.h" |
| (...skipping 6902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6925 | 6926 |
| 6926 intptr_t DeoptInfo::Instruction(intptr_t index) const { | 6927 intptr_t DeoptInfo::Instruction(intptr_t index) const { |
| 6927 return *(EntryAddr(index, kInstruction)); | 6928 return *(EntryAddr(index, kInstruction)); |
| 6928 } | 6929 } |
| 6929 | 6930 |
| 6930 | 6931 |
| 6931 const char* DeoptInfo::ToCString() const { | 6932 const char* DeoptInfo::ToCString() const { |
| 6932 if (Length() == 0) { | 6933 if (Length() == 0) { |
| 6933 return "No DeoptInfo"; | 6934 return "No DeoptInfo"; |
| 6934 } | 6935 } |
| 6935 // First compute the buffer size required. | 6936 // Convert to DeoptInstr. |
| 6937 GrowableArray<DeoptInstr*> deopt_instrs(Length()); |
| 6938 for (intptr_t i = 0; i < Length(); i++) { |
| 6939 deopt_instrs.Add(DeoptInstr::Create(Instruction(i), FromIndex(i))); |
| 6940 } |
| 6941 // Compute the buffer size required. |
| 6936 intptr_t len = 0; | 6942 intptr_t len = 0; |
| 6937 for (intptr_t i = 0; i < Length(); i++) { | 6943 for (intptr_t i = 0; i < Length(); i++) { |
| 6938 len += OS::SNPrint(NULL, 0, "[%d(%d):%d]", | 6944 len += OS::SNPrint(NULL, 0, "[%s]", deopt_instrs[i]->ToCString()); |
| 6939 Instruction(i), FromIndex(i), i); | |
| 6940 } | 6945 } |
| 6941 // Allocate the buffer. | 6946 // Allocate the buffer. |
| 6942 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 6947 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len + 1); |
| 6943 // Layout the fields in the buffer. | 6948 // Layout the fields in the buffer. |
| 6944 intptr_t index = 0; | 6949 intptr_t index = 0; |
| 6945 for (intptr_t i = 0; i < Length(); i++) { | 6950 for (intptr_t i = 0; i < Length(); i++) { |
| 6946 index += OS::SNPrint((buffer + index), | 6951 index += OS::SNPrint((buffer + index), |
| 6947 (len - index), | 6952 (len - index) + 1, |
| 6948 "[%d(%d):%d]", | 6953 "[%s]", |
| 6949 Instruction(i), | 6954 deopt_instrs[i]->ToCString()); |
| 6950 FromIndex(i), | |
| 6951 i); | |
| 6952 } | 6955 } |
| 6953 return buffer; | 6956 return buffer; |
| 6954 } | 6957 } |
| 6955 | 6958 |
| 6956 | 6959 |
| 6957 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) { | 6960 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) { |
| 6958 ASSERT(Object::deopt_info_class() != Class::null()); | 6961 ASSERT(Object::deopt_info_class() != Class::null()); |
| 6959 DeoptInfo& result = DeoptInfo::Handle(); | 6962 DeoptInfo& result = DeoptInfo::Handle(); |
| 6960 { | 6963 { |
| 6961 uword size = DeoptInfo::InstanceSize(num_commands); | 6964 uword size = DeoptInfo::InstanceSize(num_commands); |
| (...skipping 4084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11046 const char* JSRegExp::ToCString() const { | 11049 const char* JSRegExp::ToCString() const { |
| 11047 const String& str = String::Handle(pattern()); | 11050 const String& str = String::Handle(pattern()); |
| 11048 const char* format = "JSRegExp: pattern=%s flags=%s"; | 11051 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 11049 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 11052 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 11050 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 11053 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); |
| 11051 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 11054 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 11052 return chars; | 11055 return chars; |
| 11053 } | 11056 } |
| 11054 | 11057 |
| 11055 } // namespace dart | 11058 } // namespace dart |
| OLD | NEW |