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

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

Issue 1739963002: Remember token position where a function was inlined (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/precompiler.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 12722 matching lines...) Expand 10 before | Expand all | Expand 10 after
12733 Array::New(RawCode::kInlinedMetadataSize, Heap::kOld)); 12733 Array::New(RawCode::kInlinedMetadataSize, Heap::kOld));
12734 } 12734 }
12735 const Array& metadata = Array::Handle(raw_ptr()->inlined_metadata_); 12735 const Array& metadata = Array::Handle(raw_ptr()->inlined_metadata_);
12736 ASSERT(!metadata.IsNull()); 12736 ASSERT(!metadata.IsNull());
12737 ASSERT(metadata.IsOld()); 12737 ASSERT(metadata.IsOld());
12738 ASSERT(value.IsOld()); 12738 ASSERT(value.IsOld());
12739 metadata.SetAt(RawCode::kInlinedIdToFunctionIndex, value); 12739 metadata.SetAt(RawCode::kInlinedIdToFunctionIndex, value);
12740 } 12740 }
12741 12741
12742 12742
12743 RawArray* Code::GetInlinedIdToTokenPos() const {
12744 const Array& metadata = Array::Handle(raw_ptr()->inlined_metadata_);
12745 if (metadata.IsNull()) {
12746 return metadata.raw();
12747 }
12748 return reinterpret_cast<RawArray*>(
12749 metadata.At(RawCode::kInlinedIdToTokenPosIndex));
12750 }
12751
12752
12753 void Code::SetInlinedIdToTokenPos(const Array& value) const {
12754 if (raw_ptr()->inlined_metadata_ == Array::null()) {
12755 StorePointer(&raw_ptr()->inlined_metadata_,
12756 Array::New(RawCode::kInlinedMetadataSize, Heap::kOld));
12757 }
12758 const Array& metadata = Array::Handle(raw_ptr()->inlined_metadata_);
12759 ASSERT(!metadata.IsNull());
12760 ASSERT(metadata.IsOld());
12761 ASSERT(value.IsOld());
12762 metadata.SetAt(RawCode::kInlinedIdToTokenPosIndex, value);
12763 }
12764
12765
12743 RawArray* Code::GetInlinedCallerIdMap() const { 12766 RawArray* Code::GetInlinedCallerIdMap() const {
12744 const Array& metadata = Array::Handle(raw_ptr()->inlined_metadata_); 12767 const Array& metadata = Array::Handle(raw_ptr()->inlined_metadata_);
12745 if (metadata.IsNull()) { 12768 if (metadata.IsNull()) {
12746 return metadata.raw(); 12769 return metadata.raw();
12747 } 12770 }
12748 return reinterpret_cast<RawArray*>( 12771 return reinterpret_cast<RawArray*>(
12749 metadata.At(RawCode::kInlinedCallerIdMapIndex)); 12772 metadata.At(RawCode::kInlinedCallerIdMapIndex));
12750 } 12773 }
12751 12774
12752 12775
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
13198 } 13221 }
13199 THR_Print("Inlined ids:\n"); 13222 THR_Print("Inlined ids:\n");
13200 const Array& id_map = Array::Handle(GetInlinedIdToFunction()); 13223 const Array& id_map = Array::Handle(GetInlinedIdToFunction());
13201 Function& function = Function::Handle(); 13224 Function& function = Function::Handle();
13202 for (intptr_t i = 0; i < id_map.Length(); i++) { 13225 for (intptr_t i = 0; i < id_map.Length(); i++) {
13203 function ^= id_map.At(i); 13226 function ^= id_map.At(i);
13204 if (!function.IsNull()) { 13227 if (!function.IsNull()) {
13205 THR_Print(" %" Pd ": %s\n", i, function.ToQualifiedCString()); 13228 THR_Print(" %" Pd ": %s\n", i, function.ToQualifiedCString());
13206 } 13229 }
13207 } 13230 }
13231 THR_Print("Inlined token pos:\n");
13232 const Array& token_pos_map = Array::Handle(GetInlinedIdToTokenPos());
13233 Smi& smi = Smi::Handle();
13234 for (intptr_t i = 0; i < token_pos_map.Length(); i++) {
13235 smi ^= token_pos_map.At(i);
13236 TokenPosition tp = TokenPosition(smi.Value());
13237 THR_Print(" %" Pd ": %s\n", i, tp.ToCString());
13238 }
13208 THR_Print("Caller Inlining Ids:\n"); 13239 THR_Print("Caller Inlining Ids:\n");
13209 const Array& caller_map = Array::Handle(GetInlinedCallerIdMap()); 13240 const Array& caller_map = Array::Handle(GetInlinedCallerIdMap());
13210 Smi& smi = Smi::Handle();
13211 for (intptr_t i = 0; i < caller_map.Length(); i++) { 13241 for (intptr_t i = 0; i < caller_map.Length(); i++) {
13212 smi ^= caller_map.At(i); 13242 smi ^= caller_map.At(i);
13213 THR_Print(" iid: %" Pd " caller iid: %" Pd "\n", i, smi.Value()); 13243 THR_Print(" iid: %" Pd " caller iid: %" Pd "\n", i, smi.Value());
13214 } 13244 }
13215 } 13245 }
13216 13246
13217 13247
13218 RawContext* Context::New(intptr_t num_variables, Heap::Space space) { 13248 RawContext* Context::New(intptr_t num_variables, Heap::Space space) {
13219 ASSERT(num_variables >= 0); 13249 ASSERT(num_variables >= 0);
13220 ASSERT(Object::context_class() != Class::null()); 13250 ASSERT(Object::context_class() != Class::null());
(...skipping 8201 matching lines...) Expand 10 before | Expand all | Expand 10 after
21422 return UserTag::null(); 21452 return UserTag::null();
21423 } 21453 }
21424 21454
21425 21455
21426 const char* UserTag::ToCString() const { 21456 const char* UserTag::ToCString() const {
21427 const String& tag_label = String::Handle(label()); 21457 const String& tag_label = String::Handle(label());
21428 return tag_label.ToCString(); 21458 return tag_label.ToCString();
21429 } 21459 }
21430 21460
21431 } // namespace dart 21461 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698