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/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 11001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11012 deopt_ids->Add(iter.DeoptId()); | 11012 deopt_ids->Add(iter.DeoptId()); |
11013 } else { | 11013 } else { |
11014 ASSERT(!iccall_ids->Contains(iter.DeoptId())); | 11014 ASSERT(!iccall_ids->Contains(iter.DeoptId())); |
11015 iccall_ids->Add(iter.DeoptId()); | 11015 iccall_ids->Add(iter.DeoptId()); |
11016 } | 11016 } |
11017 } | 11017 } |
11018 #endif // DEBUG | 11018 #endif // DEBUG |
11019 } | 11019 } |
11020 | 11020 |
11021 | 11021 |
11022 TokenPosition CodeSourceMap::TokenPositionForPCOffset( | |
11023 uword pc_offset) const { | |
11024 Iterator iterator(*this); | |
11025 | |
11026 TokenPosition result = TokenPosition::kNoSource; | |
11027 | |
11028 while (iterator.MoveNext()) { | |
11029 if (iterator.PcOffset() > pc_offset) { | |
11030 break; | |
11031 } | |
11032 result = iterator.TokenPos(); | |
11033 } | |
11034 | |
11035 return result; | |
11036 } | |
11037 | |
11038 | |
11039 RawFunction* CodeSourceMap::FunctionForPCOffset(const Code& code, | |
11040 const Function& function, | |
11041 uword pc_offset) const { | |
11042 GrowableArray<Function*> inlined_functions; | |
11043 code.GetInlinedFunctionsAt(pc_offset, &inlined_functions); | |
11044 if (inlined_functions.length() > 0) { | |
11045 Function* inlined_function = inlined_functions[0]; | |
11046 return inlined_function->raw(); | |
11047 } else { | |
11048 return function.raw(); | |
11049 } | |
11050 } | |
11051 | |
11052 | |
11053 RawScript* CodeSourceMap::ScriptForPCOffset(const Code& code, | |
11054 const Function& function, | |
11055 uword pc_offset) const { | |
11056 const Function& func = | |
11057 Function::Handle(FunctionForPCOffset(code, function, pc_offset)); | |
11058 return func.script(); | |
11059 } | |
11060 | |
11061 | |
11062 void CodeSourceMap::Dump(const CodeSourceMap& code_source_map, | |
11063 const Code& code, | |
11064 const Function& function) { | |
11065 const String& code_name = String::Handle(code.PrettyName()); | |
11066 THR_Print("Dumping Code Source Map for %s\n", code_name.ToCString()); | |
11067 if (code_source_map.Length() == 0) { | |
11068 THR_Print("<empty>\n"); | |
11069 return; | |
11070 } | |
11071 | |
11072 const int addr_width = kBitsPerWord / 4; | |
11073 | |
11074 Iterator iterator(code_source_map); | |
11075 Function& current_function = Function::Handle(); | |
11076 Script& current_script = Script::Handle(); | |
11077 TokenPosition tp; | |
11078 while (iterator.MoveNext()) { | |
11079 const uword pc_offset = iterator.PcOffset(); | |
11080 tp = code_source_map.TokenPositionForPCOffset(pc_offset); | |
11081 current_function ^= | |
11082 code_source_map.FunctionForPCOffset(code, function, pc_offset); | |
11083 current_script ^= | |
11084 code_source_map.ScriptForPCOffset(code, function, pc_offset); | |
11085 if (current_function.IsNull() || current_script.IsNull()) { | |
11086 THR_Print("%#-*" Px "\t%s\t%s\n", addr_width, | |
11087 pc_offset, | |
rmacnak
2016/02/25 23:04:40
indent
Cutch
2016/02/26 15:59:22
Done.
| |
11088 tp.ToCString(), | |
11089 code_name.ToCString()); | |
11090 continue; | |
11091 } | |
11092 const String& uri = String::Handle(current_script.url()); | |
11093 ASSERT(!uri.IsNull()); | |
11094 THR_Print("%#-*" Px "\t%s\t%s\t%s\n", addr_width, | |
11095 pc_offset, | |
11096 tp.ToCString(), | |
11097 current_function.ToQualifiedCString(), | |
11098 uri.ToCString()); | |
11099 } | |
11100 } | |
11101 | |
11102 | |
11022 intptr_t CodeSourceMap::Length() const { | 11103 intptr_t CodeSourceMap::Length() const { |
11023 return raw_ptr()->length_; | 11104 return raw_ptr()->length_; |
11024 } | 11105 } |
11025 | 11106 |
11026 | 11107 |
11027 void CodeSourceMap::SetLength(intptr_t value) const { | 11108 void CodeSourceMap::SetLength(intptr_t value) const { |
11028 StoreNonPointer(&raw_ptr()->length_, value); | 11109 StoreNonPointer(&raw_ptr()->length_, value); |
11029 } | 11110 } |
11030 | 11111 |
11031 | 11112 |
(...skipping 10439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
21471 return UserTag::null(); | 21552 return UserTag::null(); |
21472 } | 21553 } |
21473 | 21554 |
21474 | 21555 |
21475 const char* UserTag::ToCString() const { | 21556 const char* UserTag::ToCString() const { |
21476 const String& tag_label = String::Handle(label()); | 21557 const String& tag_label = String::Handle(label()); |
21477 return tag_label.ToCString(); | 21558 return tag_label.ToCString(); |
21478 } | 21559 } |
21479 | 21560 |
21480 } // namespace dart | 21561 } // namespace dart |
OLD | NEW |