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

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

Issue 257053003: Always use the same json for null in the vm service. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 1479
1480 cls = Class::New<UserTag>(); 1480 cls = Class::New<UserTag>();
1481 } 1481 }
1482 1482
1483 1483
1484 void Object::Print() const { 1484 void Object::Print() const {
1485 OS::Print("%s\n", ToCString()); 1485 OS::Print("%s\n", ToCString());
1486 } 1486 }
1487 1487
1488 1488
1489 void Object::PrintJSON(JSONStream* stream, bool ref) const {
1490 if (IsNull()) {
1491 JSONObject jsobj(stream);
1492 jsobj.AddProperty("type", ref ? "@Null" : "Null");
1493 jsobj.AddProperty("id", "objects/null");
1494 jsobj.AddProperty("valueAsString", "null");
1495 } else {
1496 PrintJSONImpl(stream, ref);
1497 }
1498 }
1499
1500
1489 RawString* Object::DictionaryName() const { 1501 RawString* Object::DictionaryName() const {
1490 return String::null(); 1502 return String::null();
1491 } 1503 }
1492 1504
1493 1505
1494 void Object::InitializeObject(uword address, intptr_t class_id, intptr_t size) { 1506 void Object::InitializeObject(uword address, intptr_t class_id, intptr_t size) {
1495 // TODO(iposva): Get a proper halt instruction from the assembler which 1507 // TODO(iposva): Get a proper halt instruction from the assembler which
1496 // would be needed here for code objects. 1508 // would be needed here for code objects.
1497 uword initial_value = reinterpret_cast<uword>(null_); 1509 uword initial_value = reinterpret_cast<uword>(null_);
1498 uword cur = address; 1510 uword cur = address;
(...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after
3882 const Library& lib = Library::Handle(library()); 3894 const Library& lib = Library::Handle(library());
3883 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); 3895 const char* library_name = lib.IsNull() ? "" : lib.ToCString();
3884 const char* class_name = String::Handle(Name()).ToCString(); 3896 const char* class_name = String::Handle(Name()).ToCString();
3885 intptr_t len = OS::SNPrint(NULL, 0, format, library_name, class_name) + 1; 3897 intptr_t len = OS::SNPrint(NULL, 0, format, library_name, class_name) + 1;
3886 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3898 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3887 OS::SNPrint(chars, len, format, library_name, class_name); 3899 OS::SNPrint(chars, len, format, library_name, class_name);
3888 return chars; 3900 return chars;
3889 } 3901 }
3890 3902
3891 3903
3892 void Class::PrintToJSONStream(JSONStream* stream, bool ref) const { 3904 void Class::PrintJSONImpl(JSONStream* stream, bool ref) const {
3893 JSONObject jsobj(stream); 3905 JSONObject jsobj(stream);
3894 if ((raw() == Class::null()) || (id() == kFreeListElement)) { 3906 if ((raw() == Class::null()) || (id() == kFreeListElement)) {
3895 jsobj.AddProperty("type", "Null"); 3907 jsobj.AddProperty("type", "Null");
3896 return; 3908 return;
3897 } 3909 }
3898 const char* internal_class_name = String::Handle(Name()).ToCString(); 3910 const char* internal_class_name = String::Handle(Name()).ToCString();
3899 const char* user_visible_class_name = 3911 const char* user_visible_class_name =
3900 String::Handle(UserVisibleName()).ToCString(); 3912 String::Handle(UserVisibleName()).ToCString();
3901 jsobj.AddProperty("type", JSONType(ref)); 3913 jsobj.AddProperty("type", JSONType(ref));
3902 jsobj.AddPropertyF("id", "classes/%" Pd "", id()); 3914 jsobj.AddPropertyF("id", "classes/%" Pd "", id());
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
4063 const char* UnresolvedClass::ToCString() const { 4075 const char* UnresolvedClass::ToCString() const {
4064 const char* format = "unresolved class '%s'"; 4076 const char* format = "unresolved class '%s'";
4065 const char* cname = String::Handle(Name()).ToCString(); 4077 const char* cname = String::Handle(Name()).ToCString();
4066 intptr_t len = OS::SNPrint(NULL, 0, format, cname) + 1; 4078 intptr_t len = OS::SNPrint(NULL, 0, format, cname) + 1;
4067 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 4079 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
4068 OS::SNPrint(chars, len, format, cname); 4080 OS::SNPrint(chars, len, format, cname);
4069 return chars; 4081 return chars;
4070 } 4082 }
4071 4083
4072 4084
4073 void UnresolvedClass::PrintToJSONStream(JSONStream* stream, bool ref) const { 4085 void UnresolvedClass::PrintJSONImpl(JSONStream* stream, bool ref) const {
4074 Object::PrintToJSONStream(stream, ref); 4086 Object::PrintJSONImpl(stream, ref);
4075 } 4087 }
4076 4088
4077 4089
4078 static uint32_t CombineHashes(uint32_t hash, uint32_t other_hash) { 4090 static uint32_t CombineHashes(uint32_t hash, uint32_t other_hash) {
4079 hash += other_hash; 4091 hash += other_hash;
4080 hash += hash << 10; 4092 hash += hash << 10;
4081 hash ^= hash >> 6; // Logical shift, unsigned hash. 4093 hash ^= hash >> 6; // Logical shift, unsigned hash.
4082 return hash; 4094 return hash;
4083 } 4095 }
4084 4096
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
4218 other_type = other.TypeAt(from_index + i); 4230 other_type = other.TypeAt(from_index + i);
4219 ASSERT(!other_type.IsNull()); 4231 ASSERT(!other_type.IsNull());
4220 if (!type.TypeTest(test_kind, other_type, bound_error)) { 4232 if (!type.TypeTest(test_kind, other_type, bound_error)) {
4221 return false; 4233 return false;
4222 } 4234 }
4223 } 4235 }
4224 return true; 4236 return true;
4225 } 4237 }
4226 4238
4227 4239
4228 void TypeArguments::PrintToJSONStream(JSONStream* stream, bool ref) const { 4240 void TypeArguments::PrintJSONImpl(JSONStream* stream, bool ref) const {
4229 JSONObject jsobj(stream); 4241 JSONObject jsobj(stream);
4230 if (IsNull()) {
4231 jsobj.AddProperty("type", ref ? "@Null" : "Null");
4232 jsobj.AddProperty("id", "objects/null");
4233 return;
4234 }
4235 // The index in the canonical_type_arguments table cannot be used as part of 4242 // The index in the canonical_type_arguments table cannot be used as part of
4236 // the object id (as in typearguments/id), because the indices are not 4243 // the object id (as in typearguments/id), because the indices are not
4237 // preserved when the table grows and the entries get rehashed. Use the ring. 4244 // preserved when the table grows and the entries get rehashed. Use the ring.
4238 Isolate* isolate = Isolate::Current(); 4245 Isolate* isolate = Isolate::Current();
4239 ObjectStore* object_store = isolate->object_store(); 4246 ObjectStore* object_store = isolate->object_store();
4240 const Array& table = Array::Handle(object_store->canonical_type_arguments()); 4247 const Array& table = Array::Handle(object_store->canonical_type_arguments());
4241 ASSERT(table.Length() > 0); 4248 ASSERT(table.Length() > 0);
4242 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 4249 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
4243 const intptr_t id = ring->GetIdForObject(raw()); 4250 const intptr_t id = ring->GetIdForObject(raw());
4244 jsobj.AddProperty("type", JSONType(ref)); 4251 jsobj.AddProperty("type", JSONType(ref));
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
4818 const char* kFormat = "PatchClass for %s"; 4825 const char* kFormat = "PatchClass for %s";
4819 const Class& cls = Class::Handle(patched_class()); 4826 const Class& cls = Class::Handle(patched_class());
4820 const char* cls_name = cls.ToCString(); 4827 const char* cls_name = cls.ToCString();
4821 intptr_t len = OS::SNPrint(NULL, 0, kFormat, cls_name) + 1; 4828 intptr_t len = OS::SNPrint(NULL, 0, kFormat, cls_name) + 1;
4822 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 4829 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
4823 OS::SNPrint(chars, len, kFormat, cls_name); 4830 OS::SNPrint(chars, len, kFormat, cls_name);
4824 return chars; 4831 return chars;
4825 } 4832 }
4826 4833
4827 4834
4828 void PatchClass::PrintToJSONStream(JSONStream* stream, bool ref) const { 4835 void PatchClass::PrintJSONImpl(JSONStream* stream, bool ref) const {
4829 Object::PrintToJSONStream(stream, ref); 4836 Object::PrintJSONImpl(stream, ref);
4830 } 4837 }
4831 4838
4832 4839
4833 RawPatchClass* PatchClass::New(const Class& patched_class, 4840 RawPatchClass* PatchClass::New(const Class& patched_class,
4834 const Class& source_class) { 4841 const Class& source_class) {
4835 const PatchClass& result = PatchClass::Handle(PatchClass::New()); 4842 const PatchClass& result = PatchClass::Handle(PatchClass::New());
4836 result.set_patched_class(patched_class); 4843 result.set_patched_class(patched_class);
4837 result.set_source_class(source_class); 4844 result.set_source_class(source_class);
4838 return result.raw(); 4845 return result.raw();
4839 } 4846 }
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after
6419 const char* function_name = String::Handle(name()).ToCString(); 6426 const char* function_name = String::Handle(name()).ToCString();
6420 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, 6427 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name,
6421 static_str, abstract_str, kind_str, const_str) + 1; 6428 static_str, abstract_str, kind_str, const_str) + 1;
6422 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 6429 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
6423 OS::SNPrint(chars, len, kFormat, function_name, 6430 OS::SNPrint(chars, len, kFormat, function_name,
6424 static_str, abstract_str, kind_str, const_str); 6431 static_str, abstract_str, kind_str, const_str);
6425 return chars; 6432 return chars;
6426 } 6433 }
6427 6434
6428 6435
6429 void Function::PrintToJSONStream(JSONStream* stream, bool ref) const { 6436 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const {
6430 const char* internal_name = String::Handle(name()).ToCString(); 6437 const char* internal_name = String::Handle(name()).ToCString();
6431 const char* user_name = 6438 const char* user_name =
6432 String::Handle(UserVisibleName()).ToCString(); 6439 String::Handle(UserVisibleName()).ToCString();
6433 Class& cls = Class::Handle(Owner()); 6440 Class& cls = Class::Handle(Owner());
6434 ASSERT(!cls.IsNull()); 6441 ASSERT(!cls.IsNull());
6435 Error& err = Error::Handle(); 6442 Error& err = Error::Handle();
6436 err ^= cls.EnsureIsFinalized(Isolate::Current()); 6443 err ^= cls.EnsureIsFinalized(Isolate::Current());
6437 ASSERT(err.IsNull()); 6444 ASSERT(err.IsNull());
6438 intptr_t id = -1; 6445 intptr_t id = -1;
6439 const char* selector = NULL; 6446 const char* selector = NULL;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
6529 Heap::kOld); 6536 Heap::kOld);
6530 return reinterpret_cast<RawClosureData*>(raw); 6537 return reinterpret_cast<RawClosureData*>(raw);
6531 } 6538 }
6532 6539
6533 6540
6534 const char* ClosureData::ToCString() const { 6541 const char* ClosureData::ToCString() const {
6535 return "ClosureData class"; 6542 return "ClosureData class";
6536 } 6543 }
6537 6544
6538 6545
6539 void ClosureData::PrintToJSONStream(JSONStream* stream, bool ref) const { 6546 void ClosureData::PrintJSONImpl(JSONStream* stream, bool ref) const {
6540 Object::PrintToJSONStream(stream, ref); 6547 Object::PrintJSONImpl(stream, ref);
6541 } 6548 }
6542 6549
6543 6550
6544 void RedirectionData::set_type(const Type& value) const { 6551 void RedirectionData::set_type(const Type& value) const {
6545 ASSERT(!value.IsNull()); 6552 ASSERT(!value.IsNull());
6546 StorePointer(&raw_ptr()->type_, value.raw()); 6553 StorePointer(&raw_ptr()->type_, value.raw());
6547 } 6554 }
6548 6555
6549 6556
6550 void RedirectionData::set_identifier(const String& value) const { 6557 void RedirectionData::set_identifier(const String& value) const {
(...skipping 13 matching lines...) Expand all
6564 Heap::kOld); 6571 Heap::kOld);
6565 return reinterpret_cast<RawRedirectionData*>(raw); 6572 return reinterpret_cast<RawRedirectionData*>(raw);
6566 } 6573 }
6567 6574
6568 6575
6569 const char* RedirectionData::ToCString() const { 6576 const char* RedirectionData::ToCString() const {
6570 return "RedirectionData class"; 6577 return "RedirectionData class";
6571 } 6578 }
6572 6579
6573 6580
6574 void RedirectionData::PrintToJSONStream(JSONStream* stream, bool ref) const { 6581 void RedirectionData::PrintJSONImpl(JSONStream* stream, bool ref) const {
6575 Object::PrintToJSONStream(stream, ref); 6582 Object::PrintJSONImpl(stream, ref);
6576 } 6583 }
6577 6584
6578 6585
6579 RawString* Field::GetterName(const String& field_name) { 6586 RawString* Field::GetterName(const String& field_name) {
6580 CompilerStats::make_accessor_name++; 6587 CompilerStats::make_accessor_name++;
6581 return String::Concat(Symbols::GetterPrefix(), field_name); 6588 return String::Concat(Symbols::GetterPrefix(), field_name);
6582 } 6589 }
6583 6590
6584 6591
6585 RawString* Field::GetterSymbol(const String& field_name) { 6592 RawString* Field::GetterSymbol(const String& field_name) {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
6769 const char* field_name = String::Handle(name()).ToCString(); 6776 const char* field_name = String::Handle(name()).ToCString();
6770 const Class& cls = Class::Handle(owner()); 6777 const Class& cls = Class::Handle(owner());
6771 const char* cls_name = String::Handle(cls.Name()).ToCString(); 6778 const char* cls_name = String::Handle(cls.Name()).ToCString();
6772 intptr_t len = 6779 intptr_t len =
6773 OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1; 6780 OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1;
6774 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 6781 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
6775 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2); 6782 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2);
6776 return chars; 6783 return chars;
6777 } 6784 }
6778 6785
6779 void Field::PrintToJSONStream(JSONStream* stream, bool ref) const { 6786 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const {
6780 JSONObject jsobj(stream); 6787 JSONObject jsobj(stream);
6781 const char* internal_field_name = String::Handle(name()).ToCString(); 6788 const char* internal_field_name = String::Handle(name()).ToCString();
6782 const char* field_name = String::Handle(UserVisibleName()).ToCString(); 6789 const char* field_name = String::Handle(UserVisibleName()).ToCString();
6783 Class& cls = Class::Handle(owner()); 6790 Class& cls = Class::Handle(owner());
6784 intptr_t id = cls.FindFieldIndex(*this); 6791 intptr_t id = cls.FindFieldIndex(*this);
6785 ASSERT(id >= 0); 6792 ASSERT(id >= 0);
6786 intptr_t cid = cls.id(); 6793 intptr_t cid = cls.id();
6787 jsobj.AddProperty("type", JSONType(ref)); 6794 jsobj.AddProperty("type", JSONType(ref));
6788 jsobj.AddPropertyF("id", "classes/%" Pd "/fields/%" Pd "", cid, id); 6795 jsobj.AddPropertyF("id", "classes/%" Pd "/fields/%" Pd "", cid, id);
6789 jsobj.AddProperty("name", internal_field_name); 6796 jsobj.AddProperty("name", internal_field_name);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
7041 return result.raw(); 7048 return result.raw();
7042 } 7049 }
7043 7050
7044 7051
7045 const char* LiteralToken::ToCString() const { 7052 const char* LiteralToken::ToCString() const {
7046 const String& token = String::Handle(literal()); 7053 const String& token = String::Handle(literal());
7047 return token.ToCString(); 7054 return token.ToCString();
7048 } 7055 }
7049 7056
7050 7057
7051 void LiteralToken::PrintToJSONStream(JSONStream* stream, bool ref) const { 7058 void LiteralToken::PrintJSONImpl(JSONStream* stream, bool ref) const {
7052 Object::PrintToJSONStream(stream, ref); 7059 Object::PrintJSONImpl(stream, ref);
7053 } 7060 }
7054 7061
7055 7062
7056 RawArray* TokenStream::TokenObjects() const { 7063 RawArray* TokenStream::TokenObjects() const {
7057 return raw_ptr()->token_objects_; 7064 return raw_ptr()->token_objects_;
7058 } 7065 }
7059 7066
7060 7067
7061 void TokenStream::SetTokenObjects(const Array& value) const { 7068 void TokenStream::SetTokenObjects(const Array& value) const {
7062 StorePointer(&raw_ptr()->token_objects_, value.raw()); 7069 StorePointer(&raw_ptr()->token_objects_, value.raw());
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
7486 } 7493 }
7487 return result.raw(); 7494 return result.raw();
7488 } 7495 }
7489 7496
7490 7497
7491 const char* TokenStream::ToCString() const { 7498 const char* TokenStream::ToCString() const {
7492 return "TokenStream"; 7499 return "TokenStream";
7493 } 7500 }
7494 7501
7495 7502
7496 void TokenStream::PrintToJSONStream(JSONStream* stream, bool ref) const { 7503 void TokenStream::PrintJSONImpl(JSONStream* stream, bool ref) const {
7497 Object::PrintToJSONStream(stream, ref); 7504 Object::PrintJSONImpl(stream, ref);
7498 } 7505 }
7499 7506
7500 7507
7501 TokenStream::Iterator::Iterator(const TokenStream& tokens, 7508 TokenStream::Iterator::Iterator(const TokenStream& tokens,
7502 intptr_t token_pos, 7509 intptr_t token_pos,
7503 Iterator::StreamType stream_type) 7510 Iterator::StreamType stream_type)
7504 : tokens_(TokenStream::Handle(tokens.raw())), 7511 : tokens_(TokenStream::Handle(tokens.raw())),
7505 data_(ExternalTypedData::Handle(tokens.GetStream())), 7512 data_(ExternalTypedData::Handle(tokens.GetStream())),
7506 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), 7513 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()),
7507 token_objects_(Array::Handle(tokens.TokenObjects())), 7514 token_objects_(Array::Handle(tokens.TokenObjects())),
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
7990 return result.raw(); 7997 return result.raw();
7991 } 7998 }
7992 7999
7993 8000
7994 const char* Script::ToCString() const { 8001 const char* Script::ToCString() const {
7995 return "Script"; 8002 return "Script";
7996 } 8003 }
7997 8004
7998 8005
7999 // See also Dart_ScriptGetTokenInfo. 8006 // See also Dart_ScriptGetTokenInfo.
8000 void Script::PrintToJSONStream(JSONStream* stream, bool ref) const { 8007 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const {
8001 JSONObject jsobj(stream); 8008 JSONObject jsobj(stream);
8002 jsobj.AddProperty("type", JSONType(ref)); 8009 jsobj.AddProperty("type", JSONType(ref));
8003 const String& name = String::Handle(url()); 8010 const String& name = String::Handle(url());
8004 ASSERT(!name.IsNull()); 8011 ASSERT(!name.IsNull());
8005 const String& encoded_url = String::Handle(String::EncodeURI(name)); 8012 const String& encoded_url = String::Handle(String::EncodeURI(name));
8006 ASSERT(!encoded_url.IsNull()); 8013 ASSERT(!encoded_url.IsNull());
8007 jsobj.AddPropertyF("id", "scripts/%s", encoded_url.ToCString()); 8014 jsobj.AddPropertyF("id", "scripts/%s", encoded_url.ToCString());
8008 jsobj.AddProperty("name", name.ToCString()); 8015 jsobj.AddProperty("name", name.ToCString());
8009 jsobj.AddProperty("user_name", name.ToCString()); 8016 jsobj.AddProperty("user_name", name.ToCString());
8010 jsobj.AddProperty("kind", GetKindAsCString()); 8017 jsobj.AddProperty("kind", GetKindAsCString());
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after
9258 const char* Library::ToCString() const { 9265 const char* Library::ToCString() const {
9259 const char* kFormat = "Library:'%s'"; 9266 const char* kFormat = "Library:'%s'";
9260 const String& name = String::Handle(url()); 9267 const String& name = String::Handle(url());
9261 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1; 9268 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1;
9262 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 9269 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
9263 OS::SNPrint(chars, len, kFormat, name.ToCString()); 9270 OS::SNPrint(chars, len, kFormat, name.ToCString());
9264 return chars; 9271 return chars;
9265 } 9272 }
9266 9273
9267 9274
9268 void Library::PrintToJSONStream(JSONStream* stream, bool ref) const { 9275 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const {
9269 const char* library_name = String::Handle(name()).ToCString(); 9276 const char* library_name = String::Handle(name()).ToCString();
9270 intptr_t id = index(); 9277 intptr_t id = index();
9271 ASSERT(id >= 0); 9278 ASSERT(id >= 0);
9272 JSONObject jsobj(stream); 9279 JSONObject jsobj(stream);
9273 jsobj.AddProperty("type", JSONType(ref)); 9280 jsobj.AddProperty("type", JSONType(ref));
9274 jsobj.AddPropertyF("id", "libraries/%" Pd "", id); 9281 jsobj.AddPropertyF("id", "libraries/%" Pd "", id);
9275 jsobj.AddProperty("user_name", library_name); 9282 jsobj.AddProperty("user_name", library_name);
9276 jsobj.AddProperty("name", library_name); 9283 jsobj.AddProperty("name", library_name);
9277 if (ref) { 9284 if (ref) {
9278 return; 9285 return;
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
9555 const char* LibraryPrefix::ToCString() const { 9562 const char* LibraryPrefix::ToCString() const {
9556 const char* kFormat = "LibraryPrefix:'%s'"; 9563 const char* kFormat = "LibraryPrefix:'%s'";
9557 const String& prefix = String::Handle(name()); 9564 const String& prefix = String::Handle(name());
9558 intptr_t len = OS::SNPrint(NULL, 0, kFormat, prefix.ToCString()) + 1; 9565 intptr_t len = OS::SNPrint(NULL, 0, kFormat, prefix.ToCString()) + 1;
9559 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 9566 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
9560 OS::SNPrint(chars, len, kFormat, prefix.ToCString()); 9567 OS::SNPrint(chars, len, kFormat, prefix.ToCString());
9561 return chars; 9568 return chars;
9562 } 9569 }
9563 9570
9564 9571
9565 void LibraryPrefix::PrintToJSONStream(JSONStream* stream, bool ref) const { 9572 void LibraryPrefix::PrintJSONImpl(JSONStream* stream, bool ref) const {
9566 Object::PrintToJSONStream(stream, ref); 9573 Object::PrintJSONImpl(stream, ref);
9567 } 9574 }
9568 9575
9569 9576
9570 void Namespace::set_metadata_field(const Field& value) const { 9577 void Namespace::set_metadata_field(const Field& value) const {
9571 StorePointer(&raw_ptr()->metadata_field_, value.raw()); 9578 StorePointer(&raw_ptr()->metadata_field_, value.raw());
9572 } 9579 }
9573 9580
9574 9581
9575 void Namespace::AddMetadata(intptr_t token_pos, const Class& owner_class) { 9582 void Namespace::AddMetadata(intptr_t token_pos, const Class& owner_class) {
9576 ASSERT(Field::Handle(metadata_field()).IsNull()); 9583 ASSERT(Field::Handle(metadata_field()).IsNull());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
9609 const char* Namespace::ToCString() const { 9616 const char* Namespace::ToCString() const {
9610 const char* kFormat = "Namespace for library '%s'"; 9617 const char* kFormat = "Namespace for library '%s'";
9611 const Library& lib = Library::Handle(library()); 9618 const Library& lib = Library::Handle(library());
9612 intptr_t len = OS::SNPrint(NULL, 0, kFormat, lib.ToCString()) + 1; 9619 intptr_t len = OS::SNPrint(NULL, 0, kFormat, lib.ToCString()) + 1;
9613 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 9620 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
9614 OS::SNPrint(chars, len, kFormat, lib.ToCString()); 9621 OS::SNPrint(chars, len, kFormat, lib.ToCString());
9615 return chars; 9622 return chars;
9616 } 9623 }
9617 9624
9618 9625
9619 void Namespace::PrintToJSONStream(JSONStream* stream, bool ref) const { 9626 void Namespace::PrintJSONImpl(JSONStream* stream, bool ref) const {
9620 Object::PrintToJSONStream(stream, ref); 9627 Object::PrintJSONImpl(stream, ref);
9621 } 9628 }
9622 9629
9623 9630
9624 bool Namespace::HidesName(const String& name) const { 9631 bool Namespace::HidesName(const String& name) const {
9625 // Quick check for common case with no combinators. 9632 // Quick check for common case with no combinators.
9626 if (hide_names() == show_names()) { 9633 if (hide_names() == show_names()) {
9627 ASSERT(hide_names() == Array::null()); 9634 ASSERT(hide_names() == Array::null());
9628 return false; 9635 return false;
9629 } 9636 }
9630 const String* plain_name = &name; 9637 const String* plain_name = &name;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
9875 } 9882 }
9876 return result.raw(); 9883 return result.raw();
9877 } 9884 }
9878 9885
9879 9886
9880 const char* Instructions::ToCString() const { 9887 const char* Instructions::ToCString() const {
9881 return "Instructions"; 9888 return "Instructions";
9882 } 9889 }
9883 9890
9884 9891
9885 void Instructions::PrintToJSONStream(JSONStream* stream, bool ref) const { 9892 void Instructions::PrintJSONImpl(JSONStream* stream, bool ref) const {
9886 Object::PrintToJSONStream(stream, ref); 9893 Object::PrintJSONImpl(stream, ref);
9887 } 9894 }
9888 9895
9889 9896
9890 intptr_t PcDescriptors::Length() const { 9897 intptr_t PcDescriptors::Length() const {
9891 return raw_ptr()->length_; 9898 return raw_ptr()->length_;
9892 } 9899 }
9893 9900
9894 9901
9895 void PcDescriptors::SetLength(intptr_t value) const { 9902 void PcDescriptors::SetLength(intptr_t value) const {
9896 raw_ptr()->length_ = value; 9903 raw_ptr()->length_ = value;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
10027 PC(i), 10034 PC(i),
10028 KindAsStr(i), 10035 KindAsStr(i),
10029 DeoptId(i), 10036 DeoptId(i),
10030 TokenPos(i), 10037 TokenPos(i),
10031 TryIndex(i)); 10038 TryIndex(i));
10032 } 10039 }
10033 return buffer; 10040 return buffer;
10034 } 10041 }
10035 10042
10036 10043
10037 void PcDescriptors::PrintToJSONStream(JSONStream* stream, bool ref) const { 10044 void PcDescriptors::PrintJSONImpl(JSONStream* stream, bool ref) const {
10038 Object::PrintToJSONStream(stream, ref); 10045 Object::PrintJSONImpl(stream, ref);
10039 } 10046 }
10040 10047
10041 10048
10042 // Verify assumptions (in debug mode only). 10049 // Verify assumptions (in debug mode only).
10043 // - No two deopt descriptors have the same deoptimization id. 10050 // - No two deopt descriptors have the same deoptimization id.
10044 // - No two ic-call descriptors have the same deoptimization id (type feedback). 10051 // - No two ic-call descriptors have the same deoptimization id (type feedback).
10045 // A function without unique ids is marked as non-optimizable (e.g., because of 10052 // A function without unique ids is marked as non-optimizable (e.g., because of
10046 // finally blocks). 10053 // finally blocks).
10047 void PcDescriptors::Verify(const Function& function) const { 10054 void PcDescriptors::Verify(const Function& function) const {
10048 #if defined(DEBUG) 10055 #if defined(DEBUG)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
10177 intptr_t index = OS::SNPrint(chars, alloc_size, kFormat, PC()); 10184 intptr_t index = OS::SNPrint(chars, alloc_size, kFormat, PC());
10178 for (intptr_t i = 0; i < Length(); i++) { 10185 for (intptr_t i = 0; i < Length(); i++) {
10179 chars[index++] = IsObject(i) ? '1' : '0'; 10186 chars[index++] = IsObject(i) ? '1' : '0';
10180 } 10187 }
10181 chars[index] = '\0'; 10188 chars[index] = '\0';
10182 return chars; 10189 return chars;
10183 } 10190 }
10184 } 10191 }
10185 10192
10186 10193
10187 void Stackmap::PrintToJSONStream(JSONStream* stream, bool ref) const { 10194 void Stackmap::PrintJSONImpl(JSONStream* stream, bool ref) const {
10188 Object::PrintToJSONStream(stream, ref); 10195 Object::PrintJSONImpl(stream, ref);
10189 } 10196 }
10190 10197
10191 10198
10192 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { 10199 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const {
10193 ASSERT(var_index < Length()); 10200 ASSERT(var_index < Length());
10194 const Array& names = Array::Handle(raw_ptr()->names_); 10201 const Array& names = Array::Handle(raw_ptr()->names_);
10195 ASSERT(Length() == names.Length()); 10202 ASSERT(Length() == names.Length());
10196 String& name = String::Handle(); 10203 String& name = String::Handle();
10197 name ^= names.At(var_index); 10204 name ^= names.At(var_index);
10198 return name.raw(); 10205 return name.raw();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
10252 info.kind, 10259 info.kind,
10253 info.scope_id, 10260 info.scope_id,
10254 info.begin_pos, 10261 info.begin_pos,
10255 info.end_pos, 10262 info.end_pos,
10256 var_name.ToCString()); 10263 var_name.ToCString());
10257 } 10264 }
10258 return buffer; 10265 return buffer;
10259 } 10266 }
10260 10267
10261 10268
10262 void LocalVarDescriptors::PrintToJSONStream(JSONStream* stream, 10269 void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream,
10263 bool ref) const { 10270 bool ref) const {
10264 Object::PrintToJSONStream(stream, ref); 10271 Object::PrintJSONImpl(stream, ref);
10265 } 10272 }
10266 10273
10267 10274
10268 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { 10275 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) {
10269 ASSERT(Object::var_descriptors_class() != Class::null()); 10276 ASSERT(Object::var_descriptors_class() != Class::null());
10270 if (num_variables < 0 || num_variables > kMaxElements) { 10277 if (num_variables < 0 || num_variables > kMaxElements) {
10271 // This should be caught before we reach here. 10278 // This should be caught before we reach here.
10272 FATAL1("Fatal error in LocalVarDescriptors::New: " 10279 FATAL1("Fatal error in LocalVarDescriptors::New: "
10273 "invalid num_variables %" Pd "\n", num_variables); 10280 "invalid num_variables %" Pd "\n", num_variables);
10274 } 10281 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
10436 type ^= handled_types.At(k); 10443 type ^= handled_types.At(k);
10437 num_chars += OS::SNPrint((buffer + num_chars), 10444 num_chars += OS::SNPrint((buffer + num_chars),
10438 (len - num_chars), 10445 (len - num_chars),
10439 kFormat2, k, type.ToCString()); 10446 kFormat2, k, type.ToCString());
10440 } 10447 }
10441 } 10448 }
10442 return buffer; 10449 return buffer;
10443 } 10450 }
10444 10451
10445 10452
10446 void ExceptionHandlers::PrintToJSONStream(JSONStream* stream, 10453 void ExceptionHandlers::PrintJSONImpl(JSONStream* stream,
10447 bool ref) const { 10454 bool ref) const {
10448 Object::PrintToJSONStream(stream, ref); 10455 Object::PrintJSONImpl(stream, ref);
10449 } 10456 }
10450 10457
10451 10458
10452 intptr_t DeoptInfo::Length() const { 10459 intptr_t DeoptInfo::Length() const {
10453 return Smi::Value(raw_ptr()->length_); 10460 return Smi::Value(raw_ptr()->length_);
10454 } 10461 }
10455 10462
10456 10463
10457 intptr_t DeoptInfo::FromIndex(intptr_t index) const { 10464 intptr_t DeoptInfo::FromIndex(intptr_t index) const {
10458 return *(EntryAddr(index, kFromIndex)); 10465 return *(EntryAddr(index, kFromIndex));
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
10554 GrowableArray<DeoptInstr*> unpacked(length); 10561 GrowableArray<DeoptInstr*> unpacked(length);
10555 ToInstructions(deopt_table, &unpacked); 10562 ToInstructions(deopt_table, &unpacked);
10556 ASSERT(unpacked.length() == original.length()); 10563 ASSERT(unpacked.length() == original.length());
10557 for (intptr_t i = 0; i < unpacked.length(); ++i) { 10564 for (intptr_t i = 0; i < unpacked.length(); ++i) {
10558 ASSERT(unpacked[i]->Equals(*original[i])); 10565 ASSERT(unpacked[i]->Equals(*original[i]));
10559 } 10566 }
10560 return true; 10567 return true;
10561 } 10568 }
10562 10569
10563 10570
10564 void DeoptInfo::PrintToJSONStream(JSONStream* stream, bool ref) const { 10571 void DeoptInfo::PrintJSONImpl(JSONStream* stream, bool ref) const {
10565 Object::PrintToJSONStream(stream, ref); 10572 Object::PrintJSONImpl(stream, ref);
10566 } 10573 }
10567 10574
10568 10575
10569 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) { 10576 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) {
10570 ASSERT(Object::deopt_info_class() != Class::null()); 10577 ASSERT(Object::deopt_info_class() != Class::null());
10571 if ((num_commands < 0) || (num_commands > kMaxElements)) { 10578 if ((num_commands < 0) || (num_commands > kMaxElements)) {
10572 FATAL1("Fatal error in DeoptInfo::New(): invalid num_commands %" Pd "\n", 10579 FATAL1("Fatal error in DeoptInfo::New(): invalid num_commands %" Pd "\n",
10573 num_commands); 10580 num_commands);
10574 } 10581 }
10575 DeoptInfo& result = DeoptInfo::Handle(); 10582 DeoptInfo& result = DeoptInfo::Handle();
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
11109 // Number of array elements in one test entry. 11116 // Number of array elements in one test entry.
11110 intptr_t len = result.TestEntryLength(); 11117 intptr_t len = result.TestEntryLength();
11111 // IC data array must be null terminated (sentinel entry). 11118 // IC data array must be null terminated (sentinel entry).
11112 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); 11119 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld));
11113 result.set_ic_data(ic_data); 11120 result.set_ic_data(ic_data);
11114 result.WriteSentinel(ic_data); 11121 result.WriteSentinel(ic_data);
11115 return result.raw(); 11122 return result.raw();
11116 } 11123 }
11117 11124
11118 11125
11119 void ICData::PrintToJSONStream(JSONStream* stream, bool ref) const { 11126 void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const {
11120 Object::PrintToJSONStream(stream, ref); 11127 Object::PrintJSONImpl(stream, ref);
11121 } 11128 }
11122 11129
11123 11130
11124 Code::Comments& Code::Comments::New(intptr_t count) { 11131 Code::Comments& Code::Comments::New(intptr_t count) {
11125 Comments* comments; 11132 Comments* comments;
11126 if (count < 0 || count > (kIntptrMax / kNumberOfEntries)) { 11133 if (count < 0 || count > (kIntptrMax / kNumberOfEntries)) {
11127 // This should be caught before we reach here. 11134 // This should be caught before we reach here.
11128 FATAL1("Fatal error in Code::Comments::New: invalid count %" Pd "\n", 11135 FATAL1("Fatal error in Code::Comments::New: invalid count %" Pd "\n",
11129 count); 11136 count);
11130 } 11137 }
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
11593 ASSERT(!cls_name.IsNull()); 11600 ASSERT(!cls_name.IsNull());
11594 return String::Concat(Symbols::AllocationStubFor(), cls_name); 11601 return String::Concat(Symbols::AllocationStubFor(), cls_name);
11595 } else { 11602 } else {
11596 ASSERT(obj.IsFunction()); 11603 ASSERT(obj.IsFunction());
11597 // Dart function. 11604 // Dart function.
11598 return Function::Cast(obj).QualifiedUserVisibleName(); 11605 return Function::Cast(obj).QualifiedUserVisibleName();
11599 } 11606 }
11600 } 11607 }
11601 11608
11602 11609
11603 void Code::PrintToJSONStream(JSONStream* stream, bool ref) const { 11610 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const {
11604 JSONObject jsobj(stream); 11611 JSONObject jsobj(stream);
11605 jsobj.AddProperty("type", JSONType(ref)); 11612 jsobj.AddProperty("type", JSONType(ref));
11606 jsobj.AddPropertyF("id", "code/%" Px64"-%" Px "", compile_timestamp(), 11613 jsobj.AddPropertyF("id", "code/%" Px64"-%" Px "", compile_timestamp(),
11607 EntryPoint()); 11614 EntryPoint());
11608 jsobj.AddPropertyF("start", "%" Px "", EntryPoint()); 11615 jsobj.AddPropertyF("start", "%" Px "", EntryPoint());
11609 jsobj.AddPropertyF("end", "%" Px "", EntryPoint() + Size()); 11616 jsobj.AddPropertyF("end", "%" Px "", EntryPoint() + Size());
11610 jsobj.AddProperty("is_optimized", is_optimized()); 11617 jsobj.AddProperty("is_optimized", is_optimized());
11611 jsobj.AddProperty("is_alive", is_alive()); 11618 jsobj.AddProperty("is_alive", is_alive());
11612 jsobj.AddProperty("kind", "Dart"); 11619 jsobj.AddProperty("kind", "Dart");
11613 const String& name = String::Handle(Name()); 11620 const String& name = String::Handle(Name());
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
11805 11812
11806 const Context& parent_ctx = Context::Handle(parent()); 11813 const Context& parent_ctx = Context::Handle(parent());
11807 if (!parent_ctx.IsNull()) { 11814 if (!parent_ctx.IsNull()) {
11808 parent_ctx.Dump(indent + 2); 11815 parent_ctx.Dump(indent + 2);
11809 } 11816 }
11810 IndentN(indent); 11817 IndentN(indent);
11811 OS::PrintErr("}\n"); 11818 OS::PrintErr("}\n");
11812 } 11819 }
11813 11820
11814 11821
11815 void Context::PrintToJSONStream(JSONStream* stream, bool ref) const { 11822 void Context::PrintJSONImpl(JSONStream* stream, bool ref) const {
11816 Object::PrintToJSONStream(stream, ref); 11823 Object::PrintJSONImpl(stream, ref);
11817 } 11824 }
11818 11825
11819 11826
11820 RawContextScope* ContextScope::New(intptr_t num_variables) { 11827 RawContextScope* ContextScope::New(intptr_t num_variables) {
11821 ASSERT(Object::context_scope_class() != Class::null()); 11828 ASSERT(Object::context_scope_class() != Class::null());
11822 if (num_variables < 0 || num_variables > kMaxElements) { 11829 if (num_variables < 0 || num_variables > kMaxElements) {
11823 // This should be caught before we reach here. 11830 // This should be caught before we reach here.
11824 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n", 11831 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n",
11825 num_variables); 11832 num_variables);
11826 } 11833 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
11924 intptr_t context_level) const { 11931 intptr_t context_level) const {
11925 VariableDescAddr(scope_index)->context_level = Smi::New(context_level); 11932 VariableDescAddr(scope_index)->context_level = Smi::New(context_level);
11926 } 11933 }
11927 11934
11928 11935
11929 const char* ContextScope::ToCString() const { 11936 const char* ContextScope::ToCString() const {
11930 return "ContextScope"; 11937 return "ContextScope";
11931 } 11938 }
11932 11939
11933 11940
11934 void ContextScope::PrintToJSONStream(JSONStream* stream, bool ref) const { 11941 void ContextScope::PrintJSONImpl(JSONStream* stream, bool ref) const {
11935 Object::PrintToJSONStream(stream, ref); 11942 Object::PrintJSONImpl(stream, ref);
11936 } 11943 }
11937 11944
11938 11945
11939 RawArray* MegamorphicCache::buckets() const { 11946 RawArray* MegamorphicCache::buckets() const {
11940 return raw_ptr()->buckets_; 11947 return raw_ptr()->buckets_;
11941 } 11948 }
11942 11949
11943 11950
11944 void MegamorphicCache::set_buckets(const Array& buckets) const { 11951 void MegamorphicCache::set_buckets(const Array& buckets) const {
11945 StorePointer(&raw_ptr()->buckets_, buckets.raw()); 11952 StorePointer(&raw_ptr()->buckets_, buckets.raw());
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
12040 } while (i != index); 12047 } while (i != index);
12041 UNREACHABLE(); 12048 UNREACHABLE();
12042 } 12049 }
12043 12050
12044 12051
12045 const char* MegamorphicCache::ToCString() const { 12052 const char* MegamorphicCache::ToCString() const {
12046 return ""; 12053 return "";
12047 } 12054 }
12048 12055
12049 12056
12050 void MegamorphicCache::PrintToJSONStream(JSONStream* stream, bool ref) const { 12057 void MegamorphicCache::PrintJSONImpl(JSONStream* stream, bool ref) const {
12051 Object::PrintToJSONStream(stream, ref); 12058 Object::PrintJSONImpl(stream, ref);
12052 } 12059 }
12053 12060
12054 12061
12055 RawSubtypeTestCache* SubtypeTestCache::New() { 12062 RawSubtypeTestCache* SubtypeTestCache::New() {
12056 ASSERT(Object::subtypetestcache_class() != Class::null()); 12063 ASSERT(Object::subtypetestcache_class() != Class::null());
12057 SubtypeTestCache& result = SubtypeTestCache::Handle(); 12064 SubtypeTestCache& result = SubtypeTestCache::Handle();
12058 { 12065 {
12059 // SubtypeTestCache objects are long living objects, allocate them in the 12066 // SubtypeTestCache objects are long living objects, allocate them in the
12060 // old generation. 12067 // old generation.
12061 RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId, 12068 RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
12116 data.At(data_pos + kInstantiatorTypeArguments); 12123 data.At(data_pos + kInstantiatorTypeArguments);
12117 *test_result ^= data.At(data_pos + kTestResult); 12124 *test_result ^= data.At(data_pos + kTestResult);
12118 } 12125 }
12119 12126
12120 12127
12121 const char* SubtypeTestCache::ToCString() const { 12128 const char* SubtypeTestCache::ToCString() const {
12122 return "SubtypeTestCache"; 12129 return "SubtypeTestCache";
12123 } 12130 }
12124 12131
12125 12132
12126 void SubtypeTestCache::PrintToJSONStream(JSONStream* stream, bool ref) const { 12133 void SubtypeTestCache::PrintJSONImpl(JSONStream* stream, bool ref) const {
12127 Object::PrintToJSONStream(stream, ref); 12134 Object::PrintJSONImpl(stream, ref);
12128 } 12135 }
12129 12136
12130 12137
12131 const char* Error::ToErrorCString() const { 12138 const char* Error::ToErrorCString() const {
12132 UNREACHABLE(); 12139 UNREACHABLE();
12133 return "Internal Error"; 12140 return "Internal Error";
12134 } 12141 }
12135 12142
12136 12143
12137 const char* Error::ToCString() const { 12144 const char* Error::ToCString() const {
12138 // Error is an abstract class. We should never reach here. 12145 // Error is an abstract class. We should never reach here.
12139 UNREACHABLE(); 12146 UNREACHABLE();
12140 return "Error"; 12147 return "Error";
12141 } 12148 }
12142 12149
12143 12150
12144 void Error::PrintToJSONStream(JSONStream* stream, bool ref) const { 12151 void Error::PrintJSONImpl(JSONStream* stream, bool ref) const {
12145 UNREACHABLE(); 12152 UNREACHABLE();
12146 } 12153 }
12147 12154
12148 12155
12149 RawApiError* ApiError::New() { 12156 RawApiError* ApiError::New() {
12150 ASSERT(Object::api_error_class() != Class::null()); 12157 ASSERT(Object::api_error_class() != Class::null());
12151 RawObject* raw = Object::Allocate(ApiError::kClassId, 12158 RawObject* raw = Object::Allocate(ApiError::kClassId,
12152 ApiError::InstanceSize(), 12159 ApiError::InstanceSize(),
12153 Heap::kOld); 12160 Heap::kOld);
12154 return reinterpret_cast<RawApiError*>(raw); 12161 return reinterpret_cast<RawApiError*>(raw);
(...skipping 24 matching lines...) Expand all
12179 const String& msg_str = String::Handle(message()); 12186 const String& msg_str = String::Handle(message());
12180 return msg_str.ToCString(); 12187 return msg_str.ToCString();
12181 } 12188 }
12182 12189
12183 12190
12184 const char* ApiError::ToCString() const { 12191 const char* ApiError::ToCString() const {
12185 return "ApiError"; 12192 return "ApiError";
12186 } 12193 }
12187 12194
12188 12195
12189 void ApiError::PrintToJSONStream(JSONStream* stream, bool ref) const { 12196 void ApiError::PrintJSONImpl(JSONStream* stream, bool ref) const {
12190 JSONObject jsobj(stream); 12197 JSONObject jsobj(stream);
12191 jsobj.AddProperty("type", "Error"); 12198 jsobj.AddProperty("type", "Error");
12192 jsobj.AddProperty("id", ""); 12199 jsobj.AddProperty("id", "");
12193 jsobj.AddProperty("kind", JSONType(false)); 12200 jsobj.AddProperty("kind", JSONType(false));
12194 jsobj.AddProperty("message", ToErrorCString()); 12201 jsobj.AddProperty("message", ToErrorCString());
12195 } 12202 }
12196 12203
12197 12204
12198 RawLanguageError* LanguageError::New() { 12205 RawLanguageError* LanguageError::New() {
12199 ASSERT(Object::language_error_class() != Class::null()); 12206 ASSERT(Object::language_error_class() != Class::null());
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
12367 const String& msg_str = String::Handle(FormatMessage()); 12374 const String& msg_str = String::Handle(FormatMessage());
12368 return msg_str.ToCString(); 12375 return msg_str.ToCString();
12369 } 12376 }
12370 12377
12371 12378
12372 const char* LanguageError::ToCString() const { 12379 const char* LanguageError::ToCString() const {
12373 return "LanguageError"; 12380 return "LanguageError";
12374 } 12381 }
12375 12382
12376 12383
12377 void LanguageError::PrintToJSONStream(JSONStream* stream, bool ref) const { 12384 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const {
12378 JSONObject jsobj(stream); 12385 JSONObject jsobj(stream);
12379 jsobj.AddProperty("type", "Error"); 12386 jsobj.AddProperty("type", "Error");
12380 jsobj.AddProperty("id", ""); 12387 jsobj.AddProperty("id", "");
12381 jsobj.AddProperty("kind", JSONType(false)); 12388 jsobj.AddProperty("kind", JSONType(false));
12382 jsobj.AddProperty("message", ToErrorCString()); 12389 jsobj.AddProperty("message", ToErrorCString());
12383 } 12390 }
12384 12391
12385 12392
12386 RawUnhandledException* UnhandledException::New(const Instance& exception, 12393 RawUnhandledException* UnhandledException::New(const Instance& exception,
12387 const Instance& stacktrace, 12394 const Instance& stacktrace,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
12445 return chars; 12452 return chars;
12446 } 12453 }
12447 12454
12448 12455
12449 const char* UnhandledException::ToCString() const { 12456 const char* UnhandledException::ToCString() const {
12450 return "UnhandledException"; 12457 return "UnhandledException";
12451 } 12458 }
12452 12459
12453 12460
12454 12461
12455 void UnhandledException::PrintToJSONStream(JSONStream* stream, 12462 void UnhandledException::PrintJSONImpl(JSONStream* stream,
12456 bool ref) const { 12463 bool ref) const {
12457 JSONObject jsobj(stream); 12464 JSONObject jsobj(stream);
12458 jsobj.AddProperty("type", "Error"); 12465 jsobj.AddProperty("type", "Error");
12459 jsobj.AddProperty("id", ""); 12466 jsobj.AddProperty("id", "");
12460 jsobj.AddProperty("kind", JSONType(false)); 12467 jsobj.AddProperty("kind", JSONType(false));
12461 jsobj.AddProperty("message", ToErrorCString()); 12468 jsobj.AddProperty("message", ToErrorCString());
12462 12469
12463 Instance& instance = Instance::Handle(); 12470 Instance& instance = Instance::Handle();
12464 instance = exception(); 12471 instance = exception();
12465 jsobj.AddProperty("exception", instance); 12472 jsobj.AddProperty("exception", instance);
12466 instance = stacktrace(); 12473 instance = stacktrace();
(...skipping 25 matching lines...) Expand all
12492 const String& msg_str = String::Handle(message()); 12499 const String& msg_str = String::Handle(message());
12493 return msg_str.ToCString(); 12500 return msg_str.ToCString();
12494 } 12501 }
12495 12502
12496 12503
12497 const char* UnwindError::ToCString() const { 12504 const char* UnwindError::ToCString() const {
12498 return "UnwindError"; 12505 return "UnwindError";
12499 } 12506 }
12500 12507
12501 12508
12502 void UnwindError::PrintToJSONStream(JSONStream* stream, bool ref) const { 12509 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const {
12503 JSONObject jsobj(stream); 12510 JSONObject jsobj(stream);
12504 jsobj.AddProperty("type", "Error"); 12511 jsobj.AddProperty("type", "Error");
12505 jsobj.AddProperty("id", ""); 12512 jsobj.AddProperty("id", "");
12506 jsobj.AddProperty("kind", JSONType(false)); 12513 jsobj.AddProperty("kind", JSONType(false));
12507 jsobj.AddProperty("message", ToErrorCString()); 12514 jsobj.AddProperty("message", ToErrorCString());
12508 } 12515 }
12509 12516
12510 12517
12511 RawObject* Instance::Evaluate(const String& expr, 12518 RawObject* Instance::Evaluate(const String& expr,
12512 const Array& param_names, 12519 const Array& param_names,
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
12937 for (intptr_t i = 0; i < NumNativeFields(); i++) { 12944 for (intptr_t i = 0; i < NumNativeFields(); i++) {
12938 intptr_t value = GetNativeField(i); 12945 intptr_t value = GetNativeField(i);
12939 JSONObject jsfield(&jsarr); 12946 JSONObject jsfield(&jsarr);
12940 jsfield.AddProperty("index", i); 12947 jsfield.AddProperty("index", i);
12941 jsfield.AddProperty("value", value); 12948 jsfield.AddProperty("value", value);
12942 } 12949 }
12943 } 12950 }
12944 } 12951 }
12945 12952
12946 12953
12947 void Instance::PrintToJSONStream(JSONStream* stream, bool ref) const { 12954 void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const {
12948 JSONObject jsobj(stream); 12955 JSONObject jsobj(stream);
12949 12956
12950 // Handle certain special instance values. 12957 // Handle certain special instance values.
12951 if (IsNull()) { 12958 if (raw() == Object::sentinel().raw()) {
12952 jsobj.AddProperty("type", ref ? "@Null" : "Null");
12953 jsobj.AddProperty("id", "objects/null");
12954 jsobj.AddProperty("valueAsString", "null");
12955 return;
12956 } else if (raw() == Object::sentinel().raw()) {
12957 jsobj.AddProperty("type", ref ? "@Null" : "Null"); 12959 jsobj.AddProperty("type", ref ? "@Null" : "Null");
12958 jsobj.AddProperty("id", "objects/not-initialized"); 12960 jsobj.AddProperty("id", "objects/not-initialized");
12959 jsobj.AddProperty("valueAsString", "<not initialized>"); 12961 jsobj.AddProperty("valueAsString", "<not initialized>");
12960 return; 12962 return;
12961 } else if (raw() == Object::transition_sentinel().raw()) { 12963 } else if (raw() == Object::transition_sentinel().raw()) {
12962 jsobj.AddProperty("type", ref ? "@Null" : "Null"); 12964 jsobj.AddProperty("type", ref ? "@Null" : "Null");
12963 jsobj.AddProperty("id", "objects/being-initialized"); 12965 jsobj.AddProperty("id", "objects/being-initialized");
12964 jsobj.AddProperty("valueAsString", "<being initialized>"); 12966 jsobj.AddProperty("valueAsString", "<being initialized>");
12965 return; 12967 return;
12966 } 12968 }
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
13411 } 13413 }
13412 13414
13413 13415
13414 const char* AbstractType::ToCString() const { 13416 const char* AbstractType::ToCString() const {
13415 // AbstractType is an abstract class. 13417 // AbstractType is an abstract class.
13416 UNREACHABLE(); 13418 UNREACHABLE();
13417 return "AbstractType"; 13419 return "AbstractType";
13418 } 13420 }
13419 13421
13420 13422
13421 void AbstractType::PrintToJSONStream(JSONStream* stream, bool ref) const { 13423 void AbstractType::PrintJSONImpl(JSONStream* stream, bool ref) const {
13422 UNREACHABLE(); 13424 UNREACHABLE();
13423 } 13425 }
13424 13426
13425 13427
13426 RawType* Type::NullType() { 13428 RawType* Type::NullType() {
13427 return Isolate::Current()->object_store()->null_type(); 13429 return Isolate::Current()->object_store()->null_type();
13428 } 13430 }
13429 13431
13430 13432
13431 RawType* Type::DynamicType() { 13433 RawType* Type::DynamicType() {
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
14015 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 14017 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
14016 OS::SNPrint(chars, len, format, class_name, args_cstr); 14018 OS::SNPrint(chars, len, format, class_name, args_cstr);
14017 return chars; 14019 return chars;
14018 } 14020 }
14019 } else { 14021 } else {
14020 return "Unresolved Type"; 14022 return "Unresolved Type";
14021 } 14023 }
14022 } 14024 }
14023 14025
14024 14026
14025 void Type::PrintToJSONStream(JSONStream* stream, bool ref) const { 14027 void Type::PrintJSONImpl(JSONStream* stream, bool ref) const {
14026 JSONObject jsobj(stream); 14028 JSONObject jsobj(stream);
14027 PrintSharedInstanceJSON(&jsobj, ref); 14029 PrintSharedInstanceJSON(&jsobj, ref);
14028 if (IsCanonical()) { 14030 if (IsCanonical()) {
14029 const Class& type_cls = Class::Handle(type_class()); 14031 const Class& type_cls = Class::Handle(type_class());
14030 intptr_t id = type_cls.FindCanonicalTypeIndex(*this); 14032 intptr_t id = type_cls.FindCanonicalTypeIndex(*this);
14031 ASSERT(id >= 0); 14033 ASSERT(id >= 0);
14032 intptr_t cid = type_cls.id(); 14034 intptr_t cid = type_cls.id();
14033 jsobj.AddPropertyF("id", "classes/%" Pd "/types/%" Pd "", cid, id); 14035 jsobj.AddPropertyF("id", "classes/%" Pd "/types/%" Pd "", cid, id);
14034 jsobj.AddProperty("type_class", type_cls); 14036 jsobj.AddProperty("type_class", type_cls);
14035 } else { 14037 } else {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
14188 } else { 14190 } else {
14189 const char* format = "TypeRef: %s<...>"; 14191 const char* format = "TypeRef: %s<...>";
14190 const intptr_t len = OS::SNPrint(NULL, 0, format, type_cstr) + 1; 14192 const intptr_t len = OS::SNPrint(NULL, 0, format, type_cstr) + 1;
14191 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 14193 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
14192 OS::SNPrint(chars, len, format, type_cstr); 14194 OS::SNPrint(chars, len, format, type_cstr);
14193 return chars; 14195 return chars;
14194 } 14196 }
14195 } 14197 }
14196 14198
14197 14199
14198 void TypeRef::PrintToJSONStream(JSONStream* stream, bool ref) const { 14200 void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const {
14199 JSONObject jsobj(stream); 14201 JSONObject jsobj(stream);
14200 PrintSharedInstanceJSON(&jsobj, ref); 14202 PrintSharedInstanceJSON(&jsobj, ref);
14201 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 14203 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
14202 const intptr_t id = ring->GetIdForObject(raw()); 14204 const intptr_t id = ring->GetIdForObject(raw());
14203 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 14205 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
14204 const char* name = String::Handle(Name()).ToCString(); 14206 const char* name = String::Handle(Name()).ToCString();
14205 const char* user_name = String::Handle(UserVisibleName()).ToCString(); 14207 const char* user_name = String::Handle(UserVisibleName()).ToCString();
14206 jsobj.AddProperty("name", name); 14208 jsobj.AddProperty("name", name);
14207 jsobj.AddProperty("user_name", user_name); 14209 jsobj.AddProperty("user_name", user_name);
14208 if (ref) { 14210 if (ref) {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
14405 const AbstractType& upper_bound = AbstractType::Handle(bound()); 14407 const AbstractType& upper_bound = AbstractType::Handle(bound());
14406 const char* bound_cstr = String::Handle(upper_bound.Name()).ToCString(); 14408 const char* bound_cstr = String::Handle(upper_bound.Name()).ToCString();
14407 intptr_t len = OS::SNPrint( 14409 intptr_t len = OS::SNPrint(
14408 NULL, 0, format, name_cstr, index(), cls_cstr, bound_cstr) + 1; 14410 NULL, 0, format, name_cstr, index(), cls_cstr, bound_cstr) + 1;
14409 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 14411 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
14410 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr, bound_cstr); 14412 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr, bound_cstr);
14411 return chars; 14413 return chars;
14412 } 14414 }
14413 14415
14414 14416
14415 void TypeParameter::PrintToJSONStream(JSONStream* stream, bool ref) const { 14417 void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const {
14416 JSONObject jsobj(stream); 14418 JSONObject jsobj(stream);
14417 PrintSharedInstanceJSON(&jsobj, ref); 14419 PrintSharedInstanceJSON(&jsobj, ref);
14418 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 14420 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
14419 const intptr_t id = ring->GetIdForObject(raw()); 14421 const intptr_t id = ring->GetIdForObject(raw());
14420 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 14422 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
14421 const char* name = String::Handle(Name()).ToCString(); 14423 const char* name = String::Handle(Name()).ToCString();
14422 const char* user_name = String::Handle(UserVisibleName()).ToCString(); 14424 const char* user_name = String::Handle(UserVisibleName()).ToCString();
14423 jsobj.AddProperty("name", name); 14425 jsobj.AddProperty("name", name);
14424 jsobj.AddProperty("user_name", user_name); 14426 jsobj.AddProperty("user_name", user_name);
14425 const Class& param_cls = Class::Handle(parameterized_class()); 14427 const Class& param_cls = Class::Handle(parameterized_class());
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
14609 const char* cls_cstr = String::Handle(cls.Name()).ToCString(); 14611 const char* cls_cstr = String::Handle(cls.Name()).ToCString();
14610 intptr_t len = OS::SNPrint( 14612 intptr_t len = OS::SNPrint(
14611 NULL, 0, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr) + 1; 14613 NULL, 0, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr) + 1;
14612 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 14614 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
14613 OS::SNPrint( 14615 OS::SNPrint(
14614 chars, len, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr); 14616 chars, len, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr);
14615 return chars; 14617 return chars;
14616 } 14618 }
14617 14619
14618 14620
14619 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { 14621 void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const {
14620 JSONObject jsobj(stream); 14622 JSONObject jsobj(stream);
14621 PrintSharedInstanceJSON(&jsobj, ref); 14623 PrintSharedInstanceJSON(&jsobj, ref);
14622 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 14624 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
14623 const intptr_t id = ring->GetIdForObject(raw()); 14625 const intptr_t id = ring->GetIdForObject(raw());
14624 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 14626 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
14625 const char* name = String::Handle(Name()).ToCString(); 14627 const char* name = String::Handle(Name()).ToCString();
14626 const char* user_name = String::Handle(UserVisibleName()).ToCString(); 14628 const char* user_name = String::Handle(UserVisibleName()).ToCString();
14627 jsobj.AddProperty("name", name); 14629 jsobj.AddProperty("name", name);
14628 jsobj.AddProperty("user_name", user_name); 14630 jsobj.AddProperty("user_name", user_name);
14629 if (ref) { 14631 if (ref) {
(...skipping 26 matching lines...) Expand all
14656 const char* first_mixin_type_cstr = String::Handle(AbstractType::Handle( 14658 const char* first_mixin_type_cstr = String::Handle(AbstractType::Handle(
14657 MixinTypeAt(0)).Name()).ToCString(); 14659 MixinTypeAt(0)).Name()).ToCString();
14658 intptr_t len = OS::SNPrint( 14660 intptr_t len = OS::SNPrint(
14659 NULL, 0, format, super_type_cstr, first_mixin_type_cstr) + 1; 14661 NULL, 0, format, super_type_cstr, first_mixin_type_cstr) + 1;
14660 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 14662 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
14661 OS::SNPrint(chars, len, format, super_type_cstr, first_mixin_type_cstr); 14663 OS::SNPrint(chars, len, format, super_type_cstr, first_mixin_type_cstr);
14662 return chars; 14664 return chars;
14663 } 14665 }
14664 14666
14665 14667
14666 void MixinAppType::PrintToJSONStream(JSONStream* stream, bool ref) const { 14668 void MixinAppType::PrintJSONImpl(JSONStream* stream, bool ref) const {
14667 UNREACHABLE(); 14669 UNREACHABLE();
14668 } 14670 }
14669 14671
14670 14672
14671 RawAbstractType* MixinAppType::MixinTypeAt(intptr_t depth) const { 14673 RawAbstractType* MixinAppType::MixinTypeAt(intptr_t depth) const {
14672 return AbstractType::RawCast(Array::Handle(mixin_types()).At(depth)); 14674 return AbstractType::RawCast(Array::Handle(mixin_types()).At(depth));
14673 } 14675 }
14674 14676
14675 14677
14676 void MixinAppType::set_super_type(const AbstractType& value) const { 14678 void MixinAppType::set_super_type(const AbstractType& value) const {
(...skipping 27 matching lines...) Expand all
14704 } 14706 }
14705 14707
14706 14708
14707 const char* Number::ToCString() const { 14709 const char* Number::ToCString() const {
14708 // Number is an interface. No instances of Number should exist. 14710 // Number is an interface. No instances of Number should exist.
14709 UNREACHABLE(); 14711 UNREACHABLE();
14710 return "Number"; 14712 return "Number";
14711 } 14713 }
14712 14714
14713 14715
14714 void Number::PrintToJSONStream(JSONStream* stream, bool ref) const { 14716 void Number::PrintJSONImpl(JSONStream* stream, bool ref) const {
14715 JSONObject jsobj(stream); 14717 JSONObject jsobj(stream);
14716 PrintSharedInstanceJSON(&jsobj, ref); 14718 PrintSharedInstanceJSON(&jsobj, ref);
14717 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 14719 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
14718 const intptr_t id = ring->GetIdForObject(raw()); 14720 const intptr_t id = ring->GetIdForObject(raw());
14719 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 14721 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
14720 jsobj.AddProperty("valueAsString", ToCString()); 14722 jsobj.AddProperty("valueAsString", ToCString());
14721 } 14723 }
14722 14724
14723 14725
14724 const char* Integer::ToCString() const { 14726 const char* Integer::ToCString() const {
14725 // Integer is an interface. No instances of Integer should exist. 14727 // Integer is an interface. No instances of Integer should exist.
14726 UNREACHABLE(); 14728 UNREACHABLE();
14727 return "Integer"; 14729 return "Integer";
14728 } 14730 }
14729 14731
14730 14732
14731 void Integer::PrintToJSONStream(JSONStream* stream, bool ref) const { 14733 void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const {
14732 Number::PrintToJSONStream(stream, ref); 14734 Number::PrintJSONImpl(stream, ref);
14733 } 14735 }
14734 14736
14735 14737
14736 // Throw JavascriptIntegerOverflow exception. 14738 // Throw JavascriptIntegerOverflow exception.
14737 static void ThrowJavascriptIntegerOverflow(const Integer& i) { 14739 static void ThrowJavascriptIntegerOverflow(const Integer& i) {
14738 const Array& exc_args = Array::Handle(Array::New(1)); 14740 const Array& exc_args = Array::Handle(Array::New(1));
14739 const String& i_str = String::Handle(String::New(i.ToCString())); 14741 const String& i_str = String::Handle(String::New(i.ToCString()));
14740 exc_args.SetAt(0, i_str); 14742 exc_args.SetAt(0, i_str);
14741 Exceptions::ThrowByType(Exceptions::kJavascriptIntegerOverflowError, 14743 Exceptions::ThrowByType(Exceptions::kJavascriptIntegerOverflowError,
14742 exc_args); 14744 exc_args);
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
15150 const char* Smi::ToCString() const { 15152 const char* Smi::ToCString() const {
15151 const char* kFormat = "%ld"; 15153 const char* kFormat = "%ld";
15152 // Calculate the size of the string. 15154 // Calculate the size of the string.
15153 intptr_t len = OS::SNPrint(NULL, 0, kFormat, Value()) + 1; 15155 intptr_t len = OS::SNPrint(NULL, 0, kFormat, Value()) + 1;
15154 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 15156 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
15155 OS::SNPrint(chars, len, kFormat, Value()); 15157 OS::SNPrint(chars, len, kFormat, Value());
15156 return chars; 15158 return chars;
15157 } 15159 }
15158 15160
15159 15161
15160 void Smi::PrintToJSONStream(JSONStream* stream, bool ref) const { 15162 void Smi::PrintJSONImpl(JSONStream* stream, bool ref) const {
15161 JSONObject jsobj(stream); 15163 JSONObject jsobj(stream);
15162 PrintSharedInstanceJSON(&jsobj, ref); 15164 PrintSharedInstanceJSON(&jsobj, ref);
15163 jsobj.AddPropertyF("id", "objects/int-%" Pd "", Value()); 15165 jsobj.AddPropertyF("id", "objects/int-%" Pd "", Value());
15164 jsobj.AddPropertyF("valueAsString", "%" Pd "", Value()); 15166 jsobj.AddPropertyF("valueAsString", "%" Pd "", Value());
15165 } 15167 }
15166 15168
15167 15169
15168 RawClass* Smi::Class() { 15170 RawClass* Smi::Class() {
15169 return Isolate::Current()->object_store()->smi_class(); 15171 return Isolate::Current()->object_store()->smi_class();
15170 } 15172 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
15277 const char* Mint::ToCString() const { 15279 const char* Mint::ToCString() const {
15278 const char* kFormat = "%lld"; 15280 const char* kFormat = "%lld";
15279 // Calculate the size of the string. 15281 // Calculate the size of the string.
15280 intptr_t len = OS::SNPrint(NULL, 0, kFormat, value()) + 1; 15282 intptr_t len = OS::SNPrint(NULL, 0, kFormat, value()) + 1;
15281 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 15283 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
15282 OS::SNPrint(chars, len, kFormat, value()); 15284 OS::SNPrint(chars, len, kFormat, value());
15283 return chars; 15285 return chars;
15284 } 15286 }
15285 15287
15286 15288
15287 void Mint::PrintToJSONStream(JSONStream* stream, bool ref) const { 15289 void Mint::PrintJSONImpl(JSONStream* stream, bool ref) const {
15288 Number::PrintToJSONStream(stream, ref); 15290 Number::PrintJSONImpl(stream, ref);
15289 } 15291 }
15290 15292
15291 15293
15292 void Double::set_value(double value) const { 15294 void Double::set_value(double value) const {
15293 raw_ptr()->value_ = value; 15295 raw_ptr()->value_ = value;
15294 } 15296 }
15295 15297
15296 15298
15297 bool Double::EqualsToDouble(double value) const { 15299 bool Double::EqualsToDouble(double value) const {
15298 intptr_t value_offset = Double::value_offset(); 15300 intptr_t value_offset = Double::value_offset();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
15383 return value() < 0 ? "-Infinity" : "Infinity"; 15385 return value() < 0 ? "-Infinity" : "Infinity";
15384 } 15386 }
15385 const int kBufferSize = 128; 15387 const int kBufferSize = 128;
15386 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(kBufferSize); 15388 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(kBufferSize);
15387 buffer[kBufferSize - 1] = '\0'; 15389 buffer[kBufferSize - 1] = '\0';
15388 DoubleToCString(value(), buffer, kBufferSize); 15390 DoubleToCString(value(), buffer, kBufferSize);
15389 return buffer; 15391 return buffer;
15390 } 15392 }
15391 15393
15392 15394
15393 void Double::PrintToJSONStream(JSONStream* stream, bool ref) const { 15395 void Double::PrintJSONImpl(JSONStream* stream, bool ref) const {
15394 Number::PrintToJSONStream(stream, ref); 15396 Number::PrintJSONImpl(stream, ref);
15395 } 15397 }
15396 15398
15397 15399
15398 RawBigint* Integer::AsBigint() const { 15400 RawBigint* Integer::AsBigint() const {
15399 ASSERT(!IsNull()); 15401 ASSERT(!IsNull());
15400 if (IsSmi()) { 15402 if (IsSmi()) {
15401 Smi& smi = Smi::Handle(); 15403 Smi& smi = Smi::Handle();
15402 smi ^= raw(); 15404 smi ^= raw();
15403 return BigintOperations::NewFromSmi(smi); 15405 return BigintOperations::NewFromSmi(smi);
15404 } else if (IsMint()) { 15406 } else if (IsMint()) {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
15559 Zone* zone = Isolate::Current()->current_zone(); 15561 Zone* zone = Isolate::Current()->current_zone();
15560 return zone->AllocUnsafe(size); 15562 return zone->AllocUnsafe(size);
15561 } 15563 }
15562 15564
15563 15565
15564 const char* Bigint::ToCString() const { 15566 const char* Bigint::ToCString() const {
15565 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); 15567 return BigintOperations::ToDecimalCString(*this, &BigintAllocator);
15566 } 15568 }
15567 15569
15568 15570
15569 void Bigint::PrintToJSONStream(JSONStream* stream, bool ref) const { 15571 void Bigint::PrintJSONImpl(JSONStream* stream, bool ref) const {
15570 Number::PrintToJSONStream(stream, ref); 15572 Number::PrintJSONImpl(stream, ref);
15571 } 15573 }
15572 15574
15573 15575
15574 // Synchronize with implementation in compiler (intrinsifier). 15576 // Synchronize with implementation in compiler (intrinsifier).
15575 class StringHasher : ValueObject { 15577 class StringHasher : ValueObject {
15576 public: 15578 public:
15577 StringHasher() : hash_(0) {} 15579 StringHasher() : hash_(0) {}
15578 void Add(int32_t ch) { 15580 void Add(int32_t ch) {
15579 hash_ = CombineHashes(hash_, ch); 15581 hash_ = CombineHashes(hash_, ch);
15580 } 15582 }
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
16414 buffer[pos++] = '.'; 16416 buffer[pos++] = '.';
16415 buffer[pos++] = '.'; 16417 buffer[pos++] = '.';
16416 } 16418 }
16417 ASSERT(pos <= buffer_len); 16419 ASSERT(pos <= buffer_len);
16418 buffer[pos++] = '\0'; 16420 buffer[pos++] = '\0';
16419 16421
16420 return buffer; 16422 return buffer;
16421 } 16423 }
16422 16424
16423 16425
16424 void String::PrintToJSONStream(JSONStream* stream, bool ref) const { 16426 void String::PrintJSONImpl(JSONStream* stream, bool ref) const {
16425 JSONObject jsobj(stream); 16427 JSONObject jsobj(stream);
16426 if (raw() == Symbols::OptimizedOut().raw()) { 16428 if (raw() == Symbols::OptimizedOut().raw()) {
16427 // TODO(turnidge): This is a hack. The user could have this 16429 // TODO(turnidge): This is a hack. The user could have this
16428 // special string in their program. Fixing this involves updating 16430 // special string in their program. Fixing this involves updating
16429 // the debugging api a bit. 16431 // the debugging api a bit.
16430 jsobj.AddProperty("type", ref ? "@Null" : "Null"); 16432 jsobj.AddProperty("type", ref ? "@Null" : "Null");
16431 jsobj.AddProperty("id", "objects/optimized-out"); 16433 jsobj.AddProperty("id", "objects/optimized-out");
16432 jsobj.AddProperty("valueAsString", "<optimized out>"); 16434 jsobj.AddProperty("valueAsString", "<optimized out>");
16433 return; 16435 return;
16434 } 16436 }
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
17235 result.SetCanonical(); 17237 result.SetCanonical();
17236 return result.raw(); 17238 return result.raw();
17237 } 17239 }
17238 17240
17239 17241
17240 const char* Bool::ToCString() const { 17242 const char* Bool::ToCString() const {
17241 return value() ? "true" : "false"; 17243 return value() ? "true" : "false";
17242 } 17244 }
17243 17245
17244 17246
17245 void Bool::PrintToJSONStream(JSONStream* stream, bool ref) const { 17247 void Bool::PrintJSONImpl(JSONStream* stream, bool ref) const {
17246 const char* str = ToCString(); 17248 const char* str = ToCString();
17247 JSONObject jsobj(stream); 17249 JSONObject jsobj(stream);
17248 jsobj.AddProperty("type", JSONType(ref)); 17250 jsobj.AddProperty("type", JSONType(ref));
17249 jsobj.AddPropertyF("id", "objects/bool-%s", str); 17251 jsobj.AddPropertyF("id", "objects/bool-%s", str);
17250 class Class& cls = Class::Handle(this->clazz()); 17252 class Class& cls = Class::Handle(this->clazz());
17251 jsobj.AddProperty("class", cls); 17253 jsobj.AddProperty("class", cls);
17252 jsobj.AddPropertyF("valueAsString", "%s", str); 17254 jsobj.AddPropertyF("valueAsString", "%s", str);
17253 } 17255 }
17254 17256
17255 17257
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
17325 } 17327 }
17326 const char* format = IsImmutable() ? 17328 const char* format = IsImmutable() ?
17327 "_ImmutableList len:%" Pd : "_List len:%" Pd; 17329 "_ImmutableList len:%" Pd : "_List len:%" Pd;
17328 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; 17330 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
17329 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 17331 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
17330 OS::SNPrint(chars, len, format, Length()); 17332 OS::SNPrint(chars, len, format, Length());
17331 return chars; 17333 return chars;
17332 } 17334 }
17333 17335
17334 17336
17335 void Array::PrintToJSONStream(JSONStream* stream, bool ref) const { 17337 void Array::PrintJSONImpl(JSONStream* stream, bool ref) const {
17336 JSONObject jsobj(stream); 17338 JSONObject jsobj(stream);
17337 PrintSharedInstanceJSON(&jsobj, ref); 17339 PrintSharedInstanceJSON(&jsobj, ref);
17338 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 17340 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
17339 const intptr_t id = ring->GetIdForObject(raw()); 17341 const intptr_t id = ring->GetIdForObject(raw());
17340 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 17342 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
17341 jsobj.AddProperty("length", Length()); 17343 jsobj.AddProperty("length", Length());
17342 if (ref) { 17344 if (ref) {
17343 return; 17345 return;
17344 } 17346 }
17345 { 17347 {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
17561 return "_GrowableList NULL"; 17563 return "_GrowableList NULL";
17562 } 17564 }
17563 const char* format = "Instance(length:%" Pd ") of '_GrowableList'"; 17565 const char* format = "Instance(length:%" Pd ") of '_GrowableList'";
17564 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; 17566 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
17565 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 17567 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
17566 OS::SNPrint(chars, len, format, Length()); 17568 OS::SNPrint(chars, len, format, Length());
17567 return chars; 17569 return chars;
17568 } 17570 }
17569 17571
17570 17572
17571 void GrowableObjectArray::PrintToJSONStream(JSONStream* stream, 17573 void GrowableObjectArray::PrintJSONImpl(JSONStream* stream,
17572 bool ref) const { 17574 bool ref) const {
17573 JSONObject jsobj(stream); 17575 JSONObject jsobj(stream);
17574 PrintSharedInstanceJSON(&jsobj, ref); 17576 PrintSharedInstanceJSON(&jsobj, ref);
17575 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 17577 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
17576 const intptr_t id = ring->GetIdForObject(raw()); 17578 const intptr_t id = ring->GetIdForObject(raw());
17577 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 17579 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
17578 jsobj.AddProperty("length", Length()); 17580 jsobj.AddProperty("length", Length());
17579 if (ref) { 17581 if (ref) {
17580 return; 17582 return;
17581 } 17583 }
17582 { 17584 {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
17685 float _z = z(); 17687 float _z = z();
17686 float _w = w(); 17688 float _w = w();
17687 // Calculate the size of the string. 17689 // Calculate the size of the string.
17688 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; 17690 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1;
17689 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 17691 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
17690 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); 17692 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w);
17691 return chars; 17693 return chars;
17692 } 17694 }
17693 17695
17694 17696
17695 void Float32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { 17697 void Float32x4::PrintJSONImpl(JSONStream* stream, bool ref) const {
17696 Instance::PrintToJSONStream(stream, ref); 17698 Instance::PrintJSONImpl(stream, ref);
17697 } 17699 }
17698 17700
17699 17701
17700 RawInt32x4* Int32x4::New(int32_t v0, int32_t v1, int32_t v2, int32_t v3, 17702 RawInt32x4* Int32x4::New(int32_t v0, int32_t v1, int32_t v2, int32_t v3,
17701 Heap::Space space) { 17703 Heap::Space space) {
17702 ASSERT(Isolate::Current()->object_store()->int32x4_class() != 17704 ASSERT(Isolate::Current()->object_store()->int32x4_class() !=
17703 Class::null()); 17705 Class::null());
17704 Int32x4& result = Int32x4::Handle(); 17706 Int32x4& result = Int32x4::Handle();
17705 { 17707 {
17706 RawObject* raw = Object::Allocate(Int32x4::kClassId, 17708 RawObject* raw = Object::Allocate(Int32x4::kClassId,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
17790 int32_t _z = z(); 17792 int32_t _z = z();
17791 int32_t _w = w(); 17793 int32_t _w = w();
17792 // Calculate the size of the string. 17794 // Calculate the size of the string.
17793 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; 17795 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1;
17794 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 17796 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
17795 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); 17797 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w);
17796 return chars; 17798 return chars;
17797 } 17799 }
17798 17800
17799 17801
17800 void Int32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { 17802 void Int32x4::PrintJSONImpl(JSONStream* stream, bool ref) const {
17801 Instance::PrintToJSONStream(stream, ref); 17803 Instance::PrintJSONImpl(stream, ref);
17802 } 17804 }
17803 17805
17804 17806
17805 RawFloat64x2* Float64x2::New(double value0, double value1, Heap::Space space) { 17807 RawFloat64x2* Float64x2::New(double value0, double value1, Heap::Space space) {
17806 ASSERT(Isolate::Current()->object_store()->float64x2_class() != 17808 ASSERT(Isolate::Current()->object_store()->float64x2_class() !=
17807 Class::null()); 17809 Class::null());
17808 Float64x2& result = Float64x2::Handle(); 17810 Float64x2& result = Float64x2::Handle();
17809 { 17811 {
17810 RawObject* raw = Object::Allocate(Float64x2::kClassId, 17812 RawObject* raw = Object::Allocate(Float64x2::kClassId,
17811 Float64x2::InstanceSize(), 17813 Float64x2::InstanceSize(),
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
17870 double _x = x(); 17872 double _x = x();
17871 double _y = y(); 17873 double _y = y();
17872 // Calculate the size of the string. 17874 // Calculate the size of the string.
17873 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y) + 1; 17875 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y) + 1;
17874 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 17876 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
17875 OS::SNPrint(chars, len, kFormat, _x, _y); 17877 OS::SNPrint(chars, len, kFormat, _x, _y);
17876 return chars; 17878 return chars;
17877 } 17879 }
17878 17880
17879 17881
17880 void Float64x2::PrintToJSONStream(JSONStream* stream, bool ref) const { 17882 void Float64x2::PrintJSONImpl(JSONStream* stream, bool ref) const {
17881 Instance::PrintToJSONStream(stream, ref); 17883 Instance::PrintJSONImpl(stream, ref);
17882 } 17884 }
17883 17885
17884 17886
17885 const intptr_t TypedData::element_size[] = { 17887 const intptr_t TypedData::element_size[] = {
17886 1, // kTypedDataInt8ArrayCid. 17888 1, // kTypedDataInt8ArrayCid.
17887 1, // kTypedDataUint8ArrayCid. 17889 1, // kTypedDataUint8ArrayCid.
17888 1, // kTypedDataUint8ClampedArrayCid. 17890 1, // kTypedDataUint8ClampedArrayCid.
17889 2, // kTypedDataInt16ArrayCid. 17891 2, // kTypedDataInt16ArrayCid.
17890 2, // kTypedDataUint16ArrayCid. 17892 2, // kTypedDataUint16ArrayCid.
17891 4, // kTypedDataInt32ArrayCid. 17893 4, // kTypedDataInt32ArrayCid.
(...skipping 29 matching lines...) Expand all
17921 } 17923 }
17922 return result.raw(); 17924 return result.raw();
17923 } 17925 }
17924 17926
17925 17927
17926 const char* TypedData::ToCString() const { 17928 const char* TypedData::ToCString() const {
17927 return "TypedData"; 17929 return "TypedData";
17928 } 17930 }
17929 17931
17930 17932
17931 void TypedData::PrintToJSONStream(JSONStream* stream, bool ref) const { 17933 void TypedData::PrintJSONImpl(JSONStream* stream, bool ref) const {
17932 Instance::PrintToJSONStream(stream, ref); 17934 Instance::PrintJSONImpl(stream, ref);
17933 } 17935 }
17934 17936
17935 17937
17936 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( 17938 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer(
17937 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { 17939 void* peer, Dart_WeakPersistentHandleFinalizer callback) const {
17938 return dart::AddFinalizer(*this, peer, callback); 17940 return dart::AddFinalizer(*this, peer, callback);
17939 } 17941 }
17940 17942
17941 17943
17942 RawExternalTypedData* ExternalTypedData::New(intptr_t class_id, 17944 RawExternalTypedData* ExternalTypedData::New(intptr_t class_id,
(...skipping 12 matching lines...) Expand all
17955 } 17957 }
17956 return result.raw(); 17958 return result.raw();
17957 } 17959 }
17958 17960
17959 17961
17960 const char* ExternalTypedData::ToCString() const { 17962 const char* ExternalTypedData::ToCString() const {
17961 return "ExternalTypedData"; 17963 return "ExternalTypedData";
17962 } 17964 }
17963 17965
17964 17966
17965 void ExternalTypedData::PrintToJSONStream(JSONStream* stream, 17967 void ExternalTypedData::PrintJSONImpl(JSONStream* stream,
17966 bool ref) const { 17968 bool ref) const {
17967 Instance::PrintToJSONStream(stream, ref); 17969 Instance::PrintJSONImpl(stream, ref);
17968 } 17970 }
17969 17971
17970 17972
17971 RawCapability* Capability::New(uint64_t id, Heap::Space space) { 17973 RawCapability* Capability::New(uint64_t id, Heap::Space space) {
17972 Capability& result = Capability::Handle(); 17974 Capability& result = Capability::Handle();
17973 { 17975 {
17974 RawObject* raw = Object::Allocate(Capability::kClassId, 17976 RawObject* raw = Object::Allocate(Capability::kClassId,
17975 Capability::InstanceSize(), 17977 Capability::InstanceSize(),
17976 space); 17978 space);
17977 NoGCScope no_gc; 17979 NoGCScope no_gc;
17978 result ^= raw; 17980 result ^= raw;
17979 result.raw_ptr()->id_ = id; 17981 result.raw_ptr()->id_ = id;
17980 } 17982 }
17981 return result.raw(); 17983 return result.raw();
17982 } 17984 }
17983 17985
17984 17986
17985 const char* Capability::ToCString() const { 17987 const char* Capability::ToCString() const {
17986 return "Capability"; 17988 return "Capability";
17987 } 17989 }
17988 17990
17989 17991
17990 void Capability::PrintToJSONStream(JSONStream* stream, bool ref) const { 17992 void Capability::PrintJSONImpl(JSONStream* stream, bool ref) const {
17991 Instance::PrintToJSONStream(stream, ref); 17993 Instance::PrintJSONImpl(stream, ref);
17992 } 17994 }
17993 17995
17994 17996
17995 RawReceivePort* ReceivePort::New(Dart_Port id, Heap::Space space) { 17997 RawReceivePort* ReceivePort::New(Dart_Port id, Heap::Space space) {
17996 Isolate* isolate = Isolate::Current(); 17998 Isolate* isolate = Isolate::Current();
17997 const SendPort& send_port = SendPort::Handle(isolate, SendPort::New(id)); 17999 const SendPort& send_port = SendPort::Handle(isolate, SendPort::New(id));
17998 18000
17999 ReceivePort& result = ReceivePort::Handle(isolate); 18001 ReceivePort& result = ReceivePort::Handle(isolate);
18000 { 18002 {
18001 RawObject* raw = Object::Allocate(ReceivePort::kClassId, 18003 RawObject* raw = Object::Allocate(ReceivePort::kClassId,
18002 ReceivePort::InstanceSize(), 18004 ReceivePort::InstanceSize(),
18003 space); 18005 space);
18004 NoGCScope no_gc; 18006 NoGCScope no_gc;
18005 result ^= raw; 18007 result ^= raw;
18006 result.raw_ptr()->send_port_ = send_port.raw(); 18008 result.raw_ptr()->send_port_ = send_port.raw();
18007 } 18009 }
18008 PortMap::SetLive(id); 18010 PortMap::SetLive(id);
18009 return result.raw(); 18011 return result.raw();
18010 } 18012 }
18011 18013
18012 18014
18013 const char* ReceivePort::ToCString() const { 18015 const char* ReceivePort::ToCString() const {
18014 return "ReceivePort"; 18016 return "ReceivePort";
18015 } 18017 }
18016 18018
18017 18019
18018 void ReceivePort::PrintToJSONStream(JSONStream* stream, bool ref) const { 18020 void ReceivePort::PrintJSONImpl(JSONStream* stream, bool ref) const {
18019 Instance::PrintToJSONStream(stream, ref); 18021 Instance::PrintJSONImpl(stream, ref);
18020 } 18022 }
18021 18023
18022 18024
18023 RawSendPort* SendPort::New(Dart_Port id, Heap::Space space) { 18025 RawSendPort* SendPort::New(Dart_Port id, Heap::Space space) {
18024 SendPort& result = SendPort::Handle(); 18026 SendPort& result = SendPort::Handle();
18025 { 18027 {
18026 RawObject* raw = Object::Allocate(SendPort::kClassId, 18028 RawObject* raw = Object::Allocate(SendPort::kClassId,
18027 SendPort::InstanceSize(), 18029 SendPort::InstanceSize(),
18028 space); 18030 space);
18029 NoGCScope no_gc; 18031 NoGCScope no_gc;
18030 result ^= raw; 18032 result ^= raw;
18031 result.raw_ptr()->id_ = id; 18033 result.raw_ptr()->id_ = id;
18032 } 18034 }
18033 return result.raw(); 18035 return result.raw();
18034 } 18036 }
18035 18037
18036 18038
18037 const char* SendPort::ToCString() const { 18039 const char* SendPort::ToCString() const {
18038 return "SendPort"; 18040 return "SendPort";
18039 } 18041 }
18040 18042
18041 18043
18042 void SendPort::PrintToJSONStream(JSONStream* stream, bool ref) const { 18044 void SendPort::PrintJSONImpl(JSONStream* stream, bool ref) const {
18043 Instance::PrintToJSONStream(stream, ref); 18045 Instance::PrintJSONImpl(stream, ref);
18044 } 18046 }
18045 18047
18046 18048
18047 const char* Closure::ToCString(const Instance& closure) { 18049 const char* Closure::ToCString(const Instance& closure) {
18048 const Function& fun = Function::Handle(Closure::function(closure)); 18050 const Function& fun = Function::Handle(Closure::function(closure));
18049 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); 18051 const bool is_implicit_closure = fun.IsImplicitClosureFunction();
18050 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString(); 18052 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString();
18051 const char* from = is_implicit_closure ? " from " : ""; 18053 const char* from = is_implicit_closure ? " from " : "";
18052 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; 18054 const char* fun_desc = is_implicit_closure ? fun.ToCString() : "";
18053 const char* format = "Closure: %s%s%s"; 18055 const char* format = "Closure: %s%s%s";
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
18218 return String::New(ToCStringInternal(&idx)); 18220 return String::New(ToCStringInternal(&idx));
18219 } 18221 }
18220 18222
18221 18223
18222 const char* Stacktrace::ToCString() const { 18224 const char* Stacktrace::ToCString() const {
18223 const String& trace = String::Handle(FullStacktrace()); 18225 const String& trace = String::Handle(FullStacktrace());
18224 return trace.ToCString(); 18226 return trace.ToCString();
18225 } 18227 }
18226 18228
18227 18229
18228 void Stacktrace::PrintToJSONStream(JSONStream* stream, bool ref) const { 18230 void Stacktrace::PrintJSONImpl(JSONStream* stream, bool ref) const {
18229 Instance::PrintToJSONStream(stream, ref); 18231 Instance::PrintJSONImpl(stream, ref);
18230 } 18232 }
18231 18233
18232 18234
18233 static intptr_t PrintOneStacktrace(Isolate* isolate, 18235 static intptr_t PrintOneStacktrace(Isolate* isolate,
18234 GrowableArray<char*>* frame_strings, 18236 GrowableArray<char*>* frame_strings,
18235 uword pc, 18237 uword pc,
18236 const Function& function, 18238 const Function& function,
18237 const Code& code, 18239 const Code& code,
18238 intptr_t frame_index) { 18240 intptr_t frame_index) {
18239 const char* kFormatWithCol = "#%-6d %s (%s:%d:%d)\n"; 18241 const char* kFormatWithCol = "#%-6d %s (%s:%d:%d)\n";
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
18430 const char* JSRegExp::ToCString() const { 18432 const char* JSRegExp::ToCString() const {
18431 const String& str = String::Handle(pattern()); 18433 const String& str = String::Handle(pattern());
18432 const char* format = "JSRegExp: pattern=%s flags=%s"; 18434 const char* format = "JSRegExp: pattern=%s flags=%s";
18433 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 18435 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
18434 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); 18436 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1);
18435 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 18437 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
18436 return chars; 18438 return chars;
18437 } 18439 }
18438 18440
18439 18441
18440 void JSRegExp::PrintToJSONStream(JSONStream* stream, bool ref) const { 18442 void JSRegExp::PrintJSONImpl(JSONStream* stream, bool ref) const {
18441 Instance::PrintToJSONStream(stream, ref); 18443 Instance::PrintJSONImpl(stream, ref);
18442 } 18444 }
18443 18445
18444 18446
18445 RawWeakProperty* WeakProperty::New(Heap::Space space) { 18447 RawWeakProperty* WeakProperty::New(Heap::Space space) {
18446 ASSERT(Isolate::Current()->object_store()->weak_property_class() 18448 ASSERT(Isolate::Current()->object_store()->weak_property_class()
18447 != Class::null()); 18449 != Class::null());
18448 RawObject* raw = Object::Allocate(WeakProperty::kClassId, 18450 RawObject* raw = Object::Allocate(WeakProperty::kClassId,
18449 WeakProperty::InstanceSize(), 18451 WeakProperty::InstanceSize(),
18450 space); 18452 space);
18451 return reinterpret_cast<RawWeakProperty*>(raw); 18453 return reinterpret_cast<RawWeakProperty*>(raw);
18452 } 18454 }
18453 18455
18454 18456
18455 const char* WeakProperty::ToCString() const { 18457 const char* WeakProperty::ToCString() const {
18456 return "_WeakProperty"; 18458 return "_WeakProperty";
18457 } 18459 }
18458 18460
18459 18461
18460 void WeakProperty::PrintToJSONStream(JSONStream* stream, bool ref) const { 18462 void WeakProperty::PrintJSONImpl(JSONStream* stream, bool ref) const {
18461 Instance::PrintToJSONStream(stream, ref); 18463 Instance::PrintJSONImpl(stream, ref);
18462 } 18464 }
18463 18465
18464 RawAbstractType* MirrorReference::GetAbstractTypeReferent() const { 18466 RawAbstractType* MirrorReference::GetAbstractTypeReferent() const {
18465 ASSERT(Object::Handle(referent()).IsAbstractType()); 18467 ASSERT(Object::Handle(referent()).IsAbstractType());
18466 return AbstractType::Cast(Object::Handle(referent())).raw(); 18468 return AbstractType::Cast(Object::Handle(referent())).raw();
18467 } 18469 }
18468 18470
18469 18471
18470 RawClass* MirrorReference::GetClassReferent() const { 18472 RawClass* MirrorReference::GetClassReferent() const {
18471 ASSERT(Object::Handle(referent()).IsClass()); 18473 ASSERT(Object::Handle(referent()).IsClass());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
18510 result.set_referent(referent); 18512 result.set_referent(referent);
18511 return result.raw(); 18513 return result.raw();
18512 } 18514 }
18513 18515
18514 18516
18515 const char* MirrorReference::ToCString() const { 18517 const char* MirrorReference::ToCString() const {
18516 return "_MirrorReference"; 18518 return "_MirrorReference";
18517 } 18519 }
18518 18520
18519 18521
18520 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 18522 void MirrorReference::PrintJSONImpl(JSONStream* stream, bool ref) const {
18521 Instance::PrintToJSONStream(stream, ref); 18523 Instance::PrintJSONImpl(stream, ref);
18522 } 18524 }
18523 18525
18524 18526
18525 void UserTag::MakeActive() const { 18527 void UserTag::MakeActive() const {
18526 Isolate* isolate = Isolate::Current(); 18528 Isolate* isolate = Isolate::Current();
18527 ASSERT(isolate != NULL); 18529 ASSERT(isolate != NULL);
18528 isolate->set_current_tag(*this); 18530 isolate->set_current_tag(*this);
18529 } 18531 }
18530 18532
18531 18533
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
18634 return UserTag::null(); 18636 return UserTag::null();
18635 } 18637 }
18636 18638
18637 18639
18638 const char* UserTag::ToCString() const { 18640 const char* UserTag::ToCString() const {
18639 const String& tag_label = String::Handle(label()); 18641 const String& tag_label = String::Handle(label());
18640 return tag_label.ToCString(); 18642 return tag_label.ToCString();
18641 } 18643 }
18642 18644
18643 18645
18644 void UserTag::PrintToJSONStream(JSONStream* stream, bool ref) const { 18646 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
18645 Instance::PrintToJSONStream(stream, ref); 18647 Instance::PrintJSONImpl(stream, ref);
18646 } 18648 }
18647 18649
18648 18650
18649 } // namespace dart 18651 } // namespace dart
OLDNEW
« runtime/vm/object.h ('K') | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698