Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(839)

Side by Side Diff: runtime/vm/object.cc

Issue 23964003: Traverse inlined frames lazily when printing the stacktrace. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 26 matching lines...) Expand all
37 #include "vm/reusable_handles.h" 37 #include "vm/reusable_handles.h"
38 #include "vm/runtime_entry.h" 38 #include "vm/runtime_entry.h"
39 #include "vm/scopes.h" 39 #include "vm/scopes.h"
40 #include "vm/stack_frame.h" 40 #include "vm/stack_frame.h"
41 #include "vm/symbols.h" 41 #include "vm/symbols.h"
42 #include "vm/timer.h" 42 #include "vm/timer.h"
43 #include "vm/unicode.h" 43 #include "vm/unicode.h"
44 44
45 namespace dart { 45 namespace dart {
46 46
47 DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000,
48 "Huge method cutoff in unoptimized code size (in bytes).");
49 DEFINE_FLAG(int, huge_method_cutoff_in_tokens, 20000,
50 "Huge method cutoff in tokens: Disables optimizations for huge methods.");
47 DEFINE_FLAG(bool, show_internal_names, false, 51 DEFINE_FLAG(bool, show_internal_names, false,
48 "Show names of internal classes (e.g. \"OneByteString\") in error messages " 52 "Show names of internal classes (e.g. \"OneByteString\") in error messages "
49 "instead of showing the corresponding interface names (e.g. \"String\")"); 53 "instead of showing the corresponding interface names (e.g. \"String\")");
50 DEFINE_FLAG(bool, trace_disabling_optimized_code, false, 54 DEFINE_FLAG(bool, trace_disabling_optimized_code, false,
51 "Trace disabling optimized code."); 55 "Trace disabling optimized code.");
52 DEFINE_FLAG(int, huge_method_cutoff_in_tokens, 20000,
53 "Huge method cutoff in tokens: Disables optimizations for huge methods.");
54 DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000,
55 "Huge method cutoff in unoptimized code size (in bytes).");
56 DEFINE_FLAG(bool, throw_on_javascript_int_overflow, false, 56 DEFINE_FLAG(bool, throw_on_javascript_int_overflow, false,
57 "Throw an exception when the result of an integer calculation will not " 57 "Throw an exception when the result of an integer calculation will not "
58 "fit into a javascript integer."); 58 "fit into a javascript integer.");
59 DECLARE_FLAG(bool, trace_compiler);
60 DECLARE_FLAG(bool, eliminate_type_checks); 59 DECLARE_FLAG(bool, eliminate_type_checks);
61 DECLARE_FLAG(bool, enable_type_checks); 60 DECLARE_FLAG(bool, enable_type_checks);
61 DECLARE_FLAG(bool, error_on_bad_override);
62 DECLARE_FLAG(bool, error_on_bad_type);
63 DECLARE_FLAG(bool, trace_compiler);
62 DECLARE_FLAG(bool, trace_deoptimization); 64 DECLARE_FLAG(bool, trace_deoptimization);
63 DECLARE_FLAG(bool, trace_deoptimization_verbose); 65 DECLARE_FLAG(bool, trace_deoptimization_verbose);
64 DECLARE_FLAG(bool, error_on_bad_type); 66 DECLARE_FLAG(bool, verbose_stacktrace);
65 DECLARE_FLAG(bool, error_on_bad_override);
66 67
67 static const char* kGetterPrefix = "get:"; 68 static const char* kGetterPrefix = "get:";
68 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); 69 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix);
69 static const char* kSetterPrefix = "set:"; 70 static const char* kSetterPrefix = "set:";
70 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); 71 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix);
71 72
72 cpp_vtable Object::handle_vtable_ = 0; 73 cpp_vtable Object::handle_vtable_ = 0;
73 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; 74 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 };
74 cpp_vtable Smi::handle_vtable_ = 0; 75 cpp_vtable Smi::handle_vtable_ = 0;
75 76
(...skipping 14422 matching lines...) Expand 10 before | Expand all | Expand 10 after
14498 } 14499 }
14499 14500
14500 14501
14501 intptr_t Stacktrace::Length() const { 14502 intptr_t Stacktrace::Length() const {
14502 const Array& code_array = Array::Handle(raw_ptr()->code_array_); 14503 const Array& code_array = Array::Handle(raw_ptr()->code_array_);
14503 return code_array.Length(); 14504 return code_array.Length();
14504 } 14505 }
14505 14506
14506 14507
14507 RawFunction* Stacktrace::FunctionAtFrame(intptr_t frame_index) const { 14508 RawFunction* Stacktrace::FunctionAtFrame(intptr_t frame_index) const {
14508 const Array& function_array = Array::Handle(raw_ptr()->function_array_); 14509 const Code& code = Code::Handle(CodeAtFrame(frame_index));
14509 return reinterpret_cast<RawFunction*>(function_array.At(frame_index)); 14510 return code.IsNull() ? Function::null() : code.function();
14510 }
14511
14512
14513 void Stacktrace::SetFunctionAtFrame(intptr_t frame_index,
14514 const Function& func) const {
14515 const Array& function_array = Array::Handle(raw_ptr()->function_array_);
14516 function_array.SetAt(frame_index, func);
14517 } 14511 }
14518 14512
14519 14513
14520 RawCode* Stacktrace::CodeAtFrame(intptr_t frame_index) const { 14514 RawCode* Stacktrace::CodeAtFrame(intptr_t frame_index) const {
14521 const Array& code_array = Array::Handle(raw_ptr()->code_array_); 14515 const Array& code_array = Array::Handle(raw_ptr()->code_array_);
14522 return reinterpret_cast<RawCode*>(code_array.At(frame_index)); 14516 return reinterpret_cast<RawCode*>(code_array.At(frame_index));
14523 } 14517 }
14524 14518
14525 14519
14526 void Stacktrace::SetCodeAtFrame(intptr_t frame_index, 14520 void Stacktrace::SetCodeAtFrame(intptr_t frame_index,
14527 const Code& code) const { 14521 const Code& code) const {
14528 const Array& code_array = Array::Handle(raw_ptr()->code_array_); 14522 const Array& code_array = Array::Handle(raw_ptr()->code_array_);
14529 code_array.SetAt(frame_index, code); 14523 code_array.SetAt(frame_index, code);
14530 } 14524 }
14531 14525
14532 14526
14533 RawSmi* Stacktrace::PcOffsetAtFrame(intptr_t frame_index) const { 14527 RawSmi* Stacktrace::PcOffsetAtFrame(intptr_t frame_index) const {
14534 const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); 14528 const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_);
14535 return reinterpret_cast<RawSmi*>(pc_offset_array.At(frame_index)); 14529 return reinterpret_cast<RawSmi*>(pc_offset_array.At(frame_index));
14536 } 14530 }
14537 14531
14538 14532
14539 void Stacktrace::SetPcOffsetAtFrame(intptr_t frame_index, 14533 void Stacktrace::SetPcOffsetAtFrame(intptr_t frame_index,
14540 const Smi& pc_offset) const { 14534 const Smi& pc_offset) const {
14541 const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); 14535 const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_);
14542 pc_offset_array.SetAt(frame_index, pc_offset); 14536 pc_offset_array.SetAt(frame_index, pc_offset);
14543 } 14537 }
14544 14538
14545 14539
14546 void Stacktrace::set_function_array(const Array& function_array) const {
14547 StorePointer(&raw_ptr()->function_array_, function_array.raw());
14548 }
14549
14550
14551 void Stacktrace::set_code_array(const Array& code_array) const { 14540 void Stacktrace::set_code_array(const Array& code_array) const {
14552 StorePointer(&raw_ptr()->code_array_, code_array.raw()); 14541 StorePointer(&raw_ptr()->code_array_, code_array.raw());
14553 } 14542 }
14554 14543
14555 14544
14556 void Stacktrace::set_pc_offset_array(const Array& pc_offset_array) const { 14545 void Stacktrace::set_pc_offset_array(const Array& pc_offset_array) const {
14557 StorePointer(&raw_ptr()->pc_offset_array_, pc_offset_array.raw()); 14546 StorePointer(&raw_ptr()->pc_offset_array_, pc_offset_array.raw());
14558 } 14547 }
14559 14548
14560 14549
14561 void Stacktrace::set_catch_func_array(const Array& function_array) const {
14562 StorePointer(&raw_ptr()->catch_func_array_, function_array.raw());
14563 }
14564
14565
14566 void Stacktrace::set_catch_code_array(const Array& code_array) const { 14550 void Stacktrace::set_catch_code_array(const Array& code_array) const {
14567 StorePointer(&raw_ptr()->catch_code_array_, code_array.raw()); 14551 StorePointer(&raw_ptr()->catch_code_array_, code_array.raw());
14568 } 14552 }
14569 14553
14570 14554
14571 void Stacktrace::set_catch_pc_offset_array(const Array& pc_offset_array) const { 14555 void Stacktrace::set_catch_pc_offset_array(const Array& pc_offset_array) const {
14572 StorePointer(&raw_ptr()->catch_pc_offset_array_, pc_offset_array.raw()); 14556 StorePointer(&raw_ptr()->catch_pc_offset_array_, pc_offset_array.raw());
14573 } 14557 }
14574 14558
14575 14559
14576 RawStacktrace* Stacktrace::New(const Array& func_array, 14560 void Stacktrace::set_expand_inlined(bool value) const {
14577 const Array& code_array, 14561 raw_ptr()->expand_inlined_ = value;
14562 }
14563
14564
14565 bool Stacktrace::expand_inlined() const {
14566 return raw_ptr()->expand_inlined_;
14567 }
14568
14569
14570 RawStacktrace* Stacktrace::New(const Array& code_array,
14578 const Array& pc_offset_array, 14571 const Array& pc_offset_array,
14579 Heap::Space space) { 14572 Heap::Space space) {
14580 ASSERT(Isolate::Current()->object_store()->stacktrace_class() != 14573 ASSERT(Isolate::Current()->object_store()->stacktrace_class() !=
14581 Class::null()); 14574 Class::null());
14582 Stacktrace& result = Stacktrace::Handle(); 14575 Stacktrace& result = Stacktrace::Handle();
14583 { 14576 {
14584 RawObject* raw = Object::Allocate(Stacktrace::kClassId, 14577 RawObject* raw = Object::Allocate(Stacktrace::kClassId,
14585 Stacktrace::InstanceSize(), 14578 Stacktrace::InstanceSize(),
14586 space); 14579 space);
14587 NoGCScope no_gc; 14580 NoGCScope no_gc;
14588 result ^= raw; 14581 result ^= raw;
14589 } 14582 }
14590 result.set_function_array(func_array);
14591 result.set_code_array(code_array); 14583 result.set_code_array(code_array);
14592 result.set_pc_offset_array(pc_offset_array); 14584 result.set_pc_offset_array(pc_offset_array);
14593 result.SetCatchStacktrace(Object::empty_array(), 14585 result.SetCatchStacktrace(Object::empty_array(),
14594 Object::empty_array(),
14595 Object::empty_array()); 14586 Object::empty_array());
14587 result.set_expand_inlined(true); // default.
14596 return result.raw(); 14588 return result.raw();
14597 } 14589 }
14598 14590
14599 14591
14600 void Stacktrace::Append(const Array& func_list, 14592 void Stacktrace::Append(const Array& code_list,
14601 const Array& code_list,
14602 const Array& pc_offset_list) const { 14593 const Array& pc_offset_list) const {
14603 intptr_t old_length = Length(); 14594 intptr_t old_length = Length();
14604 intptr_t new_length = old_length + pc_offset_list.Length(); 14595 intptr_t new_length = old_length + pc_offset_list.Length();
14605 ASSERT(pc_offset_list.Length() == func_list.Length());
14606 ASSERT(pc_offset_list.Length() == code_list.Length()); 14596 ASSERT(pc_offset_list.Length() == code_list.Length());
14607 14597
14608 // Grow the arrays for function, code and pc_offset triplet to accommodate 14598 // Grow the arrays for function, code and pc_offset triplet to accommodate
14609 // the new stack frames. 14599 // the new stack frames.
14610 Array& function_array = Array::Handle(raw_ptr()->function_array_);
14611 Array& code_array = Array::Handle(raw_ptr()->code_array_); 14600 Array& code_array = Array::Handle(raw_ptr()->code_array_);
14612 Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); 14601 Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_);
14613 function_array = Array::Grow(function_array, new_length);
14614 code_array = Array::Grow(code_array, new_length); 14602 code_array = Array::Grow(code_array, new_length);
14615 pc_offset_array = Array::Grow(pc_offset_array, new_length); 14603 pc_offset_array = Array::Grow(pc_offset_array, new_length);
14616 set_function_array(function_array);
14617 set_code_array(code_array); 14604 set_code_array(code_array);
14618 set_pc_offset_array(pc_offset_array); 14605 set_pc_offset_array(pc_offset_array);
14619 // Now append the new function and code list to the existing arrays. 14606 // Now append the new function and code list to the existing arrays.
14620 intptr_t j = 0; 14607 intptr_t j = 0;
14621 Object& obj = Object::Handle(); 14608 Object& obj = Object::Handle();
14622 for (intptr_t i = old_length; i < new_length; i++, j++) { 14609 for (intptr_t i = old_length; i < new_length; i++, j++) {
14623 obj = func_list.At(j);
14624 function_array.SetAt(i, obj);
14625 obj = code_list.At(j); 14610 obj = code_list.At(j);
14626 code_array.SetAt(i, obj); 14611 code_array.SetAt(i, obj);
14627 obj = pc_offset_list.At(j); 14612 obj = pc_offset_list.At(j);
14628 pc_offset_array.SetAt(i, obj); 14613 pc_offset_array.SetAt(i, obj);
14629 } 14614 }
14630 } 14615 }
14631 14616
14632 14617
14633 void Stacktrace::SetCatchStacktrace(const Array& func_array, 14618 void Stacktrace::SetCatchStacktrace(const Array& code_array,
14634 const Array& code_array,
14635 const Array& pc_offset_array) const { 14619 const Array& pc_offset_array) const {
14636 StorePointer(&raw_ptr()->catch_func_array_, func_array.raw());
14637 StorePointer(&raw_ptr()->catch_code_array_, code_array.raw()); 14620 StorePointer(&raw_ptr()->catch_code_array_, code_array.raw());
14638 StorePointer(&raw_ptr()->catch_pc_offset_array_, pc_offset_array.raw()); 14621 StorePointer(&raw_ptr()->catch_pc_offset_array_, pc_offset_array.raw());
14639 } 14622 }
14640 14623
14641 14624
14642 RawString* Stacktrace::FullStacktrace() const { 14625 RawString* Stacktrace::FullStacktrace() const {
14643 const Array& func_array = Array::Handle(raw_ptr()->catch_func_array_); 14626 const Array& code_array = Array::Handle(raw_ptr()->catch_code_array_);
14644 if (!func_array.IsNull() && (func_array.Length() > 0)) { 14627 if (!code_array.IsNull() && (code_array.Length() > 0)) {
14645 const Array& code_array = Array::Handle(raw_ptr()->catch_code_array_);
14646 const Array& pc_offset_array = 14628 const Array& pc_offset_array =
14647 Array::Handle(raw_ptr()->catch_pc_offset_array_); 14629 Array::Handle(raw_ptr()->catch_pc_offset_array_);
14648 const Stacktrace& catch_trace = Stacktrace::Handle( 14630 const Stacktrace& catch_trace = Stacktrace::Handle(
14649 Stacktrace::New(func_array, code_array, pc_offset_array)); 14631 Stacktrace::New(code_array, pc_offset_array));
14650 intptr_t idx = Length(); 14632 intptr_t idx = Length();
14651 const String& trace = 14633 const String& trace =
14652 String::Handle(String::New(catch_trace.ToCStringInternal(idx))); 14634 String::Handle(String::New(catch_trace.ToCStringInternal(idx)));
14653 const String& throw_trace = 14635 const String& throw_trace =
14654 String::Handle(String::New(ToCStringInternal(0))); 14636 String::Handle(String::New(ToCStringInternal(0)));
14655 return String::Concat(throw_trace, trace); 14637 return String::Concat(throw_trace, trace);
14656 } 14638 }
14657 return String::New(ToCStringInternal(0)); 14639 return String::New(ToCStringInternal(0));
14658 } 14640 }
14659 14641
14660 14642
14661 const char* Stacktrace::ToCString() const { 14643 const char* Stacktrace::ToCString() const {
14662 const String& trace = String::Handle(FullStacktrace()); 14644 const String& trace = String::Handle(FullStacktrace());
14663 return trace.ToCString(); 14645 return trace.ToCString();
14664 } 14646 }
14665 14647
14666 14648
14667 void Stacktrace::PrintToJSONStream(JSONStream* stream, bool ref) const { 14649 void Stacktrace::PrintToJSONStream(JSONStream* stream, bool ref) const {
14668 stream->OpenObject(); 14650 stream->OpenObject();
14669 stream->CloseObject(); 14651 stream->CloseObject();
14670 } 14652 }
14671 14653
14672 14654
14655 static intptr_t PrintOneStacktrace(Isolate* isolate,
14656 GrowableArray<char*>* frame_strings,
14657 uword pc,
14658 const Function& function,
14659 const Code& code,
14660 intptr_t frame_index) {
14661 const char* kFormat = "#%-6d %s (%s:%d:%d)\n";
14662 const intptr_t token_pos = code.GetTokenIndexOfPC(pc);
14663 const Script& script = Script::Handle(isolate, function.script());
14664 const String& function_name =
14665 String::Handle(isolate, function.QualifiedUserVisibleName());
14666 const String& url = String::Handle(isolate, script.url());
14667 intptr_t line = -1;
14668 intptr_t column = -1;
14669 if (token_pos >= 0) {
14670 script.GetTokenLocation(token_pos, &line, &column);
14671 }
14672 intptr_t len = OS::SNPrint(NULL, 0, kFormat,
14673 frame_index,
14674 function_name.ToCString(),
14675 url.ToCString(),
14676 line, column);
14677 char* chars = isolate->current_zone()->Alloc<char>(len + 1);
14678 OS::SNPrint(chars, (len + 1), kFormat,
14679 frame_index,
14680 function_name.ToCString(),
14681 url.ToCString(),
14682 line, column);
14683 frame_strings->Add(chars);
14684 return len;
14685 }
14686
14687
14673 const char* Stacktrace::ToCStringInternal(intptr_t frame_index) const { 14688 const char* Stacktrace::ToCStringInternal(intptr_t frame_index) const {
14674 Isolate* isolate = Isolate::Current(); 14689 Isolate* isolate = Isolate::Current();
14675 Function& function = Function::Handle(); 14690 Function& function = Function::Handle();
14676 Code& code = Code::Handle(); 14691 Code& code = Code::Handle();
14677 Script& script = Script::Handle();
14678 String& function_name = String::Handle();
14679 String& url = String::Handle();
14680
14681 // Iterate through the stack frames and create C string description 14692 // Iterate through the stack frames and create C string description
14682 // for each frame. 14693 // for each frame.
14683 intptr_t total_len = 0; 14694 intptr_t total_len = 0;
14684 const char* kFormat = "#%-6d %s (%s:%d:%d)\n";
14685 GrowableArray<char*> frame_strings; 14695 GrowableArray<char*> frame_strings;
14686 char* chars; 14696 intptr_t current_frame_index = frame_index;
14687 for (intptr_t i = 0; i < Length(); i++) { 14697 for (intptr_t i = 0; i < Length(); i++) {
14688 function = FunctionAtFrame(i); 14698 function = FunctionAtFrame(i);
14689 if (function.IsNull()) { 14699 if (function.IsNull()) {
14690 // Check if null function object indicates a stack trace overflow. 14700 // Check if null function object indicates a stack trace overflow.
14691 if ((i < (Length() - 1)) && 14701 if ((i < (Length() - 1)) &&
14692 (FunctionAtFrame(i + 1) != Function::null())) { 14702 (FunctionAtFrame(i + 1) != Function::null())) {
14693 const char* kTruncated = "...\n...\n"; 14703 const char* kTruncated = "...\n...\n";
14694 intptr_t truncated_len = strlen(kTruncated) + 1; 14704 intptr_t truncated_len = strlen(kTruncated) + 1;
14695 chars = isolate->current_zone()->Alloc<char>(truncated_len); 14705 char* chars = isolate->current_zone()->Alloc<char>(truncated_len);
14696 OS::SNPrint(chars, truncated_len, "%s", kTruncated); 14706 OS::SNPrint(chars, truncated_len, "%s", kTruncated);
14697 frame_strings.Add(chars); 14707 frame_strings.Add(chars);
14698 } 14708 }
14699 continue; 14709 } else if (function.is_visible() || FLAG_verbose_stacktrace) {
14710 code = CodeAtFrame(i);
14711 ASSERT(function.raw() == code.function());
14712 uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i));
14713 if (code.is_optimized() && expand_inlined()) {
14714 // Traverse inlined frames.
14715 for (InlinedFunctionsIterator it(code, pc); !it.Done(); it.Advance()) {
14716 function = it.function();
14717 code = it.code();
14718 ASSERT(function.raw() == code.function());
14719 uword pc = it.pc();
14720 ASSERT(pc != 0);
14721 ASSERT(code.EntryPoint() <= pc);
14722 ASSERT(pc < (code.EntryPoint() + code.Size()));
14723 total_len += PrintOneStacktrace(
14724 isolate, &frame_strings, pc, function, code, current_frame_index);
14725 current_frame_index++; // To account for inlined frames.
14726 }
14727 } else {
14728 total_len += PrintOneStacktrace(
14729 isolate, &frame_strings, pc, function, code, current_frame_index);
14730 current_frame_index++;
14731 }
14700 } 14732 }
14701 code = CodeAtFrame(i);
14702 uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i));
14703 intptr_t token_pos = code.GetTokenIndexOfPC(pc);
14704 script = function.script();
14705 function_name = function.QualifiedUserVisibleName();
14706 url = script.url();
14707 intptr_t line = -1;
14708 intptr_t column = -1;
14709 if (token_pos >= 0) {
14710 script.GetTokenLocation(token_pos, &line, &column);
14711 }
14712 intptr_t len = OS::SNPrint(NULL, 0, kFormat,
14713 (frame_index + i),
14714 function_name.ToCString(),
14715 url.ToCString(),
14716 line, column);
14717 total_len += len;
14718 chars = isolate->current_zone()->Alloc<char>(len + 1);
14719 OS::SNPrint(chars, (len + 1), kFormat,
14720 (frame_index + i),
14721 function_name.ToCString(),
14722 url.ToCString(),
14723 line, column);
14724 frame_strings.Add(chars);
14725 } 14733 }
14726 14734
14727 // Now concatenate the frame descriptions into a single C string. 14735 // Now concatenate the frame descriptions into a single C string.
14728 chars = isolate->current_zone()->Alloc<char>(total_len + 1); 14736 char* chars = isolate->current_zone()->Alloc<char>(total_len + 1);
14729 intptr_t index = 0; 14737 intptr_t index = 0;
14730 for (intptr_t i = 0; i < frame_strings.length(); i++) { 14738 for (intptr_t i = 0; i < frame_strings.length(); i++) {
14731 index += OS::SNPrint((chars + index), 14739 index += OS::SNPrint((chars + index),
14732 (total_len + 1 - index), 14740 (total_len + 1 - index),
14733 "%s", 14741 "%s",
14734 frame_strings[i]); 14742 frame_strings[i]);
14735 } 14743 }
14736 chars[total_len] = '\0'; 14744 chars[total_len] = '\0';
14737 return chars; 14745 return chars;
14738 } 14746 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
14920 } 14928 }
14921 14929
14922 14930
14923 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14931 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14924 stream->OpenObject(); 14932 stream->OpenObject();
14925 stream->CloseObject(); 14933 stream->CloseObject();
14926 } 14934 }
14927 14935
14928 14936
14929 } // namespace dart 14937 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698