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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 11443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11454 } | 11454 } |
| 11455 | 11455 |
| 11456 | 11456 |
| 11457 void LocalVarDescriptors::GetInfo(intptr_t var_index, | 11457 void LocalVarDescriptors::GetInfo(intptr_t var_index, |
| 11458 RawLocalVarDescriptors::VarInfo* info) const { | 11458 RawLocalVarDescriptors::VarInfo* info) const { |
| 11459 ASSERT(var_index < Length()); | 11459 ASSERT(var_index < Length()); |
| 11460 *info = raw()->data()[var_index]; | 11460 *info = raw()->data()[var_index]; |
| 11461 } | 11461 } |
| 11462 | 11462 |
| 11463 | 11463 |
| 11464 static const char* VarKindString(int kind) { | |
| 11465 switch (kind) { | |
| 11466 case RawLocalVarDescriptors::kStackVar: | |
| 11467 return "StackVar"; | |
| 11468 break; | |
| 11469 case RawLocalVarDescriptors::kContextVar: | |
| 11470 return "ContextVar"; | |
| 11471 break; | |
| 11472 case RawLocalVarDescriptors::kContextLevel: | |
| 11473 return "ContextLevel"; | |
| 11474 break; | |
| 11475 case RawLocalVarDescriptors::kSavedCurrentContext: | |
| 11476 return "CurrentCtx"; | |
| 11477 break; | |
| 11478 default: | |
| 11479 UNREACHABLE(); | |
| 11480 return "Unknown"; | |
| 11481 } | |
| 11482 } | |
| 11483 | |
| 11484 | |
| 11485 static int PrintVarInfo(char* buffer, int len, | 11464 static int PrintVarInfo(char* buffer, int len, |
| 11486 intptr_t i, | 11465 intptr_t i, |
| 11487 const String& var_name, | 11466 const String& var_name, |
| 11488 const RawLocalVarDescriptors::VarInfo& info) { | 11467 const RawLocalVarDescriptors::VarInfo& info) { |
| 11489 const int8_t kind = info.kind(); | 11468 const RawLocalVarDescriptors::VarInfoKind kind = info.kind(); |
| 11490 const int32_t index = info.index(); | 11469 const int32_t index = info.index(); |
| 11491 if (kind == RawLocalVarDescriptors::kContextLevel) { | 11470 if (kind == RawLocalVarDescriptors::kContextLevel) { |
| 11492 return OS::SNPrint(buffer, len, | 11471 return OS::SNPrint(buffer, len, |
| 11493 "%2" Pd " %-13s level=%-3d scope=%-3d" | 11472 "%2" Pd " %-13s level=%-3d scope=%-3d" |
| 11494 " begin=%-3d end=%d\n", | 11473 " begin=%-3d end=%d\n", |
| 11495 i, | 11474 i, |
| 11496 VarKindString(kind), | 11475 LocalVarDescriptors::KindToCString(kind), |
| 11497 index, | 11476 index, |
| 11498 info.scope_id, | 11477 info.scope_id, |
| 11499 info.begin_pos, | 11478 info.begin_pos, |
| 11500 info.end_pos); | 11479 info.end_pos); |
| 11501 } else if (kind == RawLocalVarDescriptors::kContextVar) { | 11480 } else if (kind == RawLocalVarDescriptors::kContextVar) { |
| 11502 return OS::SNPrint(buffer, len, | 11481 return OS::SNPrint(buffer, len, |
| 11503 "%2" Pd " %-13s level=%-3d index=%-3d" | 11482 "%2" Pd " %-13s level=%-3d index=%-3d" |
| 11504 " begin=%-3d end=%-3d name=%s\n", | 11483 " begin=%-3d end=%-3d name=%s\n", |
| 11505 i, | 11484 i, |
| 11506 VarKindString(kind), | 11485 LocalVarDescriptors::KindToCString(kind), |
| 11507 info.scope_id, | 11486 info.scope_id, |
| 11508 index, | 11487 index, |
| 11509 info.begin_pos, | 11488 info.begin_pos, |
| 11510 info.end_pos, | 11489 info.end_pos, |
| 11511 var_name.ToCString()); | 11490 var_name.ToCString()); |
| 11512 } else { | 11491 } else { |
| 11513 return OS::SNPrint(buffer, len, | 11492 return OS::SNPrint(buffer, len, |
| 11514 "%2" Pd " %-13s scope=%-3d index=%-3d" | 11493 "%2" Pd " %-13s scope=%-3d index=%-3d" |
| 11515 " begin=%-3d end=%-3d name=%s\n", | 11494 " begin=%-3d end=%-3d name=%s\n", |
| 11516 i, | 11495 i, |
| 11517 VarKindString(kind), | 11496 LocalVarDescriptors::KindToCString(kind), |
| 11518 info.scope_id, | 11497 info.scope_id, |
| 11519 index, | 11498 index, |
| 11520 info.begin_pos, | 11499 info.begin_pos, |
| 11521 info.end_pos, | 11500 info.end_pos, |
| 11522 var_name.ToCString()); | 11501 var_name.ToCString()); |
| 11523 } | 11502 } |
| 11524 } | 11503 } |
| 11525 | 11504 |
| 11526 | 11505 |
| 11527 const char* LocalVarDescriptors::ToCString() const { | 11506 const char* LocalVarDescriptors::ToCString() const { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11569 for (intptr_t i = 0; i < Length(); i++) { | 11548 for (intptr_t i = 0; i < Length(); i++) { |
| 11570 RawLocalVarDescriptors::VarInfo info; | 11549 RawLocalVarDescriptors::VarInfo info; |
| 11571 var_name = GetName(i); | 11550 var_name = GetName(i); |
| 11572 GetInfo(i, &info); | 11551 GetInfo(i, &info); |
| 11573 JSONObject var(&members); | 11552 JSONObject var(&members); |
| 11574 var.AddProperty("name", var_name.ToCString()); | 11553 var.AddProperty("name", var_name.ToCString()); |
| 11575 var.AddProperty("index", static_cast<intptr_t>(info.index())); | 11554 var.AddProperty("index", static_cast<intptr_t>(info.index())); |
| 11576 var.AddProperty("beginPos", static_cast<intptr_t>(info.begin_pos)); | 11555 var.AddProperty("beginPos", static_cast<intptr_t>(info.begin_pos)); |
| 11577 var.AddProperty("endPos", static_cast<intptr_t>(info.end_pos)); | 11556 var.AddProperty("endPos", static_cast<intptr_t>(info.end_pos)); |
| 11578 var.AddProperty("scopeId", static_cast<intptr_t>(info.scope_id)); | 11557 var.AddProperty("scopeId", static_cast<intptr_t>(info.scope_id)); |
| 11579 var.AddProperty("kind", KindToStr(info.kind())); | 11558 var.AddProperty("kind", KindToCString(info.kind())); |
| 11580 } | 11559 } |
| 11581 } | 11560 } |
| 11582 | 11561 |
| 11583 | 11562 |
| 11584 const char* LocalVarDescriptors::KindToStr(intptr_t kind) { | 11563 const char* LocalVarDescriptors::KindToCString( |
| 11564 RawLocalVarDescriptors::VarInfoKind kind) { | |
| 11585 switch (kind) { | 11565 switch (kind) { |
| 11586 case RawLocalVarDescriptors::kStackVar: | 11566 case RawLocalVarDescriptors::kStackVar: |
| 11587 return "StackVar"; | 11567 return "StackVar"; |
| 11588 case RawLocalVarDescriptors::kContextVar: | 11568 case RawLocalVarDescriptors::kContextVar: |
| 11589 return "ContextVar"; | 11569 return "ContextVar"; |
| 11590 case RawLocalVarDescriptors::kContextLevel: | 11570 case RawLocalVarDescriptors::kContextLevel: |
| 11591 return "ContextLevel"; | 11571 return "ContextLevel"; |
| 11592 case RawLocalVarDescriptors::kSavedCurrentContext: | 11572 case RawLocalVarDescriptors::kSavedCurrentContext: |
| 11593 return "SavedCurrentContext"; | 11573 return "CurrentCtx"; |
|
rmacnak
2015/09/28 21:49:52
A test expects this name.
| |
| 11594 default: | 11574 default: |
| 11595 UNIMPLEMENTED(); | 11575 UNIMPLEMENTED(); |
| 11596 return NULL; | 11576 return NULL; |
| 11597 } | 11577 } |
| 11598 } | 11578 } |
| 11599 | 11579 |
| 11600 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { | 11580 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { |
| 11601 ASSERT(Object::var_descriptors_class() != Class::null()); | 11581 ASSERT(Object::var_descriptors_class() != Class::null()); |
| 11602 if (num_variables < 0 || num_variables > kMaxElements) { | 11582 if (num_variables < 0 || num_variables > kMaxElements) { |
| 11603 // This should be caught before we reach here. | 11583 // This should be caught before we reach here. |
| (...skipping 9860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 21464 return tag_label.ToCString(); | 21444 return tag_label.ToCString(); |
| 21465 } | 21445 } |
| 21466 | 21446 |
| 21467 | 21447 |
| 21468 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21448 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21469 Instance::PrintJSONImpl(stream, ref); | 21449 Instance::PrintJSONImpl(stream, ref); |
| 21470 } | 21450 } |
| 21471 | 21451 |
| 21472 | 21452 |
| 21473 } // namespace dart | 21453 } // namespace dart |
| OLD | NEW |