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

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
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_tokens, 20000,
48 "Huge method cutoff in tokens: Disables optimizations for huge methods.");
49 DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000,
50 "Huge method cutoff in unoptimized code size (in bytes).");
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_type);
62 DECLARE_FLAG(bool, error_on_bad_override);
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);
siva 2013/09/04 22:25:21 Are these flags now in alphabetical order?
srdjan 2013/09/05 18:14:09 Yes, split into DEFINEs and DECLAREs
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 14414 matching lines...) Expand 10 before | Expand all | Expand 10 after
14490 } 14491 }
14491 14492
14492 14493
14493 intptr_t Stacktrace::Length() const { 14494 intptr_t Stacktrace::Length() const {
14494 const Array& code_array = Array::Handle(raw_ptr()->code_array_); 14495 const Array& code_array = Array::Handle(raw_ptr()->code_array_);
14495 return code_array.Length(); 14496 return code_array.Length();
14496 } 14497 }
14497 14498
14498 14499
14499 RawFunction* Stacktrace::FunctionAtFrame(intptr_t frame_index) const { 14500 RawFunction* Stacktrace::FunctionAtFrame(intptr_t frame_index) const {
14500 const Array& function_array = Array::Handle(raw_ptr()->function_array_); 14501 const Code& code = Code::Handle(CodeAtFrame(frame_index));
14501 return reinterpret_cast<RawFunction*>(function_array.At(frame_index)); 14502 return code.IsNull() ? Function::null() : code.function();
14502 }
14503
14504
14505 void Stacktrace::SetFunctionAtFrame(intptr_t frame_index,
14506 const Function& func) const {
14507 const Array& function_array = Array::Handle(raw_ptr()->function_array_);
14508 function_array.SetAt(frame_index, func);
14509 } 14503 }
14510 14504
14511 14505
14512 RawCode* Stacktrace::CodeAtFrame(intptr_t frame_index) const { 14506 RawCode* Stacktrace::CodeAtFrame(intptr_t frame_index) const {
14513 const Array& code_array = Array::Handle(raw_ptr()->code_array_); 14507 const Array& code_array = Array::Handle(raw_ptr()->code_array_);
14514 return reinterpret_cast<RawCode*>(code_array.At(frame_index)); 14508 return reinterpret_cast<RawCode*>(code_array.At(frame_index));
14515 } 14509 }
14516 14510
14517 14511
14518 void Stacktrace::SetCodeAtFrame(intptr_t frame_index, 14512 void Stacktrace::SetCodeAtFrame(intptr_t frame_index,
14519 const Code& code) const { 14513 const Code& code) const {
14520 const Array& code_array = Array::Handle(raw_ptr()->code_array_); 14514 const Array& code_array = Array::Handle(raw_ptr()->code_array_);
14521 code_array.SetAt(frame_index, code); 14515 code_array.SetAt(frame_index, code);
14522 } 14516 }
14523 14517
14524 14518
14525 RawSmi* Stacktrace::PcOffsetAtFrame(intptr_t frame_index) const { 14519 RawSmi* Stacktrace::PcOffsetAtFrame(intptr_t frame_index) const {
14526 const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); 14520 const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_);
14527 return reinterpret_cast<RawSmi*>(pc_offset_array.At(frame_index)); 14521 return reinterpret_cast<RawSmi*>(pc_offset_array.At(frame_index));
14528 } 14522 }
14529 14523
14530 14524
14531 void Stacktrace::SetPcOffsetAtFrame(intptr_t frame_index, 14525 void Stacktrace::SetPcOffsetAtFrame(intptr_t frame_index,
14532 const Smi& pc_offset) const { 14526 const Smi& pc_offset) const {
14533 const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); 14527 const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_);
14534 pc_offset_array.SetAt(frame_index, pc_offset); 14528 pc_offset_array.SetAt(frame_index, pc_offset);
14535 } 14529 }
14536 14530
14537 14531
14538 void Stacktrace::set_function_array(const Array& function_array) const {
14539 StorePointer(&raw_ptr()->function_array_, function_array.raw());
14540 }
14541
14542
14543 void Stacktrace::set_code_array(const Array& code_array) const { 14532 void Stacktrace::set_code_array(const Array& code_array) const {
14544 StorePointer(&raw_ptr()->code_array_, code_array.raw()); 14533 StorePointer(&raw_ptr()->code_array_, code_array.raw());
14545 } 14534 }
14546 14535
14547 14536
14548 void Stacktrace::set_pc_offset_array(const Array& pc_offset_array) const { 14537 void Stacktrace::set_pc_offset_array(const Array& pc_offset_array) const {
14549 StorePointer(&raw_ptr()->pc_offset_array_, pc_offset_array.raw()); 14538 StorePointer(&raw_ptr()->pc_offset_array_, pc_offset_array.raw());
14550 } 14539 }
14551 14540
14552 14541
14553 void Stacktrace::set_catch_func_array(const Array& function_array) const {
14554 StorePointer(&raw_ptr()->catch_func_array_, function_array.raw());
14555 }
14556
14557
14558 void Stacktrace::set_catch_code_array(const Array& code_array) const { 14542 void Stacktrace::set_catch_code_array(const Array& code_array) const {
14559 StorePointer(&raw_ptr()->catch_code_array_, code_array.raw()); 14543 StorePointer(&raw_ptr()->catch_code_array_, code_array.raw());
14560 } 14544 }
14561 14545
14562 14546
14563 void Stacktrace::set_catch_pc_offset_array(const Array& pc_offset_array) const { 14547 void Stacktrace::set_catch_pc_offset_array(const Array& pc_offset_array) const {
14564 StorePointer(&raw_ptr()->catch_pc_offset_array_, pc_offset_array.raw()); 14548 StorePointer(&raw_ptr()->catch_pc_offset_array_, pc_offset_array.raw());
14565 } 14549 }
14566 14550
14567 14551
14568 RawStacktrace* Stacktrace::New(const Array& func_array, 14552 RawStacktrace* Stacktrace::New(const Array& code_array,
14569 const Array& code_array,
14570 const Array& pc_offset_array, 14553 const Array& pc_offset_array,
14571 Heap::Space space) { 14554 Heap::Space space) {
14572 ASSERT(Isolate::Current()->object_store()->stacktrace_class() != 14555 ASSERT(Isolate::Current()->object_store()->stacktrace_class() !=
14573 Class::null()); 14556 Class::null());
14574 Stacktrace& result = Stacktrace::Handle(); 14557 Stacktrace& result = Stacktrace::Handle();
14575 { 14558 {
14576 RawObject* raw = Object::Allocate(Stacktrace::kClassId, 14559 RawObject* raw = Object::Allocate(Stacktrace::kClassId,
14577 Stacktrace::InstanceSize(), 14560 Stacktrace::InstanceSize(),
14578 space); 14561 space);
14579 NoGCScope no_gc; 14562 NoGCScope no_gc;
14580 result ^= raw; 14563 result ^= raw;
14581 } 14564 }
14582 result.set_function_array(func_array);
14583 result.set_code_array(code_array); 14565 result.set_code_array(code_array);
14584 result.set_pc_offset_array(pc_offset_array); 14566 result.set_pc_offset_array(pc_offset_array);
14585 result.SetCatchStacktrace(Object::empty_array(), 14567 result.SetCatchStacktrace(Object::empty_array(),
14586 Object::empty_array(),
14587 Object::empty_array()); 14568 Object::empty_array());
14588 return result.raw(); 14569 return result.raw();
14589 } 14570 }
14590 14571
14591 14572
14592 void Stacktrace::Append(const Array& func_list, 14573 void Stacktrace::Append(const Array& code_list,
14593 const Array& code_list,
14594 const Array& pc_offset_list) const { 14574 const Array& pc_offset_list) const {
14595 intptr_t old_length = Length(); 14575 intptr_t old_length = Length();
14596 intptr_t new_length = old_length + pc_offset_list.Length(); 14576 intptr_t new_length = old_length + pc_offset_list.Length();
14597 ASSERT(pc_offset_list.Length() == func_list.Length());
14598 ASSERT(pc_offset_list.Length() == code_list.Length()); 14577 ASSERT(pc_offset_list.Length() == code_list.Length());
14599 14578
14600 // Grow the arrays for function, code and pc_offset triplet to accommodate 14579 // Grow the arrays for function, code and pc_offset triplet to accommodate
14601 // the new stack frames. 14580 // the new stack frames.
14602 Array& function_array = Array::Handle(raw_ptr()->function_array_);
14603 Array& code_array = Array::Handle(raw_ptr()->code_array_); 14581 Array& code_array = Array::Handle(raw_ptr()->code_array_);
14604 Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); 14582 Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_);
14605 function_array = Array::Grow(function_array, new_length);
14606 code_array = Array::Grow(code_array, new_length); 14583 code_array = Array::Grow(code_array, new_length);
14607 pc_offset_array = Array::Grow(pc_offset_array, new_length); 14584 pc_offset_array = Array::Grow(pc_offset_array, new_length);
14608 set_function_array(function_array);
14609 set_code_array(code_array); 14585 set_code_array(code_array);
14610 set_pc_offset_array(pc_offset_array); 14586 set_pc_offset_array(pc_offset_array);
14611 // Now append the new function and code list to the existing arrays. 14587 // Now append the new function and code list to the existing arrays.
14612 intptr_t j = 0; 14588 intptr_t j = 0;
14613 Object& obj = Object::Handle(); 14589 Object& obj = Object::Handle();
14614 for (intptr_t i = old_length; i < new_length; i++, j++) { 14590 for (intptr_t i = old_length; i < new_length; i++, j++) {
14615 obj = func_list.At(j);
14616 function_array.SetAt(i, obj);
14617 obj = code_list.At(j); 14591 obj = code_list.At(j);
14618 code_array.SetAt(i, obj); 14592 code_array.SetAt(i, obj);
14619 obj = pc_offset_list.At(j); 14593 obj = pc_offset_list.At(j);
14620 pc_offset_array.SetAt(i, obj); 14594 pc_offset_array.SetAt(i, obj);
14621 } 14595 }
14622 } 14596 }
14623 14597
14624 14598
14625 void Stacktrace::SetCatchStacktrace(const Array& func_array, 14599 void Stacktrace::SetCatchStacktrace(const Array& code_array,
14626 const Array& code_array,
14627 const Array& pc_offset_array) const { 14600 const Array& pc_offset_array) const {
14628 StorePointer(&raw_ptr()->catch_func_array_, func_array.raw());
14629 StorePointer(&raw_ptr()->catch_code_array_, code_array.raw()); 14601 StorePointer(&raw_ptr()->catch_code_array_, code_array.raw());
14630 StorePointer(&raw_ptr()->catch_pc_offset_array_, pc_offset_array.raw()); 14602 StorePointer(&raw_ptr()->catch_pc_offset_array_, pc_offset_array.raw());
14631 } 14603 }
14632 14604
14633 14605
14634 RawString* Stacktrace::FullStacktrace() const { 14606 RawString* Stacktrace::FullStacktrace() const {
14635 const Array& func_array = Array::Handle(raw_ptr()->catch_func_array_); 14607 const Array& code_array = Array::Handle(raw_ptr()->catch_code_array_);
14636 if (!func_array.IsNull() && (func_array.Length() > 0)) { 14608 if (!code_array.IsNull() && (code_array.Length() > 0)) {
14637 const Array& code_array = Array::Handle(raw_ptr()->catch_code_array_);
14638 const Array& pc_offset_array = 14609 const Array& pc_offset_array =
14639 Array::Handle(raw_ptr()->catch_pc_offset_array_); 14610 Array::Handle(raw_ptr()->catch_pc_offset_array_);
14640 const Stacktrace& catch_trace = Stacktrace::Handle( 14611 const Stacktrace& catch_trace = Stacktrace::Handle(
14641 Stacktrace::New(func_array, code_array, pc_offset_array)); 14612 Stacktrace::New(code_array, pc_offset_array));
14642 intptr_t idx = Length(); 14613 intptr_t idx = Length();
14643 const String& trace = 14614 const String& trace =
14644 String::Handle(String::New(catch_trace.ToCStringInternal(idx))); 14615 String::Handle(String::New(catch_trace.ToCStringInternal(idx)));
14645 const String& throw_trace = 14616 const String& throw_trace =
14646 String::Handle(String::New(ToCStringInternal(0))); 14617 String::Handle(String::New(ToCStringInternal(0)));
14647 return String::Concat(throw_trace, trace); 14618 return String::Concat(throw_trace, trace);
14648 } 14619 }
14649 return String::New(ToCStringInternal(0)); 14620 return String::New(ToCStringInternal(0));
14650 } 14621 }
14651 14622
14652 14623
14653 const char* Stacktrace::ToCString() const { 14624 const char* Stacktrace::ToCString() const {
14654 const String& trace = String::Handle(FullStacktrace()); 14625 const String& trace = String::Handle(FullStacktrace());
14655 return trace.ToCString(); 14626 return trace.ToCString();
14656 } 14627 }
14657 14628
14658 14629
14659 void Stacktrace::PrintToJSONStream(JSONStream* stream, bool ref) const { 14630 void Stacktrace::PrintToJSONStream(JSONStream* stream, bool ref) const {
14660 stream->OpenObject(); 14631 stream->OpenObject();
14661 stream->CloseObject(); 14632 stream->CloseObject();
14662 } 14633 }
14663 14634
14664 14635
14636 static intptr_t PrintOneStacktrace(Isolate* isolate,
14637 GrowableArray<char*>* frame_strings,
14638 uword pc,
14639 const Function& function,
14640 const Code& code,
14641 intptr_t frame_index) {
14642 const char* kFormat = "#%-6d %s (%s:%d:%d)\n";
14643 const intptr_t token_pos = code.GetTokenIndexOfPC(pc);
14644 const Script& script = Script::Handle(isolate, function.script());
14645 const String& function_name =
14646 String::Handle(isolate, function.QualifiedUserVisibleName());
14647 const String& url = String::Handle(isolate, script.url());
14648 intptr_t line = -1;
14649 intptr_t column = -1;
14650 if (token_pos >= 0) {
14651 script.GetTokenLocation(token_pos, &line, &column);
14652 }
14653 intptr_t len = OS::SNPrint(NULL, 0, kFormat,
14654 frame_index,
14655 function_name.ToCString(),
14656 url.ToCString(),
14657 line, column);
14658 char* chars = isolate->current_zone()->Alloc<char>(len + 1);
14659 OS::SNPrint(chars, (len + 1), kFormat,
14660 frame_index,
14661 function_name.ToCString(),
14662 url.ToCString(),
14663 line, column);
14664 frame_strings->Add(chars);
14665 return len;
14666 }
14667
14668
14665 const char* Stacktrace::ToCStringInternal(intptr_t frame_index) const { 14669 const char* Stacktrace::ToCStringInternal(intptr_t frame_index) const {
14666 Isolate* isolate = Isolate::Current(); 14670 Isolate* isolate = Isolate::Current();
14667 Function& function = Function::Handle(); 14671 Function& function = Function::Handle();
14668 Code& code = Code::Handle(); 14672 Code& code = Code::Handle();
14669 Script& script = Script::Handle();
14670 String& function_name = String::Handle();
14671 String& url = String::Handle();
14672
14673 // Iterate through the stack frames and create C string description 14673 // Iterate through the stack frames and create C string description
14674 // for each frame. 14674 // for each frame.
14675 intptr_t total_len = 0; 14675 intptr_t total_len = 0;
14676 const char* kFormat = "#%-6d %s (%s:%d:%d)\n";
14677 GrowableArray<char*> frame_strings; 14676 GrowableArray<char*> frame_strings;
14678 char* chars; 14677 intptr_t current_frame_index = frame_index;
14679 for (intptr_t i = 0; i < Length(); i++) { 14678 for (intptr_t i = 0; i < Length(); i++) {
14680 function = FunctionAtFrame(i); 14679 function = FunctionAtFrame(i);
14681 if (function.IsNull()) { 14680 if (function.IsNull()) {
14682 // Check if null function object indicates a stack trace overflow. 14681 // Check if null function object indicates a stack trace overflow.
14683 if ((i < (Length() - 1)) && 14682 if ((i < (Length() - 1)) &&
14684 (FunctionAtFrame(i + 1) != Function::null())) { 14683 (FunctionAtFrame(i + 1) != Function::null())) {
14685 const char* kTruncated = "...\n...\n"; 14684 const char* kTruncated = "...\n...\n";
14686 intptr_t truncated_len = strlen(kTruncated) + 1; 14685 intptr_t truncated_len = strlen(kTruncated) + 1;
14687 chars = isolate->current_zone()->Alloc<char>(truncated_len); 14686 char* chars = isolate->current_zone()->Alloc<char>(truncated_len);
14688 OS::SNPrint(chars, truncated_len, "%s", kTruncated); 14687 OS::SNPrint(chars, truncated_len, "%s", kTruncated);
14689 frame_strings.Add(chars); 14688 frame_strings.Add(chars);
14690 } 14689 }
14691 continue; 14690 } else if (function.is_visible() || FLAG_verbose_stacktrace) {
siva 2013/09/04 22:25:21 I think we should be skipping over this inline fra
srdjan 2013/09/05 18:14:09 Done.
14691 code = CodeAtFrame(i);
14692 ASSERT(function.raw() == code.function());
14693 uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i));
14694 if (code.is_optimized()) {
14695 // Traverse inlined frames.
14696 for (InlinedFunctionsIterator it(code, pc); !it.Done(); it.Advance()) {
14697 function = it.function();
14698 code = it.code();
14699 ASSERT(function.raw() == code.function());
14700 uword pc = it.pc();
14701 ASSERT(pc != 0);
14702 ASSERT(code.EntryPoint() <= pc);
14703 ASSERT(pc < (code.EntryPoint() + code.Size()));
14704 total_len += PrintOneStacktrace(
14705 isolate, &frame_strings, pc, function, code, current_frame_index);
14706 current_frame_index++; // To account for inlined frames.
14707 }
14708 } else {
14709 total_len += PrintOneStacktrace(
14710 isolate, &frame_strings, pc, function, code, current_frame_index);
14711 current_frame_index++;
14712 }
14692 } 14713 }
14693 code = CodeAtFrame(i);
14694 uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i));
14695 intptr_t token_pos = code.GetTokenIndexOfPC(pc);
14696 script = function.script();
14697 function_name = function.QualifiedUserVisibleName();
14698 url = script.url();
14699 intptr_t line = -1;
14700 intptr_t column = -1;
14701 if (token_pos >= 0) {
14702 script.GetTokenLocation(token_pos, &line, &column);
14703 }
14704 intptr_t len = OS::SNPrint(NULL, 0, kFormat,
14705 (frame_index + i),
14706 function_name.ToCString(),
14707 url.ToCString(),
14708 line, column);
14709 total_len += len;
14710 chars = isolate->current_zone()->Alloc<char>(len + 1);
14711 OS::SNPrint(chars, (len + 1), kFormat,
14712 (frame_index + i),
14713 function_name.ToCString(),
14714 url.ToCString(),
14715 line, column);
14716 frame_strings.Add(chars);
14717 } 14714 }
14718 14715
14719 // Now concatenate the frame descriptions into a single C string. 14716 // Now concatenate the frame descriptions into a single C string.
14720 chars = isolate->current_zone()->Alloc<char>(total_len + 1); 14717 char* chars = isolate->current_zone()->Alloc<char>(total_len + 1);
14721 intptr_t index = 0; 14718 intptr_t index = 0;
14722 for (intptr_t i = 0; i < frame_strings.length(); i++) { 14719 for (intptr_t i = 0; i < frame_strings.length(); i++) {
14723 index += OS::SNPrint((chars + index), 14720 index += OS::SNPrint((chars + index),
14724 (total_len + 1 - index), 14721 (total_len + 1 - index),
14725 "%s", 14722 "%s",
14726 frame_strings[i]); 14723 frame_strings[i]);
14727 } 14724 }
14728 chars[total_len] = '\0'; 14725 chars[total_len] = '\0';
14729 return chars; 14726 return chars;
14730 } 14727 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
14912 } 14909 }
14913 14910
14914 14911
14915 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14912 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14916 stream->OpenObject(); 14913 stream->OpenObject();
14917 stream->CloseObject(); 14914 stream->CloseObject();
14918 } 14915 }
14919 14916
14920 14917
14921 } // namespace dart 14918 } // namespace dart
OLDNEW
« runtime/lib/stacktrace.cc ('K') | « 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