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 10453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10464 UNREACHABLE(); | 10464 UNREACHABLE(); |
10465 return "Unknown"; | 10465 return "Unknown"; |
10466 } | 10466 } |
10467 } | 10467 } |
10468 | 10468 |
10469 | 10469 |
10470 static int PrintVarInfo(char* buffer, int len, | 10470 static int PrintVarInfo(char* buffer, int len, |
10471 intptr_t i, | 10471 intptr_t i, |
10472 const String& var_name, | 10472 const String& var_name, |
10473 const RawLocalVarDescriptors::VarInfo& info) { | 10473 const RawLocalVarDescriptors::VarInfo& info) { |
10474 if (info.kind == RawLocalVarDescriptors::kContextLevel) { | 10474 const int8_t kind = |
| 10475 RawLocalVarDescriptors::KindBits::decode(info.index_kind); |
| 10476 const int32_t index = |
| 10477 RawLocalVarDescriptors::IndexBits::decode(info.index_kind); |
| 10478 if (kind == RawLocalVarDescriptors::kContextLevel) { |
10475 return OS::SNPrint(buffer, len, | 10479 return OS::SNPrint(buffer, len, |
10476 "%2" Pd " %-13s level=%-3" Pd " scope=%-3d" | 10480 "%2" Pd " %-13s level=%-3d scope=%-3d" |
10477 " begin=%-3" Pd " end=%" Pd "\n", | 10481 " begin=%-3d end=%d\n", |
10478 i, | 10482 i, |
10479 VarKindString(info.kind), | 10483 VarKindString(kind), |
10480 info.index, | 10484 index, |
10481 info.scope_id, | 10485 info.scope_id, |
10482 info.begin_pos, | 10486 info.begin_pos, |
10483 info.end_pos); | 10487 info.end_pos); |
10484 } else if (info.kind == RawLocalVarDescriptors::kContextVar) { | 10488 } else if (kind == RawLocalVarDescriptors::kContextVar) { |
10485 return OS::SNPrint(buffer, len, | 10489 return OS::SNPrint(buffer, len, |
10486 "%2" Pd " %-13s level=%-3d index=%-3" Pd "" | 10490 "%2" Pd " %-13s level=%-3d index=%-3d" |
10487 " begin=%-3" Pd " end=%-3" Pd " name=%s\n", | 10491 " begin=%-3d end=%-3d name=%s\n", |
10488 i, | 10492 i, |
10489 VarKindString(info.kind), | 10493 VarKindString(kind), |
10490 info.scope_id, | 10494 info.scope_id, |
10491 info.index, | 10495 index, |
10492 info.begin_pos, | 10496 info.begin_pos, |
10493 info.end_pos, | 10497 info.end_pos, |
10494 var_name.ToCString()); | 10498 var_name.ToCString()); |
10495 } else { | 10499 } else { |
10496 return OS::SNPrint(buffer, len, | 10500 return OS::SNPrint(buffer, len, |
10497 "%2" Pd " %-13s scope=%-3d index=%-3" Pd "" | 10501 "%2" Pd " %-13s scope=%-3d index=%-3d" |
10498 " begin=%-3" Pd " end=%-3" Pd " name=%s\n", | 10502 " begin=%-3d end=%-3d name=%s\n", |
10499 i, | 10503 i, |
10500 VarKindString(info.kind), | 10504 VarKindString(kind), |
10501 info.scope_id, | 10505 info.scope_id, |
10502 info.index, | 10506 index, |
10503 info.begin_pos, | 10507 info.begin_pos, |
10504 info.end_pos, | 10508 info.end_pos, |
10505 var_name.ToCString()); | 10509 var_name.ToCString()); |
10506 } | 10510 } |
10507 } | 10511 } |
10508 | 10512 |
10509 | 10513 |
10510 const char* LocalVarDescriptors::ToCString() const { | 10514 const char* LocalVarDescriptors::ToCString() const { |
10511 if (IsNull()) { | 10515 if (IsNull()) { |
10512 return "LocalVarDescriptors(NULL)"; | 10516 return "LocalVarDescriptors(NULL)"; |
(...skipping 30 matching lines...) Expand all Loading... |
10543 void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream, | 10547 void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream, |
10544 bool ref) const { | 10548 bool ref) const { |
10545 Object::PrintJSONImpl(stream, ref); | 10549 Object::PrintJSONImpl(stream, ref); |
10546 } | 10550 } |
10547 | 10551 |
10548 | 10552 |
10549 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { | 10553 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { |
10550 ASSERT(Object::var_descriptors_class() != Class::null()); | 10554 ASSERT(Object::var_descriptors_class() != Class::null()); |
10551 if (num_variables < 0 || num_variables > kMaxElements) { | 10555 if (num_variables < 0 || num_variables > kMaxElements) { |
10552 // This should be caught before we reach here. | 10556 // This should be caught before we reach here. |
10553 FATAL1("Fatal error in LocalVarDescriptors::New: " | 10557 FATAL2("Fatal error in LocalVarDescriptors::New: " |
10554 "invalid num_variables %" Pd "\n", num_variables); | 10558 "invalid num_variables %" Pd ". Maximum is: %d\n", |
| 10559 num_variables, RawLocalVarDescriptors::kMaxIndex); |
10555 } | 10560 } |
10556 LocalVarDescriptors& result = LocalVarDescriptors::Handle(); | 10561 LocalVarDescriptors& result = LocalVarDescriptors::Handle(); |
10557 { | 10562 { |
10558 uword size = LocalVarDescriptors::InstanceSize(num_variables); | 10563 uword size = LocalVarDescriptors::InstanceSize(num_variables); |
10559 RawObject* raw = Object::Allocate(LocalVarDescriptors::kClassId, | 10564 RawObject* raw = Object::Allocate(LocalVarDescriptors::kClassId, |
10560 size, | 10565 size, |
10561 Heap::kOld); | 10566 Heap::kOld); |
10562 NoGCScope no_gc; | 10567 NoGCScope no_gc; |
10563 result ^= raw; | 10568 result ^= raw; |
10564 result.raw_ptr()->length_ = num_variables; | 10569 result.raw_ptr()->length_ = num_variables; |
(...skipping 8185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18750 | 18755 |
18751 RawJSRegExp* JSRegExp::FromDataStartAddress(void* data) { | 18756 RawJSRegExp* JSRegExp::FromDataStartAddress(void* data) { |
18752 JSRegExp& regexp = JSRegExp::Handle(); | 18757 JSRegExp& regexp = JSRegExp::Handle(); |
18753 intptr_t addr = reinterpret_cast<intptr_t>(data) - sizeof(RawJSRegExp); | 18758 intptr_t addr = reinterpret_cast<intptr_t>(data) - sizeof(RawJSRegExp); |
18754 regexp ^= RawObject::FromAddr(addr); | 18759 regexp ^= RawObject::FromAddr(addr); |
18755 return regexp.raw(); | 18760 return regexp.raw(); |
18756 } | 18761 } |
18757 | 18762 |
18758 | 18763 |
18759 const char* JSRegExp::Flags() const { | 18764 const char* JSRegExp::Flags() const { |
18760 switch (raw_ptr()->flags_) { | 18765 switch (flags()) { |
18761 case kGlobal | kIgnoreCase | kMultiLine : | 18766 case kGlobal | kIgnoreCase | kMultiLine : |
18762 case kIgnoreCase | kMultiLine : | 18767 case kIgnoreCase | kMultiLine : |
18763 return "im"; | 18768 return "im"; |
18764 case kGlobal | kIgnoreCase : | 18769 case kGlobal | kIgnoreCase : |
18765 case kIgnoreCase: | 18770 case kIgnoreCase: |
18766 return "i"; | 18771 return "i"; |
18767 case kGlobal | kMultiLine : | 18772 case kGlobal | kMultiLine : |
18768 case kMultiLine: | 18773 case kMultiLine: |
18769 return "m"; | 18774 return "m"; |
18770 default: | 18775 default: |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19021 return tag_label.ToCString(); | 19026 return tag_label.ToCString(); |
19022 } | 19027 } |
19023 | 19028 |
19024 | 19029 |
19025 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19030 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
19026 Instance::PrintJSONImpl(stream, ref); | 19031 Instance::PrintJSONImpl(stream, ref); |
19027 } | 19032 } |
19028 | 19033 |
19029 | 19034 |
19030 } // namespace dart | 19035 } // namespace dart |
OLD | NEW |