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

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: gen js 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 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 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after
3883 const Library& lib = Library::Handle(library()); 3895 const Library& lib = Library::Handle(library());
3884 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); 3896 const char* library_name = lib.IsNull() ? "" : lib.ToCString();
3885 const char* class_name = String::Handle(Name()).ToCString(); 3897 const char* class_name = String::Handle(Name()).ToCString();
3886 intptr_t len = OS::SNPrint(NULL, 0, format, library_name, class_name) + 1; 3898 intptr_t len = OS::SNPrint(NULL, 0, format, library_name, class_name) + 1;
3887 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3899 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3888 OS::SNPrint(chars, len, format, library_name, class_name); 3900 OS::SNPrint(chars, len, format, library_name, class_name);
3889 return chars; 3901 return chars;
3890 } 3902 }
3891 3903
3892 3904
3893 void Class::PrintToJSONStream(JSONStream* stream, bool ref) const { 3905 void Class::PrintJSONImpl(JSONStream* stream, bool ref) const {
3894 JSONObject jsobj(stream); 3906 JSONObject jsobj(stream);
3895 if ((raw() == Class::null()) || (id() == kFreeListElement)) { 3907 if ((raw() == Class::null()) || (id() == kFreeListElement)) {
3896 jsobj.AddProperty("type", "Null"); 3908 jsobj.AddProperty("type", "Null");
3897 return; 3909 return;
3898 } 3910 }
3899 const char* internal_class_name = String::Handle(Name()).ToCString(); 3911 const char* internal_class_name = String::Handle(Name()).ToCString();
3900 const char* user_visible_class_name = 3912 const char* user_visible_class_name =
3901 String::Handle(UserVisibleName()).ToCString(); 3913 String::Handle(UserVisibleName()).ToCString();
3902 jsobj.AddProperty("type", JSONType(ref)); 3914 jsobj.AddProperty("type", JSONType(ref));
3903 jsobj.AddPropertyF("id", "classes/%" Pd "", id()); 3915 jsobj.AddPropertyF("id", "classes/%" Pd "", id());
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
4064 const char* UnresolvedClass::ToCString() const { 4076 const char* UnresolvedClass::ToCString() const {
4065 const char* format = "unresolved class '%s'"; 4077 const char* format = "unresolved class '%s'";
4066 const char* cname = String::Handle(Name()).ToCString(); 4078 const char* cname = String::Handle(Name()).ToCString();
4067 intptr_t len = OS::SNPrint(NULL, 0, format, cname) + 1; 4079 intptr_t len = OS::SNPrint(NULL, 0, format, cname) + 1;
4068 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 4080 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
4069 OS::SNPrint(chars, len, format, cname); 4081 OS::SNPrint(chars, len, format, cname);
4070 return chars; 4082 return chars;
4071 } 4083 }
4072 4084
4073 4085
4074 void UnresolvedClass::PrintToJSONStream(JSONStream* stream, bool ref) const { 4086 void UnresolvedClass::PrintJSONImpl(JSONStream* stream, bool ref) const {
4075 Object::PrintToJSONStream(stream, ref); 4087 Object::PrintJSONImpl(stream, ref);
4076 } 4088 }
4077 4089
4078 4090
4079 static uint32_t CombineHashes(uint32_t hash, uint32_t other_hash) { 4091 static uint32_t CombineHashes(uint32_t hash, uint32_t other_hash) {
4080 hash += other_hash; 4092 hash += other_hash;
4081 hash += hash << 10; 4093 hash += hash << 10;
4082 hash ^= hash >> 6; // Logical shift, unsigned hash. 4094 hash ^= hash >> 6; // Logical shift, unsigned hash.
4083 return hash; 4095 return hash;
4084 } 4096 }
4085 4097
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
4219 other_type = other.TypeAt(from_index + i); 4231 other_type = other.TypeAt(from_index + i);
4220 ASSERT(!other_type.IsNull()); 4232 ASSERT(!other_type.IsNull());
4221 if (!type.TypeTest(test_kind, other_type, bound_error)) { 4233 if (!type.TypeTest(test_kind, other_type, bound_error)) {
4222 return false; 4234 return false;
4223 } 4235 }
4224 } 4236 }
4225 return true; 4237 return true;
4226 } 4238 }
4227 4239
4228 4240
4229 void TypeArguments::PrintToJSONStream(JSONStream* stream, bool ref) const { 4241 void TypeArguments::PrintJSONImpl(JSONStream* stream, bool ref) const {
4230 JSONObject jsobj(stream); 4242 JSONObject jsobj(stream);
4231 if (IsNull()) {
4232 jsobj.AddProperty("type", ref ? "@Null" : "Null");
4233 jsobj.AddProperty("id", "objects/null");
4234 return;
4235 }
4236 // The index in the canonical_type_arguments table cannot be used as part of 4243 // The index in the canonical_type_arguments table cannot be used as part of
4237 // the object id (as in typearguments/id), because the indices are not 4244 // the object id (as in typearguments/id), because the indices are not
4238 // preserved when the table grows and the entries get rehashed. Use the ring. 4245 // preserved when the table grows and the entries get rehashed. Use the ring.
4239 Isolate* isolate = Isolate::Current(); 4246 Isolate* isolate = Isolate::Current();
4240 ObjectStore* object_store = isolate->object_store(); 4247 ObjectStore* object_store = isolate->object_store();
4241 const Array& table = Array::Handle(object_store->canonical_type_arguments()); 4248 const Array& table = Array::Handle(object_store->canonical_type_arguments());
4242 ASSERT(table.Length() > 0); 4249 ASSERT(table.Length() > 0);
4243 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 4250 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
4244 const intptr_t id = ring->GetIdForObject(raw()); 4251 const intptr_t id = ring->GetIdForObject(raw());
4245 jsobj.AddProperty("type", JSONType(ref)); 4252 jsobj.AddProperty("type", JSONType(ref));
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
4819 const char* kFormat = "PatchClass for %s"; 4826 const char* kFormat = "PatchClass for %s";
4820 const Class& cls = Class::Handle(patched_class()); 4827 const Class& cls = Class::Handle(patched_class());
4821 const char* cls_name = cls.ToCString(); 4828 const char* cls_name = cls.ToCString();
4822 intptr_t len = OS::SNPrint(NULL, 0, kFormat, cls_name) + 1; 4829 intptr_t len = OS::SNPrint(NULL, 0, kFormat, cls_name) + 1;
4823 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 4830 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
4824 OS::SNPrint(chars, len, kFormat, cls_name); 4831 OS::SNPrint(chars, len, kFormat, cls_name);
4825 return chars; 4832 return chars;
4826 } 4833 }
4827 4834
4828 4835
4829 void PatchClass::PrintToJSONStream(JSONStream* stream, bool ref) const { 4836 void PatchClass::PrintJSONImpl(JSONStream* stream, bool ref) const {
4830 Object::PrintToJSONStream(stream, ref); 4837 Object::PrintJSONImpl(stream, ref);
4831 } 4838 }
4832 4839
4833 4840
4834 RawPatchClass* PatchClass::New(const Class& patched_class, 4841 RawPatchClass* PatchClass::New(const Class& patched_class,
4835 const Class& source_class) { 4842 const Class& source_class) {
4836 const PatchClass& result = PatchClass::Handle(PatchClass::New()); 4843 const PatchClass& result = PatchClass::Handle(PatchClass::New());
4837 result.set_patched_class(patched_class); 4844 result.set_patched_class(patched_class);
4838 result.set_source_class(source_class); 4845 result.set_source_class(source_class);
4839 return result.raw(); 4846 return result.raw();
4840 } 4847 }
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after
6420 const char* function_name = String::Handle(name()).ToCString(); 6427 const char* function_name = String::Handle(name()).ToCString();
6421 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, 6428 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name,
6422 static_str, abstract_str, kind_str, const_str) + 1; 6429 static_str, abstract_str, kind_str, const_str) + 1;
6423 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 6430 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
6424 OS::SNPrint(chars, len, kFormat, function_name, 6431 OS::SNPrint(chars, len, kFormat, function_name,
6425 static_str, abstract_str, kind_str, const_str); 6432 static_str, abstract_str, kind_str, const_str);
6426 return chars; 6433 return chars;
6427 } 6434 }
6428 6435
6429 6436
6430 void Function::PrintToJSONStream(JSONStream* stream, bool ref) const { 6437 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const {
6431 const char* internal_name = String::Handle(name()).ToCString(); 6438 const char* internal_name = String::Handle(name()).ToCString();
6432 const char* user_name = 6439 const char* user_name =
6433 String::Handle(UserVisibleName()).ToCString(); 6440 String::Handle(UserVisibleName()).ToCString();
6434 Class& cls = Class::Handle(Owner()); 6441 Class& cls = Class::Handle(Owner());
6435 ASSERT(!cls.IsNull()); 6442 ASSERT(!cls.IsNull());
6436 Error& err = Error::Handle(); 6443 Error& err = Error::Handle();
6437 err ^= cls.EnsureIsFinalized(Isolate::Current()); 6444 err ^= cls.EnsureIsFinalized(Isolate::Current());
6438 ASSERT(err.IsNull()); 6445 ASSERT(err.IsNull());
6439 intptr_t id = -1; 6446 intptr_t id = -1;
6440 const char* selector = NULL; 6447 const char* selector = NULL;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
6530 Heap::kOld); 6537 Heap::kOld);
6531 return reinterpret_cast<RawClosureData*>(raw); 6538 return reinterpret_cast<RawClosureData*>(raw);
6532 } 6539 }
6533 6540
6534 6541
6535 const char* ClosureData::ToCString() const { 6542 const char* ClosureData::ToCString() const {
6536 return "ClosureData class"; 6543 return "ClosureData class";
6537 } 6544 }
6538 6545
6539 6546
6540 void ClosureData::PrintToJSONStream(JSONStream* stream, bool ref) const { 6547 void ClosureData::PrintJSONImpl(JSONStream* stream, bool ref) const {
6541 Object::PrintToJSONStream(stream, ref); 6548 Object::PrintJSONImpl(stream, ref);
6542 } 6549 }
6543 6550
6544 6551
6545 void RedirectionData::set_type(const Type& value) const { 6552 void RedirectionData::set_type(const Type& value) const {
6546 ASSERT(!value.IsNull()); 6553 ASSERT(!value.IsNull());
6547 StorePointer(&raw_ptr()->type_, value.raw()); 6554 StorePointer(&raw_ptr()->type_, value.raw());
6548 } 6555 }
6549 6556
6550 6557
6551 void RedirectionData::set_identifier(const String& value) const { 6558 void RedirectionData::set_identifier(const String& value) const {
(...skipping 13 matching lines...) Expand all
6565 Heap::kOld); 6572 Heap::kOld);
6566 return reinterpret_cast<RawRedirectionData*>(raw); 6573 return reinterpret_cast<RawRedirectionData*>(raw);
6567 } 6574 }
6568 6575
6569 6576
6570 const char* RedirectionData::ToCString() const { 6577 const char* RedirectionData::ToCString() const {
6571 return "RedirectionData class"; 6578 return "RedirectionData class";
6572 } 6579 }
6573 6580
6574 6581
6575 void RedirectionData::PrintToJSONStream(JSONStream* stream, bool ref) const { 6582 void RedirectionData::PrintJSONImpl(JSONStream* stream, bool ref) const {
6576 Object::PrintToJSONStream(stream, ref); 6583 Object::PrintJSONImpl(stream, ref);
6577 } 6584 }
6578 6585
6579 6586
6580 RawString* Field::GetterName(const String& field_name) { 6587 RawString* Field::GetterName(const String& field_name) {
6581 CompilerStats::make_accessor_name++; 6588 CompilerStats::make_accessor_name++;
6582 return String::Concat(Symbols::GetterPrefix(), field_name); 6589 return String::Concat(Symbols::GetterPrefix(), field_name);
6583 } 6590 }
6584 6591
6585 6592
6586 RawString* Field::GetterSymbol(const String& field_name) { 6593 RawString* Field::GetterSymbol(const String& field_name) {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
6770 const char* field_name = String::Handle(name()).ToCString(); 6777 const char* field_name = String::Handle(name()).ToCString();
6771 const Class& cls = Class::Handle(owner()); 6778 const Class& cls = Class::Handle(owner());
6772 const char* cls_name = String::Handle(cls.Name()).ToCString(); 6779 const char* cls_name = String::Handle(cls.Name()).ToCString();
6773 intptr_t len = 6780 intptr_t len =
6774 OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1; 6781 OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1;
6775 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 6782 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
6776 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2); 6783 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2);
6777 return chars; 6784 return chars;
6778 } 6785 }
6779 6786
6780 void Field::PrintToJSONStream(JSONStream* stream, bool ref) const { 6787 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const {
6781 JSONObject jsobj(stream); 6788 JSONObject jsobj(stream);
6782 const char* internal_field_name = String::Handle(name()).ToCString(); 6789 const char* internal_field_name = String::Handle(name()).ToCString();
6783 const char* field_name = String::Handle(UserVisibleName()).ToCString(); 6790 const char* field_name = String::Handle(UserVisibleName()).ToCString();
6784 Class& cls = Class::Handle(owner()); 6791 Class& cls = Class::Handle(owner());
6785 intptr_t id = cls.FindFieldIndex(*this); 6792 intptr_t id = cls.FindFieldIndex(*this);
6786 ASSERT(id >= 0); 6793 ASSERT(id >= 0);
6787 intptr_t cid = cls.id(); 6794 intptr_t cid = cls.id();
6788 jsobj.AddProperty("type", JSONType(ref)); 6795 jsobj.AddProperty("type", JSONType(ref));
6789 jsobj.AddPropertyF("id", "classes/%" Pd "/fields/%" Pd "", cid, id); 6796 jsobj.AddPropertyF("id", "classes/%" Pd "/fields/%" Pd "", cid, id);
6790 jsobj.AddProperty("name", internal_field_name); 6797 jsobj.AddProperty("name", internal_field_name);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
7042 return result.raw(); 7049 return result.raw();
7043 } 7050 }
7044 7051
7045 7052
7046 const char* LiteralToken::ToCString() const { 7053 const char* LiteralToken::ToCString() const {
7047 const String& token = String::Handle(literal()); 7054 const String& token = String::Handle(literal());
7048 return token.ToCString(); 7055 return token.ToCString();
7049 } 7056 }
7050 7057
7051 7058
7052 void LiteralToken::PrintToJSONStream(JSONStream* stream, bool ref) const { 7059 void LiteralToken::PrintJSONImpl(JSONStream* stream, bool ref) const {
7053 Object::PrintToJSONStream(stream, ref); 7060 Object::PrintJSONImpl(stream, ref);
7054 } 7061 }
7055 7062
7056 7063
7057 RawArray* TokenStream::TokenObjects() const { 7064 RawArray* TokenStream::TokenObjects() const {
7058 return raw_ptr()->token_objects_; 7065 return raw_ptr()->token_objects_;
7059 } 7066 }
7060 7067
7061 7068
7062 void TokenStream::SetTokenObjects(const Array& value) const { 7069 void TokenStream::SetTokenObjects(const Array& value) const {
7063 StorePointer(&raw_ptr()->token_objects_, value.raw()); 7070 StorePointer(&raw_ptr()->token_objects_, value.raw());
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
7487 } 7494 }
7488 return result.raw(); 7495 return result.raw();
7489 } 7496 }
7490 7497
7491 7498
7492 const char* TokenStream::ToCString() const { 7499 const char* TokenStream::ToCString() const {
7493 return "TokenStream"; 7500 return "TokenStream";
7494 } 7501 }
7495 7502
7496 7503
7497 void TokenStream::PrintToJSONStream(JSONStream* stream, bool ref) const { 7504 void TokenStream::PrintJSONImpl(JSONStream* stream, bool ref) const {
7498 Object::PrintToJSONStream(stream, ref); 7505 Object::PrintJSONImpl(stream, ref);
7499 } 7506 }
7500 7507
7501 7508
7502 TokenStream::Iterator::Iterator(const TokenStream& tokens, 7509 TokenStream::Iterator::Iterator(const TokenStream& tokens,
7503 intptr_t token_pos, 7510 intptr_t token_pos,
7504 Iterator::StreamType stream_type) 7511 Iterator::StreamType stream_type)
7505 : tokens_(TokenStream::Handle(tokens.raw())), 7512 : tokens_(TokenStream::Handle(tokens.raw())),
7506 data_(ExternalTypedData::Handle(tokens.GetStream())), 7513 data_(ExternalTypedData::Handle(tokens.GetStream())),
7507 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), 7514 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()),
7508 token_objects_(Array::Handle(tokens.TokenObjects())), 7515 token_objects_(Array::Handle(tokens.TokenObjects())),
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
7991 return result.raw(); 7998 return result.raw();
7992 } 7999 }
7993 8000
7994 8001
7995 const char* Script::ToCString() const { 8002 const char* Script::ToCString() const {
7996 return "Script"; 8003 return "Script";
7997 } 8004 }
7998 8005
7999 8006
8000 // See also Dart_ScriptGetTokenInfo. 8007 // See also Dart_ScriptGetTokenInfo.
8001 void Script::PrintToJSONStream(JSONStream* stream, bool ref) const { 8008 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const {
8002 JSONObject jsobj(stream); 8009 JSONObject jsobj(stream);
8003 jsobj.AddProperty("type", JSONType(ref)); 8010 jsobj.AddProperty("type", JSONType(ref));
8004 const String& name = String::Handle(url()); 8011 const String& name = String::Handle(url());
8005 ASSERT(!name.IsNull()); 8012 ASSERT(!name.IsNull());
8006 const String& encoded_url = String::Handle(String::EncodeURI(name)); 8013 const String& encoded_url = String::Handle(String::EncodeURI(name));
8007 ASSERT(!encoded_url.IsNull()); 8014 ASSERT(!encoded_url.IsNull());
8008 jsobj.AddPropertyF("id", "scripts/%s", encoded_url.ToCString()); 8015 jsobj.AddPropertyF("id", "scripts/%s", encoded_url.ToCString());
8009 jsobj.AddProperty("name", name.ToCString()); 8016 jsobj.AddProperty("name", name.ToCString());
8010 jsobj.AddProperty("user_name", name.ToCString()); 8017 jsobj.AddProperty("user_name", name.ToCString());
8011 jsobj.AddProperty("kind", GetKindAsCString()); 8018 jsobj.AddProperty("kind", GetKindAsCString());
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after
9259 const char* Library::ToCString() const { 9266 const char* Library::ToCString() const {
9260 const char* kFormat = "Library:'%s'"; 9267 const char* kFormat = "Library:'%s'";
9261 const String& name = String::Handle(url()); 9268 const String& name = String::Handle(url());
9262 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1; 9269 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1;
9263 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 9270 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
9264 OS::SNPrint(chars, len, kFormat, name.ToCString()); 9271 OS::SNPrint(chars, len, kFormat, name.ToCString());
9265 return chars; 9272 return chars;
9266 } 9273 }
9267 9274
9268 9275
9269 void Library::PrintToJSONStream(JSONStream* stream, bool ref) const { 9276 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const {
9270 const char* library_name = String::Handle(name()).ToCString(); 9277 const char* library_name = String::Handle(name()).ToCString();
9271 intptr_t id = index(); 9278 intptr_t id = index();
9272 ASSERT(id >= 0); 9279 ASSERT(id >= 0);
9273 JSONObject jsobj(stream); 9280 JSONObject jsobj(stream);
9274 jsobj.AddProperty("type", JSONType(ref)); 9281 jsobj.AddProperty("type", JSONType(ref));
9275 jsobj.AddPropertyF("id", "libraries/%" Pd "", id); 9282 jsobj.AddPropertyF("id", "libraries/%" Pd "", id);
9276 jsobj.AddProperty("user_name", library_name); 9283 jsobj.AddProperty("user_name", library_name);
9277 jsobj.AddProperty("name", library_name); 9284 jsobj.AddProperty("name", library_name);
9278 if (ref) { 9285 if (ref) {
9279 return; 9286 return;
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
9556 const char* LibraryPrefix::ToCString() const { 9563 const char* LibraryPrefix::ToCString() const {
9557 const char* kFormat = "LibraryPrefix:'%s'"; 9564 const char* kFormat = "LibraryPrefix:'%s'";
9558 const String& prefix = String::Handle(name()); 9565 const String& prefix = String::Handle(name());
9559 intptr_t len = OS::SNPrint(NULL, 0, kFormat, prefix.ToCString()) + 1; 9566 intptr_t len = OS::SNPrint(NULL, 0, kFormat, prefix.ToCString()) + 1;
9560 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 9567 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
9561 OS::SNPrint(chars, len, kFormat, prefix.ToCString()); 9568 OS::SNPrint(chars, len, kFormat, prefix.ToCString());
9562 return chars; 9569 return chars;
9563 } 9570 }
9564 9571
9565 9572
9566 void LibraryPrefix::PrintToJSONStream(JSONStream* stream, bool ref) const { 9573 void LibraryPrefix::PrintJSONImpl(JSONStream* stream, bool ref) const {
9567 Object::PrintToJSONStream(stream, ref); 9574 Object::PrintJSONImpl(stream, ref);
9568 } 9575 }
9569 9576
9570 9577
9571 void Namespace::set_metadata_field(const Field& value) const { 9578 void Namespace::set_metadata_field(const Field& value) const {
9572 StorePointer(&raw_ptr()->metadata_field_, value.raw()); 9579 StorePointer(&raw_ptr()->metadata_field_, value.raw());
9573 } 9580 }
9574 9581
9575 9582
9576 void Namespace::AddMetadata(intptr_t token_pos, const Class& owner_class) { 9583 void Namespace::AddMetadata(intptr_t token_pos, const Class& owner_class) {
9577 ASSERT(Field::Handle(metadata_field()).IsNull()); 9584 ASSERT(Field::Handle(metadata_field()).IsNull());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
9610 const char* Namespace::ToCString() const { 9617 const char* Namespace::ToCString() const {
9611 const char* kFormat = "Namespace for library '%s'"; 9618 const char* kFormat = "Namespace for library '%s'";
9612 const Library& lib = Library::Handle(library()); 9619 const Library& lib = Library::Handle(library());
9613 intptr_t len = OS::SNPrint(NULL, 0, kFormat, lib.ToCString()) + 1; 9620 intptr_t len = OS::SNPrint(NULL, 0, kFormat, lib.ToCString()) + 1;
9614 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 9621 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
9615 OS::SNPrint(chars, len, kFormat, lib.ToCString()); 9622 OS::SNPrint(chars, len, kFormat, lib.ToCString());
9616 return chars; 9623 return chars;
9617 } 9624 }
9618 9625
9619 9626
9620 void Namespace::PrintToJSONStream(JSONStream* stream, bool ref) const { 9627 void Namespace::PrintJSONImpl(JSONStream* stream, bool ref) const {
9621 Object::PrintToJSONStream(stream, ref); 9628 Object::PrintJSONImpl(stream, ref);
9622 } 9629 }
9623 9630
9624 9631
9625 bool Namespace::HidesName(const String& name) const { 9632 bool Namespace::HidesName(const String& name) const {
9626 // Quick check for common case with no combinators. 9633 // Quick check for common case with no combinators.
9627 if (hide_names() == show_names()) { 9634 if (hide_names() == show_names()) {
9628 ASSERT(hide_names() == Array::null()); 9635 ASSERT(hide_names() == Array::null());
9629 return false; 9636 return false;
9630 } 9637 }
9631 const String* plain_name = &name; 9638 const String* plain_name = &name;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
9876 } 9883 }
9877 return result.raw(); 9884 return result.raw();
9878 } 9885 }
9879 9886
9880 9887
9881 const char* Instructions::ToCString() const { 9888 const char* Instructions::ToCString() const {
9882 return "Instructions"; 9889 return "Instructions";
9883 } 9890 }
9884 9891
9885 9892
9886 void Instructions::PrintToJSONStream(JSONStream* stream, bool ref) const { 9893 void Instructions::PrintJSONImpl(JSONStream* stream, bool ref) const {
9887 Object::PrintToJSONStream(stream, ref); 9894 Object::PrintJSONImpl(stream, ref);
9888 } 9895 }
9889 9896
9890 9897
9891 intptr_t PcDescriptors::Length() const { 9898 intptr_t PcDescriptors::Length() const {
9892 return raw_ptr()->length_; 9899 return raw_ptr()->length_;
9893 } 9900 }
9894 9901
9895 9902
9896 void PcDescriptors::SetLength(intptr_t value) const { 9903 void PcDescriptors::SetLength(intptr_t value) const {
9897 raw_ptr()->length_ = value; 9904 raw_ptr()->length_ = value;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
10046 JSONObject descriptor(&members); 10053 JSONObject descriptor(&members);
10047 descriptor.AddPropertyF("pc", "%" Px "", PC(i)); 10054 descriptor.AddPropertyF("pc", "%" Px "", PC(i));
10048 descriptor.AddProperty("kind", KindAsStr(i)); 10055 descriptor.AddProperty("kind", KindAsStr(i));
10049 descriptor.AddProperty("deoptId", DeoptId(i)); 10056 descriptor.AddProperty("deoptId", DeoptId(i));
10050 descriptor.AddProperty("tokenPos", TokenPos(i)); 10057 descriptor.AddProperty("tokenPos", TokenPos(i));
10051 descriptor.AddProperty("tryIndex", TryIndex(i)); 10058 descriptor.AddProperty("tryIndex", TryIndex(i));
10052 } 10059 }
10053 } 10060 }
10054 10061
10055 10062
10056 void PcDescriptors::PrintToJSONStream(JSONStream* stream, bool ref) const { 10063 void PcDescriptors::PrintJSONImpl(JSONStream* stream, bool ref) const {
10057 JSONObject jsobj(stream); 10064 JSONObject jsobj(stream);
10058 PrintToJSONObject(&jsobj); 10065 PrintToJSONObject(&jsobj);
10059 } 10066 }
10060 10067
10061 10068
10062 // Verify assumptions (in debug mode only). 10069 // Verify assumptions (in debug mode only).
10063 // - No two deopt descriptors have the same deoptimization id. 10070 // - No two deopt descriptors have the same deoptimization id.
10064 // - No two ic-call descriptors have the same deoptimization id (type feedback). 10071 // - No two ic-call descriptors have the same deoptimization id (type feedback).
10065 // A function without unique ids is marked as non-optimizable (e.g., because of 10072 // A function without unique ids is marked as non-optimizable (e.g., because of
10066 // finally blocks). 10073 // finally blocks).
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
10197 intptr_t index = OS::SNPrint(chars, alloc_size, kFormat, PC()); 10204 intptr_t index = OS::SNPrint(chars, alloc_size, kFormat, PC());
10198 for (intptr_t i = 0; i < Length(); i++) { 10205 for (intptr_t i = 0; i < Length(); i++) {
10199 chars[index++] = IsObject(i) ? '1' : '0'; 10206 chars[index++] = IsObject(i) ? '1' : '0';
10200 } 10207 }
10201 chars[index] = '\0'; 10208 chars[index] = '\0';
10202 return chars; 10209 return chars;
10203 } 10210 }
10204 } 10211 }
10205 10212
10206 10213
10207 void Stackmap::PrintToJSONStream(JSONStream* stream, bool ref) const { 10214 void Stackmap::PrintJSONImpl(JSONStream* stream, bool ref) const {
10208 Object::PrintToJSONStream(stream, ref); 10215 Object::PrintJSONImpl(stream, ref);
10209 } 10216 }
10210 10217
10211 10218
10212 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { 10219 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const {
10213 ASSERT(var_index < Length()); 10220 ASSERT(var_index < Length());
10214 const Array& names = Array::Handle(raw_ptr()->names_); 10221 const Array& names = Array::Handle(raw_ptr()->names_);
10215 ASSERT(Length() == names.Length()); 10222 ASSERT(Length() == names.Length());
10216 String& name = String::Handle(); 10223 String& name = String::Handle();
10217 name ^= names.At(var_index); 10224 name ^= names.At(var_index);
10218 return name.raw(); 10225 return name.raw();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
10272 info.kind, 10279 info.kind,
10273 info.scope_id, 10280 info.scope_id,
10274 info.begin_pos, 10281 info.begin_pos,
10275 info.end_pos, 10282 info.end_pos,
10276 var_name.ToCString()); 10283 var_name.ToCString());
10277 } 10284 }
10278 return buffer; 10285 return buffer;
10279 } 10286 }
10280 10287
10281 10288
10282 void LocalVarDescriptors::PrintToJSONStream(JSONStream* stream, 10289 void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream,
10283 bool ref) const { 10290 bool ref) const {
10284 Object::PrintToJSONStream(stream, ref); 10291 Object::PrintJSONImpl(stream, ref);
10285 } 10292 }
10286 10293
10287 10294
10288 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { 10295 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) {
10289 ASSERT(Object::var_descriptors_class() != Class::null()); 10296 ASSERT(Object::var_descriptors_class() != Class::null());
10290 if (num_variables < 0 || num_variables > kMaxElements) { 10297 if (num_variables < 0 || num_variables > kMaxElements) {
10291 // This should be caught before we reach here. 10298 // This should be caught before we reach here.
10292 FATAL1("Fatal error in LocalVarDescriptors::New: " 10299 FATAL1("Fatal error in LocalVarDescriptors::New: "
10293 "invalid num_variables %" Pd "\n", num_variables); 10300 "invalid num_variables %" Pd "\n", num_variables);
10294 } 10301 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
10456 type ^= handled_types.At(k); 10463 type ^= handled_types.At(k);
10457 num_chars += OS::SNPrint((buffer + num_chars), 10464 num_chars += OS::SNPrint((buffer + num_chars),
10458 (len - num_chars), 10465 (len - num_chars),
10459 kFormat2, k, type.ToCString()); 10466 kFormat2, k, type.ToCString());
10460 } 10467 }
10461 } 10468 }
10462 return buffer; 10469 return buffer;
10463 } 10470 }
10464 10471
10465 10472
10466 void ExceptionHandlers::PrintToJSONStream(JSONStream* stream, 10473 void ExceptionHandlers::PrintJSONImpl(JSONStream* stream,
10467 bool ref) const { 10474 bool ref) const {
10468 Object::PrintToJSONStream(stream, ref); 10475 Object::PrintJSONImpl(stream, ref);
10469 } 10476 }
10470 10477
10471 10478
10472 intptr_t DeoptInfo::Length() const { 10479 intptr_t DeoptInfo::Length() const {
10473 return Smi::Value(raw_ptr()->length_); 10480 return Smi::Value(raw_ptr()->length_);
10474 } 10481 }
10475 10482
10476 10483
10477 intptr_t DeoptInfo::FromIndex(intptr_t index) const { 10484 intptr_t DeoptInfo::FromIndex(intptr_t index) const {
10478 return *(EntryAddr(index, kFromIndex)); 10485 return *(EntryAddr(index, kFromIndex));
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
10574 GrowableArray<DeoptInstr*> unpacked(length); 10581 GrowableArray<DeoptInstr*> unpacked(length);
10575 ToInstructions(deopt_table, &unpacked); 10582 ToInstructions(deopt_table, &unpacked);
10576 ASSERT(unpacked.length() == original.length()); 10583 ASSERT(unpacked.length() == original.length());
10577 for (intptr_t i = 0; i < unpacked.length(); ++i) { 10584 for (intptr_t i = 0; i < unpacked.length(); ++i) {
10578 ASSERT(unpacked[i]->Equals(*original[i])); 10585 ASSERT(unpacked[i]->Equals(*original[i]));
10579 } 10586 }
10580 return true; 10587 return true;
10581 } 10588 }
10582 10589
10583 10590
10584 void DeoptInfo::PrintToJSONStream(JSONStream* stream, bool ref) const { 10591 void DeoptInfo::PrintJSONImpl(JSONStream* stream, bool ref) const {
10585 Object::PrintToJSONStream(stream, ref); 10592 Object::PrintJSONImpl(stream, ref);
10586 } 10593 }
10587 10594
10588 10595
10589 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) { 10596 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) {
10590 ASSERT(Object::deopt_info_class() != Class::null()); 10597 ASSERT(Object::deopt_info_class() != Class::null());
10591 if ((num_commands < 0) || (num_commands > kMaxElements)) { 10598 if ((num_commands < 0) || (num_commands > kMaxElements)) {
10592 FATAL1("Fatal error in DeoptInfo::New(): invalid num_commands %" Pd "\n", 10599 FATAL1("Fatal error in DeoptInfo::New(): invalid num_commands %" Pd "\n",
10593 num_commands); 10600 num_commands);
10594 } 10601 }
10595 DeoptInfo& result = DeoptInfo::Handle(); 10602 DeoptInfo& result = DeoptInfo::Handle();
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
11129 // Number of array elements in one test entry. 11136 // Number of array elements in one test entry.
11130 intptr_t len = result.TestEntryLength(); 11137 intptr_t len = result.TestEntryLength();
11131 // IC data array must be null terminated (sentinel entry). 11138 // IC data array must be null terminated (sentinel entry).
11132 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); 11139 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld));
11133 result.set_ic_data(ic_data); 11140 result.set_ic_data(ic_data);
11134 result.WriteSentinel(ic_data); 11141 result.WriteSentinel(ic_data);
11135 return result.raw(); 11142 return result.raw();
11136 } 11143 }
11137 11144
11138 11145
11139 void ICData::PrintToJSONStream(JSONStream* stream, bool ref) const { 11146 void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const {
11140 Object::PrintToJSONStream(stream, ref); 11147 Object::PrintJSONImpl(stream, ref);
11141 } 11148 }
11142 11149
11143 11150
11144 Code::Comments& Code::Comments::New(intptr_t count) { 11151 Code::Comments& Code::Comments::New(intptr_t count) {
11145 Comments* comments; 11152 Comments* comments;
11146 if (count < 0 || count > (kIntptrMax / kNumberOfEntries)) { 11153 if (count < 0 || count > (kIntptrMax / kNumberOfEntries)) {
11147 // This should be caught before we reach here. 11154 // This should be caught before we reach here.
11148 FATAL1("Fatal error in Code::Comments::New: invalid count %" Pd "\n", 11155 FATAL1("Fatal error in Code::Comments::New: invalid count %" Pd "\n",
11149 count); 11156 count);
11150 } 11157 }
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
11613 ASSERT(!cls_name.IsNull()); 11620 ASSERT(!cls_name.IsNull());
11614 return String::Concat(Symbols::AllocationStubFor(), cls_name); 11621 return String::Concat(Symbols::AllocationStubFor(), cls_name);
11615 } else { 11622 } else {
11616 ASSERT(obj.IsFunction()); 11623 ASSERT(obj.IsFunction());
11617 // Dart function. 11624 // Dart function.
11618 return Function::Cast(obj).QualifiedUserVisibleName(); 11625 return Function::Cast(obj).QualifiedUserVisibleName();
11619 } 11626 }
11620 } 11627 }
11621 11628
11622 11629
11623 void Code::PrintToJSONStream(JSONStream* stream, bool ref) const { 11630 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const {
11624 JSONObject jsobj(stream); 11631 JSONObject jsobj(stream);
11625 jsobj.AddProperty("type", JSONType(ref)); 11632 jsobj.AddProperty("type", JSONType(ref));
11626 jsobj.AddPropertyF("id", "code/%" Px64"-%" Px "", compile_timestamp(), 11633 jsobj.AddPropertyF("id", "code/%" Px64"-%" Px "", compile_timestamp(),
11627 EntryPoint()); 11634 EntryPoint());
11628 jsobj.AddPropertyF("start", "%" Px "", EntryPoint()); 11635 jsobj.AddPropertyF("start", "%" Px "", EntryPoint());
11629 jsobj.AddPropertyF("end", "%" Px "", EntryPoint() + Size()); 11636 jsobj.AddPropertyF("end", "%" Px "", EntryPoint() + Size());
11630 jsobj.AddProperty("is_optimized", is_optimized()); 11637 jsobj.AddProperty("is_optimized", is_optimized());
11631 jsobj.AddProperty("is_alive", is_alive()); 11638 jsobj.AddProperty("is_alive", is_alive());
11632 jsobj.AddProperty("kind", "Dart"); 11639 jsobj.AddProperty("kind", "Dart");
11633 const String& name = String::Handle(Name()); 11640 const String& name = String::Handle(Name());
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
11832 11839
11833 const Context& parent_ctx = Context::Handle(parent()); 11840 const Context& parent_ctx = Context::Handle(parent());
11834 if (!parent_ctx.IsNull()) { 11841 if (!parent_ctx.IsNull()) {
11835 parent_ctx.Dump(indent + 2); 11842 parent_ctx.Dump(indent + 2);
11836 } 11843 }
11837 IndentN(indent); 11844 IndentN(indent);
11838 OS::PrintErr("}\n"); 11845 OS::PrintErr("}\n");
11839 } 11846 }
11840 11847
11841 11848
11842 void Context::PrintToJSONStream(JSONStream* stream, bool ref) const { 11849 void Context::PrintJSONImpl(JSONStream* stream, bool ref) const {
11843 Object::PrintToJSONStream(stream, ref); 11850 Object::PrintJSONImpl(stream, ref);
11844 } 11851 }
11845 11852
11846 11853
11847 RawContextScope* ContextScope::New(intptr_t num_variables) { 11854 RawContextScope* ContextScope::New(intptr_t num_variables) {
11848 ASSERT(Object::context_scope_class() != Class::null()); 11855 ASSERT(Object::context_scope_class() != Class::null());
11849 if (num_variables < 0 || num_variables > kMaxElements) { 11856 if (num_variables < 0 || num_variables > kMaxElements) {
11850 // This should be caught before we reach here. 11857 // This should be caught before we reach here.
11851 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n", 11858 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n",
11852 num_variables); 11859 num_variables);
11853 } 11860 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
11951 intptr_t context_level) const { 11958 intptr_t context_level) const {
11952 VariableDescAddr(scope_index)->context_level = Smi::New(context_level); 11959 VariableDescAddr(scope_index)->context_level = Smi::New(context_level);
11953 } 11960 }
11954 11961
11955 11962
11956 const char* ContextScope::ToCString() const { 11963 const char* ContextScope::ToCString() const {
11957 return "ContextScope"; 11964 return "ContextScope";
11958 } 11965 }
11959 11966
11960 11967
11961 void ContextScope::PrintToJSONStream(JSONStream* stream, bool ref) const { 11968 void ContextScope::PrintJSONImpl(JSONStream* stream, bool ref) const {
11962 Object::PrintToJSONStream(stream, ref); 11969 Object::PrintJSONImpl(stream, ref);
11963 } 11970 }
11964 11971
11965 11972
11966 RawArray* MegamorphicCache::buckets() const { 11973 RawArray* MegamorphicCache::buckets() const {
11967 return raw_ptr()->buckets_; 11974 return raw_ptr()->buckets_;
11968 } 11975 }
11969 11976
11970 11977
11971 void MegamorphicCache::set_buckets(const Array& buckets) const { 11978 void MegamorphicCache::set_buckets(const Array& buckets) const {
11972 StorePointer(&raw_ptr()->buckets_, buckets.raw()); 11979 StorePointer(&raw_ptr()->buckets_, buckets.raw());
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
12067 } while (i != index); 12074 } while (i != index);
12068 UNREACHABLE(); 12075 UNREACHABLE();
12069 } 12076 }
12070 12077
12071 12078
12072 const char* MegamorphicCache::ToCString() const { 12079 const char* MegamorphicCache::ToCString() const {
12073 return ""; 12080 return "";
12074 } 12081 }
12075 12082
12076 12083
12077 void MegamorphicCache::PrintToJSONStream(JSONStream* stream, bool ref) const { 12084 void MegamorphicCache::PrintJSONImpl(JSONStream* stream, bool ref) const {
12078 Object::PrintToJSONStream(stream, ref); 12085 Object::PrintJSONImpl(stream, ref);
12079 } 12086 }
12080 12087
12081 12088
12082 RawSubtypeTestCache* SubtypeTestCache::New() { 12089 RawSubtypeTestCache* SubtypeTestCache::New() {
12083 ASSERT(Object::subtypetestcache_class() != Class::null()); 12090 ASSERT(Object::subtypetestcache_class() != Class::null());
12084 SubtypeTestCache& result = SubtypeTestCache::Handle(); 12091 SubtypeTestCache& result = SubtypeTestCache::Handle();
12085 { 12092 {
12086 // SubtypeTestCache objects are long living objects, allocate them in the 12093 // SubtypeTestCache objects are long living objects, allocate them in the
12087 // old generation. 12094 // old generation.
12088 RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId, 12095 RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
12143 data.At(data_pos + kInstantiatorTypeArguments); 12150 data.At(data_pos + kInstantiatorTypeArguments);
12144 *test_result ^= data.At(data_pos + kTestResult); 12151 *test_result ^= data.At(data_pos + kTestResult);
12145 } 12152 }
12146 12153
12147 12154
12148 const char* SubtypeTestCache::ToCString() const { 12155 const char* SubtypeTestCache::ToCString() const {
12149 return "SubtypeTestCache"; 12156 return "SubtypeTestCache";
12150 } 12157 }
12151 12158
12152 12159
12153 void SubtypeTestCache::PrintToJSONStream(JSONStream* stream, bool ref) const { 12160 void SubtypeTestCache::PrintJSONImpl(JSONStream* stream, bool ref) const {
12154 Object::PrintToJSONStream(stream, ref); 12161 Object::PrintJSONImpl(stream, ref);
12155 } 12162 }
12156 12163
12157 12164
12158 const char* Error::ToErrorCString() const { 12165 const char* Error::ToErrorCString() const {
12159 UNREACHABLE(); 12166 UNREACHABLE();
12160 return "Internal Error"; 12167 return "Internal Error";
12161 } 12168 }
12162 12169
12163 12170
12164 const char* Error::ToCString() const { 12171 const char* Error::ToCString() const {
12165 // Error is an abstract class. We should never reach here. 12172 // Error is an abstract class. We should never reach here.
12166 UNREACHABLE(); 12173 UNREACHABLE();
12167 return "Error"; 12174 return "Error";
12168 } 12175 }
12169 12176
12170 12177
12171 void Error::PrintToJSONStream(JSONStream* stream, bool ref) const { 12178 void Error::PrintJSONImpl(JSONStream* stream, bool ref) const {
12172 UNREACHABLE(); 12179 UNREACHABLE();
12173 } 12180 }
12174 12181
12175 12182
12176 RawApiError* ApiError::New() { 12183 RawApiError* ApiError::New() {
12177 ASSERT(Object::api_error_class() != Class::null()); 12184 ASSERT(Object::api_error_class() != Class::null());
12178 RawObject* raw = Object::Allocate(ApiError::kClassId, 12185 RawObject* raw = Object::Allocate(ApiError::kClassId,
12179 ApiError::InstanceSize(), 12186 ApiError::InstanceSize(),
12180 Heap::kOld); 12187 Heap::kOld);
12181 return reinterpret_cast<RawApiError*>(raw); 12188 return reinterpret_cast<RawApiError*>(raw);
(...skipping 24 matching lines...) Expand all
12206 const String& msg_str = String::Handle(message()); 12213 const String& msg_str = String::Handle(message());
12207 return msg_str.ToCString(); 12214 return msg_str.ToCString();
12208 } 12215 }
12209 12216
12210 12217
12211 const char* ApiError::ToCString() const { 12218 const char* ApiError::ToCString() const {
12212 return "ApiError"; 12219 return "ApiError";
12213 } 12220 }
12214 12221
12215 12222
12216 void ApiError::PrintToJSONStream(JSONStream* stream, bool ref) const { 12223 void ApiError::PrintJSONImpl(JSONStream* stream, bool ref) const {
12217 JSONObject jsobj(stream); 12224 JSONObject jsobj(stream);
12218 jsobj.AddProperty("type", "Error"); 12225 jsobj.AddProperty("type", "Error");
12219 jsobj.AddProperty("id", ""); 12226 jsobj.AddProperty("id", "");
12220 jsobj.AddProperty("kind", JSONType(false)); 12227 jsobj.AddProperty("kind", JSONType(false));
12221 jsobj.AddProperty("message", ToErrorCString()); 12228 jsobj.AddProperty("message", ToErrorCString());
12222 } 12229 }
12223 12230
12224 12231
12225 RawLanguageError* LanguageError::New() { 12232 RawLanguageError* LanguageError::New() {
12226 ASSERT(Object::language_error_class() != Class::null()); 12233 ASSERT(Object::language_error_class() != Class::null());
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
12394 const String& msg_str = String::Handle(FormatMessage()); 12401 const String& msg_str = String::Handle(FormatMessage());
12395 return msg_str.ToCString(); 12402 return msg_str.ToCString();
12396 } 12403 }
12397 12404
12398 12405
12399 const char* LanguageError::ToCString() const { 12406 const char* LanguageError::ToCString() const {
12400 return "LanguageError"; 12407 return "LanguageError";
12401 } 12408 }
12402 12409
12403 12410
12404 void LanguageError::PrintToJSONStream(JSONStream* stream, bool ref) const { 12411 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const {
12405 JSONObject jsobj(stream); 12412 JSONObject jsobj(stream);
12406 jsobj.AddProperty("type", "Error"); 12413 jsobj.AddProperty("type", "Error");
12407 jsobj.AddProperty("id", ""); 12414 jsobj.AddProperty("id", "");
12408 jsobj.AddProperty("kind", JSONType(false)); 12415 jsobj.AddProperty("kind", JSONType(false));
12409 jsobj.AddProperty("message", ToErrorCString()); 12416 jsobj.AddProperty("message", ToErrorCString());
12410 } 12417 }
12411 12418
12412 12419
12413 RawUnhandledException* UnhandledException::New(const Instance& exception, 12420 RawUnhandledException* UnhandledException::New(const Instance& exception,
12414 const Instance& stacktrace, 12421 const Instance& stacktrace,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
12472 return chars; 12479 return chars;
12473 } 12480 }
12474 12481
12475 12482
12476 const char* UnhandledException::ToCString() const { 12483 const char* UnhandledException::ToCString() const {
12477 return "UnhandledException"; 12484 return "UnhandledException";
12478 } 12485 }
12479 12486
12480 12487
12481 12488
12482 void UnhandledException::PrintToJSONStream(JSONStream* stream, 12489 void UnhandledException::PrintJSONImpl(JSONStream* stream,
12483 bool ref) const { 12490 bool ref) const {
12484 JSONObject jsobj(stream); 12491 JSONObject jsobj(stream);
12485 jsobj.AddProperty("type", "Error"); 12492 jsobj.AddProperty("type", "Error");
12486 jsobj.AddProperty("id", ""); 12493 jsobj.AddProperty("id", "");
12487 jsobj.AddProperty("kind", JSONType(false)); 12494 jsobj.AddProperty("kind", JSONType(false));
12488 jsobj.AddProperty("message", ToErrorCString()); 12495 jsobj.AddProperty("message", ToErrorCString());
12489 12496
12490 Instance& instance = Instance::Handle(); 12497 Instance& instance = Instance::Handle();
12491 instance = exception(); 12498 instance = exception();
12492 jsobj.AddProperty("exception", instance); 12499 jsobj.AddProperty("exception", instance);
12493 instance = stacktrace(); 12500 instance = stacktrace();
(...skipping 25 matching lines...) Expand all
12519 const String& msg_str = String::Handle(message()); 12526 const String& msg_str = String::Handle(message());
12520 return msg_str.ToCString(); 12527 return msg_str.ToCString();
12521 } 12528 }
12522 12529
12523 12530
12524 const char* UnwindError::ToCString() const { 12531 const char* UnwindError::ToCString() const {
12525 return "UnwindError"; 12532 return "UnwindError";
12526 } 12533 }
12527 12534
12528 12535
12529 void UnwindError::PrintToJSONStream(JSONStream* stream, bool ref) const { 12536 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const {
12530 JSONObject jsobj(stream); 12537 JSONObject jsobj(stream);
12531 jsobj.AddProperty("type", "Error"); 12538 jsobj.AddProperty("type", "Error");
12532 jsobj.AddProperty("id", ""); 12539 jsobj.AddProperty("id", "");
12533 jsobj.AddProperty("kind", JSONType(false)); 12540 jsobj.AddProperty("kind", JSONType(false));
12534 jsobj.AddProperty("message", ToErrorCString()); 12541 jsobj.AddProperty("message", ToErrorCString());
12535 } 12542 }
12536 12543
12537 12544
12538 RawObject* Instance::Evaluate(const String& expr, 12545 RawObject* Instance::Evaluate(const String& expr,
12539 const Array& param_names, 12546 const Array& param_names,
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
12964 for (intptr_t i = 0; i < NumNativeFields(); i++) { 12971 for (intptr_t i = 0; i < NumNativeFields(); i++) {
12965 intptr_t value = GetNativeField(i); 12972 intptr_t value = GetNativeField(i);
12966 JSONObject jsfield(&jsarr); 12973 JSONObject jsfield(&jsarr);
12967 jsfield.AddProperty("index", i); 12974 jsfield.AddProperty("index", i);
12968 jsfield.AddProperty("value", value); 12975 jsfield.AddProperty("value", value);
12969 } 12976 }
12970 } 12977 }
12971 } 12978 }
12972 12979
12973 12980
12974 void Instance::PrintToJSONStream(JSONStream* stream, bool ref) const { 12981 void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const {
12975 JSONObject jsobj(stream); 12982 JSONObject jsobj(stream);
12976 12983
12977 // Handle certain special instance values. 12984 // Handle certain special instance values.
12978 if (IsNull()) { 12985 if (raw() == Object::sentinel().raw()) {
12979 jsobj.AddProperty("type", ref ? "@Null" : "Null");
12980 jsobj.AddProperty("id", "objects/null");
12981 jsobj.AddProperty("valueAsString", "null");
12982 return;
12983 } else if (raw() == Object::sentinel().raw()) {
12984 jsobj.AddProperty("type", ref ? "@Null" : "Null"); 12986 jsobj.AddProperty("type", ref ? "@Null" : "Null");
12985 jsobj.AddProperty("id", "objects/not-initialized"); 12987 jsobj.AddProperty("id", "objects/not-initialized");
12986 jsobj.AddProperty("valueAsString", "<not initialized>"); 12988 jsobj.AddProperty("valueAsString", "<not initialized>");
12987 return; 12989 return;
12988 } else if (raw() == Object::transition_sentinel().raw()) { 12990 } else if (raw() == Object::transition_sentinel().raw()) {
12989 jsobj.AddProperty("type", ref ? "@Null" : "Null"); 12991 jsobj.AddProperty("type", ref ? "@Null" : "Null");
12990 jsobj.AddProperty("id", "objects/being-initialized"); 12992 jsobj.AddProperty("id", "objects/being-initialized");
12991 jsobj.AddProperty("valueAsString", "<being initialized>"); 12993 jsobj.AddProperty("valueAsString", "<being initialized>");
12992 return; 12994 return;
12993 } 12995 }
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
13438 } 13440 }
13439 13441
13440 13442
13441 const char* AbstractType::ToCString() const { 13443 const char* AbstractType::ToCString() const {
13442 // AbstractType is an abstract class. 13444 // AbstractType is an abstract class.
13443 UNREACHABLE(); 13445 UNREACHABLE();
13444 return "AbstractType"; 13446 return "AbstractType";
13445 } 13447 }
13446 13448
13447 13449
13448 void AbstractType::PrintToJSONStream(JSONStream* stream, bool ref) const { 13450 void AbstractType::PrintJSONImpl(JSONStream* stream, bool ref) const {
13449 if (IsNull()) {
13450 Instance::PrintToJSONStream(stream, ref);
13451 return;
13452 }
13453 UNREACHABLE(); 13451 UNREACHABLE();
13454 } 13452 }
13455 13453
13456 13454
13457 RawType* Type::NullType() { 13455 RawType* Type::NullType() {
13458 return Isolate::Current()->object_store()->null_type(); 13456 return Isolate::Current()->object_store()->null_type();
13459 } 13457 }
13460 13458
13461 13459
13462 RawType* Type::DynamicType() { 13460 RawType* Type::DynamicType() {
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
14046 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 14044 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
14047 OS::SNPrint(chars, len, format, class_name, args_cstr); 14045 OS::SNPrint(chars, len, format, class_name, args_cstr);
14048 return chars; 14046 return chars;
14049 } 14047 }
14050 } else { 14048 } else {
14051 return "Unresolved Type"; 14049 return "Unresolved Type";
14052 } 14050 }
14053 } 14051 }
14054 14052
14055 14053
14056 void Type::PrintToJSONStream(JSONStream* stream, bool ref) const { 14054 void Type::PrintJSONImpl(JSONStream* stream, bool ref) const {
14057 JSONObject jsobj(stream); 14055 JSONObject jsobj(stream);
14058 PrintSharedInstanceJSON(&jsobj, ref); 14056 PrintSharedInstanceJSON(&jsobj, ref);
14059 if (IsCanonical()) { 14057 if (IsCanonical()) {
14060 const Class& type_cls = Class::Handle(type_class()); 14058 const Class& type_cls = Class::Handle(type_class());
14061 intptr_t id = type_cls.FindCanonicalTypeIndex(*this); 14059 intptr_t id = type_cls.FindCanonicalTypeIndex(*this);
14062 ASSERT(id >= 0); 14060 ASSERT(id >= 0);
14063 intptr_t cid = type_cls.id(); 14061 intptr_t cid = type_cls.id();
14064 jsobj.AddPropertyF("id", "classes/%" Pd "/types/%" Pd "", cid, id); 14062 jsobj.AddPropertyF("id", "classes/%" Pd "/types/%" Pd "", cid, id);
14065 jsobj.AddProperty("type_class", type_cls); 14063 jsobj.AddProperty("type_class", type_cls);
14066 } else { 14064 } else {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
14219 } else { 14217 } else {
14220 const char* format = "TypeRef: %s<...>"; 14218 const char* format = "TypeRef: %s<...>";
14221 const intptr_t len = OS::SNPrint(NULL, 0, format, type_cstr) + 1; 14219 const intptr_t len = OS::SNPrint(NULL, 0, format, type_cstr) + 1;
14222 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 14220 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
14223 OS::SNPrint(chars, len, format, type_cstr); 14221 OS::SNPrint(chars, len, format, type_cstr);
14224 return chars; 14222 return chars;
14225 } 14223 }
14226 } 14224 }
14227 14225
14228 14226
14229 void TypeRef::PrintToJSONStream(JSONStream* stream, bool ref) const { 14227 void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const {
14230 JSONObject jsobj(stream); 14228 JSONObject jsobj(stream);
14231 PrintSharedInstanceJSON(&jsobj, ref); 14229 PrintSharedInstanceJSON(&jsobj, ref);
14232 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 14230 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
14233 const intptr_t id = ring->GetIdForObject(raw()); 14231 const intptr_t id = ring->GetIdForObject(raw());
14234 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 14232 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
14235 const char* name = String::Handle(Name()).ToCString(); 14233 const char* name = String::Handle(Name()).ToCString();
14236 const char* user_name = String::Handle(UserVisibleName()).ToCString(); 14234 const char* user_name = String::Handle(UserVisibleName()).ToCString();
14237 jsobj.AddProperty("name", name); 14235 jsobj.AddProperty("name", name);
14238 jsobj.AddProperty("user_name", user_name); 14236 jsobj.AddProperty("user_name", user_name);
14239 if (ref) { 14237 if (ref) {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
14436 const AbstractType& upper_bound = AbstractType::Handle(bound()); 14434 const AbstractType& upper_bound = AbstractType::Handle(bound());
14437 const char* bound_cstr = String::Handle(upper_bound.Name()).ToCString(); 14435 const char* bound_cstr = String::Handle(upper_bound.Name()).ToCString();
14438 intptr_t len = OS::SNPrint( 14436 intptr_t len = OS::SNPrint(
14439 NULL, 0, format, name_cstr, index(), cls_cstr, bound_cstr) + 1; 14437 NULL, 0, format, name_cstr, index(), cls_cstr, bound_cstr) + 1;
14440 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 14438 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
14441 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr, bound_cstr); 14439 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr, bound_cstr);
14442 return chars; 14440 return chars;
14443 } 14441 }
14444 14442
14445 14443
14446 void TypeParameter::PrintToJSONStream(JSONStream* stream, bool ref) const { 14444 void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const {
14447 JSONObject jsobj(stream); 14445 JSONObject jsobj(stream);
14448 PrintSharedInstanceJSON(&jsobj, ref); 14446 PrintSharedInstanceJSON(&jsobj, ref);
14449 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 14447 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
14450 const intptr_t id = ring->GetIdForObject(raw()); 14448 const intptr_t id = ring->GetIdForObject(raw());
14451 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 14449 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
14452 const char* name = String::Handle(Name()).ToCString(); 14450 const char* name = String::Handle(Name()).ToCString();
14453 const char* user_name = String::Handle(UserVisibleName()).ToCString(); 14451 const char* user_name = String::Handle(UserVisibleName()).ToCString();
14454 jsobj.AddProperty("name", name); 14452 jsobj.AddProperty("name", name);
14455 jsobj.AddProperty("user_name", user_name); 14453 jsobj.AddProperty("user_name", user_name);
14456 const Class& param_cls = Class::Handle(parameterized_class()); 14454 const Class& param_cls = Class::Handle(parameterized_class());
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
14640 const char* cls_cstr = String::Handle(cls.Name()).ToCString(); 14638 const char* cls_cstr = String::Handle(cls.Name()).ToCString();
14641 intptr_t len = OS::SNPrint( 14639 intptr_t len = OS::SNPrint(
14642 NULL, 0, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr) + 1; 14640 NULL, 0, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr) + 1;
14643 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 14641 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
14644 OS::SNPrint( 14642 OS::SNPrint(
14645 chars, len, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr); 14643 chars, len, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr);
14646 return chars; 14644 return chars;
14647 } 14645 }
14648 14646
14649 14647
14650 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { 14648 void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const {
14651 JSONObject jsobj(stream); 14649 JSONObject jsobj(stream);
14652 PrintSharedInstanceJSON(&jsobj, ref); 14650 PrintSharedInstanceJSON(&jsobj, ref);
14653 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 14651 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
14654 const intptr_t id = ring->GetIdForObject(raw()); 14652 const intptr_t id = ring->GetIdForObject(raw());
14655 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 14653 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
14656 const char* name = String::Handle(Name()).ToCString(); 14654 const char* name = String::Handle(Name()).ToCString();
14657 const char* user_name = String::Handle(UserVisibleName()).ToCString(); 14655 const char* user_name = String::Handle(UserVisibleName()).ToCString();
14658 jsobj.AddProperty("name", name); 14656 jsobj.AddProperty("name", name);
14659 jsobj.AddProperty("user_name", user_name); 14657 jsobj.AddProperty("user_name", user_name);
14660 if (ref) { 14658 if (ref) {
(...skipping 26 matching lines...) Expand all
14687 const char* first_mixin_type_cstr = String::Handle(AbstractType::Handle( 14685 const char* first_mixin_type_cstr = String::Handle(AbstractType::Handle(
14688 MixinTypeAt(0)).Name()).ToCString(); 14686 MixinTypeAt(0)).Name()).ToCString();
14689 intptr_t len = OS::SNPrint( 14687 intptr_t len = OS::SNPrint(
14690 NULL, 0, format, super_type_cstr, first_mixin_type_cstr) + 1; 14688 NULL, 0, format, super_type_cstr, first_mixin_type_cstr) + 1;
14691 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 14689 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
14692 OS::SNPrint(chars, len, format, super_type_cstr, first_mixin_type_cstr); 14690 OS::SNPrint(chars, len, format, super_type_cstr, first_mixin_type_cstr);
14693 return chars; 14691 return chars;
14694 } 14692 }
14695 14693
14696 14694
14697 void MixinAppType::PrintToJSONStream(JSONStream* stream, bool ref) const { 14695 void MixinAppType::PrintJSONImpl(JSONStream* stream, bool ref) const {
14698 UNREACHABLE(); 14696 UNREACHABLE();
14699 } 14697 }
14700 14698
14701 14699
14702 RawAbstractType* MixinAppType::MixinTypeAt(intptr_t depth) const { 14700 RawAbstractType* MixinAppType::MixinTypeAt(intptr_t depth) const {
14703 return AbstractType::RawCast(Array::Handle(mixin_types()).At(depth)); 14701 return AbstractType::RawCast(Array::Handle(mixin_types()).At(depth));
14704 } 14702 }
14705 14703
14706 14704
14707 void MixinAppType::set_super_type(const AbstractType& value) const { 14705 void MixinAppType::set_super_type(const AbstractType& value) const {
(...skipping 27 matching lines...) Expand all
14735 } 14733 }
14736 14734
14737 14735
14738 const char* Number::ToCString() const { 14736 const char* Number::ToCString() const {
14739 // Number is an interface. No instances of Number should exist. 14737 // Number is an interface. No instances of Number should exist.
14740 UNREACHABLE(); 14738 UNREACHABLE();
14741 return "Number"; 14739 return "Number";
14742 } 14740 }
14743 14741
14744 14742
14745 void Number::PrintToJSONStream(JSONStream* stream, bool ref) const { 14743 void Number::PrintJSONImpl(JSONStream* stream, bool ref) const {
14746 JSONObject jsobj(stream); 14744 JSONObject jsobj(stream);
14747 PrintSharedInstanceJSON(&jsobj, ref); 14745 PrintSharedInstanceJSON(&jsobj, ref);
14748 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 14746 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
14749 const intptr_t id = ring->GetIdForObject(raw()); 14747 const intptr_t id = ring->GetIdForObject(raw());
14750 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 14748 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
14751 jsobj.AddProperty("valueAsString", ToCString()); 14749 jsobj.AddProperty("valueAsString", ToCString());
14752 } 14750 }
14753 14751
14754 14752
14755 const char* Integer::ToCString() const { 14753 const char* Integer::ToCString() const {
14756 // Integer is an interface. No instances of Integer should exist. 14754 // Integer is an interface. No instances of Integer should exist.
14757 UNREACHABLE(); 14755 UNREACHABLE();
14758 return "Integer"; 14756 return "Integer";
14759 } 14757 }
14760 14758
14761 14759
14762 void Integer::PrintToJSONStream(JSONStream* stream, bool ref) const { 14760 void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const {
14763 Number::PrintToJSONStream(stream, ref); 14761 Number::PrintJSONImpl(stream, ref);
14764 } 14762 }
14765 14763
14766 14764
14767 // Throw JavascriptIntegerOverflow exception. 14765 // Throw JavascriptIntegerOverflow exception.
14768 static void ThrowJavascriptIntegerOverflow(const Integer& i) { 14766 static void ThrowJavascriptIntegerOverflow(const Integer& i) {
14769 const Array& exc_args = Array::Handle(Array::New(1)); 14767 const Array& exc_args = Array::Handle(Array::New(1));
14770 const String& i_str = String::Handle(String::New(i.ToCString())); 14768 const String& i_str = String::Handle(String::New(i.ToCString()));
14771 exc_args.SetAt(0, i_str); 14769 exc_args.SetAt(0, i_str);
14772 Exceptions::ThrowByType(Exceptions::kJavascriptIntegerOverflowError, 14770 Exceptions::ThrowByType(Exceptions::kJavascriptIntegerOverflowError,
14773 exc_args); 14771 exc_args);
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
15181 const char* Smi::ToCString() const { 15179 const char* Smi::ToCString() const {
15182 const char* kFormat = "%ld"; 15180 const char* kFormat = "%ld";
15183 // Calculate the size of the string. 15181 // Calculate the size of the string.
15184 intptr_t len = OS::SNPrint(NULL, 0, kFormat, Value()) + 1; 15182 intptr_t len = OS::SNPrint(NULL, 0, kFormat, Value()) + 1;
15185 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 15183 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
15186 OS::SNPrint(chars, len, kFormat, Value()); 15184 OS::SNPrint(chars, len, kFormat, Value());
15187 return chars; 15185 return chars;
15188 } 15186 }
15189 15187
15190 15188
15191 void Smi::PrintToJSONStream(JSONStream* stream, bool ref) const { 15189 void Smi::PrintJSONImpl(JSONStream* stream, bool ref) const {
15192 JSONObject jsobj(stream); 15190 JSONObject jsobj(stream);
15193 PrintSharedInstanceJSON(&jsobj, ref); 15191 PrintSharedInstanceJSON(&jsobj, ref);
15194 jsobj.AddPropertyF("id", "objects/int-%" Pd "", Value()); 15192 jsobj.AddPropertyF("id", "objects/int-%" Pd "", Value());
15195 jsobj.AddPropertyF("valueAsString", "%" Pd "", Value()); 15193 jsobj.AddPropertyF("valueAsString", "%" Pd "", Value());
15196 } 15194 }
15197 15195
15198 15196
15199 RawClass* Smi::Class() { 15197 RawClass* Smi::Class() {
15200 return Isolate::Current()->object_store()->smi_class(); 15198 return Isolate::Current()->object_store()->smi_class();
15201 } 15199 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
15308 const char* Mint::ToCString() const { 15306 const char* Mint::ToCString() const {
15309 const char* kFormat = "%lld"; 15307 const char* kFormat = "%lld";
15310 // Calculate the size of the string. 15308 // Calculate the size of the string.
15311 intptr_t len = OS::SNPrint(NULL, 0, kFormat, value()) + 1; 15309 intptr_t len = OS::SNPrint(NULL, 0, kFormat, value()) + 1;
15312 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 15310 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
15313 OS::SNPrint(chars, len, kFormat, value()); 15311 OS::SNPrint(chars, len, kFormat, value());
15314 return chars; 15312 return chars;
15315 } 15313 }
15316 15314
15317 15315
15318 void Mint::PrintToJSONStream(JSONStream* stream, bool ref) const { 15316 void Mint::PrintJSONImpl(JSONStream* stream, bool ref) const {
15319 Number::PrintToJSONStream(stream, ref); 15317 Number::PrintJSONImpl(stream, ref);
15320 } 15318 }
15321 15319
15322 15320
15323 void Double::set_value(double value) const { 15321 void Double::set_value(double value) const {
15324 raw_ptr()->value_ = value; 15322 raw_ptr()->value_ = value;
15325 } 15323 }
15326 15324
15327 15325
15328 bool Double::EqualsToDouble(double value) const { 15326 bool Double::EqualsToDouble(double value) const {
15329 intptr_t value_offset = Double::value_offset(); 15327 intptr_t value_offset = Double::value_offset();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
15414 return value() < 0 ? "-Infinity" : "Infinity"; 15412 return value() < 0 ? "-Infinity" : "Infinity";
15415 } 15413 }
15416 const int kBufferSize = 128; 15414 const int kBufferSize = 128;
15417 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(kBufferSize); 15415 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(kBufferSize);
15418 buffer[kBufferSize - 1] = '\0'; 15416 buffer[kBufferSize - 1] = '\0';
15419 DoubleToCString(value(), buffer, kBufferSize); 15417 DoubleToCString(value(), buffer, kBufferSize);
15420 return buffer; 15418 return buffer;
15421 } 15419 }
15422 15420
15423 15421
15424 void Double::PrintToJSONStream(JSONStream* stream, bool ref) const { 15422 void Double::PrintJSONImpl(JSONStream* stream, bool ref) const {
15425 Number::PrintToJSONStream(stream, ref); 15423 Number::PrintJSONImpl(stream, ref);
15426 } 15424 }
15427 15425
15428 15426
15429 RawBigint* Integer::AsBigint() const { 15427 RawBigint* Integer::AsBigint() const {
15430 ASSERT(!IsNull()); 15428 ASSERT(!IsNull());
15431 if (IsSmi()) { 15429 if (IsSmi()) {
15432 Smi& smi = Smi::Handle(); 15430 Smi& smi = Smi::Handle();
15433 smi ^= raw(); 15431 smi ^= raw();
15434 return BigintOperations::NewFromSmi(smi); 15432 return BigintOperations::NewFromSmi(smi);
15435 } else if (IsMint()) { 15433 } else if (IsMint()) {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
15590 Zone* zone = Isolate::Current()->current_zone(); 15588 Zone* zone = Isolate::Current()->current_zone();
15591 return zone->AllocUnsafe(size); 15589 return zone->AllocUnsafe(size);
15592 } 15590 }
15593 15591
15594 15592
15595 const char* Bigint::ToCString() const { 15593 const char* Bigint::ToCString() const {
15596 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); 15594 return BigintOperations::ToDecimalCString(*this, &BigintAllocator);
15597 } 15595 }
15598 15596
15599 15597
15600 void Bigint::PrintToJSONStream(JSONStream* stream, bool ref) const { 15598 void Bigint::PrintJSONImpl(JSONStream* stream, bool ref) const {
15601 Number::PrintToJSONStream(stream, ref); 15599 Number::PrintJSONImpl(stream, ref);
15602 } 15600 }
15603 15601
15604 15602
15605 // Synchronize with implementation in compiler (intrinsifier). 15603 // Synchronize with implementation in compiler (intrinsifier).
15606 class StringHasher : ValueObject { 15604 class StringHasher : ValueObject {
15607 public: 15605 public:
15608 StringHasher() : hash_(0) {} 15606 StringHasher() : hash_(0) {}
15609 void Add(int32_t ch) { 15607 void Add(int32_t ch) {
15610 hash_ = CombineHashes(hash_, ch); 15608 hash_ = CombineHashes(hash_, ch);
15611 } 15609 }
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
16445 buffer[pos++] = '.'; 16443 buffer[pos++] = '.';
16446 buffer[pos++] = '.'; 16444 buffer[pos++] = '.';
16447 } 16445 }
16448 ASSERT(pos <= buffer_len); 16446 ASSERT(pos <= buffer_len);
16449 buffer[pos++] = '\0'; 16447 buffer[pos++] = '\0';
16450 16448
16451 return buffer; 16449 return buffer;
16452 } 16450 }
16453 16451
16454 16452
16455 void String::PrintToJSONStream(JSONStream* stream, bool ref) const { 16453 void String::PrintJSONImpl(JSONStream* stream, bool ref) const {
16456 JSONObject jsobj(stream); 16454 JSONObject jsobj(stream);
16457 if (raw() == Symbols::OptimizedOut().raw()) { 16455 if (raw() == Symbols::OptimizedOut().raw()) {
16458 // TODO(turnidge): This is a hack. The user could have this 16456 // TODO(turnidge): This is a hack. The user could have this
16459 // special string in their program. Fixing this involves updating 16457 // special string in their program. Fixing this involves updating
16460 // the debugging api a bit. 16458 // the debugging api a bit.
16461 jsobj.AddProperty("type", ref ? "@Null" : "Null"); 16459 jsobj.AddProperty("type", ref ? "@Null" : "Null");
16462 jsobj.AddProperty("id", "objects/optimized-out"); 16460 jsobj.AddProperty("id", "objects/optimized-out");
16463 jsobj.AddProperty("valueAsString", "<optimized out>"); 16461 jsobj.AddProperty("valueAsString", "<optimized out>");
16464 return; 16462 return;
16465 } 16463 }
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
17266 result.SetCanonical(); 17264 result.SetCanonical();
17267 return result.raw(); 17265 return result.raw();
17268 } 17266 }
17269 17267
17270 17268
17271 const char* Bool::ToCString() const { 17269 const char* Bool::ToCString() const {
17272 return value() ? "true" : "false"; 17270 return value() ? "true" : "false";
17273 } 17271 }
17274 17272
17275 17273
17276 void Bool::PrintToJSONStream(JSONStream* stream, bool ref) const { 17274 void Bool::PrintJSONImpl(JSONStream* stream, bool ref) const {
17277 const char* str = ToCString(); 17275 const char* str = ToCString();
17278 JSONObject jsobj(stream); 17276 JSONObject jsobj(stream);
17279 jsobj.AddProperty("type", JSONType(ref)); 17277 jsobj.AddProperty("type", JSONType(ref));
17280 jsobj.AddPropertyF("id", "objects/bool-%s", str); 17278 jsobj.AddPropertyF("id", "objects/bool-%s", str);
17281 class Class& cls = Class::Handle(this->clazz()); 17279 class Class& cls = Class::Handle(this->clazz());
17282 jsobj.AddProperty("class", cls); 17280 jsobj.AddProperty("class", cls);
17283 jsobj.AddPropertyF("valueAsString", "%s", str); 17281 jsobj.AddPropertyF("valueAsString", "%s", str);
17284 } 17282 }
17285 17283
17286 17284
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
17356 } 17354 }
17357 const char* format = IsImmutable() ? 17355 const char* format = IsImmutable() ?
17358 "_ImmutableList len:%" Pd : "_List len:%" Pd; 17356 "_ImmutableList len:%" Pd : "_List len:%" Pd;
17359 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; 17357 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
17360 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 17358 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
17361 OS::SNPrint(chars, len, format, Length()); 17359 OS::SNPrint(chars, len, format, Length());
17362 return chars; 17360 return chars;
17363 } 17361 }
17364 17362
17365 17363
17366 void Array::PrintToJSONStream(JSONStream* stream, bool ref) const { 17364 void Array::PrintJSONImpl(JSONStream* stream, bool ref) const {
17367 JSONObject jsobj(stream); 17365 JSONObject jsobj(stream);
17368 PrintSharedInstanceJSON(&jsobj, ref); 17366 PrintSharedInstanceJSON(&jsobj, ref);
17369 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 17367 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
17370 const intptr_t id = ring->GetIdForObject(raw()); 17368 const intptr_t id = ring->GetIdForObject(raw());
17371 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 17369 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
17372 jsobj.AddProperty("length", Length()); 17370 jsobj.AddProperty("length", Length());
17373 if (ref) { 17371 if (ref) {
17374 return; 17372 return;
17375 } 17373 }
17376 { 17374 {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
17592 return "_GrowableList NULL"; 17590 return "_GrowableList NULL";
17593 } 17591 }
17594 const char* format = "Instance(length:%" Pd ") of '_GrowableList'"; 17592 const char* format = "Instance(length:%" Pd ") of '_GrowableList'";
17595 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; 17593 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
17596 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 17594 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
17597 OS::SNPrint(chars, len, format, Length()); 17595 OS::SNPrint(chars, len, format, Length());
17598 return chars; 17596 return chars;
17599 } 17597 }
17600 17598
17601 17599
17602 void GrowableObjectArray::PrintToJSONStream(JSONStream* stream, 17600 void GrowableObjectArray::PrintJSONImpl(JSONStream* stream,
17603 bool ref) const { 17601 bool ref) const {
17604 JSONObject jsobj(stream); 17602 JSONObject jsobj(stream);
17605 PrintSharedInstanceJSON(&jsobj, ref); 17603 PrintSharedInstanceJSON(&jsobj, ref);
17606 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 17604 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
17607 const intptr_t id = ring->GetIdForObject(raw()); 17605 const intptr_t id = ring->GetIdForObject(raw());
17608 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 17606 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
17609 jsobj.AddProperty("length", Length()); 17607 jsobj.AddProperty("length", Length());
17610 if (ref) { 17608 if (ref) {
17611 return; 17609 return;
17612 } 17610 }
17613 { 17611 {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
17716 float _z = z(); 17714 float _z = z();
17717 float _w = w(); 17715 float _w = w();
17718 // Calculate the size of the string. 17716 // Calculate the size of the string.
17719 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; 17717 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1;
17720 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 17718 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
17721 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); 17719 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w);
17722 return chars; 17720 return chars;
17723 } 17721 }
17724 17722
17725 17723
17726 void Float32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { 17724 void Float32x4::PrintJSONImpl(JSONStream* stream, bool ref) const {
17727 Instance::PrintToJSONStream(stream, ref); 17725 Instance::PrintJSONImpl(stream, ref);
17728 } 17726 }
17729 17727
17730 17728
17731 RawInt32x4* Int32x4::New(int32_t v0, int32_t v1, int32_t v2, int32_t v3, 17729 RawInt32x4* Int32x4::New(int32_t v0, int32_t v1, int32_t v2, int32_t v3,
17732 Heap::Space space) { 17730 Heap::Space space) {
17733 ASSERT(Isolate::Current()->object_store()->int32x4_class() != 17731 ASSERT(Isolate::Current()->object_store()->int32x4_class() !=
17734 Class::null()); 17732 Class::null());
17735 Int32x4& result = Int32x4::Handle(); 17733 Int32x4& result = Int32x4::Handle();
17736 { 17734 {
17737 RawObject* raw = Object::Allocate(Int32x4::kClassId, 17735 RawObject* raw = Object::Allocate(Int32x4::kClassId,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
17821 int32_t _z = z(); 17819 int32_t _z = z();
17822 int32_t _w = w(); 17820 int32_t _w = w();
17823 // Calculate the size of the string. 17821 // Calculate the size of the string.
17824 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; 17822 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1;
17825 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 17823 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
17826 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); 17824 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w);
17827 return chars; 17825 return chars;
17828 } 17826 }
17829 17827
17830 17828
17831 void Int32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { 17829 void Int32x4::PrintJSONImpl(JSONStream* stream, bool ref) const {
17832 Instance::PrintToJSONStream(stream, ref); 17830 Instance::PrintJSONImpl(stream, ref);
17833 } 17831 }
17834 17832
17835 17833
17836 RawFloat64x2* Float64x2::New(double value0, double value1, Heap::Space space) { 17834 RawFloat64x2* Float64x2::New(double value0, double value1, Heap::Space space) {
17837 ASSERT(Isolate::Current()->object_store()->float64x2_class() != 17835 ASSERT(Isolate::Current()->object_store()->float64x2_class() !=
17838 Class::null()); 17836 Class::null());
17839 Float64x2& result = Float64x2::Handle(); 17837 Float64x2& result = Float64x2::Handle();
17840 { 17838 {
17841 RawObject* raw = Object::Allocate(Float64x2::kClassId, 17839 RawObject* raw = Object::Allocate(Float64x2::kClassId,
17842 Float64x2::InstanceSize(), 17840 Float64x2::InstanceSize(),
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
17901 double _x = x(); 17899 double _x = x();
17902 double _y = y(); 17900 double _y = y();
17903 // Calculate the size of the string. 17901 // Calculate the size of the string.
17904 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y) + 1; 17902 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y) + 1;
17905 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 17903 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
17906 OS::SNPrint(chars, len, kFormat, _x, _y); 17904 OS::SNPrint(chars, len, kFormat, _x, _y);
17907 return chars; 17905 return chars;
17908 } 17906 }
17909 17907
17910 17908
17911 void Float64x2::PrintToJSONStream(JSONStream* stream, bool ref) const { 17909 void Float64x2::PrintJSONImpl(JSONStream* stream, bool ref) const {
17912 Instance::PrintToJSONStream(stream, ref); 17910 Instance::PrintJSONImpl(stream, ref);
17913 } 17911 }
17914 17912
17915 17913
17916 const intptr_t TypedData::element_size[] = { 17914 const intptr_t TypedData::element_size[] = {
17917 1, // kTypedDataInt8ArrayCid. 17915 1, // kTypedDataInt8ArrayCid.
17918 1, // kTypedDataUint8ArrayCid. 17916 1, // kTypedDataUint8ArrayCid.
17919 1, // kTypedDataUint8ClampedArrayCid. 17917 1, // kTypedDataUint8ClampedArrayCid.
17920 2, // kTypedDataInt16ArrayCid. 17918 2, // kTypedDataInt16ArrayCid.
17921 2, // kTypedDataUint16ArrayCid. 17919 2, // kTypedDataUint16ArrayCid.
17922 4, // kTypedDataInt32ArrayCid. 17920 4, // kTypedDataInt32ArrayCid.
(...skipping 29 matching lines...) Expand all
17952 } 17950 }
17953 return result.raw(); 17951 return result.raw();
17954 } 17952 }
17955 17953
17956 17954
17957 const char* TypedData::ToCString() const { 17955 const char* TypedData::ToCString() const {
17958 return "TypedData"; 17956 return "TypedData";
17959 } 17957 }
17960 17958
17961 17959
17962 void TypedData::PrintToJSONStream(JSONStream* stream, bool ref) const { 17960 void TypedData::PrintJSONImpl(JSONStream* stream, bool ref) const {
17963 Instance::PrintToJSONStream(stream, ref); 17961 Instance::PrintJSONImpl(stream, ref);
17964 } 17962 }
17965 17963
17966 17964
17967 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( 17965 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer(
17968 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { 17966 void* peer, Dart_WeakPersistentHandleFinalizer callback) const {
17969 return dart::AddFinalizer(*this, peer, callback); 17967 return dart::AddFinalizer(*this, peer, callback);
17970 } 17968 }
17971 17969
17972 17970
17973 RawExternalTypedData* ExternalTypedData::New(intptr_t class_id, 17971 RawExternalTypedData* ExternalTypedData::New(intptr_t class_id,
(...skipping 12 matching lines...) Expand all
17986 } 17984 }
17987 return result.raw(); 17985 return result.raw();
17988 } 17986 }
17989 17987
17990 17988
17991 const char* ExternalTypedData::ToCString() const { 17989 const char* ExternalTypedData::ToCString() const {
17992 return "ExternalTypedData"; 17990 return "ExternalTypedData";
17993 } 17991 }
17994 17992
17995 17993
17996 void ExternalTypedData::PrintToJSONStream(JSONStream* stream, 17994 void ExternalTypedData::PrintJSONImpl(JSONStream* stream,
17997 bool ref) const { 17995 bool ref) const {
17998 Instance::PrintToJSONStream(stream, ref); 17996 Instance::PrintJSONImpl(stream, ref);
17999 } 17997 }
18000 17998
18001 17999
18002 RawCapability* Capability::New(uint64_t id, Heap::Space space) { 18000 RawCapability* Capability::New(uint64_t id, Heap::Space space) {
18003 Capability& result = Capability::Handle(); 18001 Capability& result = Capability::Handle();
18004 { 18002 {
18005 RawObject* raw = Object::Allocate(Capability::kClassId, 18003 RawObject* raw = Object::Allocate(Capability::kClassId,
18006 Capability::InstanceSize(), 18004 Capability::InstanceSize(),
18007 space); 18005 space);
18008 NoGCScope no_gc; 18006 NoGCScope no_gc;
18009 result ^= raw; 18007 result ^= raw;
18010 result.raw_ptr()->id_ = id; 18008 result.raw_ptr()->id_ = id;
18011 } 18009 }
18012 return result.raw(); 18010 return result.raw();
18013 } 18011 }
18014 18012
18015 18013
18016 const char* Capability::ToCString() const { 18014 const char* Capability::ToCString() const {
18017 return "Capability"; 18015 return "Capability";
18018 } 18016 }
18019 18017
18020 18018
18021 void Capability::PrintToJSONStream(JSONStream* stream, bool ref) const { 18019 void Capability::PrintJSONImpl(JSONStream* stream, bool ref) const {
18022 Instance::PrintToJSONStream(stream, ref); 18020 Instance::PrintJSONImpl(stream, ref);
18023 } 18021 }
18024 18022
18025 18023
18026 RawReceivePort* ReceivePort::New(Dart_Port id, Heap::Space space) { 18024 RawReceivePort* ReceivePort::New(Dart_Port id, Heap::Space space) {
18027 Isolate* isolate = Isolate::Current(); 18025 Isolate* isolate = Isolate::Current();
18028 const SendPort& send_port = SendPort::Handle(isolate, SendPort::New(id)); 18026 const SendPort& send_port = SendPort::Handle(isolate, SendPort::New(id));
18029 18027
18030 ReceivePort& result = ReceivePort::Handle(isolate); 18028 ReceivePort& result = ReceivePort::Handle(isolate);
18031 { 18029 {
18032 RawObject* raw = Object::Allocate(ReceivePort::kClassId, 18030 RawObject* raw = Object::Allocate(ReceivePort::kClassId,
18033 ReceivePort::InstanceSize(), 18031 ReceivePort::InstanceSize(),
18034 space); 18032 space);
18035 NoGCScope no_gc; 18033 NoGCScope no_gc;
18036 result ^= raw; 18034 result ^= raw;
18037 result.raw_ptr()->send_port_ = send_port.raw(); 18035 result.raw_ptr()->send_port_ = send_port.raw();
18038 } 18036 }
18039 PortMap::SetLive(id); 18037 PortMap::SetLive(id);
18040 return result.raw(); 18038 return result.raw();
18041 } 18039 }
18042 18040
18043 18041
18044 const char* ReceivePort::ToCString() const { 18042 const char* ReceivePort::ToCString() const {
18045 return "ReceivePort"; 18043 return "ReceivePort";
18046 } 18044 }
18047 18045
18048 18046
18049 void ReceivePort::PrintToJSONStream(JSONStream* stream, bool ref) const { 18047 void ReceivePort::PrintJSONImpl(JSONStream* stream, bool ref) const {
18050 Instance::PrintToJSONStream(stream, ref); 18048 Instance::PrintJSONImpl(stream, ref);
18051 } 18049 }
18052 18050
18053 18051
18054 RawSendPort* SendPort::New(Dart_Port id, Heap::Space space) { 18052 RawSendPort* SendPort::New(Dart_Port id, Heap::Space space) {
18055 SendPort& result = SendPort::Handle(); 18053 SendPort& result = SendPort::Handle();
18056 { 18054 {
18057 RawObject* raw = Object::Allocate(SendPort::kClassId, 18055 RawObject* raw = Object::Allocate(SendPort::kClassId,
18058 SendPort::InstanceSize(), 18056 SendPort::InstanceSize(),
18059 space); 18057 space);
18060 NoGCScope no_gc; 18058 NoGCScope no_gc;
18061 result ^= raw; 18059 result ^= raw;
18062 result.raw_ptr()->id_ = id; 18060 result.raw_ptr()->id_ = id;
18063 } 18061 }
18064 return result.raw(); 18062 return result.raw();
18065 } 18063 }
18066 18064
18067 18065
18068 const char* SendPort::ToCString() const { 18066 const char* SendPort::ToCString() const {
18069 return "SendPort"; 18067 return "SendPort";
18070 } 18068 }
18071 18069
18072 18070
18073 void SendPort::PrintToJSONStream(JSONStream* stream, bool ref) const { 18071 void SendPort::PrintJSONImpl(JSONStream* stream, bool ref) const {
18074 Instance::PrintToJSONStream(stream, ref); 18072 Instance::PrintJSONImpl(stream, ref);
18075 } 18073 }
18076 18074
18077 18075
18078 const char* Closure::ToCString(const Instance& closure) { 18076 const char* Closure::ToCString(const Instance& closure) {
18079 const Function& fun = Function::Handle(Closure::function(closure)); 18077 const Function& fun = Function::Handle(Closure::function(closure));
18080 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); 18078 const bool is_implicit_closure = fun.IsImplicitClosureFunction();
18081 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString(); 18079 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString();
18082 const char* from = is_implicit_closure ? " from " : ""; 18080 const char* from = is_implicit_closure ? " from " : "";
18083 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; 18081 const char* fun_desc = is_implicit_closure ? fun.ToCString() : "";
18084 const char* format = "Closure: %s%s%s"; 18082 const char* format = "Closure: %s%s%s";
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
18249 return String::New(ToCStringInternal(&idx)); 18247 return String::New(ToCStringInternal(&idx));
18250 } 18248 }
18251 18249
18252 18250
18253 const char* Stacktrace::ToCString() const { 18251 const char* Stacktrace::ToCString() const {
18254 const String& trace = String::Handle(FullStacktrace()); 18252 const String& trace = String::Handle(FullStacktrace());
18255 return trace.ToCString(); 18253 return trace.ToCString();
18256 } 18254 }
18257 18255
18258 18256
18259 void Stacktrace::PrintToJSONStream(JSONStream* stream, bool ref) const { 18257 void Stacktrace::PrintJSONImpl(JSONStream* stream, bool ref) const {
18260 Instance::PrintToJSONStream(stream, ref); 18258 Instance::PrintJSONImpl(stream, ref);
18261 } 18259 }
18262 18260
18263 18261
18264 static intptr_t PrintOneStacktrace(Isolate* isolate, 18262 static intptr_t PrintOneStacktrace(Isolate* isolate,
18265 GrowableArray<char*>* frame_strings, 18263 GrowableArray<char*>* frame_strings,
18266 uword pc, 18264 uword pc,
18267 const Function& function, 18265 const Function& function,
18268 const Code& code, 18266 const Code& code,
18269 intptr_t frame_index) { 18267 intptr_t frame_index) {
18270 const char* kFormatWithCol = "#%-6d %s (%s:%d:%d)\n"; 18268 const char* kFormatWithCol = "#%-6d %s (%s:%d:%d)\n";
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
18461 const char* JSRegExp::ToCString() const { 18459 const char* JSRegExp::ToCString() const {
18462 const String& str = String::Handle(pattern()); 18460 const String& str = String::Handle(pattern());
18463 const char* format = "JSRegExp: pattern=%s flags=%s"; 18461 const char* format = "JSRegExp: pattern=%s flags=%s";
18464 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 18462 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
18465 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); 18463 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1);
18466 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 18464 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
18467 return chars; 18465 return chars;
18468 } 18466 }
18469 18467
18470 18468
18471 void JSRegExp::PrintToJSONStream(JSONStream* stream, bool ref) const { 18469 void JSRegExp::PrintJSONImpl(JSONStream* stream, bool ref) const {
18472 Instance::PrintToJSONStream(stream, ref); 18470 Instance::PrintJSONImpl(stream, ref);
18473 } 18471 }
18474 18472
18475 18473
18476 RawWeakProperty* WeakProperty::New(Heap::Space space) { 18474 RawWeakProperty* WeakProperty::New(Heap::Space space) {
18477 ASSERT(Isolate::Current()->object_store()->weak_property_class() 18475 ASSERT(Isolate::Current()->object_store()->weak_property_class()
18478 != Class::null()); 18476 != Class::null());
18479 RawObject* raw = Object::Allocate(WeakProperty::kClassId, 18477 RawObject* raw = Object::Allocate(WeakProperty::kClassId,
18480 WeakProperty::InstanceSize(), 18478 WeakProperty::InstanceSize(),
18481 space); 18479 space);
18482 return reinterpret_cast<RawWeakProperty*>(raw); 18480 return reinterpret_cast<RawWeakProperty*>(raw);
18483 } 18481 }
18484 18482
18485 18483
18486 const char* WeakProperty::ToCString() const { 18484 const char* WeakProperty::ToCString() const {
18487 return "_WeakProperty"; 18485 return "_WeakProperty";
18488 } 18486 }
18489 18487
18490 18488
18491 void WeakProperty::PrintToJSONStream(JSONStream* stream, bool ref) const { 18489 void WeakProperty::PrintJSONImpl(JSONStream* stream, bool ref) const {
18492 Instance::PrintToJSONStream(stream, ref); 18490 Instance::PrintJSONImpl(stream, ref);
18493 } 18491 }
18494 18492
18495 RawAbstractType* MirrorReference::GetAbstractTypeReferent() const { 18493 RawAbstractType* MirrorReference::GetAbstractTypeReferent() const {
18496 ASSERT(Object::Handle(referent()).IsAbstractType()); 18494 ASSERT(Object::Handle(referent()).IsAbstractType());
18497 return AbstractType::Cast(Object::Handle(referent())).raw(); 18495 return AbstractType::Cast(Object::Handle(referent())).raw();
18498 } 18496 }
18499 18497
18500 18498
18501 RawClass* MirrorReference::GetClassReferent() const { 18499 RawClass* MirrorReference::GetClassReferent() const {
18502 ASSERT(Object::Handle(referent()).IsClass()); 18500 ASSERT(Object::Handle(referent()).IsClass());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
18541 result.set_referent(referent); 18539 result.set_referent(referent);
18542 return result.raw(); 18540 return result.raw();
18543 } 18541 }
18544 18542
18545 18543
18546 const char* MirrorReference::ToCString() const { 18544 const char* MirrorReference::ToCString() const {
18547 return "_MirrorReference"; 18545 return "_MirrorReference";
18548 } 18546 }
18549 18547
18550 18548
18551 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 18549 void MirrorReference::PrintJSONImpl(JSONStream* stream, bool ref) const {
18552 Instance::PrintToJSONStream(stream, ref); 18550 Instance::PrintJSONImpl(stream, ref);
18553 } 18551 }
18554 18552
18555 18553
18556 void UserTag::MakeActive() const { 18554 void UserTag::MakeActive() const {
18557 Isolate* isolate = Isolate::Current(); 18555 Isolate* isolate = Isolate::Current();
18558 ASSERT(isolate != NULL); 18556 ASSERT(isolate != NULL);
18559 isolate->set_current_tag(*this); 18557 isolate->set_current_tag(*this);
18560 } 18558 }
18561 18559
18562 18560
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
18665 return UserTag::null(); 18663 return UserTag::null();
18666 } 18664 }
18667 18665
18668 18666
18669 const char* UserTag::ToCString() const { 18667 const char* UserTag::ToCString() const {
18670 const String& tag_label = String::Handle(label()); 18668 const String& tag_label = String::Handle(label());
18671 return tag_label.ToCString(); 18669 return tag_label.ToCString();
18672 } 18670 }
18673 18671
18674 18672
18675 void UserTag::PrintToJSONStream(JSONStream* stream, bool ref) const { 18673 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
18676 Instance::PrintToJSONStream(stream, ref); 18674 Instance::PrintJSONImpl(stream, ref);
18677 } 18675 }
18678 18676
18679 18677
18680 } // namespace dart 18678 } // namespace dart
OLDNEW
« no previous file with comments | « 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