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/become.h" | 10 #include "vm/become.h" |
| (...skipping 7042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7053 RawString* Function::UserVisibleName() const { | 7053 RawString* Function::UserVisibleName() const { |
| 7054 if (FLAG_show_internal_names) { | 7054 if (FLAG_show_internal_names) { |
| 7055 return name(); | 7055 return name(); |
| 7056 } | 7056 } |
| 7057 return String::ScrubName(String::Handle(name())); | 7057 return String::ScrubName(String::Handle(name())); |
| 7058 } | 7058 } |
| 7059 | 7059 |
| 7060 | 7060 |
| 7061 RawString* Function::QualifiedName(NameVisibility name_visibility) const { | 7061 RawString* Function::QualifiedName(NameVisibility name_visibility) const { |
| 7062 ASSERT(name_visibility != kInternalName); // We never request it. | 7062 ASSERT(name_visibility != kInternalName); // We never request it. |
| 7063 // If |this| is the generated asynchronous body closure, use the | |
| 7064 // name of the parent function. | |
| 7065 Function& fun = Function::Handle(raw()); | |
| 7066 if (fun.IsClosureFunction()) { | |
| 7067 // Sniff the parent function. | |
| 7068 fun = fun.parent_function(); | |
| 7069 ASSERT(!fun.IsNull()); | |
| 7070 if (!fun.IsAsyncGenerator() && !fun.IsAsyncFunction()) { | |
|
rmacnak
2017/02/10 21:27:14
Do this for a sync generator as well?
Cutch
2017/02/11 00:02:39
Done.
| |
| 7071 // Parent function is not the generator of an asynchronous body closure, | |
| 7072 // start at |this|. | |
| 7073 fun = raw(); | |
| 7074 } | |
| 7075 } | |
| 7063 // A function's scrubbed name and its user visible name are identical. | 7076 // A function's scrubbed name and its user visible name are identical. |
| 7064 String& result = String::Handle(UserVisibleName()); | 7077 String& result = String::Handle(fun.UserVisibleName()); |
| 7065 if (IsClosureFunction()) { | 7078 if (IsClosureFunction()) { |
| 7066 Function& fun = Function::Handle(raw()); | |
| 7067 while (fun.IsLocalFunction() && !fun.IsImplicitClosureFunction()) { | 7079 while (fun.IsLocalFunction() && !fun.IsImplicitClosureFunction()) { |
| 7068 fun = fun.parent_function(); | 7080 fun = fun.parent_function(); |
| 7069 result = String::Concat(Symbols::Dot(), result, Heap::kOld); | 7081 result = String::Concat(Symbols::Dot(), result, Heap::kOld); |
| 7070 result = String::Concat(String::Handle(fun.UserVisibleName()), result, | 7082 result = String::Concat(String::Handle(fun.UserVisibleName()), result, |
| 7071 Heap::kOld); | 7083 Heap::kOld); |
| 7072 } | 7084 } |
| 7073 } | 7085 } |
| 7074 const Class& cls = Class::Handle(Owner()); | 7086 const Class& cls = Class::Handle(Owner()); |
| 7075 if (!cls.IsTopLevel()) { | 7087 if (!cls.IsTopLevel()) { |
| 7076 result = String::Concat(Symbols::Dot(), result, Heap::kOld); | 7088 result = String::Concat(Symbols::Dot(), result, Heap::kOld); |
| (...skipping 15334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 22411 if ((i < (stack_trace.Length() - 1)) && | 22423 if ((i < (stack_trace.Length() - 1)) && |
| 22412 (stack_trace.CodeAtFrame(i + 1) != Code::null())) { | 22424 (stack_trace.CodeAtFrame(i + 1) != Code::null())) { |
| 22413 buffer.AddString("...\n...\n"); | 22425 buffer.AddString("...\n...\n"); |
| 22414 ASSERT(stack_trace.PcOffsetAtFrame(i) != Smi::null()); | 22426 ASSERT(stack_trace.PcOffsetAtFrame(i) != Smi::null()); |
| 22415 // To account for gap frames. | 22427 // To account for gap frames. |
| 22416 (*frame_index) += Smi::Value(stack_trace.PcOffsetAtFrame(i)); | 22428 (*frame_index) += Smi::Value(stack_trace.PcOffsetAtFrame(i)); |
| 22417 } | 22429 } |
| 22418 } else if (code.raw() == | 22430 } else if (code.raw() == |
| 22419 StubCode::AsynchronousGapMarker_entry()->code()) { | 22431 StubCode::AsynchronousGapMarker_entry()->code()) { |
| 22420 buffer.AddString("<asynchronous suspension>\n"); | 22432 buffer.AddString("<asynchronous suspension>\n"); |
| 22433 // The frame immediately after the asynchronous gap marker is the | |
| 22434 // identical to the frame above the marker. Skip the frame to enhance | |
| 22435 // the readability of the trace. | |
| 22436 i++; | |
| 22421 } else { | 22437 } else { |
| 22422 ASSERT(code.IsFunctionCode()); | 22438 ASSERT(code.IsFunctionCode()); |
| 22423 intptr_t pc_offset = Smi::Value(stack_trace.PcOffsetAtFrame(i)); | 22439 intptr_t pc_offset = Smi::Value(stack_trace.PcOffsetAtFrame(i)); |
| 22424 if (code.is_optimized() && stack_trace.expand_inlined() && | 22440 if (code.is_optimized() && stack_trace.expand_inlined() && |
| 22425 !FLAG_precompiled_runtime) { | 22441 !FLAG_precompiled_runtime) { |
| 22426 code.GetInlinedFunctionsAtReturnAddress(pc_offset, &inlined_functions, | 22442 code.GetInlinedFunctionsAtReturnAddress(pc_offset, &inlined_functions, |
| 22427 &inlined_token_positions); | 22443 &inlined_token_positions); |
| 22428 ASSERT(inlined_functions.length() >= 1); | 22444 ASSERT(inlined_functions.length() >= 1); |
| 22429 for (intptr_t j = inlined_functions.length() - 1; j >= 0; j--) { | 22445 for (intptr_t j = inlined_functions.length() - 1; j >= 0; j--) { |
| 22430 if (inlined_functions[j]->is_visible() || | 22446 if (inlined_functions[j]->is_visible() || |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 22768 return UserTag::null(); | 22784 return UserTag::null(); |
| 22769 } | 22785 } |
| 22770 | 22786 |
| 22771 | 22787 |
| 22772 const char* UserTag::ToCString() const { | 22788 const char* UserTag::ToCString() const { |
| 22773 const String& tag_label = String::Handle(label()); | 22789 const String& tag_label = String::Handle(label()); |
| 22774 return tag_label.ToCString(); | 22790 return tag_label.ToCString(); |
| 22775 } | 22791 } |
| 22776 | 22792 |
| 22777 } // namespace dart | 22793 } // namespace dart |
| OLD | NEW |