OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 2673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2684 const Library& lib = Library::Handle(library()); | 2684 const Library& lib = Library::Handle(library()); |
2685 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); | 2685 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); |
2686 const char* class_name = String::Handle(Name()).ToCString(); | 2686 const char* class_name = String::Handle(Name()).ToCString(); |
2687 intptr_t len = OS::SNPrint(NULL, 0, format, library_name, class_name) + 1; | 2687 intptr_t len = OS::SNPrint(NULL, 0, format, library_name, class_name) + 1; |
2688 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2688 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
2689 OS::SNPrint(chars, len, format, library_name, class_name); | 2689 OS::SNPrint(chars, len, format, library_name, class_name); |
2690 return chars; | 2690 return chars; |
2691 } | 2691 } |
2692 | 2692 |
2693 | 2693 |
| 2694 void Class::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 2695 stream->OpenObject(); |
| 2696 stream->CloseObject(); |
| 2697 } |
| 2698 |
| 2699 |
2694 void Class::InsertCanonicalConstant(intptr_t index, | 2700 void Class::InsertCanonicalConstant(intptr_t index, |
2695 const Instance& constant) const { | 2701 const Instance& constant) const { |
2696 // The constant needs to be added to the list. Grow the list if it is full. | 2702 // The constant needs to be added to the list. Grow the list if it is full. |
2697 Array& canonical_list = Array::Handle(constants()); | 2703 Array& canonical_list = Array::Handle(constants()); |
2698 const intptr_t list_len = canonical_list.Length(); | 2704 const intptr_t list_len = canonical_list.Length(); |
2699 if (index >= list_len) { | 2705 if (index >= list_len) { |
2700 const intptr_t new_length = (list_len == 0) ? 4 : list_len + 4; | 2706 const intptr_t new_length = (list_len == 0) ? 4 : list_len + 4; |
2701 const Array& new_canonical_list = | 2707 const Array& new_canonical_list = |
2702 Array::Handle(Array::Grow(canonical_list, new_length, Heap::kOld)); | 2708 Array::Handle(Array::Grow(canonical_list, new_length, Heap::kOld)); |
2703 set_constants(new_canonical_list); | 2709 set_constants(new_canonical_list); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2763 const char* UnresolvedClass::ToCString() const { | 2769 const char* UnresolvedClass::ToCString() const { |
2764 const char* format = "unresolved class '%s'"; | 2770 const char* format = "unresolved class '%s'"; |
2765 const char* cname = String::Handle(Name()).ToCString(); | 2771 const char* cname = String::Handle(Name()).ToCString(); |
2766 intptr_t len = OS::SNPrint(NULL, 0, format, cname) + 1; | 2772 intptr_t len = OS::SNPrint(NULL, 0, format, cname) + 1; |
2767 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2773 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
2768 OS::SNPrint(chars, len, format, cname); | 2774 OS::SNPrint(chars, len, format, cname); |
2769 return chars; | 2775 return chars; |
2770 } | 2776 } |
2771 | 2777 |
2772 | 2778 |
| 2779 void UnresolvedClass::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 2780 stream->OpenObject(); |
| 2781 stream->CloseObject(); |
| 2782 } |
| 2783 |
| 2784 |
2773 intptr_t AbstractTypeArguments::Length() const { | 2785 intptr_t AbstractTypeArguments::Length() const { |
2774 // AbstractTypeArguments is an abstract class. | 2786 // AbstractTypeArguments is an abstract class. |
2775 UNREACHABLE(); | 2787 UNREACHABLE(); |
2776 return -1; | 2788 return -1; |
2777 } | 2789 } |
2778 | 2790 |
2779 | 2791 |
2780 RawAbstractType* AbstractTypeArguments::TypeAt(intptr_t index) const { | 2792 RawAbstractType* AbstractTypeArguments::TypeAt(intptr_t index) const { |
2781 // AbstractTypeArguments is an abstract class. | 2793 // AbstractTypeArguments is an abstract class. |
2782 UNREACHABLE(); | 2794 UNREACHABLE(); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2995 // AbstractTypeArguments is an abstract class, valid only for representing | 3007 // AbstractTypeArguments is an abstract class, valid only for representing |
2996 // null. | 3008 // null. |
2997 if (IsNull()) { | 3009 if (IsNull()) { |
2998 return "NULL AbstractTypeArguments"; | 3010 return "NULL AbstractTypeArguments"; |
2999 } | 3011 } |
3000 UNREACHABLE(); | 3012 UNREACHABLE(); |
3001 return "AbstractTypeArguments"; | 3013 return "AbstractTypeArguments"; |
3002 } | 3014 } |
3003 | 3015 |
3004 | 3016 |
| 3017 void AbstractTypeArguments::PrintToJSONStream(JSONStream* stream, |
| 3018 bool ref) const { |
| 3019 stream->OpenObject(); |
| 3020 stream->CloseObject(); |
| 3021 } |
| 3022 |
| 3023 |
3005 intptr_t TypeArguments::Length() const { | 3024 intptr_t TypeArguments::Length() const { |
3006 ASSERT(!IsNull()); | 3025 ASSERT(!IsNull()); |
3007 return Smi::Value(raw_ptr()->length_); | 3026 return Smi::Value(raw_ptr()->length_); |
3008 } | 3027 } |
3009 | 3028 |
3010 | 3029 |
3011 RawAbstractType* TypeArguments::TypeAt(intptr_t index) const { | 3030 RawAbstractType* TypeArguments::TypeAt(intptr_t index) const { |
3012 return *TypeAddr(index); | 3031 return *TypeAddr(index); |
3013 } | 3032 } |
3014 | 3033 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3330 const char* type_cstr = type_at.IsNull() ? "null" : type_at.ToCString(); | 3349 const char* type_cstr = type_at.IsNull() ? "null" : type_at.ToCString(); |
3331 intptr_t len = OS::SNPrint(NULL, 0, format, prev_cstr, type_cstr) + 1; | 3350 intptr_t len = OS::SNPrint(NULL, 0, format, prev_cstr, type_cstr) + 1; |
3332 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3351 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
3333 OS::SNPrint(chars, len, format, prev_cstr, type_cstr); | 3352 OS::SNPrint(chars, len, format, prev_cstr, type_cstr); |
3334 prev_cstr = chars; | 3353 prev_cstr = chars; |
3335 } | 3354 } |
3336 return prev_cstr; | 3355 return prev_cstr; |
3337 } | 3356 } |
3338 | 3357 |
3339 | 3358 |
| 3359 void TypeArguments::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 3360 stream->OpenObject(); |
| 3361 stream->CloseObject(); |
| 3362 } |
| 3363 |
| 3364 |
3340 intptr_t InstantiatedTypeArguments::Length() const { | 3365 intptr_t InstantiatedTypeArguments::Length() const { |
3341 return AbstractTypeArguments::Handle( | 3366 return AbstractTypeArguments::Handle( |
3342 uninstantiated_type_arguments()).Length(); | 3367 uninstantiated_type_arguments()).Length(); |
3343 } | 3368 } |
3344 | 3369 |
3345 | 3370 |
3346 RawAbstractType* InstantiatedTypeArguments::TypeAt(intptr_t index) const { | 3371 RawAbstractType* InstantiatedTypeArguments::TypeAt(intptr_t index) const { |
3347 AbstractType& type = AbstractType::Handle(AbstractTypeArguments::Handle( | 3372 AbstractType& type = AbstractType::Handle(AbstractTypeArguments::Handle( |
3348 uninstantiated_type_arguments()).TypeAt(index)); | 3373 uninstantiated_type_arguments()).TypeAt(index)); |
3349 if (!type.IsInstantiated()) { | 3374 if (!type.IsInstantiated()) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3412 const char* instantiator_cstr = | 3437 const char* instantiator_cstr = |
3413 AbstractTypeArguments::Handle(instantiator_type_arguments()).ToCString(); | 3438 AbstractTypeArguments::Handle(instantiator_type_arguments()).ToCString(); |
3414 intptr_t len = | 3439 intptr_t len = |
3415 OS::SNPrint(NULL, 0, format, arg_cstr, instantiator_cstr) + 1; | 3440 OS::SNPrint(NULL, 0, format, arg_cstr, instantiator_cstr) + 1; |
3416 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3441 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
3417 OS::SNPrint(chars, len, format, arg_cstr, instantiator_cstr); | 3442 OS::SNPrint(chars, len, format, arg_cstr, instantiator_cstr); |
3418 return chars; | 3443 return chars; |
3419 } | 3444 } |
3420 | 3445 |
3421 | 3446 |
| 3447 void InstantiatedTypeArguments::PrintToJSONStream(JSONStream* stream, |
| 3448 bool ref) const { |
| 3449 stream->OpenObject(); |
| 3450 stream->CloseObject(); |
| 3451 } |
| 3452 |
| 3453 |
3422 const char* PatchClass::ToCString() const { | 3454 const char* PatchClass::ToCString() const { |
3423 const char* kFormat = "PatchClass for %s"; | 3455 const char* kFormat = "PatchClass for %s"; |
3424 const Class& cls = Class::Handle(patched_class()); | 3456 const Class& cls = Class::Handle(patched_class()); |
3425 const char* cls_name = cls.ToCString(); | 3457 const char* cls_name = cls.ToCString(); |
3426 intptr_t len = OS::SNPrint(NULL, 0, kFormat, cls_name) + 1; | 3458 intptr_t len = OS::SNPrint(NULL, 0, kFormat, cls_name) + 1; |
3427 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3459 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
3428 OS::SNPrint(chars, len, kFormat, cls_name); | 3460 OS::SNPrint(chars, len, kFormat, cls_name); |
3429 return chars; | 3461 return chars; |
3430 } | 3462 } |
3431 | 3463 |
3432 | 3464 |
| 3465 void PatchClass::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 3466 stream->OpenObject(); |
| 3467 stream->CloseObject(); |
| 3468 } |
| 3469 |
| 3470 |
3433 RawPatchClass* PatchClass::New(const Class& patched_class, | 3471 RawPatchClass* PatchClass::New(const Class& patched_class, |
3434 const Class& source_class) { | 3472 const Class& source_class) { |
3435 const PatchClass& result = PatchClass::Handle(PatchClass::New()); | 3473 const PatchClass& result = PatchClass::Handle(PatchClass::New()); |
3436 result.set_patched_class(patched_class); | 3474 result.set_patched_class(patched_class); |
3437 result.set_source_class(source_class); | 3475 result.set_source_class(source_class); |
3438 return result.raw(); | 3476 return result.raw(); |
3439 } | 3477 } |
3440 | 3478 |
3441 | 3479 |
3442 RawPatchClass* PatchClass::New() { | 3480 RawPatchClass* PatchClass::New() { |
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4736 const char* function_name = String::Handle(name()).ToCString(); | 4774 const char* function_name = String::Handle(name()).ToCString(); |
4737 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, | 4775 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, |
4738 static_str, abstract_str, kind_str, const_str) + 1; | 4776 static_str, abstract_str, kind_str, const_str) + 1; |
4739 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 4777 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
4740 OS::SNPrint(chars, len, kFormat, function_name, | 4778 OS::SNPrint(chars, len, kFormat, function_name, |
4741 static_str, abstract_str, kind_str, const_str); | 4779 static_str, abstract_str, kind_str, const_str); |
4742 return chars; | 4780 return chars; |
4743 } | 4781 } |
4744 | 4782 |
4745 | 4783 |
| 4784 void Function::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 4785 stream->OpenObject(); |
| 4786 stream->CloseObject(); |
| 4787 } |
| 4788 |
| 4789 |
4746 void ClosureData::set_context_scope(const ContextScope& value) const { | 4790 void ClosureData::set_context_scope(const ContextScope& value) const { |
4747 StorePointer(&raw_ptr()->context_scope_, value.raw()); | 4791 StorePointer(&raw_ptr()->context_scope_, value.raw()); |
4748 } | 4792 } |
4749 | 4793 |
4750 | 4794 |
4751 void ClosureData::set_implicit_static_closure(const Instance& closure) const { | 4795 void ClosureData::set_implicit_static_closure(const Instance& closure) const { |
4752 ASSERT(!closure.IsNull()); | 4796 ASSERT(!closure.IsNull()); |
4753 ASSERT(raw_ptr()->closure_ == Instance::null()); | 4797 ASSERT(raw_ptr()->closure_ == Instance::null()); |
4754 StorePointer(&raw_ptr()->closure_, closure.raw()); | 4798 StorePointer(&raw_ptr()->closure_, closure.raw()); |
4755 } | 4799 } |
(...skipping 23 matching lines...) Expand all Loading... |
4779 Heap::kOld); | 4823 Heap::kOld); |
4780 return reinterpret_cast<RawClosureData*>(raw); | 4824 return reinterpret_cast<RawClosureData*>(raw); |
4781 } | 4825 } |
4782 | 4826 |
4783 | 4827 |
4784 const char* ClosureData::ToCString() const { | 4828 const char* ClosureData::ToCString() const { |
4785 return "ClosureData class"; | 4829 return "ClosureData class"; |
4786 } | 4830 } |
4787 | 4831 |
4788 | 4832 |
| 4833 void ClosureData::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 4834 stream->OpenObject(); |
| 4835 stream->CloseObject(); |
| 4836 } |
| 4837 |
| 4838 |
4789 void RedirectionData::set_type(const Type& value) const { | 4839 void RedirectionData::set_type(const Type& value) const { |
4790 ASSERT(!value.IsNull()); | 4840 ASSERT(!value.IsNull()); |
4791 StorePointer(&raw_ptr()->type_, value.raw()); | 4841 StorePointer(&raw_ptr()->type_, value.raw()); |
4792 } | 4842 } |
4793 | 4843 |
4794 | 4844 |
4795 void RedirectionData::set_identifier(const String& value) const { | 4845 void RedirectionData::set_identifier(const String& value) const { |
4796 StorePointer(&raw_ptr()->identifier_, value.raw()); | 4846 StorePointer(&raw_ptr()->identifier_, value.raw()); |
4797 } | 4847 } |
4798 | 4848 |
(...skipping 10 matching lines...) Expand all Loading... |
4809 Heap::kOld); | 4859 Heap::kOld); |
4810 return reinterpret_cast<RawRedirectionData*>(raw); | 4860 return reinterpret_cast<RawRedirectionData*>(raw); |
4811 } | 4861 } |
4812 | 4862 |
4813 | 4863 |
4814 const char* RedirectionData::ToCString() const { | 4864 const char* RedirectionData::ToCString() const { |
4815 return "RedirectionData class"; | 4865 return "RedirectionData class"; |
4816 } | 4866 } |
4817 | 4867 |
4818 | 4868 |
| 4869 void RedirectionData::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 4870 stream->OpenObject(); |
| 4871 stream->CloseObject(); |
| 4872 } |
| 4873 |
| 4874 |
4819 RawString* Field::GetterName(const String& field_name) { | 4875 RawString* Field::GetterName(const String& field_name) { |
4820 return String::Concat(Symbols::GetterPrefix(), field_name); | 4876 return String::Concat(Symbols::GetterPrefix(), field_name); |
4821 } | 4877 } |
4822 | 4878 |
4823 | 4879 |
4824 RawString* Field::GetterSymbol(const String& field_name) { | 4880 RawString* Field::GetterSymbol(const String& field_name) { |
4825 const String& str = String::Handle(Field::GetterName(field_name)); | 4881 const String& str = String::Handle(Field::GetterName(field_name)); |
4826 return Symbols::New(str); | 4882 return Symbols::New(str); |
4827 } | 4883 } |
4828 | 4884 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4972 const Class& cls = Class::Handle(owner()); | 5028 const Class& cls = Class::Handle(owner()); |
4973 const char* cls_name = String::Handle(cls.Name()).ToCString(); | 5029 const char* cls_name = String::Handle(cls.Name()).ToCString(); |
4974 intptr_t len = | 5030 intptr_t len = |
4975 OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1; | 5031 OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1; |
4976 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 5032 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
4977 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2); | 5033 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2); |
4978 return chars; | 5034 return chars; |
4979 } | 5035 } |
4980 | 5036 |
4981 | 5037 |
| 5038 void Field::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5039 stream->OpenObject(); |
| 5040 stream->CloseObject(); |
| 5041 } |
| 5042 |
| 5043 |
4982 RawArray* Field::dependent_code() const { | 5044 RawArray* Field::dependent_code() const { |
4983 return raw_ptr()->dependent_code_; | 5045 return raw_ptr()->dependent_code_; |
4984 } | 5046 } |
4985 | 5047 |
4986 | 5048 |
4987 void Field::set_dependent_code(const Array& array) const { | 5049 void Field::set_dependent_code(const Array& array) const { |
4988 raw_ptr()->dependent_code_ = array.raw(); | 5050 raw_ptr()->dependent_code_ = array.raw(); |
4989 } | 5051 } |
4990 | 5052 |
4991 | 5053 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5147 return result.raw(); | 5209 return result.raw(); |
5148 } | 5210 } |
5149 | 5211 |
5150 | 5212 |
5151 const char* LiteralToken::ToCString() const { | 5213 const char* LiteralToken::ToCString() const { |
5152 const String& token = String::Handle(literal()); | 5214 const String& token = String::Handle(literal()); |
5153 return token.ToCString(); | 5215 return token.ToCString(); |
5154 } | 5216 } |
5155 | 5217 |
5156 | 5218 |
| 5219 void LiteralToken::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5220 stream->OpenObject(); |
| 5221 stream->CloseObject(); |
| 5222 } |
| 5223 |
| 5224 |
5157 RawArray* TokenStream::TokenObjects() const { | 5225 RawArray* TokenStream::TokenObjects() const { |
5158 return raw_ptr()->token_objects_; | 5226 return raw_ptr()->token_objects_; |
5159 } | 5227 } |
5160 | 5228 |
5161 | 5229 |
5162 void TokenStream::SetTokenObjects(const Array& value) const { | 5230 void TokenStream::SetTokenObjects(const Array& value) const { |
5163 StorePointer(&raw_ptr()->token_objects_, value.raw()); | 5231 StorePointer(&raw_ptr()->token_objects_, value.raw()); |
5164 } | 5232 } |
5165 | 5233 |
5166 | 5234 |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5557 } | 5625 } |
5558 return result.raw(); | 5626 return result.raw(); |
5559 } | 5627 } |
5560 | 5628 |
5561 | 5629 |
5562 const char* TokenStream::ToCString() const { | 5630 const char* TokenStream::ToCString() const { |
5563 return "TokenStream"; | 5631 return "TokenStream"; |
5564 } | 5632 } |
5565 | 5633 |
5566 | 5634 |
| 5635 void TokenStream::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5636 stream->OpenObject(); |
| 5637 stream->CloseObject(); |
| 5638 } |
| 5639 |
| 5640 |
5567 TokenStream::Iterator::Iterator(const TokenStream& tokens, intptr_t token_pos) | 5641 TokenStream::Iterator::Iterator(const TokenStream& tokens, intptr_t token_pos) |
5568 : tokens_(TokenStream::Handle(tokens.raw())), | 5642 : tokens_(TokenStream::Handle(tokens.raw())), |
5569 data_(ExternalTypedData::Handle(tokens.GetStream())), | 5643 data_(ExternalTypedData::Handle(tokens.GetStream())), |
5570 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), | 5644 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), |
5571 token_objects_(Array::Handle(tokens.TokenObjects())), | 5645 token_objects_(Array::Handle(tokens.TokenObjects())), |
5572 obj_(Object::Handle()), | 5646 obj_(Object::Handle()), |
5573 cur_token_pos_(token_pos), | 5647 cur_token_pos_(token_pos), |
5574 cur_token_kind_(Token::kILLEGAL), | 5648 cur_token_kind_(Token::kILLEGAL), |
5575 cur_token_obj_index_(-1) { | 5649 cur_token_obj_index_(-1) { |
5576 SetCurrentPosition(token_pos); | 5650 SetCurrentPosition(token_pos); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5903 result.SetLocationOffset(0, 0); | 5977 result.SetLocationOffset(0, 0); |
5904 return result.raw(); | 5978 return result.raw(); |
5905 } | 5979 } |
5906 | 5980 |
5907 | 5981 |
5908 const char* Script::ToCString() const { | 5982 const char* Script::ToCString() const { |
5909 return "Script"; | 5983 return "Script"; |
5910 } | 5984 } |
5911 | 5985 |
5912 | 5986 |
| 5987 void Script::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5988 stream->OpenObject(); |
| 5989 stream->CloseObject(); |
| 5990 } |
| 5991 |
| 5992 |
5913 DictionaryIterator::DictionaryIterator(const Library& library) | 5993 DictionaryIterator::DictionaryIterator(const Library& library) |
5914 : array_(Array::Handle(library.dictionary())), | 5994 : array_(Array::Handle(library.dictionary())), |
5915 // Last element in array is a Smi. | 5995 // Last element in array is a Smi. |
5916 size_(Array::Handle(library.dictionary()).Length() - 1), | 5996 size_(Array::Handle(library.dictionary()).Length() - 1), |
5917 next_ix_(0) { | 5997 next_ix_(0) { |
5918 MoveToNextObject(); | 5998 MoveToNextObject(); |
5919 } | 5999 } |
5920 | 6000 |
5921 | 6001 |
5922 RawObject* DictionaryIterator::GetNext() { | 6002 RawObject* DictionaryIterator::GetNext() { |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6893 const char* Library::ToCString() const { | 6973 const char* Library::ToCString() const { |
6894 const char* kFormat = "Library:'%s'"; | 6974 const char* kFormat = "Library:'%s'"; |
6895 const String& name = String::Handle(url()); | 6975 const String& name = String::Handle(url()); |
6896 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1; | 6976 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1; |
6897 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 6977 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
6898 OS::SNPrint(chars, len, kFormat, name.ToCString()); | 6978 OS::SNPrint(chars, len, kFormat, name.ToCString()); |
6899 return chars; | 6979 return chars; |
6900 } | 6980 } |
6901 | 6981 |
6902 | 6982 |
| 6983 void Library::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 6984 stream->OpenObject(); |
| 6985 stream->CloseObject(); |
| 6986 } |
| 6987 |
| 6988 |
6903 RawLibrary* LibraryPrefix::GetLibrary(int index) const { | 6989 RawLibrary* LibraryPrefix::GetLibrary(int index) const { |
6904 if ((index >= 0) || (index < num_imports())) { | 6990 if ((index >= 0) || (index < num_imports())) { |
6905 const Array& imports = Array::Handle(this->imports()); | 6991 const Array& imports = Array::Handle(this->imports()); |
6906 Namespace& import = Namespace::Handle(); | 6992 Namespace& import = Namespace::Handle(); |
6907 import ^= imports.At(index); | 6993 import ^= imports.At(index); |
6908 return import.library(); | 6994 return import.library(); |
6909 } | 6995 } |
6910 return Library::null(); | 6996 return Library::null(); |
6911 } | 6997 } |
6912 | 6998 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7002 const char* LibraryPrefix::ToCString() const { | 7088 const char* LibraryPrefix::ToCString() const { |
7003 const char* kFormat = "LibraryPrefix:'%s'"; | 7089 const char* kFormat = "LibraryPrefix:'%s'"; |
7004 const String& prefix = String::Handle(name()); | 7090 const String& prefix = String::Handle(name()); |
7005 intptr_t len = OS::SNPrint(NULL, 0, kFormat, prefix.ToCString()) + 1; | 7091 intptr_t len = OS::SNPrint(NULL, 0, kFormat, prefix.ToCString()) + 1; |
7006 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 7092 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
7007 OS::SNPrint(chars, len, kFormat, prefix.ToCString()); | 7093 OS::SNPrint(chars, len, kFormat, prefix.ToCString()); |
7008 return chars; | 7094 return chars; |
7009 } | 7095 } |
7010 | 7096 |
7011 | 7097 |
| 7098 void LibraryPrefix::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7099 stream->OpenObject(); |
| 7100 stream->CloseObject(); |
| 7101 } |
| 7102 |
| 7103 |
7012 const char* Namespace::ToCString() const { | 7104 const char* Namespace::ToCString() const { |
7013 const char* kFormat = "Namespace for library '%s'"; | 7105 const char* kFormat = "Namespace for library '%s'"; |
7014 const Library& lib = Library::Handle(library()); | 7106 const Library& lib = Library::Handle(library()); |
7015 intptr_t len = OS::SNPrint(NULL, 0, kFormat, lib.ToCString()) + 1; | 7107 intptr_t len = OS::SNPrint(NULL, 0, kFormat, lib.ToCString()) + 1; |
7016 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 7108 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
7017 OS::SNPrint(chars, len, kFormat, lib.ToCString()); | 7109 OS::SNPrint(chars, len, kFormat, lib.ToCString()); |
7018 return chars; | 7110 return chars; |
7019 } | 7111 } |
7020 | 7112 |
7021 | 7113 |
| 7114 void Namespace::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7115 stream->OpenObject(); |
| 7116 stream->CloseObject(); |
| 7117 } |
| 7118 |
| 7119 |
7022 bool Namespace::HidesName(const String& name) const { | 7120 bool Namespace::HidesName(const String& name) const { |
7023 // Check whether the name is in the list of explicitly hidden names. | 7121 // Check whether the name is in the list of explicitly hidden names. |
7024 if (hide_names() != Array::null()) { | 7122 if (hide_names() != Array::null()) { |
7025 const Array& names = Array::Handle(hide_names()); | 7123 const Array& names = Array::Handle(hide_names()); |
7026 String& hidden = String::Handle(); | 7124 String& hidden = String::Handle(); |
7027 intptr_t num_names = names.Length(); | 7125 intptr_t num_names = names.Length(); |
7028 for (intptr_t i = 0; i < num_names; i++) { | 7126 for (intptr_t i = 0; i < num_names; i++) { |
7029 hidden ^= names.At(i); | 7127 hidden ^= names.At(i); |
7030 if (name.Equals(hidden)) { | 7128 if (name.Equals(hidden)) { |
7031 return true; | 7129 return true; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7221 } | 7319 } |
7222 return result.raw(); | 7320 return result.raw(); |
7223 } | 7321 } |
7224 | 7322 |
7225 | 7323 |
7226 const char* Instructions::ToCString() const { | 7324 const char* Instructions::ToCString() const { |
7227 return "Instructions"; | 7325 return "Instructions"; |
7228 } | 7326 } |
7229 | 7327 |
7230 | 7328 |
| 7329 void Instructions::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7330 stream->OpenObject(); |
| 7331 stream->CloseObject(); |
| 7332 } |
| 7333 |
| 7334 |
7231 intptr_t PcDescriptors::Length() const { | 7335 intptr_t PcDescriptors::Length() const { |
7232 return Smi::Value(raw_ptr()->length_); | 7336 return Smi::Value(raw_ptr()->length_); |
7233 } | 7337 } |
7234 | 7338 |
7235 | 7339 |
7236 void PcDescriptors::SetLength(intptr_t value) const { | 7340 void PcDescriptors::SetLength(intptr_t value) const { |
7237 // This is only safe because we create a new Smi, which does not cause | 7341 // This is only safe because we create a new Smi, which does not cause |
7238 // heap allocation. | 7342 // heap allocation. |
7239 raw_ptr()->length_ = Smi::New(value); | 7343 raw_ptr()->length_ = Smi::New(value); |
7240 } | 7344 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7370 PC(i), | 7474 PC(i), |
7371 KindAsStr(i), | 7475 KindAsStr(i), |
7372 DeoptId(i), | 7476 DeoptId(i), |
7373 TokenPos(i), | 7477 TokenPos(i), |
7374 TryIndex(i)); | 7478 TryIndex(i)); |
7375 } | 7479 } |
7376 return buffer; | 7480 return buffer; |
7377 } | 7481 } |
7378 | 7482 |
7379 | 7483 |
| 7484 void PcDescriptors::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7485 stream->OpenObject(); |
| 7486 stream->CloseObject(); |
| 7487 } |
| 7488 |
| 7489 |
7380 // Verify assumptions (in debug mode only). | 7490 // Verify assumptions (in debug mode only). |
7381 // - No two deopt descriptors have the same deoptimization id. | 7491 // - No two deopt descriptors have the same deoptimization id. |
7382 // - No two ic-call descriptors have the same deoptimization id (type feedback). | 7492 // - No two ic-call descriptors have the same deoptimization id (type feedback). |
7383 // A function without unique ids is marked as non-optimizable (e.g., because of | 7493 // A function without unique ids is marked as non-optimizable (e.g., because of |
7384 // finally blocks). | 7494 // finally blocks). |
7385 void PcDescriptors::Verify(const Function& function) const { | 7495 void PcDescriptors::Verify(const Function& function) const { |
7386 #if defined(DEBUG) | 7496 #if defined(DEBUG) |
7387 // TODO(srdjan): Implement a more efficient way to check, currently drop | 7497 // TODO(srdjan): Implement a more efficient way to check, currently drop |
7388 // the check for too large number of descriptors. | 7498 // the check for too large number of descriptors. |
7389 if (Length() > 3000) { | 7499 if (Length() > 3000) { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7521 intptr_t index = OS::SNPrint(chars, alloc_size, kFormat, PC()); | 7631 intptr_t index = OS::SNPrint(chars, alloc_size, kFormat, PC()); |
7522 for (intptr_t i = 0; i < Length(); i++) { | 7632 for (intptr_t i = 0; i < Length(); i++) { |
7523 chars[index++] = IsObject(i) ? '1' : '0'; | 7633 chars[index++] = IsObject(i) ? '1' : '0'; |
7524 } | 7634 } |
7525 chars[index] = '\0'; | 7635 chars[index] = '\0'; |
7526 return chars; | 7636 return chars; |
7527 } | 7637 } |
7528 } | 7638 } |
7529 | 7639 |
7530 | 7640 |
| 7641 void Stackmap::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7642 stream->OpenObject(); |
| 7643 stream->CloseObject(); |
| 7644 } |
| 7645 |
| 7646 |
7531 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { | 7647 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { |
7532 ASSERT(var_index < Length()); | 7648 ASSERT(var_index < Length()); |
7533 const Array& names = Array::Handle(raw_ptr()->names_); | 7649 const Array& names = Array::Handle(raw_ptr()->names_); |
7534 ASSERT(Length() == names.Length()); | 7650 ASSERT(Length() == names.Length()); |
7535 String& name = String::Handle(); | 7651 String& name = String::Handle(); |
7536 name ^= names.At(var_index); | 7652 name ^= names.At(var_index); |
7537 return name.raw(); | 7653 return name.raw(); |
7538 } | 7654 } |
7539 | 7655 |
7540 | 7656 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7585 info.kind, | 7701 info.kind, |
7586 info.scope_id, | 7702 info.scope_id, |
7587 info.begin_pos, | 7703 info.begin_pos, |
7588 info.end_pos, | 7704 info.end_pos, |
7589 var_name.ToCString()); | 7705 var_name.ToCString()); |
7590 } | 7706 } |
7591 return buffer; | 7707 return buffer; |
7592 } | 7708 } |
7593 | 7709 |
7594 | 7710 |
| 7711 void LocalVarDescriptors::PrintToJSONStream(JSONStream* stream, |
| 7712 bool ref) const { |
| 7713 stream->OpenObject(); |
| 7714 stream->CloseObject(); |
| 7715 } |
| 7716 |
| 7717 |
7595 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { | 7718 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { |
7596 ASSERT(Object::var_descriptors_class() != Class::null()); | 7719 ASSERT(Object::var_descriptors_class() != Class::null()); |
7597 if (num_variables < 0 || num_variables > kMaxElements) { | 7720 if (num_variables < 0 || num_variables > kMaxElements) { |
7598 // This should be caught before we reach here. | 7721 // This should be caught before we reach here. |
7599 FATAL1("Fatal error in LocalVarDescriptors::New: " | 7722 FATAL1("Fatal error in LocalVarDescriptors::New: " |
7600 "invalid num_variables %"Pd"\n", num_variables); | 7723 "invalid num_variables %"Pd"\n", num_variables); |
7601 } | 7724 } |
7602 LocalVarDescriptors& result = LocalVarDescriptors::Handle(); | 7725 LocalVarDescriptors& result = LocalVarDescriptors::Handle(); |
7603 { | 7726 { |
7604 uword size = LocalVarDescriptors::InstanceSize(num_variables); | 7727 uword size = LocalVarDescriptors::InstanceSize(num_variables); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7748 type ^= handled_types.At(k); | 7871 type ^= handled_types.At(k); |
7749 num_chars += OS::SNPrint((buffer + num_chars), | 7872 num_chars += OS::SNPrint((buffer + num_chars), |
7750 (len - num_chars), | 7873 (len - num_chars), |
7751 kFormat2, k, type.ToCString()); | 7874 kFormat2, k, type.ToCString()); |
7752 } | 7875 } |
7753 } | 7876 } |
7754 return buffer; | 7877 return buffer; |
7755 } | 7878 } |
7756 | 7879 |
7757 | 7880 |
| 7881 void ExceptionHandlers::PrintToJSONStream(JSONStream* stream, |
| 7882 bool ref) const { |
| 7883 stream->OpenObject(); |
| 7884 stream->CloseObject(); |
| 7885 } |
| 7886 |
| 7887 |
7758 intptr_t DeoptInfo::Length() const { | 7888 intptr_t DeoptInfo::Length() const { |
7759 return Smi::Value(raw_ptr()->length_); | 7889 return Smi::Value(raw_ptr()->length_); |
7760 } | 7890 } |
7761 | 7891 |
7762 | 7892 |
7763 intptr_t DeoptInfo::FromIndex(intptr_t index) const { | 7893 intptr_t DeoptInfo::FromIndex(intptr_t index) const { |
7764 return *(EntryAddr(index, kFromIndex)); | 7894 return *(EntryAddr(index, kFromIndex)); |
7765 } | 7895 } |
7766 | 7896 |
7767 | 7897 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7841 for (intptr_t i = 0; i < Length(); i++) { | 7971 for (intptr_t i = 0; i < Length(); i++) { |
7842 index += OS::SNPrint((buffer + index), | 7972 index += OS::SNPrint((buffer + index), |
7843 (len - index), | 7973 (len - index), |
7844 "[%s]", | 7974 "[%s]", |
7845 deopt_instrs[i]->ToCString()); | 7975 deopt_instrs[i]->ToCString()); |
7846 } | 7976 } |
7847 return buffer; | 7977 return buffer; |
7848 } | 7978 } |
7849 | 7979 |
7850 | 7980 |
| 7981 void DeoptInfo::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7982 stream->OpenObject(); |
| 7983 stream->CloseObject(); |
| 7984 } |
| 7985 |
| 7986 |
7851 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) { | 7987 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) { |
7852 ASSERT(Object::deopt_info_class() != Class::null()); | 7988 ASSERT(Object::deopt_info_class() != Class::null()); |
7853 DeoptInfo& result = DeoptInfo::Handle(); | 7989 DeoptInfo& result = DeoptInfo::Handle(); |
7854 { | 7990 { |
7855 uword size = DeoptInfo::InstanceSize(num_commands); | 7991 uword size = DeoptInfo::InstanceSize(num_commands); |
7856 RawObject* raw = Object::Allocate(DeoptInfo::kClassId, | 7992 RawObject* raw = Object::Allocate(DeoptInfo::kClassId, |
7857 size, | 7993 size, |
7858 Heap::kOld); | 7994 Heap::kOld); |
7859 NoGCScope no_gc; | 7995 NoGCScope no_gc; |
7860 result ^= raw; | 7996 result ^= raw; |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8204 | 8340 |
8205 const char* Code::ToCString() const { | 8341 const char* Code::ToCString() const { |
8206 const char* kFormat = "Code entry:%p"; | 8342 const char* kFormat = "Code entry:%p"; |
8207 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; | 8343 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; |
8208 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 8344 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
8209 OS::SNPrint(chars, len, kFormat, EntryPoint()); | 8345 OS::SNPrint(chars, len, kFormat, EntryPoint()); |
8210 return chars; | 8346 return chars; |
8211 } | 8347 } |
8212 | 8348 |
8213 | 8349 |
| 8350 void Code::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 8351 stream->OpenObject(); |
| 8352 stream->CloseObject(); |
| 8353 } |
| 8354 |
| 8355 |
8214 uword Code::GetPatchCodePc() const { | 8356 uword Code::GetPatchCodePc() const { |
8215 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | 8357 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
8216 return descriptors.GetPcForKind(PcDescriptors::kPatchCode); | 8358 return descriptors.GetPcForKind(PcDescriptors::kPatchCode); |
8217 } | 8359 } |
8218 | 8360 |
8219 | 8361 |
8220 uword Code::GetLazyDeoptPc() const { | 8362 uword Code::GetLazyDeoptPc() const { |
8221 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | 8363 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
8222 return descriptors.GetPcForKind(PcDescriptors::kLazyDeoptJump); | 8364 return descriptors.GetPcForKind(PcDescriptors::kLazyDeoptJump); |
8223 } | 8365 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8330 result.set_isolate(Isolate::Current()); | 8472 result.set_isolate(Isolate::Current()); |
8331 return result.raw(); | 8473 return result.raw(); |
8332 } | 8474 } |
8333 | 8475 |
8334 | 8476 |
8335 const char* Context::ToCString() const { | 8477 const char* Context::ToCString() const { |
8336 return "Context"; | 8478 return "Context"; |
8337 } | 8479 } |
8338 | 8480 |
8339 | 8481 |
| 8482 void Context::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 8483 stream->OpenObject(); |
| 8484 stream->CloseObject(); |
| 8485 } |
| 8486 |
| 8487 |
8340 RawContextScope* ContextScope::New(intptr_t num_variables) { | 8488 RawContextScope* ContextScope::New(intptr_t num_variables) { |
8341 ASSERT(Object::context_scope_class() != Class::null()); | 8489 ASSERT(Object::context_scope_class() != Class::null()); |
8342 if (num_variables < 0 || num_variables > kMaxElements) { | 8490 if (num_variables < 0 || num_variables > kMaxElements) { |
8343 // This should be caught before we reach here. | 8491 // This should be caught before we reach here. |
8344 FATAL1("Fatal error in ContextScope::New: invalid num_variables %"Pd"\n", | 8492 FATAL1("Fatal error in ContextScope::New: invalid num_variables %"Pd"\n", |
8345 num_variables); | 8493 num_variables); |
8346 } | 8494 } |
8347 intptr_t size = ContextScope::InstanceSize(num_variables); | 8495 intptr_t size = ContextScope::InstanceSize(num_variables); |
8348 ContextScope& result = ContextScope::Handle(); | 8496 ContextScope& result = ContextScope::Handle(); |
8349 { | 8497 { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8444 intptr_t context_level) const { | 8592 intptr_t context_level) const { |
8445 VariableDescAddr(scope_index)->context_level = Smi::New(context_level); | 8593 VariableDescAddr(scope_index)->context_level = Smi::New(context_level); |
8446 } | 8594 } |
8447 | 8595 |
8448 | 8596 |
8449 const char* ContextScope::ToCString() const { | 8597 const char* ContextScope::ToCString() const { |
8450 return "ContextScope"; | 8598 return "ContextScope"; |
8451 } | 8599 } |
8452 | 8600 |
8453 | 8601 |
| 8602 void ContextScope::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 8603 stream->OpenObject(); |
| 8604 stream->CloseObject(); |
| 8605 } |
| 8606 |
| 8607 |
8454 const char* ICData::ToCString() const { | 8608 const char* ICData::ToCString() const { |
8455 const char* kFormat = "ICData target:'%s' num-checks: %"Pd""; | 8609 const char* kFormat = "ICData target:'%s' num-checks: %"Pd""; |
8456 const String& name = String::Handle(target_name()); | 8610 const String& name = String::Handle(target_name()); |
8457 const intptr_t num = NumberOfChecks(); | 8611 const intptr_t num = NumberOfChecks(); |
8458 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString(), num) + 1; | 8612 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString(), num) + 1; |
8459 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 8613 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
8460 OS::SNPrint(chars, len, kFormat, name.ToCString(), num); | 8614 OS::SNPrint(chars, len, kFormat, name.ToCString(), num); |
8461 return chars; | 8615 return chars; |
8462 } | 8616 } |
8463 | 8617 |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8857 // Number of array elements in one test entry. | 9011 // Number of array elements in one test entry. |
8858 intptr_t len = result.TestEntryLength(); | 9012 intptr_t len = result.TestEntryLength(); |
8859 // IC data array must be null terminated (sentinel entry). | 9013 // IC data array must be null terminated (sentinel entry). |
8860 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); | 9014 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); |
8861 result.set_ic_data(ic_data); | 9015 result.set_ic_data(ic_data); |
8862 result.WriteSentinel(ic_data); | 9016 result.WriteSentinel(ic_data); |
8863 return result.raw(); | 9017 return result.raw(); |
8864 } | 9018 } |
8865 | 9019 |
8866 | 9020 |
| 9021 void ICData::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9022 stream->OpenObject(); |
| 9023 stream->CloseObject(); |
| 9024 } |
| 9025 |
| 9026 |
8867 RawArray* MegamorphicCache::buckets() const { | 9027 RawArray* MegamorphicCache::buckets() const { |
8868 return raw_ptr()->buckets_; | 9028 return raw_ptr()->buckets_; |
8869 } | 9029 } |
8870 | 9030 |
8871 | 9031 |
8872 void MegamorphicCache::set_buckets(const Array& buckets) const { | 9032 void MegamorphicCache::set_buckets(const Array& buckets) const { |
8873 StorePointer(&raw_ptr()->buckets_, buckets.raw()); | 9033 StorePointer(&raw_ptr()->buckets_, buckets.raw()); |
8874 } | 9034 } |
8875 | 9035 |
8876 | 9036 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8968 } while (i != index); | 9128 } while (i != index); |
8969 UNREACHABLE(); | 9129 UNREACHABLE(); |
8970 } | 9130 } |
8971 | 9131 |
8972 | 9132 |
8973 const char* MegamorphicCache::ToCString() const { | 9133 const char* MegamorphicCache::ToCString() const { |
8974 return ""; | 9134 return ""; |
8975 } | 9135 } |
8976 | 9136 |
8977 | 9137 |
| 9138 void MegamorphicCache::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9139 stream->OpenObject(); |
| 9140 stream->CloseObject(); |
| 9141 } |
| 9142 |
| 9143 |
8978 RawSubtypeTestCache* SubtypeTestCache::New() { | 9144 RawSubtypeTestCache* SubtypeTestCache::New() { |
8979 ASSERT(Object::subtypetestcache_class() != Class::null()); | 9145 ASSERT(Object::subtypetestcache_class() != Class::null()); |
8980 SubtypeTestCache& result = SubtypeTestCache::Handle(); | 9146 SubtypeTestCache& result = SubtypeTestCache::Handle(); |
8981 { | 9147 { |
8982 // SubtypeTestCache objects are long living objects, allocate them in the | 9148 // SubtypeTestCache objects are long living objects, allocate them in the |
8983 // old generation. | 9149 // old generation. |
8984 RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId, | 9150 RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId, |
8985 SubtypeTestCache::InstanceSize(), | 9151 SubtypeTestCache::InstanceSize(), |
8986 Heap::kOld); | 9152 Heap::kOld); |
8987 NoGCScope no_gc; | 9153 NoGCScope no_gc; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9039 data.At(data_pos + kInstantiatorTypeArguments); | 9205 data.At(data_pos + kInstantiatorTypeArguments); |
9040 *test_result ^= data.At(data_pos + kTestResult); | 9206 *test_result ^= data.At(data_pos + kTestResult); |
9041 } | 9207 } |
9042 | 9208 |
9043 | 9209 |
9044 const char* SubtypeTestCache::ToCString() const { | 9210 const char* SubtypeTestCache::ToCString() const { |
9045 return "SubtypeTestCache"; | 9211 return "SubtypeTestCache"; |
9046 } | 9212 } |
9047 | 9213 |
9048 | 9214 |
| 9215 void SubtypeTestCache::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9216 stream->OpenObject(); |
| 9217 stream->CloseObject(); |
| 9218 } |
| 9219 |
| 9220 |
9049 const char* Error::ToErrorCString() const { | 9221 const char* Error::ToErrorCString() const { |
9050 UNREACHABLE(); | 9222 UNREACHABLE(); |
9051 return "Internal Error"; | 9223 return "Internal Error"; |
9052 } | 9224 } |
9053 | 9225 |
9054 | 9226 |
9055 const char* Error::ToCString() const { | 9227 const char* Error::ToCString() const { |
9056 // Error is an abstract class. We should never reach here. | 9228 // Error is an abstract class. We should never reach here. |
9057 UNREACHABLE(); | 9229 UNREACHABLE(); |
9058 return "Error"; | 9230 return "Error"; |
9059 } | 9231 } |
9060 | 9232 |
9061 | 9233 |
| 9234 void Error::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9235 stream->OpenObject(); |
| 9236 stream->CloseObject(); |
| 9237 } |
| 9238 |
| 9239 |
9062 RawApiError* ApiError::New() { | 9240 RawApiError* ApiError::New() { |
9063 ASSERT(Object::api_error_class() != Class::null()); | 9241 ASSERT(Object::api_error_class() != Class::null()); |
9064 RawObject* raw = Object::Allocate(ApiError::kClassId, | 9242 RawObject* raw = Object::Allocate(ApiError::kClassId, |
9065 ApiError::InstanceSize(), | 9243 ApiError::InstanceSize(), |
9066 Heap::kOld); | 9244 Heap::kOld); |
9067 return reinterpret_cast<RawApiError*>(raw); | 9245 return reinterpret_cast<RawApiError*>(raw); |
9068 } | 9246 } |
9069 | 9247 |
9070 | 9248 |
9071 RawApiError* ApiError::New(const String& message, Heap::Space space) { | 9249 RawApiError* ApiError::New(const String& message, Heap::Space space) { |
(...skipping 20 matching lines...) Expand all Loading... |
9092 const String& msg_str = String::Handle(message()); | 9270 const String& msg_str = String::Handle(message()); |
9093 return msg_str.ToCString(); | 9271 return msg_str.ToCString(); |
9094 } | 9272 } |
9095 | 9273 |
9096 | 9274 |
9097 const char* ApiError::ToCString() const { | 9275 const char* ApiError::ToCString() const { |
9098 return "ApiError"; | 9276 return "ApiError"; |
9099 } | 9277 } |
9100 | 9278 |
9101 | 9279 |
| 9280 void ApiError::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9281 stream->OpenObject(); |
| 9282 stream->CloseObject(); |
| 9283 } |
| 9284 |
| 9285 |
9102 RawLanguageError* LanguageError::New() { | 9286 RawLanguageError* LanguageError::New() { |
9103 ASSERT(Object::language_error_class() != Class::null()); | 9287 ASSERT(Object::language_error_class() != Class::null()); |
9104 RawObject* raw = Object::Allocate(LanguageError::kClassId, | 9288 RawObject* raw = Object::Allocate(LanguageError::kClassId, |
9105 LanguageError::InstanceSize(), | 9289 LanguageError::InstanceSize(), |
9106 Heap::kOld); | 9290 Heap::kOld); |
9107 return reinterpret_cast<RawLanguageError*>(raw); | 9291 return reinterpret_cast<RawLanguageError*>(raw); |
9108 } | 9292 } |
9109 | 9293 |
9110 | 9294 |
9111 RawLanguageError* LanguageError::New(const String& message, Heap::Space space) { | 9295 RawLanguageError* LanguageError::New(const String& message, Heap::Space space) { |
(...skipping 20 matching lines...) Expand all Loading... |
9132 const String& msg_str = String::Handle(message()); | 9316 const String& msg_str = String::Handle(message()); |
9133 return msg_str.ToCString(); | 9317 return msg_str.ToCString(); |
9134 } | 9318 } |
9135 | 9319 |
9136 | 9320 |
9137 const char* LanguageError::ToCString() const { | 9321 const char* LanguageError::ToCString() const { |
9138 return "LanguageError"; | 9322 return "LanguageError"; |
9139 } | 9323 } |
9140 | 9324 |
9141 | 9325 |
| 9326 void LanguageError::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9327 stream->OpenObject(); |
| 9328 stream->CloseObject(); |
| 9329 } |
| 9330 |
| 9331 |
9142 RawUnhandledException* UnhandledException::New(const Instance& exception, | 9332 RawUnhandledException* UnhandledException::New(const Instance& exception, |
9143 const Instance& stacktrace, | 9333 const Instance& stacktrace, |
9144 Heap::Space space) { | 9334 Heap::Space space) { |
9145 ASSERT(Object::unhandled_exception_class() != Class::null()); | 9335 ASSERT(Object::unhandled_exception_class() != Class::null()); |
9146 UnhandledException& result = UnhandledException::Handle(); | 9336 UnhandledException& result = UnhandledException::Handle(); |
9147 { | 9337 { |
9148 RawObject* raw = Object::Allocate(UnhandledException::kClassId, | 9338 RawObject* raw = Object::Allocate(UnhandledException::kClassId, |
9149 UnhandledException::InstanceSize(), | 9339 UnhandledException::InstanceSize(), |
9150 space); | 9340 space); |
9151 NoGCScope no_gc; | 9341 NoGCScope no_gc; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9200 OS::SNPrint(chars, len, format, exc_str, stack_str); | 9390 OS::SNPrint(chars, len, format, exc_str, stack_str); |
9201 return chars; | 9391 return chars; |
9202 } | 9392 } |
9203 | 9393 |
9204 | 9394 |
9205 const char* UnhandledException::ToCString() const { | 9395 const char* UnhandledException::ToCString() const { |
9206 return "UnhandledException"; | 9396 return "UnhandledException"; |
9207 } | 9397 } |
9208 | 9398 |
9209 | 9399 |
| 9400 void UnhandledException::PrintToJSONStream(JSONStream* stream, |
| 9401 bool ref) const { |
| 9402 stream->OpenObject(); |
| 9403 stream->CloseObject(); |
| 9404 } |
| 9405 |
| 9406 |
9210 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { | 9407 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { |
9211 ASSERT(Object::unwind_error_class() != Class::null()); | 9408 ASSERT(Object::unwind_error_class() != Class::null()); |
9212 UnwindError& result = UnwindError::Handle(); | 9409 UnwindError& result = UnwindError::Handle(); |
9213 { | 9410 { |
9214 RawObject* raw = Object::Allocate(UnwindError::kClassId, | 9411 RawObject* raw = Object::Allocate(UnwindError::kClassId, |
9215 UnwindError::InstanceSize(), | 9412 UnwindError::InstanceSize(), |
9216 space); | 9413 space); |
9217 NoGCScope no_gc; | 9414 NoGCScope no_gc; |
9218 result ^= raw; | 9415 result ^= raw; |
9219 } | 9416 } |
(...skipping 11 matching lines...) Expand all Loading... |
9231 const String& msg_str = String::Handle(message()); | 9428 const String& msg_str = String::Handle(message()); |
9232 return msg_str.ToCString(); | 9429 return msg_str.ToCString(); |
9233 } | 9430 } |
9234 | 9431 |
9235 | 9432 |
9236 const char* UnwindError::ToCString() const { | 9433 const char* UnwindError::ToCString() const { |
9237 return "UnwindError"; | 9434 return "UnwindError"; |
9238 } | 9435 } |
9239 | 9436 |
9240 | 9437 |
| 9438 void UnwindError::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9439 stream->OpenObject(); |
| 9440 stream->CloseObject(); |
| 9441 } |
| 9442 |
| 9443 |
9241 bool Instance::Equals(const Instance& other) const { | 9444 bool Instance::Equals(const Instance& other) const { |
9242 if (this->raw() == other.raw()) { | 9445 if (this->raw() == other.raw()) { |
9243 return true; // "===". | 9446 return true; // "===". |
9244 } | 9447 } |
9245 | 9448 |
9246 if (other.IsNull() || (this->clazz() != other.clazz())) { | 9449 if (other.IsNull() || (this->clazz() != other.clazz())) { |
9247 return false; | 9450 return false; |
9248 } | 9451 } |
9249 | 9452 |
9250 { | 9453 { |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9551 const String& type_name = String::Handle(type.Name()); | 9754 const String& type_name = String::Handle(type.Name()); |
9552 // Calculate the size of the string. | 9755 // Calculate the size of the string. |
9553 intptr_t len = OS::SNPrint(NULL, 0, kFormat, type_name.ToCString()) + 1; | 9756 intptr_t len = OS::SNPrint(NULL, 0, kFormat, type_name.ToCString()) + 1; |
9554 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 9757 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
9555 OS::SNPrint(chars, len, kFormat, type_name.ToCString()); | 9758 OS::SNPrint(chars, len, kFormat, type_name.ToCString()); |
9556 return chars; | 9759 return chars; |
9557 } | 9760 } |
9558 } | 9761 } |
9559 | 9762 |
9560 | 9763 |
| 9764 void Instance::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9765 stream->OpenObject(); |
| 9766 stream->CloseObject(); |
| 9767 } |
| 9768 |
| 9769 |
9561 bool AbstractType::IsResolved() const { | 9770 bool AbstractType::IsResolved() const { |
9562 // AbstractType is an abstract class. | 9771 // AbstractType is an abstract class. |
9563 UNREACHABLE(); | 9772 UNREACHABLE(); |
9564 return false; | 9773 return false; |
9565 } | 9774 } |
9566 | 9775 |
9567 | 9776 |
9568 bool AbstractType::HasResolvedTypeClass() const { | 9777 bool AbstractType::HasResolvedTypeClass() const { |
9569 // AbstractType is an abstract class. | 9778 // AbstractType is an abstract class. |
9570 UNREACHABLE(); | 9779 UNREACHABLE(); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9890 } | 10099 } |
9891 | 10100 |
9892 | 10101 |
9893 const char* AbstractType::ToCString() const { | 10102 const char* AbstractType::ToCString() const { |
9894 // AbstractType is an abstract class. | 10103 // AbstractType is an abstract class. |
9895 UNREACHABLE(); | 10104 UNREACHABLE(); |
9896 return "AbstractType"; | 10105 return "AbstractType"; |
9897 } | 10106 } |
9898 | 10107 |
9899 | 10108 |
| 10109 void AbstractType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10110 stream->OpenObject(); |
| 10111 stream->CloseObject(); |
| 10112 } |
| 10113 |
| 10114 |
9900 RawType* Type::NullType() { | 10115 RawType* Type::NullType() { |
9901 return Isolate::Current()->object_store()->null_type(); | 10116 return Isolate::Current()->object_store()->null_type(); |
9902 } | 10117 } |
9903 | 10118 |
9904 | 10119 |
9905 RawType* Type::DynamicType() { | 10120 RawType* Type::DynamicType() { |
9906 return Isolate::Current()->object_store()->dynamic_type(); | 10121 return Isolate::Current()->object_store()->dynamic_type(); |
9907 } | 10122 } |
9908 | 10123 |
9909 | 10124 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10281 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 10496 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
10282 OS::SNPrint(chars, len, format, class_name, args_cstr); | 10497 OS::SNPrint(chars, len, format, class_name, args_cstr); |
10283 return chars; | 10498 return chars; |
10284 } | 10499 } |
10285 } else { | 10500 } else { |
10286 return "Unresolved Type"; | 10501 return "Unresolved Type"; |
10287 } | 10502 } |
10288 } | 10503 } |
10289 | 10504 |
10290 | 10505 |
| 10506 void Type::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10507 stream->OpenObject(); |
| 10508 stream->CloseObject(); |
| 10509 } |
| 10510 |
| 10511 |
10291 void TypeParameter::set_is_finalized() const { | 10512 void TypeParameter::set_is_finalized() const { |
10292 ASSERT(!IsFinalized()); | 10513 ASSERT(!IsFinalized()); |
10293 set_type_state(RawTypeParameter::kFinalizedUninstantiated); | 10514 set_type_state(RawTypeParameter::kFinalizedUninstantiated); |
10294 } | 10515 } |
10295 | 10516 |
10296 | 10517 |
10297 bool TypeParameter::Equals(const Instance& other) const { | 10518 bool TypeParameter::Equals(const Instance& other) const { |
10298 if (raw() == other.raw()) { | 10519 if (raw() == other.raw()) { |
10299 return true; | 10520 return true; |
10300 } | 10521 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10459 const Class& cls = Class::Handle(parameterized_class()); | 10680 const Class& cls = Class::Handle(parameterized_class()); |
10460 const char* cls_cstr = | 10681 const char* cls_cstr = |
10461 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); | 10682 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); |
10462 intptr_t len = OS::SNPrint(NULL, 0, format, name_cstr, index(), cls_cstr) + 1; | 10683 intptr_t len = OS::SNPrint(NULL, 0, format, name_cstr, index(), cls_cstr) + 1; |
10463 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 10684 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
10464 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr); | 10685 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr); |
10465 return chars; | 10686 return chars; |
10466 } | 10687 } |
10467 | 10688 |
10468 | 10689 |
| 10690 void TypeParameter::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10691 stream->OpenObject(); |
| 10692 stream->CloseObject(); |
| 10693 } |
| 10694 |
| 10695 |
10469 bool BoundedType::IsMalformed() const { | 10696 bool BoundedType::IsMalformed() const { |
10470 return FLAG_enable_type_checks && AbstractType::Handle(bound()).IsMalformed(); | 10697 return FLAG_enable_type_checks && AbstractType::Handle(bound()).IsMalformed(); |
10471 } | 10698 } |
10472 | 10699 |
10473 | 10700 |
10474 RawError* BoundedType::malformed_error() const { | 10701 RawError* BoundedType::malformed_error() const { |
10475 ASSERT(FLAG_enable_type_checks); | 10702 ASSERT(FLAG_enable_type_checks); |
10476 return AbstractType::Handle(bound()).malformed_error(); | 10703 return AbstractType::Handle(bound()).malformed_error(); |
10477 } | 10704 } |
10478 | 10705 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10607 const char* cls_cstr = | 10834 const char* cls_cstr = |
10608 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); | 10835 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); |
10609 intptr_t len = OS::SNPrint( | 10836 intptr_t len = OS::SNPrint( |
10610 NULL, 0, format, type_cstr, bound_cstr, cls_cstr) + 1; | 10837 NULL, 0, format, type_cstr, bound_cstr, cls_cstr) + 1; |
10611 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 10838 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
10612 OS::SNPrint(chars, len, format, type_cstr, bound_cstr, cls_cstr); | 10839 OS::SNPrint(chars, len, format, type_cstr, bound_cstr, cls_cstr); |
10613 return chars; | 10840 return chars; |
10614 } | 10841 } |
10615 | 10842 |
10616 | 10843 |
| 10844 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10845 stream->OpenObject(); |
| 10846 stream->CloseObject(); |
| 10847 } |
| 10848 |
10617 | 10849 |
10618 RawString* MixinAppType::Name() const { | 10850 RawString* MixinAppType::Name() const { |
10619 return String::New("MixinApplication"); | 10851 return String::New("MixinApplication"); |
10620 } | 10852 } |
10621 | 10853 |
10622 | 10854 |
10623 const char* MixinAppType::ToCString() const { | 10855 const char* MixinAppType::ToCString() const { |
10624 return "MixinAppType"; | 10856 return "MixinAppType"; |
10625 } | 10857 } |
10626 | 10858 |
10627 | 10859 |
| 10860 void MixinAppType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10861 stream->OpenObject(); |
| 10862 stream->CloseObject(); |
| 10863 } |
| 10864 |
| 10865 |
10628 void MixinAppType::set_super_type(const AbstractType& value) const { | 10866 void MixinAppType::set_super_type(const AbstractType& value) const { |
10629 StorePointer(&raw_ptr()->super_type_, value.raw()); | 10867 StorePointer(&raw_ptr()->super_type_, value.raw()); |
10630 } | 10868 } |
10631 | 10869 |
10632 | 10870 |
10633 void MixinAppType::set_mixin_types(const Array& value) const { | 10871 void MixinAppType::set_mixin_types(const Array& value) const { |
10634 StorePointer(&raw_ptr()->mixin_types_, value.raw()); | 10872 StorePointer(&raw_ptr()->mixin_types_, value.raw()); |
10635 } | 10873 } |
10636 | 10874 |
10637 | 10875 |
(...skipping 18 matching lines...) Expand all Loading... |
10656 } | 10894 } |
10657 | 10895 |
10658 | 10896 |
10659 const char* Number::ToCString() const { | 10897 const char* Number::ToCString() const { |
10660 // Number is an interface. No instances of Number should exist. | 10898 // Number is an interface. No instances of Number should exist. |
10661 UNREACHABLE(); | 10899 UNREACHABLE(); |
10662 return "Number"; | 10900 return "Number"; |
10663 } | 10901 } |
10664 | 10902 |
10665 | 10903 |
| 10904 void Number::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10905 stream->OpenObject(); |
| 10906 stream->CloseObject(); |
| 10907 } |
| 10908 |
| 10909 |
10666 const char* Integer::ToCString() const { | 10910 const char* Integer::ToCString() const { |
10667 // Integer is an interface. No instances of Integer should exist. | 10911 // Integer is an interface. No instances of Integer should exist. |
10668 UNREACHABLE(); | 10912 UNREACHABLE(); |
10669 return "Integer"; | 10913 return "Integer"; |
10670 } | 10914 } |
10671 | 10915 |
10672 | 10916 |
| 10917 void Integer::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10918 stream->OpenObject(); |
| 10919 stream->CloseObject(); |
| 10920 } |
| 10921 |
| 10922 |
10673 // Throw FiftyThreeBitOverflow exception. | 10923 // Throw FiftyThreeBitOverflow exception. |
10674 static void ThrowFiftyThreeBitOverflow(const Integer& i) { | 10924 static void ThrowFiftyThreeBitOverflow(const Integer& i) { |
10675 const Array& exc_args = Array::Handle(Array::New(1)); | 10925 const Array& exc_args = Array::Handle(Array::New(1)); |
10676 const String& i_str = String::Handle(String::New(i.ToCString())); | 10926 const String& i_str = String::Handle(String::New(i.ToCString())); |
10677 exc_args.SetAt(0, i_str); | 10927 exc_args.SetAt(0, i_str); |
10678 Exceptions::ThrowByType(Exceptions::kFiftyThreeBitOverflowError, exc_args); | 10928 Exceptions::ThrowByType(Exceptions::kFiftyThreeBitOverflowError, exc_args); |
10679 } | 10929 } |
10680 | 10930 |
10681 | 10931 |
10682 RawInteger* Integer::New(const String& str, Heap::Space space) { | 10932 RawInteger* Integer::New(const String& str, Heap::Space space) { |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11063 const char* Smi::ToCString() const { | 11313 const char* Smi::ToCString() const { |
11064 const char* kFormat = "%ld"; | 11314 const char* kFormat = "%ld"; |
11065 // Calculate the size of the string. | 11315 // Calculate the size of the string. |
11066 intptr_t len = OS::SNPrint(NULL, 0, kFormat, Value()) + 1; | 11316 intptr_t len = OS::SNPrint(NULL, 0, kFormat, Value()) + 1; |
11067 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 11317 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
11068 OS::SNPrint(chars, len, kFormat, Value()); | 11318 OS::SNPrint(chars, len, kFormat, Value()); |
11069 return chars; | 11319 return chars; |
11070 } | 11320 } |
11071 | 11321 |
11072 | 11322 |
| 11323 void Smi::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11324 stream->OpenObject(); |
| 11325 stream->CloseObject(); |
| 11326 } |
| 11327 |
| 11328 |
11073 RawClass* Smi::Class() { | 11329 RawClass* Smi::Class() { |
11074 return Isolate::Current()->object_store()->smi_class(); | 11330 return Isolate::Current()->object_store()->smi_class(); |
11075 } | 11331 } |
11076 | 11332 |
11077 | 11333 |
11078 void Mint::set_value(int64_t value) const { | 11334 void Mint::set_value(int64_t value) const { |
11079 raw_ptr()->value_ = value; | 11335 raw_ptr()->value_ = value; |
11080 } | 11336 } |
11081 | 11337 |
11082 | 11338 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11177 const char* Mint::ToCString() const { | 11433 const char* Mint::ToCString() const { |
11178 const char* kFormat = "%lld"; | 11434 const char* kFormat = "%lld"; |
11179 // Calculate the size of the string. | 11435 // Calculate the size of the string. |
11180 intptr_t len = OS::SNPrint(NULL, 0, kFormat, value()) + 1; | 11436 intptr_t len = OS::SNPrint(NULL, 0, kFormat, value()) + 1; |
11181 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 11437 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
11182 OS::SNPrint(chars, len, kFormat, value()); | 11438 OS::SNPrint(chars, len, kFormat, value()); |
11183 return chars; | 11439 return chars; |
11184 } | 11440 } |
11185 | 11441 |
11186 | 11442 |
| 11443 void Mint::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11444 stream->OpenObject(); |
| 11445 stream->CloseObject(); |
| 11446 } |
| 11447 |
| 11448 |
11187 void Double::set_value(double value) const { | 11449 void Double::set_value(double value) const { |
11188 raw_ptr()->value_ = value; | 11450 raw_ptr()->value_ = value; |
11189 } | 11451 } |
11190 | 11452 |
11191 | 11453 |
11192 bool Double::EqualsToDouble(double value) const { | 11454 bool Double::EqualsToDouble(double value) const { |
11193 intptr_t value_offset = Double::value_offset(); | 11455 intptr_t value_offset = Double::value_offset(); |
11194 void* this_addr = reinterpret_cast<void*>( | 11456 void* this_addr = reinterpret_cast<void*>( |
11195 reinterpret_cast<uword>(this->raw_ptr()) + value_offset); | 11457 reinterpret_cast<uword>(this->raw_ptr()) + value_offset); |
11196 void* other_addr = reinterpret_cast<void*>(&value); | 11458 void* other_addr = reinterpret_cast<void*>(&value); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11278 return value() < 0 ? "-Infinity" : "Infinity"; | 11540 return value() < 0 ? "-Infinity" : "Infinity"; |
11279 } | 11541 } |
11280 const int kBufferSize = 128; | 11542 const int kBufferSize = 128; |
11281 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(kBufferSize); | 11543 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(kBufferSize); |
11282 buffer[kBufferSize - 1] = '\0'; | 11544 buffer[kBufferSize - 1] = '\0'; |
11283 DoubleToCString(value(), buffer, kBufferSize); | 11545 DoubleToCString(value(), buffer, kBufferSize); |
11284 return buffer; | 11546 return buffer; |
11285 } | 11547 } |
11286 | 11548 |
11287 | 11549 |
| 11550 void Double::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11551 stream->OpenObject(); |
| 11552 stream->CloseObject(); |
| 11553 } |
| 11554 |
| 11555 |
11288 RawBigint* Integer::AsBigint() const { | 11556 RawBigint* Integer::AsBigint() const { |
11289 ASSERT(!IsNull()); | 11557 ASSERT(!IsNull()); |
11290 if (IsSmi()) { | 11558 if (IsSmi()) { |
11291 Smi& smi = Smi::Handle(); | 11559 Smi& smi = Smi::Handle(); |
11292 smi ^= raw(); | 11560 smi ^= raw(); |
11293 return BigintOperations::NewFromSmi(smi); | 11561 return BigintOperations::NewFromSmi(smi); |
11294 } else if (IsMint()) { | 11562 } else if (IsMint()) { |
11295 Mint& mint = Mint::Handle(); | 11563 Mint& mint = Mint::Handle(); |
11296 mint ^= raw(); | 11564 mint ^= raw(); |
11297 return BigintOperations::NewFromInt64(mint.value()); | 11565 return BigintOperations::NewFromInt64(mint.value()); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11444 Zone* zone = Isolate::Current()->current_zone(); | 11712 Zone* zone = Isolate::Current()->current_zone(); |
11445 return zone->AllocUnsafe(size); | 11713 return zone->AllocUnsafe(size); |
11446 } | 11714 } |
11447 | 11715 |
11448 | 11716 |
11449 const char* Bigint::ToCString() const { | 11717 const char* Bigint::ToCString() const { |
11450 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); | 11718 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); |
11451 } | 11719 } |
11452 | 11720 |
11453 | 11721 |
| 11722 void Bigint::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11723 stream->OpenObject(); |
| 11724 stream->CloseObject(); |
| 11725 } |
| 11726 |
| 11727 |
11454 // Synchronize with implementation in compiler (intrinsifier). | 11728 // Synchronize with implementation in compiler (intrinsifier). |
11455 class StringHasher : ValueObject { | 11729 class StringHasher : ValueObject { |
11456 public: | 11730 public: |
11457 StringHasher() : hash_(0) {} | 11731 StringHasher() : hash_(0) {} |
11458 void Add(int32_t ch) { | 11732 void Add(int32_t ch) { |
11459 hash_ += ch; | 11733 hash_ += ch; |
11460 hash_ += hash_ << 10; | 11734 hash_ += hash_ << 10; |
11461 hash_ ^= hash_ >> 6; | 11735 hash_ ^= hash_ >> 6; |
11462 } | 11736 } |
11463 // Return a non-zero hash of at most 'bits' bits. | 11737 // Return a non-zero hash of at most 'bits' bits. |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12042 } | 12316 } |
12043 const intptr_t len = Utf8::Length(*this); | 12317 const intptr_t len = Utf8::Length(*this); |
12044 Zone* zone = Isolate::Current()->current_zone(); | 12318 Zone* zone = Isolate::Current()->current_zone(); |
12045 uint8_t* result = zone->Alloc<uint8_t>(len + 1); | 12319 uint8_t* result = zone->Alloc<uint8_t>(len + 1); |
12046 ToUTF8(result, len); | 12320 ToUTF8(result, len); |
12047 result[len] = 0; | 12321 result[len] = 0; |
12048 return reinterpret_cast<const char*>(result); | 12322 return reinterpret_cast<const char*>(result); |
12049 } | 12323 } |
12050 | 12324 |
12051 | 12325 |
| 12326 void String::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 12327 stream->OpenObject(); |
| 12328 stream->CloseObject(); |
| 12329 } |
| 12330 |
| 12331 |
12052 void String::ToUTF8(uint8_t* utf8_array, intptr_t array_len) const { | 12332 void String::ToUTF8(uint8_t* utf8_array, intptr_t array_len) const { |
12053 ASSERT(array_len >= Utf8::Length(*this)); | 12333 ASSERT(array_len >= Utf8::Length(*this)); |
12054 Utf8::Encode(*this, reinterpret_cast<char*>(utf8_array), array_len); | 12334 Utf8::Encode(*this, reinterpret_cast<char*>(utf8_array), array_len); |
12055 } | 12335 } |
12056 | 12336 |
12057 | 12337 |
12058 static FinalizablePersistentHandle* AddFinalizer( | 12338 static FinalizablePersistentHandle* AddFinalizer( |
12059 const Object& referent, | 12339 const Object& referent, |
12060 void* peer, | 12340 void* peer, |
12061 Dart_WeakPersistentHandleFinalizer callback) { | 12341 Dart_WeakPersistentHandleFinalizer callback) { |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12722 result.SetCanonical(); | 13002 result.SetCanonical(); |
12723 return result.raw(); | 13003 return result.raw(); |
12724 } | 13004 } |
12725 | 13005 |
12726 | 13006 |
12727 const char* Bool::ToCString() const { | 13007 const char* Bool::ToCString() const { |
12728 return value() ? "true" : "false"; | 13008 return value() ? "true" : "false"; |
12729 } | 13009 } |
12730 | 13010 |
12731 | 13011 |
| 13012 void Bool::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13013 stream->OpenObject(); |
| 13014 stream->CloseObject(); |
| 13015 } |
| 13016 |
| 13017 |
12732 bool Array::Equals(const Instance& other) const { | 13018 bool Array::Equals(const Instance& other) const { |
12733 if (this->raw() == other.raw()) { | 13019 if (this->raw() == other.raw()) { |
12734 // Both handles point to the same raw instance. | 13020 // Both handles point to the same raw instance. |
12735 return true; | 13021 return true; |
12736 } | 13022 } |
12737 | 13023 |
12738 if (!other.IsArray() || other.IsNull()) { | 13024 if (!other.IsArray() || other.IsNull()) { |
12739 return false; | 13025 return false; |
12740 } | 13026 } |
12741 | 13027 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12800 } | 13086 } |
12801 const char* format = !IsImmutable() ? "Array len:%"Pd"" : | 13087 const char* format = !IsImmutable() ? "Array len:%"Pd"" : |
12802 "Immutable Array len:%"Pd""; | 13088 "Immutable Array len:%"Pd""; |
12803 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; | 13089 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; |
12804 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 13090 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
12805 OS::SNPrint(chars, len, format, Length()); | 13091 OS::SNPrint(chars, len, format, Length()); |
12806 return chars; | 13092 return chars; |
12807 } | 13093 } |
12808 | 13094 |
12809 | 13095 |
| 13096 void Array::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13097 stream->OpenObject(); |
| 13098 stream->CloseObject(); |
| 13099 } |
| 13100 |
| 13101 |
12810 RawArray* Array::Grow(const Array& source, int new_length, Heap::Space space) { | 13102 RawArray* Array::Grow(const Array& source, int new_length, Heap::Space space) { |
12811 const Array& result = Array::Handle(Array::New(new_length, space)); | 13103 const Array& result = Array::Handle(Array::New(new_length, space)); |
12812 intptr_t len = 0; | 13104 intptr_t len = 0; |
12813 if (!source.IsNull()) { | 13105 if (!source.IsNull()) { |
12814 len = source.Length(); | 13106 len = source.Length(); |
12815 result.SetTypeArguments( | 13107 result.SetTypeArguments( |
12816 AbstractTypeArguments::Handle(source.GetTypeArguments())); | 13108 AbstractTypeArguments::Handle(source.GetTypeArguments())); |
12817 } | 13109 } |
12818 ASSERT(new_length >= len); // Cannot copy 'source' into new array. | 13110 ASSERT(new_length >= len); // Cannot copy 'source' into new array. |
12819 ASSERT(new_length != len); // Unnecessary copying of array. | 13111 ASSERT(new_length != len); // Unnecessary copying of array. |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13005 return "GrowableObjectArray NULL"; | 13297 return "GrowableObjectArray NULL"; |
13006 } | 13298 } |
13007 const char* format = "GrowableObjectArray len:%"Pd""; | 13299 const char* format = "GrowableObjectArray len:%"Pd""; |
13008 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; | 13300 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; |
13009 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 13301 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
13010 OS::SNPrint(chars, len, format, Length()); | 13302 OS::SNPrint(chars, len, format, Length()); |
13011 return chars; | 13303 return chars; |
13012 } | 13304 } |
13013 | 13305 |
13014 | 13306 |
| 13307 void GrowableObjectArray::PrintToJSONStream(JSONStream* stream, |
| 13308 bool ref) const { |
| 13309 stream->OpenObject(); |
| 13310 stream->CloseObject(); |
| 13311 } |
| 13312 |
| 13313 |
13015 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, | 13314 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, |
13016 Heap::Space space) { | 13315 Heap::Space space) { |
13017 ASSERT(Isolate::Current()->object_store()->float32x4_class() != | 13316 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
13018 Class::null()); | 13317 Class::null()); |
13019 Float32x4& result = Float32x4::Handle(); | 13318 Float32x4& result = Float32x4::Handle(); |
13020 { | 13319 { |
13021 RawObject* raw = Object::Allocate(Float32x4::kClassId, | 13320 RawObject* raw = Object::Allocate(Float32x4::kClassId, |
13022 Float32x4::InstanceSize(), | 13321 Float32x4::InstanceSize(), |
13023 space); | 13322 space); |
13024 NoGCScope no_gc; | 13323 NoGCScope no_gc; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13105 float _z = z(); | 13404 float _z = z(); |
13106 float _w = w(); | 13405 float _w = w(); |
13107 // Calculate the size of the string. | 13406 // Calculate the size of the string. |
13108 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; | 13407 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; |
13109 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 13408 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
13110 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); | 13409 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); |
13111 return chars; | 13410 return chars; |
13112 } | 13411 } |
13113 | 13412 |
13114 | 13413 |
| 13414 void Float32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13415 stream->OpenObject(); |
| 13416 stream->CloseObject(); |
| 13417 } |
| 13418 |
| 13419 |
13115 RawUint32x4* Uint32x4::New(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3, | 13420 RawUint32x4* Uint32x4::New(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3, |
13116 Heap::Space space) { | 13421 Heap::Space space) { |
13117 ASSERT(Isolate::Current()->object_store()->uint32x4_class() != | 13422 ASSERT(Isolate::Current()->object_store()->uint32x4_class() != |
13118 Class::null()); | 13423 Class::null()); |
13119 Uint32x4& result = Uint32x4::Handle(); | 13424 Uint32x4& result = Uint32x4::Handle(); |
13120 { | 13425 { |
13121 RawObject* raw = Object::Allocate(Uint32x4::kClassId, | 13426 RawObject* raw = Object::Allocate(Uint32x4::kClassId, |
13122 Uint32x4::InstanceSize(), | 13427 Uint32x4::InstanceSize(), |
13123 space); | 13428 space); |
13124 NoGCScope no_gc; | 13429 NoGCScope no_gc; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13205 uint32_t _z = z(); | 13510 uint32_t _z = z(); |
13206 uint32_t _w = w(); | 13511 uint32_t _w = w(); |
13207 // Calculate the size of the string. | 13512 // Calculate the size of the string. |
13208 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; | 13513 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; |
13209 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 13514 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
13210 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); | 13515 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); |
13211 return chars; | 13516 return chars; |
13212 } | 13517 } |
13213 | 13518 |
13214 | 13519 |
| 13520 void Uint32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13521 stream->OpenObject(); |
| 13522 stream->CloseObject(); |
| 13523 } |
| 13524 |
| 13525 |
13215 const intptr_t TypedData::element_size[] = { | 13526 const intptr_t TypedData::element_size[] = { |
13216 1, // kTypedDataInt8ArrayCid. | 13527 1, // kTypedDataInt8ArrayCid. |
13217 1, // kTypedDataUint8ArrayCid. | 13528 1, // kTypedDataUint8ArrayCid. |
13218 1, // kTypedDataUint8ClampedArrayCid. | 13529 1, // kTypedDataUint8ClampedArrayCid. |
13219 2, // kTypedDataInt16ArrayCid. | 13530 2, // kTypedDataInt16ArrayCid. |
13220 2, // kTypedDataUint16ArrayCid. | 13531 2, // kTypedDataUint16ArrayCid. |
13221 4, // kTypedDataInt32ArrayCid. | 13532 4, // kTypedDataInt32ArrayCid. |
13222 4, // kTypedDataUint32ArrayCid. | 13533 4, // kTypedDataUint32ArrayCid. |
13223 8, // kTypedDataInt64ArrayCid. | 13534 8, // kTypedDataInt64ArrayCid. |
13224 8, // kTypedDataUint64ArrayCid. | 13535 8, // kTypedDataUint64ArrayCid. |
(...skipping 26 matching lines...) Expand all Loading... |
13251 } | 13562 } |
13252 return result.raw(); | 13563 return result.raw(); |
13253 } | 13564 } |
13254 | 13565 |
13255 | 13566 |
13256 const char* TypedData::ToCString() const { | 13567 const char* TypedData::ToCString() const { |
13257 return "TypedData"; | 13568 return "TypedData"; |
13258 } | 13569 } |
13259 | 13570 |
13260 | 13571 |
| 13572 void TypedData::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13573 stream->OpenObject(); |
| 13574 stream->CloseObject(); |
| 13575 } |
| 13576 |
| 13577 |
13261 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( | 13578 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( |
13262 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { | 13579 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { |
13263 SetPeer(peer); | 13580 SetPeer(peer); |
13264 return dart::AddFinalizer(*this, peer, callback); | 13581 return dart::AddFinalizer(*this, peer, callback); |
13265 } | 13582 } |
13266 | 13583 |
13267 | 13584 |
13268 RawExternalTypedData* ExternalTypedData::New(intptr_t class_id, | 13585 RawExternalTypedData* ExternalTypedData::New(intptr_t class_id, |
13269 uint8_t* data, | 13586 uint8_t* data, |
13270 intptr_t len, | 13587 intptr_t len, |
(...skipping 10 matching lines...) Expand all Loading... |
13281 } | 13598 } |
13282 return result.raw(); | 13599 return result.raw(); |
13283 } | 13600 } |
13284 | 13601 |
13285 | 13602 |
13286 const char* ExternalTypedData::ToCString() const { | 13603 const char* ExternalTypedData::ToCString() const { |
13287 return "ExternalTypedData"; | 13604 return "ExternalTypedData"; |
13288 } | 13605 } |
13289 | 13606 |
13290 | 13607 |
| 13608 void ExternalTypedData::PrintToJSONStream(JSONStream* stream, |
| 13609 bool ref) const { |
| 13610 stream->OpenObject(); |
| 13611 stream->CloseObject(); |
| 13612 } |
| 13613 |
| 13614 |
| 13615 |
13291 const char* Closure::ToCString(const Instance& closure) { | 13616 const char* Closure::ToCString(const Instance& closure) { |
13292 const Function& fun = Function::Handle(Closure::function(closure)); | 13617 const Function& fun = Function::Handle(Closure::function(closure)); |
13293 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); | 13618 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); |
13294 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString(); | 13619 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString(); |
13295 const char* from = is_implicit_closure ? " from " : ""; | 13620 const char* from = is_implicit_closure ? " from " : ""; |
13296 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; | 13621 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; |
13297 const char* format = "Closure: %s%s%s"; | 13622 const char* format = "Closure: %s%s%s"; |
13298 intptr_t len = OS::SNPrint(NULL, 0, format, fun_sig, from, fun_desc) + 1; | 13623 intptr_t len = OS::SNPrint(NULL, 0, format, fun_sig, from, fun_desc) + 1; |
13299 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 13624 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
13300 OS::SNPrint(chars, len, format, fun_sig, from, fun_desc); | 13625 OS::SNPrint(chars, len, format, fun_sig, from, fun_desc); |
(...skipping 19 matching lines...) Expand all Loading... |
13320 Closure::set_context(result, context); | 13645 Closure::set_context(result, context); |
13321 return result.raw(); | 13646 return result.raw(); |
13322 } | 13647 } |
13323 | 13648 |
13324 | 13649 |
13325 const char* DartFunction::ToCString() const { | 13650 const char* DartFunction::ToCString() const { |
13326 return "Function type class"; | 13651 return "Function type class"; |
13327 } | 13652 } |
13328 | 13653 |
13329 | 13654 |
| 13655 void DartFunction::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13656 stream->OpenObject(); |
| 13657 stream->CloseObject(); |
| 13658 } |
| 13659 |
| 13660 |
13330 intptr_t Stacktrace::Length() const { | 13661 intptr_t Stacktrace::Length() const { |
13331 const Array& code_array = Array::Handle(raw_ptr()->code_array_); | 13662 const Array& code_array = Array::Handle(raw_ptr()->code_array_); |
13332 return code_array.Length(); | 13663 return code_array.Length(); |
13333 } | 13664 } |
13334 | 13665 |
13335 | 13666 |
13336 RawFunction* Stacktrace::FunctionAtFrame(intptr_t frame_index) const { | 13667 RawFunction* Stacktrace::FunctionAtFrame(intptr_t frame_index) const { |
13337 const Array& function_array = Array::Handle(raw_ptr()->function_array_); | 13668 const Array& function_array = Array::Handle(raw_ptr()->function_array_); |
13338 return reinterpret_cast<RawFunction*>(function_array.At(frame_index)); | 13669 return reinterpret_cast<RawFunction*>(function_array.At(frame_index)); |
13339 } | 13670 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13486 return String::New(ToCStringInternal(0)); | 13817 return String::New(ToCStringInternal(0)); |
13487 } | 13818 } |
13488 | 13819 |
13489 | 13820 |
13490 const char* Stacktrace::ToCString() const { | 13821 const char* Stacktrace::ToCString() const { |
13491 const String& trace = String::Handle(FullStacktrace()); | 13822 const String& trace = String::Handle(FullStacktrace()); |
13492 return trace.ToCString(); | 13823 return trace.ToCString(); |
13493 } | 13824 } |
13494 | 13825 |
13495 | 13826 |
| 13827 void Stacktrace::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13828 stream->OpenObject(); |
| 13829 stream->CloseObject(); |
| 13830 } |
| 13831 |
| 13832 |
13496 const char* Stacktrace::ToCStringInternal(intptr_t frame_index) const { | 13833 const char* Stacktrace::ToCStringInternal(intptr_t frame_index) const { |
13497 Isolate* isolate = Isolate::Current(); | 13834 Isolate* isolate = Isolate::Current(); |
13498 Function& function = Function::Handle(); | 13835 Function& function = Function::Handle(); |
13499 Code& code = Code::Handle(); | 13836 Code& code = Code::Handle(); |
13500 Script& script = Script::Handle(); | 13837 Script& script = Script::Handle(); |
13501 String& function_name = String::Handle(); | 13838 String& function_name = String::Handle(); |
13502 String& url = String::Handle(); | 13839 String& url = String::Handle(); |
13503 | 13840 |
13504 // Iterate through the stack frames and create C string description | 13841 // Iterate through the stack frames and create C string description |
13505 // for each frame. | 13842 // for each frame. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13652 const char* JSRegExp::ToCString() const { | 13989 const char* JSRegExp::ToCString() const { |
13653 const String& str = String::Handle(pattern()); | 13990 const String& str = String::Handle(pattern()); |
13654 const char* format = "JSRegExp: pattern=%s flags=%s"; | 13991 const char* format = "JSRegExp: pattern=%s flags=%s"; |
13655 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 13992 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
13656 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 13993 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); |
13657 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 13994 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
13658 return chars; | 13995 return chars; |
13659 } | 13996 } |
13660 | 13997 |
13661 | 13998 |
| 13999 void JSRegExp::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14000 stream->OpenObject(); |
| 14001 stream->CloseObject(); |
| 14002 } |
| 14003 |
| 14004 |
13662 RawWeakProperty* WeakProperty::New(Heap::Space space) { | 14005 RawWeakProperty* WeakProperty::New(Heap::Space space) { |
13663 ASSERT(Isolate::Current()->object_store()->weak_property_class() | 14006 ASSERT(Isolate::Current()->object_store()->weak_property_class() |
13664 != Class::null()); | 14007 != Class::null()); |
13665 RawObject* raw = Object::Allocate(WeakProperty::kClassId, | 14008 RawObject* raw = Object::Allocate(WeakProperty::kClassId, |
13666 WeakProperty::InstanceSize(), | 14009 WeakProperty::InstanceSize(), |
13667 space); | 14010 space); |
13668 return reinterpret_cast<RawWeakProperty*>(raw); | 14011 return reinterpret_cast<RawWeakProperty*>(raw); |
13669 } | 14012 } |
13670 | 14013 |
13671 | 14014 |
13672 const char* WeakProperty::ToCString() const { | 14015 const char* WeakProperty::ToCString() const { |
13673 return "_WeakProperty"; | 14016 return "_WeakProperty"; |
13674 } | 14017 } |
13675 | 14018 |
13676 | 14019 |
| 14020 void WeakProperty::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14021 stream->OpenObject(); |
| 14022 stream->CloseObject(); |
| 14023 } |
| 14024 |
13677 RawMirrorReference* MirrorReference::New(Heap::Space space) { | 14025 RawMirrorReference* MirrorReference::New(Heap::Space space) { |
13678 ASSERT(Isolate::Current()->object_store()->mirror_reference_class() | 14026 ASSERT(Isolate::Current()->object_store()->mirror_reference_class() |
13679 != Class::null()); | 14027 != Class::null()); |
13680 RawObject* raw = Object::Allocate(MirrorReference::kClassId, | 14028 RawObject* raw = Object::Allocate(MirrorReference::kClassId, |
13681 MirrorReference::InstanceSize(), | 14029 MirrorReference::InstanceSize(), |
13682 space); | 14030 space); |
13683 return reinterpret_cast<RawMirrorReference*>(raw); | 14031 return reinterpret_cast<RawMirrorReference*>(raw); |
13684 } | 14032 } |
13685 | 14033 |
13686 | 14034 |
13687 const char* MirrorReference::ToCString() const { | 14035 const char* MirrorReference::ToCString() const { |
13688 return "_MirrorReference"; | 14036 return "_MirrorReference"; |
13689 } | 14037 } |
13690 | 14038 |
13691 | 14039 |
| 14040 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14041 stream->OpenObject(); |
| 14042 stream->CloseObject(); |
| 14043 } |
| 14044 |
| 14045 |
13692 } // namespace dart | 14046 } // namespace dart |
OLD | NEW |