| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 "Throw an exception when the result of an integer calculation will not " | 57 "Throw an exception when the result of an integer calculation will not " |
| 58 "fit into a javascript integer."); | 58 "fit into a javascript integer."); |
| 59 DECLARE_FLAG(bool, eliminate_type_checks); | 59 DECLARE_FLAG(bool, eliminate_type_checks); |
| 60 DECLARE_FLAG(bool, enable_type_checks); | 60 DECLARE_FLAG(bool, enable_type_checks); |
| 61 DECLARE_FLAG(bool, error_on_bad_override); | 61 DECLARE_FLAG(bool, error_on_bad_override); |
| 62 DECLARE_FLAG(bool, error_on_bad_type); | 62 DECLARE_FLAG(bool, error_on_bad_type); |
| 63 DECLARE_FLAG(bool, trace_compiler); | 63 DECLARE_FLAG(bool, trace_compiler); |
| 64 DECLARE_FLAG(bool, trace_deoptimization); | 64 DECLARE_FLAG(bool, trace_deoptimization); |
| 65 DECLARE_FLAG(bool, trace_deoptimization_verbose); | 65 DECLARE_FLAG(bool, trace_deoptimization_verbose); |
| 66 DECLARE_FLAG(bool, verbose_stacktrace); | 66 DECLARE_FLAG(bool, verbose_stacktrace); |
| 67 DECLARE_FLAG(bool, print_coverage); |
| 67 | 68 |
| 68 static const char* kGetterPrefix = "get:"; | 69 static const char* kGetterPrefix = "get:"; |
| 69 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); | 70 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); |
| 70 static const char* kSetterPrefix = "set:"; | 71 static const char* kSetterPrefix = "set:"; |
| 71 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); | 72 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); |
| 72 | 73 |
| 73 cpp_vtable Object::handle_vtable_ = 0; | 74 cpp_vtable Object::handle_vtable_ = 0; |
| 74 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; | 75 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; |
| 75 cpp_vtable Smi::handle_vtable_ = 0; | 76 cpp_vtable Smi::handle_vtable_ = 0; |
| 76 | 77 |
| (...skipping 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2911 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2912 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 2912 OS::SNPrint(chars, len, format, library_name, class_name); | 2913 OS::SNPrint(chars, len, format, library_name, class_name); |
| 2913 return chars; | 2914 return chars; |
| 2914 } | 2915 } |
| 2915 | 2916 |
| 2916 | 2917 |
| 2917 void Class::PrintToJSONStream(JSONStream* stream, bool ref) const { | 2918 void Class::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 2918 const char* class_name = String::Handle(UserVisibleName()).ToCString(); | 2919 const char* class_name = String::Handle(UserVisibleName()).ToCString(); |
| 2919 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 2920 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 2920 intptr_t id = ring->GetIdForObject(raw()); | 2921 intptr_t id = ring->GetIdForObject(raw()); |
| 2921 if (ref) { | 2922 JSONObject jsobj(stream); |
| 2922 stream->OpenObject(); | 2923 jsobj.AddProperty("type", JSONType(ref)); |
| 2923 stream->PrintProperty("type", "@Class"); | 2924 jsobj.AddProperty("id", id); |
| 2924 stream->PrintProperty("id", id); | 2925 jsobj.AddProperty("name", class_name); |
| 2925 stream->PrintProperty("name", class_name); | 2926 if (!ref) { |
| 2926 stream->CloseObject(); | 2927 jsobj.AddProperty("library", Object::Handle(library())); |
| 2927 return; | |
| 2928 } | 2928 } |
| 2929 stream->OpenObject(); | |
| 2930 stream->PrintProperty("type", "Class"); | |
| 2931 stream->PrintProperty("id", id); | |
| 2932 stream->PrintProperty("name", class_name); | |
| 2933 stream->PrintProperty("library", Object::Handle(library())); | |
| 2934 stream->CloseObject(); | |
| 2935 } | 2929 } |
| 2936 | 2930 |
| 2937 | 2931 |
| 2938 void Class::InsertCanonicalConstant(intptr_t index, | 2932 void Class::InsertCanonicalConstant(intptr_t index, |
| 2939 const Instance& constant) const { | 2933 const Instance& constant) const { |
| 2940 // The constant needs to be added to the list. Grow the list if it is full. | 2934 // The constant needs to be added to the list. Grow the list if it is full. |
| 2941 Array& canonical_list = Array::Handle(constants()); | 2935 Array& canonical_list = Array::Handle(constants()); |
| 2942 const intptr_t list_len = canonical_list.Length(); | 2936 const intptr_t list_len = canonical_list.Length(); |
| 2943 if (index >= list_len) { | 2937 if (index >= list_len) { |
| 2944 const intptr_t new_length = (list_len == 0) ? 4 : list_len + 4; | 2938 const intptr_t new_length = (list_len == 0) ? 4 : list_len + 4; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3008 const char* format = "unresolved class '%s'"; | 3002 const char* format = "unresolved class '%s'"; |
| 3009 const char* cname = String::Handle(Name()).ToCString(); | 3003 const char* cname = String::Handle(Name()).ToCString(); |
| 3010 intptr_t len = OS::SNPrint(NULL, 0, format, cname) + 1; | 3004 intptr_t len = OS::SNPrint(NULL, 0, format, cname) + 1; |
| 3011 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3005 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3012 OS::SNPrint(chars, len, format, cname); | 3006 OS::SNPrint(chars, len, format, cname); |
| 3013 return chars; | 3007 return chars; |
| 3014 } | 3008 } |
| 3015 | 3009 |
| 3016 | 3010 |
| 3017 void UnresolvedClass::PrintToJSONStream(JSONStream* stream, bool ref) const { | 3011 void UnresolvedClass::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 3018 stream->OpenObject(); | 3012 JSONObject jsobj(stream); |
| 3019 stream->CloseObject(); | |
| 3020 } | 3013 } |
| 3021 | 3014 |
| 3022 | 3015 |
| 3023 intptr_t AbstractTypeArguments::Length() const { | 3016 intptr_t AbstractTypeArguments::Length() const { |
| 3024 // AbstractTypeArguments is an abstract class. | 3017 // AbstractTypeArguments is an abstract class. |
| 3025 UNREACHABLE(); | 3018 UNREACHABLE(); |
| 3026 return -1; | 3019 return -1; |
| 3027 } | 3020 } |
| 3028 | 3021 |
| 3029 | 3022 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3232 if (IsNull()) { | 3225 if (IsNull()) { |
| 3233 return "NULL AbstractTypeArguments"; | 3226 return "NULL AbstractTypeArguments"; |
| 3234 } | 3227 } |
| 3235 UNREACHABLE(); | 3228 UNREACHABLE(); |
| 3236 return "AbstractTypeArguments"; | 3229 return "AbstractTypeArguments"; |
| 3237 } | 3230 } |
| 3238 | 3231 |
| 3239 | 3232 |
| 3240 void AbstractTypeArguments::PrintToJSONStream(JSONStream* stream, | 3233 void AbstractTypeArguments::PrintToJSONStream(JSONStream* stream, |
| 3241 bool ref) const { | 3234 bool ref) const { |
| 3242 stream->OpenObject(); | 3235 JSONObject jsobj(stream); |
| 3243 stream->CloseObject(); | |
| 3244 } | 3236 } |
| 3245 | 3237 |
| 3246 | 3238 |
| 3247 intptr_t TypeArguments::Length() const { | 3239 intptr_t TypeArguments::Length() const { |
| 3248 ASSERT(!IsNull()); | 3240 ASSERT(!IsNull()); |
| 3249 return Smi::Value(raw_ptr()->length_); | 3241 return Smi::Value(raw_ptr()->length_); |
| 3250 } | 3242 } |
| 3251 | 3243 |
| 3252 | 3244 |
| 3253 RawAbstractType* TypeArguments::TypeAt(intptr_t index) const { | 3245 RawAbstractType* TypeArguments::TypeAt(intptr_t index) const { |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3573 intptr_t len = OS::SNPrint(NULL, 0, format, prev_cstr, type_cstr) + 1; | 3565 intptr_t len = OS::SNPrint(NULL, 0, format, prev_cstr, type_cstr) + 1; |
| 3574 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3566 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3575 OS::SNPrint(chars, len, format, prev_cstr, type_cstr); | 3567 OS::SNPrint(chars, len, format, prev_cstr, type_cstr); |
| 3576 prev_cstr = chars; | 3568 prev_cstr = chars; |
| 3577 } | 3569 } |
| 3578 return prev_cstr; | 3570 return prev_cstr; |
| 3579 } | 3571 } |
| 3580 | 3572 |
| 3581 | 3573 |
| 3582 void TypeArguments::PrintToJSONStream(JSONStream* stream, bool ref) const { | 3574 void TypeArguments::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 3583 stream->OpenObject(); | 3575 JSONObject jsobj(stream); |
| 3584 stream->CloseObject(); | |
| 3585 } | 3576 } |
| 3586 | 3577 |
| 3587 | 3578 |
| 3588 intptr_t InstantiatedTypeArguments::Length() const { | 3579 intptr_t InstantiatedTypeArguments::Length() const { |
| 3589 return AbstractTypeArguments::Handle( | 3580 return AbstractTypeArguments::Handle( |
| 3590 uninstantiated_type_arguments()).Length(); | 3581 uninstantiated_type_arguments()).Length(); |
| 3591 } | 3582 } |
| 3592 | 3583 |
| 3593 | 3584 |
| 3594 RawAbstractType* InstantiatedTypeArguments::TypeAt(intptr_t index) const { | 3585 RawAbstractType* InstantiatedTypeArguments::TypeAt(intptr_t index) const { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3662 intptr_t len = | 3653 intptr_t len = |
| 3663 OS::SNPrint(NULL, 0, format, arg_cstr, instantiator_cstr) + 1; | 3654 OS::SNPrint(NULL, 0, format, arg_cstr, instantiator_cstr) + 1; |
| 3664 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3655 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3665 OS::SNPrint(chars, len, format, arg_cstr, instantiator_cstr); | 3656 OS::SNPrint(chars, len, format, arg_cstr, instantiator_cstr); |
| 3666 return chars; | 3657 return chars; |
| 3667 } | 3658 } |
| 3668 | 3659 |
| 3669 | 3660 |
| 3670 void InstantiatedTypeArguments::PrintToJSONStream(JSONStream* stream, | 3661 void InstantiatedTypeArguments::PrintToJSONStream(JSONStream* stream, |
| 3671 bool ref) const { | 3662 bool ref) const { |
| 3672 stream->OpenObject(); | 3663 JSONObject jsobj(stream); |
| 3673 stream->CloseObject(); | |
| 3674 } | 3664 } |
| 3675 | 3665 |
| 3676 | 3666 |
| 3677 const char* PatchClass::ToCString() const { | 3667 const char* PatchClass::ToCString() const { |
| 3678 const char* kFormat = "PatchClass for %s"; | 3668 const char* kFormat = "PatchClass for %s"; |
| 3679 const Class& cls = Class::Handle(patched_class()); | 3669 const Class& cls = Class::Handle(patched_class()); |
| 3680 const char* cls_name = cls.ToCString(); | 3670 const char* cls_name = cls.ToCString(); |
| 3681 intptr_t len = OS::SNPrint(NULL, 0, kFormat, cls_name) + 1; | 3671 intptr_t len = OS::SNPrint(NULL, 0, kFormat, cls_name) + 1; |
| 3682 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3672 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3683 OS::SNPrint(chars, len, kFormat, cls_name); | 3673 OS::SNPrint(chars, len, kFormat, cls_name); |
| 3684 return chars; | 3674 return chars; |
| 3685 } | 3675 } |
| 3686 | 3676 |
| 3687 | 3677 |
| 3688 void PatchClass::PrintToJSONStream(JSONStream* stream, bool ref) const { | 3678 void PatchClass::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 3689 stream->OpenObject(); | 3679 JSONObject jsobj(stream); |
| 3690 stream->CloseObject(); | |
| 3691 } | 3680 } |
| 3692 | 3681 |
| 3693 | 3682 |
| 3694 RawPatchClass* PatchClass::New(const Class& patched_class, | 3683 RawPatchClass* PatchClass::New(const Class& patched_class, |
| 3695 const Class& source_class) { | 3684 const Class& source_class) { |
| 3696 const PatchClass& result = PatchClass::Handle(PatchClass::New()); | 3685 const PatchClass& result = PatchClass::Handle(PatchClass::New()); |
| 3697 result.set_patched_class(patched_class); | 3686 result.set_patched_class(patched_class); |
| 3698 result.set_source_class(source_class); | 3687 result.set_source_class(source_class); |
| 3699 return result.raw(); | 3688 return result.raw(); |
| 3700 } | 3689 } |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4127 void Function::SetNumOptionalParameters(intptr_t num_optional_parameters, | 4116 void Function::SetNumOptionalParameters(intptr_t num_optional_parameters, |
| 4128 bool are_optional_positional) const { | 4117 bool are_optional_positional) const { |
| 4129 ASSERT(num_optional_parameters >= 0); | 4118 ASSERT(num_optional_parameters >= 0); |
| 4130 set_num_optional_parameters(are_optional_positional ? | 4119 set_num_optional_parameters(are_optional_positional ? |
| 4131 num_optional_parameters : | 4120 num_optional_parameters : |
| 4132 -num_optional_parameters); | 4121 -num_optional_parameters); |
| 4133 } | 4122 } |
| 4134 | 4123 |
| 4135 | 4124 |
| 4136 bool Function::is_optimizable() const { | 4125 bool Function::is_optimizable() const { |
| 4126 if (FLAG_print_coverage) { |
| 4127 return false; |
| 4128 } |
| 4137 if (OptimizableBit::decode(raw_ptr()->kind_tag_) && | 4129 if (OptimizableBit::decode(raw_ptr()->kind_tag_) && |
| 4138 (script() != Script::null()) && | 4130 (script() != Script::null()) && |
| 4139 ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff_in_tokens)) { | 4131 ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff_in_tokens)) { |
| 4140 // Additional check needed for implicit getters. | 4132 // Additional check needed for implicit getters. |
| 4141 if (HasCode() && | 4133 if (HasCode() && |
| 4142 (Code::Handle(unoptimized_code()).Size() >= | 4134 (Code::Handle(unoptimized_code()).Size() >= |
| 4143 FLAG_huge_method_cutoff_in_code_size)) { | 4135 FLAG_huge_method_cutoff_in_code_size)) { |
| 4144 return false; | 4136 return false; |
| 4145 } else { | 4137 } else { |
| 4146 return true; | 4138 return true; |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5085 static_str, abstract_str, kind_str, const_str); | 5077 static_str, abstract_str, kind_str, const_str); |
| 5086 return chars; | 5078 return chars; |
| 5087 } | 5079 } |
| 5088 | 5080 |
| 5089 | 5081 |
| 5090 void Function::PrintToJSONStream(JSONStream* stream, bool ref) const { | 5082 void Function::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5091 const char* function_name = | 5083 const char* function_name = |
| 5092 String::Handle(QualifiedUserVisibleName()).ToCString(); | 5084 String::Handle(QualifiedUserVisibleName()).ToCString(); |
| 5093 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 5085 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 5094 intptr_t id = ring->GetIdForObject(raw()); | 5086 intptr_t id = ring->GetIdForObject(raw()); |
| 5095 if (ref) { | 5087 JSONObject jsobj(stream); |
| 5096 stream->OpenObject(); | 5088 jsobj.AddProperty("type", JSONType(ref)); |
| 5097 stream->PrintProperty("type", "@Function"); | 5089 jsobj.AddProperty("id", id); |
| 5098 stream->PrintProperty("id", id); | 5090 jsobj.AddProperty("name", function_name); |
| 5099 stream->PrintProperty("name", function_name); | 5091 if (ref) return; |
| 5100 stream->CloseObject(); | 5092 jsobj.AddProperty("is_static", is_static()); |
| 5101 return; | 5093 jsobj.AddProperty("is_const", is_const()); |
| 5102 } | 5094 jsobj.AddProperty("is_optimizable", is_optimizable()); |
| 5103 stream->OpenObject(); | 5095 jsobj.AddProperty("is_inlinable", IsInlineable()); |
| 5104 stream->PrintProperty("type", "Function"); | |
| 5105 stream->PrintProperty("name", function_name); | |
| 5106 stream->PrintProperty("id", id); | |
| 5107 stream->PrintPropertyBool("is_static", is_static()); | |
| 5108 stream->PrintPropertyBool("is_const", is_const()); | |
| 5109 stream->PrintPropertyBool("is_optimizable", is_optimizable()); | |
| 5110 stream->PrintPropertyBool("is_inlinable", IsInlineable()); | |
| 5111 const char* kind_string = NULL; | 5096 const char* kind_string = NULL; |
| 5112 switch (kind()) { | 5097 switch (kind()) { |
| 5113 case RawFunction::kRegularFunction: | 5098 case RawFunction::kRegularFunction: |
| 5114 kind_string = "regular"; | 5099 kind_string = "regular"; |
| 5115 break; | 5100 break; |
| 5116 case RawFunction::kGetterFunction: | 5101 case RawFunction::kGetterFunction: |
| 5117 kind_string = "getter"; | 5102 kind_string = "getter"; |
| 5118 break; | 5103 break; |
| 5119 case RawFunction::kSetterFunction: | 5104 case RawFunction::kSetterFunction: |
| 5120 kind_string = "setter"; | 5105 kind_string = "setter"; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5136 break; | 5121 break; |
| 5137 case RawFunction::kConstructor: | 5122 case RawFunction::kConstructor: |
| 5138 kind_string = "constructor"; | 5123 kind_string = "constructor"; |
| 5139 break; | 5124 break; |
| 5140 case RawFunction::kImplicitStaticFinalGetter: | 5125 case RawFunction::kImplicitStaticFinalGetter: |
| 5141 kind_string = "static final getter"; | 5126 kind_string = "static final getter"; |
| 5142 break; | 5127 break; |
| 5143 default: | 5128 default: |
| 5144 UNREACHABLE(); | 5129 UNREACHABLE(); |
| 5145 } | 5130 } |
| 5146 stream->PrintProperty("kind", kind_string); | 5131 jsobj.AddProperty("kind", kind_string); |
| 5147 stream->PrintProperty("unoptimized_code", Object::Handle(unoptimized_code())); | 5132 jsobj.AddProperty("unoptimized_code", Object::Handle(unoptimized_code())); |
| 5148 stream->PrintProperty("usage_counter", usage_counter()); | 5133 jsobj.AddProperty("usage_counter", usage_counter()); |
| 5149 stream->PrintProperty("optimized_call_site_count", | 5134 jsobj.AddProperty("optimized_call_site_count", optimized_call_site_count()); |
| 5150 optimized_call_site_count()); | 5135 jsobj.AddProperty("code", Object::Handle(CurrentCode())); |
| 5151 stream->PrintProperty("code", Object::Handle(CurrentCode())); | 5136 jsobj.AddProperty("deoptimizations", |
| 5152 stream->PrintProperty("deoptimizations", | 5137 static_cast<intptr_t>(deoptimization_counter())); |
| 5153 static_cast<intptr_t>(deoptimization_counter())); | |
| 5154 stream->CloseObject(); | |
| 5155 } | 5138 } |
| 5156 | 5139 |
| 5157 | 5140 |
| 5158 void ClosureData::set_context_scope(const ContextScope& value) const { | 5141 void ClosureData::set_context_scope(const ContextScope& value) const { |
| 5159 StorePointer(&raw_ptr()->context_scope_, value.raw()); | 5142 StorePointer(&raw_ptr()->context_scope_, value.raw()); |
| 5160 } | 5143 } |
| 5161 | 5144 |
| 5162 | 5145 |
| 5163 void ClosureData::set_implicit_static_closure(const Instance& closure) const { | 5146 void ClosureData::set_implicit_static_closure(const Instance& closure) const { |
| 5164 ASSERT(!closure.IsNull()); | 5147 ASSERT(!closure.IsNull()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 5192 return reinterpret_cast<RawClosureData*>(raw); | 5175 return reinterpret_cast<RawClosureData*>(raw); |
| 5193 } | 5176 } |
| 5194 | 5177 |
| 5195 | 5178 |
| 5196 const char* ClosureData::ToCString() const { | 5179 const char* ClosureData::ToCString() const { |
| 5197 return "ClosureData class"; | 5180 return "ClosureData class"; |
| 5198 } | 5181 } |
| 5199 | 5182 |
| 5200 | 5183 |
| 5201 void ClosureData::PrintToJSONStream(JSONStream* stream, bool ref) const { | 5184 void ClosureData::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5202 stream->OpenObject(); | 5185 JSONObject jsobj(stream); |
| 5203 stream->CloseObject(); | |
| 5204 } | 5186 } |
| 5205 | 5187 |
| 5206 | 5188 |
| 5207 void RedirectionData::set_type(const Type& value) const { | 5189 void RedirectionData::set_type(const Type& value) const { |
| 5208 ASSERT(!value.IsNull()); | 5190 ASSERT(!value.IsNull()); |
| 5209 StorePointer(&raw_ptr()->type_, value.raw()); | 5191 StorePointer(&raw_ptr()->type_, value.raw()); |
| 5210 } | 5192 } |
| 5211 | 5193 |
| 5212 | 5194 |
| 5213 void RedirectionData::set_identifier(const String& value) const { | 5195 void RedirectionData::set_identifier(const String& value) const { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 5228 return reinterpret_cast<RawRedirectionData*>(raw); | 5210 return reinterpret_cast<RawRedirectionData*>(raw); |
| 5229 } | 5211 } |
| 5230 | 5212 |
| 5231 | 5213 |
| 5232 const char* RedirectionData::ToCString() const { | 5214 const char* RedirectionData::ToCString() const { |
| 5233 return "RedirectionData class"; | 5215 return "RedirectionData class"; |
| 5234 } | 5216 } |
| 5235 | 5217 |
| 5236 | 5218 |
| 5237 void RedirectionData::PrintToJSONStream(JSONStream* stream, bool ref) const { | 5219 void RedirectionData::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5238 stream->OpenObject(); | 5220 JSONObject jsobj(stream); |
| 5239 stream->CloseObject(); | |
| 5240 } | 5221 } |
| 5241 | 5222 |
| 5242 | 5223 |
| 5243 RawString* Field::GetterName(const String& field_name) { | 5224 RawString* Field::GetterName(const String& field_name) { |
| 5244 return String::Concat(Symbols::GetterPrefix(), field_name); | 5225 return String::Concat(Symbols::GetterPrefix(), field_name); |
| 5245 } | 5226 } |
| 5246 | 5227 |
| 5247 | 5228 |
| 5248 RawString* Field::GetterSymbol(const String& field_name) { | 5229 RawString* Field::GetterSymbol(const String& field_name) { |
| 5249 const String& str = String::Handle(Field::GetterName(field_name)); | 5230 const String& str = String::Handle(Field::GetterName(field_name)); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5413 const char* cls_name = String::Handle(cls.Name()).ToCString(); | 5394 const char* cls_name = String::Handle(cls.Name()).ToCString(); |
| 5414 intptr_t len = | 5395 intptr_t len = |
| 5415 OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1; | 5396 OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1; |
| 5416 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 5397 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 5417 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2); | 5398 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2); |
| 5418 return chars; | 5399 return chars; |
| 5419 } | 5400 } |
| 5420 | 5401 |
| 5421 | 5402 |
| 5422 void Field::PrintToJSONStream(JSONStream* stream, bool ref) const { | 5403 void Field::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5423 stream->OpenObject(); | 5404 JSONObject jsobj(stream); |
| 5424 stream->CloseObject(); | |
| 5425 } | 5405 } |
| 5426 | 5406 |
| 5427 | 5407 |
| 5428 RawArray* Field::dependent_code() const { | 5408 RawArray* Field::dependent_code() const { |
| 5429 return raw_ptr()->dependent_code_; | 5409 return raw_ptr()->dependent_code_; |
| 5430 } | 5410 } |
| 5431 | 5411 |
| 5432 | 5412 |
| 5433 void Field::set_dependent_code(const Array& array) const { | 5413 void Field::set_dependent_code(const Array& array) const { |
| 5434 raw_ptr()->dependent_code_ = array.raw(); | 5414 raw_ptr()->dependent_code_ = array.raw(); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5636 } | 5616 } |
| 5637 | 5617 |
| 5638 | 5618 |
| 5639 const char* LiteralToken::ToCString() const { | 5619 const char* LiteralToken::ToCString() const { |
| 5640 const String& token = String::Handle(literal()); | 5620 const String& token = String::Handle(literal()); |
| 5641 return token.ToCString(); | 5621 return token.ToCString(); |
| 5642 } | 5622 } |
| 5643 | 5623 |
| 5644 | 5624 |
| 5645 void LiteralToken::PrintToJSONStream(JSONStream* stream, bool ref) const { | 5625 void LiteralToken::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5646 stream->OpenObject(); | 5626 JSONObject jsobj(stream); |
| 5647 stream->CloseObject(); | |
| 5648 } | 5627 } |
| 5649 | 5628 |
| 5650 | 5629 |
| 5651 RawArray* TokenStream::TokenObjects() const { | 5630 RawArray* TokenStream::TokenObjects() const { |
| 5652 return raw_ptr()->token_objects_; | 5631 return raw_ptr()->token_objects_; |
| 5653 } | 5632 } |
| 5654 | 5633 |
| 5655 | 5634 |
| 5656 void TokenStream::SetTokenObjects(const Array& value) const { | 5635 void TokenStream::SetTokenObjects(const Array& value) const { |
| 5657 StorePointer(&raw_ptr()->token_objects_, value.raw()); | 5636 StorePointer(&raw_ptr()->token_objects_, value.raw()); |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6052 return result.raw(); | 6031 return result.raw(); |
| 6053 } | 6032 } |
| 6054 | 6033 |
| 6055 | 6034 |
| 6056 const char* TokenStream::ToCString() const { | 6035 const char* TokenStream::ToCString() const { |
| 6057 return "TokenStream"; | 6036 return "TokenStream"; |
| 6058 } | 6037 } |
| 6059 | 6038 |
| 6060 | 6039 |
| 6061 void TokenStream::PrintToJSONStream(JSONStream* stream, bool ref) const { | 6040 void TokenStream::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 6062 stream->OpenObject(); | 6041 JSONObject jsobj(stream); |
| 6063 stream->CloseObject(); | |
| 6064 } | 6042 } |
| 6065 | 6043 |
| 6066 | 6044 |
| 6067 TokenStream::Iterator::Iterator(const TokenStream& tokens, intptr_t token_pos) | 6045 TokenStream::Iterator::Iterator(const TokenStream& tokens, intptr_t token_pos) |
| 6068 : tokens_(TokenStream::Handle(tokens.raw())), | 6046 : tokens_(TokenStream::Handle(tokens.raw())), |
| 6069 data_(ExternalTypedData::Handle(tokens.GetStream())), | 6047 data_(ExternalTypedData::Handle(tokens.GetStream())), |
| 6070 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), | 6048 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), |
| 6071 token_objects_(Array::Handle(tokens.TokenObjects())), | 6049 token_objects_(Array::Handle(tokens.TokenObjects())), |
| 6072 obj_(Object::Handle()), | 6050 obj_(Object::Handle()), |
| 6073 cur_token_pos_(token_pos), | 6051 cur_token_pos_(token_pos), |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6404 return result.raw(); | 6382 return result.raw(); |
| 6405 } | 6383 } |
| 6406 | 6384 |
| 6407 | 6385 |
| 6408 const char* Script::ToCString() const { | 6386 const char* Script::ToCString() const { |
| 6409 return "Script"; | 6387 return "Script"; |
| 6410 } | 6388 } |
| 6411 | 6389 |
| 6412 | 6390 |
| 6413 void Script::PrintToJSONStream(JSONStream* stream, bool ref) const { | 6391 void Script::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 6414 stream->OpenObject(); | 6392 JSONObject jsobj(stream); |
| 6415 stream->CloseObject(); | |
| 6416 } | 6393 } |
| 6417 | 6394 |
| 6418 | 6395 |
| 6419 DictionaryIterator::DictionaryIterator(const Library& library) | 6396 DictionaryIterator::DictionaryIterator(const Library& library) |
| 6420 : array_(Array::Handle(library.dictionary())), | 6397 : array_(Array::Handle(library.dictionary())), |
| 6421 // Last element in array is a Smi indicating the number of entries used. | 6398 // Last element in array is a Smi indicating the number of entries used. |
| 6422 size_(Array::Handle(library.dictionary()).Length() - 1), | 6399 size_(Array::Handle(library.dictionary()).Length() - 1), |
| 6423 next_ix_(0) { | 6400 next_ix_(0) { |
| 6424 MoveToNextObject(); | 6401 MoveToNextObject(); |
| 6425 } | 6402 } |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7441 OS::SNPrint(chars, len, kFormat, name.ToCString()); | 7418 OS::SNPrint(chars, len, kFormat, name.ToCString()); |
| 7442 return chars; | 7419 return chars; |
| 7443 } | 7420 } |
| 7444 | 7421 |
| 7445 | 7422 |
| 7446 void Library::PrintToJSONStream(JSONStream* stream, bool ref) const { | 7423 void Library::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7447 const char* library_name = String::Handle(name()).ToCString(); | 7424 const char* library_name = String::Handle(name()).ToCString(); |
| 7448 const char* library_url = String::Handle(url()).ToCString(); | 7425 const char* library_url = String::Handle(url()).ToCString(); |
| 7449 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 7426 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 7450 intptr_t id = ring->GetIdForObject(raw()); | 7427 intptr_t id = ring->GetIdForObject(raw()); |
| 7451 if (ref) { | 7428 JSONObject jsobj(stream); |
| 7452 // Print a reference | 7429 jsobj.AddProperty("type", JSONType(ref)); |
| 7453 stream->OpenObject(); | 7430 jsobj.AddProperty("id", id); |
| 7454 stream->PrintProperty("type", "@Library"); | 7431 jsobj.AddProperty("name", library_name); |
| 7455 stream->PrintProperty("id", id); | 7432 if (ref) return; |
| 7456 stream->PrintProperty("name", library_name); | 7433 jsobj.AddProperty("url", library_url); |
| 7457 stream->CloseObject(); | 7434 { |
| 7458 return; | 7435 JSONArray jsarr(jsobj, "classes"); |
| 7436 ClassDictionaryIterator class_iter(*this); |
| 7437 Class& klass = Class::Handle(); |
| 7438 while (class_iter.HasNext()) { |
| 7439 klass = class_iter.GetNextClass(); |
| 7440 jsarr.AddValue(klass); |
| 7441 } |
| 7459 } | 7442 } |
| 7460 stream->OpenObject(); | 7443 { |
| 7461 stream->PrintProperty("type", "Library"); | 7444 JSONArray jsarr(jsobj, "libraries"); |
| 7462 stream->PrintProperty("id", id); | 7445 Library& lib = Library::Handle(); |
| 7463 stream->PrintProperty("name", library_name); | 7446 for (intptr_t i = 0; i < num_imports(); i++) { |
| 7464 stream->PrintProperty("url", library_url); | 7447 lib = ImportLibraryAt(i); |
| 7465 ClassDictionaryIterator class_iter(*this); | 7448 jsarr.AddValue(lib); |
| 7466 stream->OpenArray("classes"); | 7449 } |
| 7467 Class& klass = Class::Handle(); | |
| 7468 while (class_iter.HasNext()) { | |
| 7469 klass = class_iter.GetNextClass(); | |
| 7470 stream->PrintValue(klass); | |
| 7471 } | 7450 } |
| 7472 stream->CloseArray(); | |
| 7473 stream->OpenArray("libraries"); | |
| 7474 Library& lib = Library::Handle(); | |
| 7475 for (intptr_t i = 0; i < num_imports(); i++) { | |
| 7476 lib = ImportLibraryAt(i); | |
| 7477 stream->PrintValue(lib); | |
| 7478 } | |
| 7479 stream->CloseArray(); | |
| 7480 stream->CloseObject(); | |
| 7481 } | 7451 } |
| 7482 | 7452 |
| 7483 | 7453 |
| 7484 RawLibrary* LibraryPrefix::GetLibrary(int index) const { | 7454 RawLibrary* LibraryPrefix::GetLibrary(int index) const { |
| 7485 if ((index >= 0) || (index < num_imports())) { | 7455 if ((index >= 0) || (index < num_imports())) { |
| 7486 const Array& imports = Array::Handle(this->imports()); | 7456 const Array& imports = Array::Handle(this->imports()); |
| 7487 Namespace& import = Namespace::Handle(); | 7457 Namespace& import = Namespace::Handle(); |
| 7488 import ^= imports.At(index); | 7458 import ^= imports.At(index); |
| 7489 return import.library(); | 7459 return import.library(); |
| 7490 } | 7460 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7615 const char* kFormat = "LibraryPrefix:'%s'"; | 7585 const char* kFormat = "LibraryPrefix:'%s'"; |
| 7616 const String& prefix = String::Handle(name()); | 7586 const String& prefix = String::Handle(name()); |
| 7617 intptr_t len = OS::SNPrint(NULL, 0, kFormat, prefix.ToCString()) + 1; | 7587 intptr_t len = OS::SNPrint(NULL, 0, kFormat, prefix.ToCString()) + 1; |
| 7618 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 7588 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 7619 OS::SNPrint(chars, len, kFormat, prefix.ToCString()); | 7589 OS::SNPrint(chars, len, kFormat, prefix.ToCString()); |
| 7620 return chars; | 7590 return chars; |
| 7621 } | 7591 } |
| 7622 | 7592 |
| 7623 | 7593 |
| 7624 void LibraryPrefix::PrintToJSONStream(JSONStream* stream, bool ref) const { | 7594 void LibraryPrefix::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7625 stream->OpenObject(); | 7595 JSONObject jsobj(stream); |
| 7626 stream->CloseObject(); | |
| 7627 } | 7596 } |
| 7628 | 7597 |
| 7629 | 7598 |
| 7630 const char* Namespace::ToCString() const { | 7599 const char* Namespace::ToCString() const { |
| 7631 const char* kFormat = "Namespace for library '%s'"; | 7600 const char* kFormat = "Namespace for library '%s'"; |
| 7632 const Library& lib = Library::Handle(library()); | 7601 const Library& lib = Library::Handle(library()); |
| 7633 intptr_t len = OS::SNPrint(NULL, 0, kFormat, lib.ToCString()) + 1; | 7602 intptr_t len = OS::SNPrint(NULL, 0, kFormat, lib.ToCString()) + 1; |
| 7634 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 7603 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 7635 OS::SNPrint(chars, len, kFormat, lib.ToCString()); | 7604 OS::SNPrint(chars, len, kFormat, lib.ToCString()); |
| 7636 return chars; | 7605 return chars; |
| 7637 } | 7606 } |
| 7638 | 7607 |
| 7639 | 7608 |
| 7640 void Namespace::PrintToJSONStream(JSONStream* stream, bool ref) const { | 7609 void Namespace::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7641 stream->OpenObject(); | 7610 JSONObject jsobj(stream); |
| 7642 stream->CloseObject(); | |
| 7643 } | 7611 } |
| 7644 | 7612 |
| 7645 | 7613 |
| 7646 bool Namespace::HidesName(const String& name) const { | 7614 bool Namespace::HidesName(const String& name) const { |
| 7647 // Quick check for common case with no combinators. | 7615 // Quick check for common case with no combinators. |
| 7648 if (hide_names() == show_names()) { | 7616 if (hide_names() == show_names()) { |
| 7649 ASSERT(hide_names() == Array::null()); | 7617 ASSERT(hide_names() == Array::null()); |
| 7650 return false; | 7618 return false; |
| 7651 } | 7619 } |
| 7652 const String* plain_name = &name; | 7620 const String* plain_name = &name; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7896 return result.raw(); | 7864 return result.raw(); |
| 7897 } | 7865 } |
| 7898 | 7866 |
| 7899 | 7867 |
| 7900 const char* Instructions::ToCString() const { | 7868 const char* Instructions::ToCString() const { |
| 7901 return "Instructions"; | 7869 return "Instructions"; |
| 7902 } | 7870 } |
| 7903 | 7871 |
| 7904 | 7872 |
| 7905 void Instructions::PrintToJSONStream(JSONStream* stream, bool ref) const { | 7873 void Instructions::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7906 stream->OpenObject(); | 7874 JSONObject jsobj(stream); |
| 7907 stream->CloseObject(); | |
| 7908 } | 7875 } |
| 7909 | 7876 |
| 7910 | 7877 |
| 7911 intptr_t PcDescriptors::Length() const { | 7878 intptr_t PcDescriptors::Length() const { |
| 7912 return Smi::Value(raw_ptr()->length_); | 7879 return Smi::Value(raw_ptr()->length_); |
| 7913 } | 7880 } |
| 7914 | 7881 |
| 7915 | 7882 |
| 7916 void PcDescriptors::SetLength(intptr_t value) const { | 7883 void PcDescriptors::SetLength(intptr_t value) const { |
| 7917 // This is only safe because we create a new Smi, which does not cause | 7884 // This is only safe because we create a new Smi, which does not cause |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8051 KindAsStr(i), | 8018 KindAsStr(i), |
| 8052 DeoptId(i), | 8019 DeoptId(i), |
| 8053 TokenPos(i), | 8020 TokenPos(i), |
| 8054 TryIndex(i)); | 8021 TryIndex(i)); |
| 8055 } | 8022 } |
| 8056 return buffer; | 8023 return buffer; |
| 8057 } | 8024 } |
| 8058 | 8025 |
| 8059 | 8026 |
| 8060 void PcDescriptors::PrintToJSONStream(JSONStream* stream, bool ref) const { | 8027 void PcDescriptors::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 8061 stream->OpenObject(); | 8028 JSONObject jsobj(stream); |
| 8062 stream->CloseObject(); | |
| 8063 } | 8029 } |
| 8064 | 8030 |
| 8065 | 8031 |
| 8066 // Verify assumptions (in debug mode only). | 8032 // Verify assumptions (in debug mode only). |
| 8067 // - No two deopt descriptors have the same deoptimization id. | 8033 // - No two deopt descriptors have the same deoptimization id. |
| 8068 // - No two ic-call descriptors have the same deoptimization id (type feedback). | 8034 // - No two ic-call descriptors have the same deoptimization id (type feedback). |
| 8069 // A function without unique ids is marked as non-optimizable (e.g., because of | 8035 // A function without unique ids is marked as non-optimizable (e.g., because of |
| 8070 // finally blocks). | 8036 // finally blocks). |
| 8071 void PcDescriptors::Verify(const Function& function) const { | 8037 void PcDescriptors::Verify(const Function& function) const { |
| 8072 #if defined(DEBUG) | 8038 #if defined(DEBUG) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8207 for (intptr_t i = 0; i < Length(); i++) { | 8173 for (intptr_t i = 0; i < Length(); i++) { |
| 8208 chars[index++] = IsObject(i) ? '1' : '0'; | 8174 chars[index++] = IsObject(i) ? '1' : '0'; |
| 8209 } | 8175 } |
| 8210 chars[index] = '\0'; | 8176 chars[index] = '\0'; |
| 8211 return chars; | 8177 return chars; |
| 8212 } | 8178 } |
| 8213 } | 8179 } |
| 8214 | 8180 |
| 8215 | 8181 |
| 8216 void Stackmap::PrintToJSONStream(JSONStream* stream, bool ref) const { | 8182 void Stackmap::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 8217 stream->OpenObject(); | 8183 JSONObject jsobj(stream); |
| 8218 stream->CloseObject(); | |
| 8219 } | 8184 } |
| 8220 | 8185 |
| 8221 | 8186 |
| 8222 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { | 8187 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { |
| 8223 ASSERT(var_index < Length()); | 8188 ASSERT(var_index < Length()); |
| 8224 const Array& names = Array::Handle(raw_ptr()->names_); | 8189 const Array& names = Array::Handle(raw_ptr()->names_); |
| 8225 ASSERT(Length() == names.Length()); | 8190 ASSERT(Length() == names.Length()); |
| 8226 String& name = String::Handle(); | 8191 String& name = String::Handle(); |
| 8227 name ^= names.At(var_index); | 8192 name ^= names.At(var_index); |
| 8228 return name.raw(); | 8193 return name.raw(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8278 info.begin_pos, | 8243 info.begin_pos, |
| 8279 info.end_pos, | 8244 info.end_pos, |
| 8280 var_name.ToCString()); | 8245 var_name.ToCString()); |
| 8281 } | 8246 } |
| 8282 return buffer; | 8247 return buffer; |
| 8283 } | 8248 } |
| 8284 | 8249 |
| 8285 | 8250 |
| 8286 void LocalVarDescriptors::PrintToJSONStream(JSONStream* stream, | 8251 void LocalVarDescriptors::PrintToJSONStream(JSONStream* stream, |
| 8287 bool ref) const { | 8252 bool ref) const { |
| 8288 stream->OpenObject(); | 8253 JSONObject jsobj(stream); |
| 8289 stream->CloseObject(); | |
| 8290 } | 8254 } |
| 8291 | 8255 |
| 8292 | 8256 |
| 8293 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { | 8257 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { |
| 8294 ASSERT(Object::var_descriptors_class() != Class::null()); | 8258 ASSERT(Object::var_descriptors_class() != Class::null()); |
| 8295 if (num_variables < 0 || num_variables > kMaxElements) { | 8259 if (num_variables < 0 || num_variables > kMaxElements) { |
| 8296 // This should be caught before we reach here. | 8260 // This should be caught before we reach here. |
| 8297 FATAL1("Fatal error in LocalVarDescriptors::New: " | 8261 FATAL1("Fatal error in LocalVarDescriptors::New: " |
| 8298 "invalid num_variables %" Pd "\n", num_variables); | 8262 "invalid num_variables %" Pd "\n", num_variables); |
| 8299 } | 8263 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8463 (len - num_chars), | 8427 (len - num_chars), |
| 8464 kFormat2, k, type.ToCString()); | 8428 kFormat2, k, type.ToCString()); |
| 8465 } | 8429 } |
| 8466 } | 8430 } |
| 8467 return buffer; | 8431 return buffer; |
| 8468 } | 8432 } |
| 8469 | 8433 |
| 8470 | 8434 |
| 8471 void ExceptionHandlers::PrintToJSONStream(JSONStream* stream, | 8435 void ExceptionHandlers::PrintToJSONStream(JSONStream* stream, |
| 8472 bool ref) const { | 8436 bool ref) const { |
| 8473 stream->OpenObject(); | 8437 JSONObject jsobj(stream); |
| 8474 stream->CloseObject(); | |
| 8475 } | 8438 } |
| 8476 | 8439 |
| 8477 | 8440 |
| 8478 intptr_t DeoptInfo::Length() const { | 8441 intptr_t DeoptInfo::Length() const { |
| 8479 return Smi::Value(raw_ptr()->length_); | 8442 return Smi::Value(raw_ptr()->length_); |
| 8480 } | 8443 } |
| 8481 | 8444 |
| 8482 | 8445 |
| 8483 intptr_t DeoptInfo::FromIndex(intptr_t index) const { | 8446 intptr_t DeoptInfo::FromIndex(intptr_t index) const { |
| 8484 return *(EntryAddr(index, kFromIndex)); | 8447 return *(EntryAddr(index, kFromIndex)); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8562 index += OS::SNPrint((buffer + index), | 8525 index += OS::SNPrint((buffer + index), |
| 8563 (len - index), | 8526 (len - index), |
| 8564 "[%s]", | 8527 "[%s]", |
| 8565 deopt_instrs[i]->ToCString()); | 8528 deopt_instrs[i]->ToCString()); |
| 8566 } | 8529 } |
| 8567 return buffer; | 8530 return buffer; |
| 8568 } | 8531 } |
| 8569 | 8532 |
| 8570 | 8533 |
| 8571 void DeoptInfo::PrintToJSONStream(JSONStream* stream, bool ref) const { | 8534 void DeoptInfo::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 8572 stream->OpenObject(); | 8535 JSONObject jsobj(stream); |
| 8573 stream->CloseObject(); | |
| 8574 } | 8536 } |
| 8575 | 8537 |
| 8576 | 8538 |
| 8577 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) { | 8539 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) { |
| 8578 ASSERT(Object::deopt_info_class() != Class::null()); | 8540 ASSERT(Object::deopt_info_class() != Class::null()); |
| 8579 if ((num_commands < 0) || (num_commands > kMaxElements)) { | 8541 if ((num_commands < 0) || (num_commands > kMaxElements)) { |
| 8580 FATAL1("Fatal error in DeoptInfo::New(): invalid num_commands %" Pd "\n", | 8542 FATAL1("Fatal error in DeoptInfo::New(): invalid num_commands %" Pd "\n", |
| 8581 num_commands); | 8543 num_commands); |
| 8582 } | 8544 } |
| 8583 DeoptInfo& result = DeoptInfo::Handle(); | 8545 DeoptInfo& result = DeoptInfo::Handle(); |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8958 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; | 8920 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; |
| 8959 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 8921 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 8960 OS::SNPrint(chars, len, kFormat, EntryPoint()); | 8922 OS::SNPrint(chars, len, kFormat, EntryPoint()); |
| 8961 return chars; | 8923 return chars; |
| 8962 } | 8924 } |
| 8963 | 8925 |
| 8964 | 8926 |
| 8965 void Code::PrintToJSONStream(JSONStream* stream, bool ref) const { | 8927 void Code::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 8966 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 8928 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 8967 intptr_t id = ring->GetIdForObject(raw()); | 8929 intptr_t id = ring->GetIdForObject(raw()); |
| 8930 JSONObject jsobj(stream); |
| 8968 if (ref) { | 8931 if (ref) { |
| 8969 stream->OpenObject(); | 8932 jsobj.AddProperty("type", "@Code"); |
| 8970 stream->PrintProperty("type", "@Code"); | 8933 jsobj.AddProperty("id", id); |
| 8971 stream->PrintProperty("id", id); | |
| 8972 stream->CloseObject(); | |
| 8973 return; | 8934 return; |
| 8974 } | 8935 } |
| 8975 stream->OpenObject(); | 8936 jsobj.AddProperty("type", "Code"); |
| 8976 stream->PrintProperty("type", "Code"); | 8937 jsobj.AddProperty("id", id); |
| 8977 stream->PrintProperty("id", id); | 8938 jsobj.AddProperty("is_optimized", is_optimized()); |
| 8978 stream->PrintPropertyBool("is_optimized", is_optimized()); | 8939 jsobj.AddProperty("is_alive", is_alive()); |
| 8979 stream->PrintPropertyBool("is_alive", is_alive()); | 8940 jsobj.AddProperty("function", Object::Handle(function())); |
| 8980 stream->PrintProperty("function", Object::Handle(function())); | 8941 JSONArray jsarr(jsobj, "disassembly"); |
| 8981 stream->OpenArray("disassembly"); | 8942 DisassembleToJSONStream formatter(jsarr); |
| 8982 DisassembleToJSONStream formatter(stream); | |
| 8983 const Instructions& instr = Instructions::Handle(instructions()); | 8943 const Instructions& instr = Instructions::Handle(instructions()); |
| 8984 uword start = instr.EntryPoint(); | 8944 uword start = instr.EntryPoint(); |
| 8985 Disassembler::Disassemble(start, start + instr.size(), &formatter, | 8945 Disassembler::Disassemble(start, start + instr.size(), &formatter, |
| 8986 comments()); | 8946 comments()); |
| 8987 stream->CloseArray(); | |
| 8988 stream->CloseObject(); | |
| 8989 } | 8947 } |
| 8990 | 8948 |
| 8991 | 8949 |
| 8992 uword Code::GetPatchCodePc() const { | 8950 uword Code::GetPatchCodePc() const { |
| 8993 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | 8951 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
| 8994 return descriptors.GetPcForKind(PcDescriptors::kPatchCode); | 8952 return descriptors.GetPcForKind(PcDescriptors::kPatchCode); |
| 8995 } | 8953 } |
| 8996 | 8954 |
| 8997 | 8955 |
| 8998 uword Code::GetLazyDeoptPc() const { | 8956 uword Code::GetLazyDeoptPc() const { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9109 return result.raw(); | 9067 return result.raw(); |
| 9110 } | 9068 } |
| 9111 | 9069 |
| 9112 | 9070 |
| 9113 const char* Context::ToCString() const { | 9071 const char* Context::ToCString() const { |
| 9114 return "Context"; | 9072 return "Context"; |
| 9115 } | 9073 } |
| 9116 | 9074 |
| 9117 | 9075 |
| 9118 void Context::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9076 void Context::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9119 stream->OpenObject(); | 9077 JSONObject jsobj(stream); |
| 9120 stream->CloseObject(); | |
| 9121 } | 9078 } |
| 9122 | 9079 |
| 9123 | 9080 |
| 9124 RawContextScope* ContextScope::New(intptr_t num_variables) { | 9081 RawContextScope* ContextScope::New(intptr_t num_variables) { |
| 9125 ASSERT(Object::context_scope_class() != Class::null()); | 9082 ASSERT(Object::context_scope_class() != Class::null()); |
| 9126 if (num_variables < 0 || num_variables > kMaxElements) { | 9083 if (num_variables < 0 || num_variables > kMaxElements) { |
| 9127 // This should be caught before we reach here. | 9084 // This should be caught before we reach here. |
| 9128 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n", | 9085 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n", |
| 9129 num_variables); | 9086 num_variables); |
| 9130 } | 9087 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9229 VariableDescAddr(scope_index)->context_level = Smi::New(context_level); | 9186 VariableDescAddr(scope_index)->context_level = Smi::New(context_level); |
| 9230 } | 9187 } |
| 9231 | 9188 |
| 9232 | 9189 |
| 9233 const char* ContextScope::ToCString() const { | 9190 const char* ContextScope::ToCString() const { |
| 9234 return "ContextScope"; | 9191 return "ContextScope"; |
| 9235 } | 9192 } |
| 9236 | 9193 |
| 9237 | 9194 |
| 9238 void ContextScope::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9195 void ContextScope::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9239 stream->OpenObject(); | 9196 JSONObject jsobj(stream); |
| 9240 stream->CloseObject(); | |
| 9241 } | 9197 } |
| 9242 | 9198 |
| 9243 | 9199 |
| 9244 const char* ICData::ToCString() const { | 9200 const char* ICData::ToCString() const { |
| 9245 const char* kFormat = "ICData target:'%s' num-args: %" Pd | 9201 const char* kFormat = "ICData target:'%s' num-args: %" Pd |
| 9246 " num-checks: %" Pd ""; | 9202 " num-checks: %" Pd ""; |
| 9247 const String& name = String::Handle(target_name()); | 9203 const String& name = String::Handle(target_name()); |
| 9248 const intptr_t num_args = num_args_tested(); | 9204 const intptr_t num_args = num_args_tested(); |
| 9249 const intptr_t num_checks = NumberOfChecks(); | 9205 const intptr_t num_checks = NumberOfChecks(); |
| 9250 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString(), | 9206 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString(), |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9702 intptr_t len = result.TestEntryLength(); | 9658 intptr_t len = result.TestEntryLength(); |
| 9703 // IC data array must be null terminated (sentinel entry). | 9659 // IC data array must be null terminated (sentinel entry). |
| 9704 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); | 9660 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); |
| 9705 result.set_ic_data(ic_data); | 9661 result.set_ic_data(ic_data); |
| 9706 result.WriteSentinel(ic_data); | 9662 result.WriteSentinel(ic_data); |
| 9707 return result.raw(); | 9663 return result.raw(); |
| 9708 } | 9664 } |
| 9709 | 9665 |
| 9710 | 9666 |
| 9711 void ICData::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9667 void ICData::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9712 stream->OpenObject(); | 9668 JSONObject jsobj(stream); |
| 9713 stream->CloseObject(); | |
| 9714 } | 9669 } |
| 9715 | 9670 |
| 9716 | 9671 |
| 9717 RawArray* MegamorphicCache::buckets() const { | 9672 RawArray* MegamorphicCache::buckets() const { |
| 9718 return raw_ptr()->buckets_; | 9673 return raw_ptr()->buckets_; |
| 9719 } | 9674 } |
| 9720 | 9675 |
| 9721 | 9676 |
| 9722 void MegamorphicCache::set_buckets(const Array& buckets) const { | 9677 void MegamorphicCache::set_buckets(const Array& buckets) const { |
| 9723 StorePointer(&raw_ptr()->buckets_, buckets.raw()); | 9678 StorePointer(&raw_ptr()->buckets_, buckets.raw()); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9819 UNREACHABLE(); | 9774 UNREACHABLE(); |
| 9820 } | 9775 } |
| 9821 | 9776 |
| 9822 | 9777 |
| 9823 const char* MegamorphicCache::ToCString() const { | 9778 const char* MegamorphicCache::ToCString() const { |
| 9824 return ""; | 9779 return ""; |
| 9825 } | 9780 } |
| 9826 | 9781 |
| 9827 | 9782 |
| 9828 void MegamorphicCache::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9783 void MegamorphicCache::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9829 stream->OpenObject(); | 9784 JSONObject jsobj(stream); |
| 9830 stream->CloseObject(); | |
| 9831 } | 9785 } |
| 9832 | 9786 |
| 9833 | 9787 |
| 9834 RawSubtypeTestCache* SubtypeTestCache::New() { | 9788 RawSubtypeTestCache* SubtypeTestCache::New() { |
| 9835 ASSERT(Object::subtypetestcache_class() != Class::null()); | 9789 ASSERT(Object::subtypetestcache_class() != Class::null()); |
| 9836 SubtypeTestCache& result = SubtypeTestCache::Handle(); | 9790 SubtypeTestCache& result = SubtypeTestCache::Handle(); |
| 9837 { | 9791 { |
| 9838 // SubtypeTestCache objects are long living objects, allocate them in the | 9792 // SubtypeTestCache objects are long living objects, allocate them in the |
| 9839 // old generation. | 9793 // old generation. |
| 9840 RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId, | 9794 RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9896 *test_result ^= data.At(data_pos + kTestResult); | 9850 *test_result ^= data.At(data_pos + kTestResult); |
| 9897 } | 9851 } |
| 9898 | 9852 |
| 9899 | 9853 |
| 9900 const char* SubtypeTestCache::ToCString() const { | 9854 const char* SubtypeTestCache::ToCString() const { |
| 9901 return "SubtypeTestCache"; | 9855 return "SubtypeTestCache"; |
| 9902 } | 9856 } |
| 9903 | 9857 |
| 9904 | 9858 |
| 9905 void SubtypeTestCache::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9859 void SubtypeTestCache::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9906 stream->OpenObject(); | 9860 JSONObject jsobj(stream); |
| 9907 stream->CloseObject(); | |
| 9908 } | 9861 } |
| 9909 | 9862 |
| 9910 | 9863 |
| 9911 const char* Error::ToErrorCString() const { | 9864 const char* Error::ToErrorCString() const { |
| 9912 UNREACHABLE(); | 9865 UNREACHABLE(); |
| 9913 return "Internal Error"; | 9866 return "Internal Error"; |
| 9914 } | 9867 } |
| 9915 | 9868 |
| 9916 | 9869 |
| 9917 const char* Error::ToCString() const { | 9870 const char* Error::ToCString() const { |
| 9918 // Error is an abstract class. We should never reach here. | 9871 // Error is an abstract class. We should never reach here. |
| 9919 UNREACHABLE(); | 9872 UNREACHABLE(); |
| 9920 return "Error"; | 9873 return "Error"; |
| 9921 } | 9874 } |
| 9922 | 9875 |
| 9923 | 9876 |
| 9924 void Error::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9877 void Error::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9925 stream->OpenObject(); | 9878 JSONObject jsobj(stream); |
| 9926 stream->CloseObject(); | |
| 9927 } | 9879 } |
| 9928 | 9880 |
| 9929 | 9881 |
| 9930 RawApiError* ApiError::New() { | 9882 RawApiError* ApiError::New() { |
| 9931 ASSERT(Object::api_error_class() != Class::null()); | 9883 ASSERT(Object::api_error_class() != Class::null()); |
| 9932 RawObject* raw = Object::Allocate(ApiError::kClassId, | 9884 RawObject* raw = Object::Allocate(ApiError::kClassId, |
| 9933 ApiError::InstanceSize(), | 9885 ApiError::InstanceSize(), |
| 9934 Heap::kOld); | 9886 Heap::kOld); |
| 9935 return reinterpret_cast<RawApiError*>(raw); | 9887 return reinterpret_cast<RawApiError*>(raw); |
| 9936 } | 9888 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 9961 return msg_str.ToCString(); | 9913 return msg_str.ToCString(); |
| 9962 } | 9914 } |
| 9963 | 9915 |
| 9964 | 9916 |
| 9965 const char* ApiError::ToCString() const { | 9917 const char* ApiError::ToCString() const { |
| 9966 return "ApiError"; | 9918 return "ApiError"; |
| 9967 } | 9919 } |
| 9968 | 9920 |
| 9969 | 9921 |
| 9970 void ApiError::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9922 void ApiError::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9971 stream->OpenObject(); | 9923 JSONObject jsobj(stream); |
| 9972 stream->CloseObject(); | |
| 9973 } | 9924 } |
| 9974 | 9925 |
| 9975 | 9926 |
| 9976 RawLanguageError* LanguageError::New() { | 9927 RawLanguageError* LanguageError::New() { |
| 9977 ASSERT(Object::language_error_class() != Class::null()); | 9928 ASSERT(Object::language_error_class() != Class::null()); |
| 9978 RawObject* raw = Object::Allocate(LanguageError::kClassId, | 9929 RawObject* raw = Object::Allocate(LanguageError::kClassId, |
| 9979 LanguageError::InstanceSize(), | 9930 LanguageError::InstanceSize(), |
| 9980 Heap::kOld); | 9931 Heap::kOld); |
| 9981 return reinterpret_cast<RawLanguageError*>(raw); | 9932 return reinterpret_cast<RawLanguageError*>(raw); |
| 9982 } | 9933 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 10007 return msg_str.ToCString(); | 9958 return msg_str.ToCString(); |
| 10008 } | 9959 } |
| 10009 | 9960 |
| 10010 | 9961 |
| 10011 const char* LanguageError::ToCString() const { | 9962 const char* LanguageError::ToCString() const { |
| 10012 return "LanguageError"; | 9963 return "LanguageError"; |
| 10013 } | 9964 } |
| 10014 | 9965 |
| 10015 | 9966 |
| 10016 void LanguageError::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9967 void LanguageError::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10017 stream->OpenObject(); | 9968 JSONObject jsobj(stream); |
| 10018 stream->CloseObject(); | |
| 10019 } | 9969 } |
| 10020 | 9970 |
| 10021 | 9971 |
| 10022 RawUnhandledException* UnhandledException::New(const Instance& exception, | 9972 RawUnhandledException* UnhandledException::New(const Instance& exception, |
| 10023 const Instance& stacktrace, | 9973 const Instance& stacktrace, |
| 10024 Heap::Space space) { | 9974 Heap::Space space) { |
| 10025 ASSERT(Object::unhandled_exception_class() != Class::null()); | 9975 ASSERT(Object::unhandled_exception_class() != Class::null()); |
| 10026 UnhandledException& result = UnhandledException::Handle(); | 9976 UnhandledException& result = UnhandledException::Handle(); |
| 10027 { | 9977 { |
| 10028 RawObject* raw = Object::Allocate(UnhandledException::kClassId, | 9978 RawObject* raw = Object::Allocate(UnhandledException::kClassId, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10082 } | 10032 } |
| 10083 | 10033 |
| 10084 | 10034 |
| 10085 const char* UnhandledException::ToCString() const { | 10035 const char* UnhandledException::ToCString() const { |
| 10086 return "UnhandledException"; | 10036 return "UnhandledException"; |
| 10087 } | 10037 } |
| 10088 | 10038 |
| 10089 | 10039 |
| 10090 void UnhandledException::PrintToJSONStream(JSONStream* stream, | 10040 void UnhandledException::PrintToJSONStream(JSONStream* stream, |
| 10091 bool ref) const { | 10041 bool ref) const { |
| 10092 stream->OpenObject(); | 10042 JSONObject jsobj(stream); |
| 10093 stream->CloseObject(); | |
| 10094 } | 10043 } |
| 10095 | 10044 |
| 10096 | 10045 |
| 10097 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { | 10046 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { |
| 10098 ASSERT(Object::unwind_error_class() != Class::null()); | 10047 ASSERT(Object::unwind_error_class() != Class::null()); |
| 10099 UnwindError& result = UnwindError::Handle(); | 10048 UnwindError& result = UnwindError::Handle(); |
| 10100 { | 10049 { |
| 10101 RawObject* raw = Object::Allocate(UnwindError::kClassId, | 10050 RawObject* raw = Object::Allocate(UnwindError::kClassId, |
| 10102 UnwindError::InstanceSize(), | 10051 UnwindError::InstanceSize(), |
| 10103 space); | 10052 space); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 10119 return msg_str.ToCString(); | 10068 return msg_str.ToCString(); |
| 10120 } | 10069 } |
| 10121 | 10070 |
| 10122 | 10071 |
| 10123 const char* UnwindError::ToCString() const { | 10072 const char* UnwindError::ToCString() const { |
| 10124 return "UnwindError"; | 10073 return "UnwindError"; |
| 10125 } | 10074 } |
| 10126 | 10075 |
| 10127 | 10076 |
| 10128 void UnwindError::PrintToJSONStream(JSONStream* stream, bool ref) const { | 10077 void UnwindError::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10129 stream->OpenObject(); | 10078 JSONObject jsobj(stream); |
| 10130 stream->CloseObject(); | |
| 10131 } | 10079 } |
| 10132 | 10080 |
| 10133 | 10081 |
| 10134 RawObject* Instance::Evaluate(const String& expr) const { | 10082 RawObject* Instance::Evaluate(const String& expr) const { |
| 10135 const Class& cls = Class::Handle(clazz()); | 10083 const Class& cls = Class::Handle(clazz()); |
| 10136 const PatchClass& temp_class = | 10084 const PatchClass& temp_class = |
| 10137 PatchClass::Handle(MakeTempPatchClass(cls, expr)); | 10085 PatchClass::Handle(MakeTempPatchClass(cls, expr)); |
| 10138 const String& eval_func_name = String::Handle(Symbols::New(":eval")); | 10086 const String& eval_func_name = String::Handle(Symbols::New(":eval")); |
| 10139 const Function& eval_func = | 10087 const Function& eval_func = |
| 10140 Function::Handle(Function::New(eval_func_name, | 10088 Function::Handle(Function::New(eval_func_name, |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10474 // Calculate the size of the string. | 10422 // Calculate the size of the string. |
| 10475 intptr_t len = OS::SNPrint(NULL, 0, kFormat, type_name.ToCString()) + 1; | 10423 intptr_t len = OS::SNPrint(NULL, 0, kFormat, type_name.ToCString()) + 1; |
| 10476 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 10424 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 10477 OS::SNPrint(chars, len, kFormat, type_name.ToCString()); | 10425 OS::SNPrint(chars, len, kFormat, type_name.ToCString()); |
| 10478 return chars; | 10426 return chars; |
| 10479 } | 10427 } |
| 10480 } | 10428 } |
| 10481 | 10429 |
| 10482 | 10430 |
| 10483 void Instance::PrintToJSONStream(JSONStream* stream, bool ref) const { | 10431 void Instance::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10484 stream->OpenObject(); | 10432 JSONObject jsobj(stream); |
| 10485 stream->CloseObject(); | |
| 10486 } | 10433 } |
| 10487 | 10434 |
| 10488 | 10435 |
| 10489 bool AbstractType::IsResolved() const { | 10436 bool AbstractType::IsResolved() const { |
| 10490 // AbstractType is an abstract class. | 10437 // AbstractType is an abstract class. |
| 10491 UNREACHABLE(); | 10438 UNREACHABLE(); |
| 10492 return false; | 10439 return false; |
| 10493 } | 10440 } |
| 10494 | 10441 |
| 10495 | 10442 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10833 | 10780 |
| 10834 | 10781 |
| 10835 const char* AbstractType::ToCString() const { | 10782 const char* AbstractType::ToCString() const { |
| 10836 // AbstractType is an abstract class. | 10783 // AbstractType is an abstract class. |
| 10837 UNREACHABLE(); | 10784 UNREACHABLE(); |
| 10838 return "AbstractType"; | 10785 return "AbstractType"; |
| 10839 } | 10786 } |
| 10840 | 10787 |
| 10841 | 10788 |
| 10842 void AbstractType::PrintToJSONStream(JSONStream* stream, bool ref) const { | 10789 void AbstractType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10843 stream->OpenObject(); | 10790 JSONObject jsobj(stream); |
| 10844 stream->CloseObject(); | |
| 10845 } | 10791 } |
| 10846 | 10792 |
| 10847 | 10793 |
| 10848 RawType* Type::NullType() { | 10794 RawType* Type::NullType() { |
| 10849 return Isolate::Current()->object_store()->null_type(); | 10795 return Isolate::Current()->object_store()->null_type(); |
| 10850 } | 10796 } |
| 10851 | 10797 |
| 10852 | 10798 |
| 10853 RawType* Type::DynamicType() { | 10799 RawType* Type::DynamicType() { |
| 10854 return Object::dynamic_type(); | 10800 return Object::dynamic_type(); |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11281 OS::SNPrint(chars, len, format, class_name, args_cstr); | 11227 OS::SNPrint(chars, len, format, class_name, args_cstr); |
| 11282 return chars; | 11228 return chars; |
| 11283 } | 11229 } |
| 11284 } else { | 11230 } else { |
| 11285 return "Unresolved Type"; | 11231 return "Unresolved Type"; |
| 11286 } | 11232 } |
| 11287 } | 11233 } |
| 11288 | 11234 |
| 11289 | 11235 |
| 11290 void Type::PrintToJSONStream(JSONStream* stream, bool ref) const { | 11236 void Type::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11291 stream->OpenObject(); | 11237 JSONObject jsobj(stream); |
| 11292 stream->CloseObject(); | |
| 11293 } | 11238 } |
| 11294 | 11239 |
| 11295 | 11240 |
| 11296 void TypeParameter::set_is_finalized() const { | 11241 void TypeParameter::set_is_finalized() const { |
| 11297 ASSERT(!IsFinalized()); | 11242 ASSERT(!IsFinalized()); |
| 11298 set_type_state(RawTypeParameter::kFinalizedUninstantiated); | 11243 set_type_state(RawTypeParameter::kFinalizedUninstantiated); |
| 11299 } | 11244 } |
| 11300 | 11245 |
| 11301 | 11246 |
| 11302 bool TypeParameter::Equals(const Instance& other) const { | 11247 bool TypeParameter::Equals(const Instance& other) const { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11469 const char* cls_cstr = | 11414 const char* cls_cstr = |
| 11470 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); | 11415 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); |
| 11471 intptr_t len = OS::SNPrint(NULL, 0, format, name_cstr, index(), cls_cstr) + 1; | 11416 intptr_t len = OS::SNPrint(NULL, 0, format, name_cstr, index(), cls_cstr) + 1; |
| 11472 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 11417 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 11473 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr); | 11418 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr); |
| 11474 return chars; | 11419 return chars; |
| 11475 } | 11420 } |
| 11476 | 11421 |
| 11477 | 11422 |
| 11478 void TypeParameter::PrintToJSONStream(JSONStream* stream, bool ref) const { | 11423 void TypeParameter::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11479 stream->OpenObject(); | 11424 JSONObject jsobj(stream); |
| 11480 stream->CloseObject(); | |
| 11481 } | 11425 } |
| 11482 | 11426 |
| 11483 | 11427 |
| 11484 bool BoundedType::IsMalformed() const { | 11428 bool BoundedType::IsMalformed() const { |
| 11485 return AbstractType::Handle(type()).IsMalformed(); | 11429 return AbstractType::Handle(type()).IsMalformed(); |
| 11486 } | 11430 } |
| 11487 | 11431 |
| 11488 | 11432 |
| 11489 bool BoundedType::IsMalboundedWithError(Error* bound_error) const { | 11433 bool BoundedType::IsMalboundedWithError(Error* bound_error) const { |
| 11490 if (!FLAG_enable_type_checks && !FLAG_error_on_bad_type) { | 11434 if (!FLAG_enable_type_checks && !FLAG_error_on_bad_type) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11638 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); | 11582 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); |
| 11639 intptr_t len = OS::SNPrint( | 11583 intptr_t len = OS::SNPrint( |
| 11640 NULL, 0, format, type_cstr, bound_cstr, cls_cstr) + 1; | 11584 NULL, 0, format, type_cstr, bound_cstr, cls_cstr) + 1; |
| 11641 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 11585 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 11642 OS::SNPrint(chars, len, format, type_cstr, bound_cstr, cls_cstr); | 11586 OS::SNPrint(chars, len, format, type_cstr, bound_cstr, cls_cstr); |
| 11643 return chars; | 11587 return chars; |
| 11644 } | 11588 } |
| 11645 | 11589 |
| 11646 | 11590 |
| 11647 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { | 11591 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11648 stream->OpenObject(); | 11592 JSONObject jsobj(stream); |
| 11649 stream->CloseObject(); | |
| 11650 } | 11593 } |
| 11651 | 11594 |
| 11652 | 11595 |
| 11653 RawString* MixinAppType::Name() const { | 11596 RawString* MixinAppType::Name() const { |
| 11654 return String::New("MixinApplication"); | 11597 return String::New("MixinApplication"); |
| 11655 } | 11598 } |
| 11656 | 11599 |
| 11657 | 11600 |
| 11658 const char* MixinAppType::ToCString() const { | 11601 const char* MixinAppType::ToCString() const { |
| 11659 return "MixinAppType"; | 11602 return "MixinAppType"; |
| 11660 } | 11603 } |
| 11661 | 11604 |
| 11662 | 11605 |
| 11663 void MixinAppType::PrintToJSONStream(JSONStream* stream, bool ref) const { | 11606 void MixinAppType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11664 stream->OpenObject(); | 11607 JSONObject jsobj(stream); |
| 11665 stream->CloseObject(); | |
| 11666 } | 11608 } |
| 11667 | 11609 |
| 11668 | 11610 |
| 11669 void MixinAppType::set_super_type(const AbstractType& value) const { | 11611 void MixinAppType::set_super_type(const AbstractType& value) const { |
| 11670 StorePointer(&raw_ptr()->super_type_, value.raw()); | 11612 StorePointer(&raw_ptr()->super_type_, value.raw()); |
| 11671 } | 11613 } |
| 11672 | 11614 |
| 11673 | 11615 |
| 11674 void MixinAppType::set_mixin_types(const Array& value) const { | 11616 void MixinAppType::set_mixin_types(const Array& value) const { |
| 11675 StorePointer(&raw_ptr()->mixin_types_, value.raw()); | 11617 StorePointer(&raw_ptr()->mixin_types_, value.raw()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 11698 | 11640 |
| 11699 | 11641 |
| 11700 const char* Number::ToCString() const { | 11642 const char* Number::ToCString() const { |
| 11701 // Number is an interface. No instances of Number should exist. | 11643 // Number is an interface. No instances of Number should exist. |
| 11702 UNREACHABLE(); | 11644 UNREACHABLE(); |
| 11703 return "Number"; | 11645 return "Number"; |
| 11704 } | 11646 } |
| 11705 | 11647 |
| 11706 | 11648 |
| 11707 void Number::PrintToJSONStream(JSONStream* stream, bool ref) const { | 11649 void Number::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11708 stream->OpenObject(); | 11650 JSONObject jsobj(stream); |
| 11709 stream->CloseObject(); | |
| 11710 } | 11651 } |
| 11711 | 11652 |
| 11712 | 11653 |
| 11713 const char* Integer::ToCString() const { | 11654 const char* Integer::ToCString() const { |
| 11714 // Integer is an interface. No instances of Integer should exist. | 11655 // Integer is an interface. No instances of Integer should exist. |
| 11715 UNREACHABLE(); | 11656 UNREACHABLE(); |
| 11716 return "Integer"; | 11657 return "Integer"; |
| 11717 } | 11658 } |
| 11718 | 11659 |
| 11719 | 11660 |
| 11720 void Integer::PrintToJSONStream(JSONStream* stream, bool ref) const { | 11661 void Integer::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11721 stream->OpenObject(); | 11662 JSONObject jsobj(stream); |
| 11722 stream->CloseObject(); | |
| 11723 } | 11663 } |
| 11724 | 11664 |
| 11725 | 11665 |
| 11726 // Throw JavascriptIntegerOverflow exception. | 11666 // Throw JavascriptIntegerOverflow exception. |
| 11727 static void ThrowJavascriptIntegerOverflow(const Integer& i) { | 11667 static void ThrowJavascriptIntegerOverflow(const Integer& i) { |
| 11728 const Array& exc_args = Array::Handle(Array::New(1)); | 11668 const Array& exc_args = Array::Handle(Array::New(1)); |
| 11729 const String& i_str = String::Handle(String::New(i.ToCString())); | 11669 const String& i_str = String::Handle(String::New(i.ToCString())); |
| 11730 exc_args.SetAt(0, i_str); | 11670 exc_args.SetAt(0, i_str); |
| 11731 Exceptions::ThrowByType(Exceptions::kJavascriptIntegerOverflowError, | 11671 Exceptions::ThrowByType(Exceptions::kJavascriptIntegerOverflowError, |
| 11732 exc_args); | 11672 exc_args); |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12130 const char* kFormat = "%ld"; | 12070 const char* kFormat = "%ld"; |
| 12131 // Calculate the size of the string. | 12071 // Calculate the size of the string. |
| 12132 intptr_t len = OS::SNPrint(NULL, 0, kFormat, Value()) + 1; | 12072 intptr_t len = OS::SNPrint(NULL, 0, kFormat, Value()) + 1; |
| 12133 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 12073 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 12134 OS::SNPrint(chars, len, kFormat, Value()); | 12074 OS::SNPrint(chars, len, kFormat, Value()); |
| 12135 return chars; | 12075 return chars; |
| 12136 } | 12076 } |
| 12137 | 12077 |
| 12138 | 12078 |
| 12139 void Smi::PrintToJSONStream(JSONStream* stream, bool ref) const { | 12079 void Smi::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 12140 stream->OpenObject(); | 12080 JSONObject jsobj(stream); |
| 12141 stream->CloseObject(); | |
| 12142 } | 12081 } |
| 12143 | 12082 |
| 12144 | 12083 |
| 12145 RawClass* Smi::Class() { | 12084 RawClass* Smi::Class() { |
| 12146 return Isolate::Current()->object_store()->smi_class(); | 12085 return Isolate::Current()->object_store()->smi_class(); |
| 12147 } | 12086 } |
| 12148 | 12087 |
| 12149 | 12088 |
| 12150 void Mint::set_value(int64_t value) const { | 12089 void Mint::set_value(int64_t value) const { |
| 12151 raw_ptr()->value_ = value; | 12090 raw_ptr()->value_ = value; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12250 const char* kFormat = "%lld"; | 12189 const char* kFormat = "%lld"; |
| 12251 // Calculate the size of the string. | 12190 // Calculate the size of the string. |
| 12252 intptr_t len = OS::SNPrint(NULL, 0, kFormat, value()) + 1; | 12191 intptr_t len = OS::SNPrint(NULL, 0, kFormat, value()) + 1; |
| 12253 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 12192 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 12254 OS::SNPrint(chars, len, kFormat, value()); | 12193 OS::SNPrint(chars, len, kFormat, value()); |
| 12255 return chars; | 12194 return chars; |
| 12256 } | 12195 } |
| 12257 | 12196 |
| 12258 | 12197 |
| 12259 void Mint::PrintToJSONStream(JSONStream* stream, bool ref) const { | 12198 void Mint::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 12260 stream->OpenObject(); | 12199 JSONObject jsobj(stream); |
| 12261 stream->CloseObject(); | |
| 12262 } | 12200 } |
| 12263 | 12201 |
| 12264 | 12202 |
| 12265 void Double::set_value(double value) const { | 12203 void Double::set_value(double value) const { |
| 12266 raw_ptr()->value_ = value; | 12204 raw_ptr()->value_ = value; |
| 12267 } | 12205 } |
| 12268 | 12206 |
| 12269 | 12207 |
| 12270 bool Double::EqualsToDouble(double value) const { | 12208 bool Double::EqualsToDouble(double value) const { |
| 12271 intptr_t value_offset = Double::value_offset(); | 12209 intptr_t value_offset = Double::value_offset(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12357 } | 12295 } |
| 12358 const int kBufferSize = 128; | 12296 const int kBufferSize = 128; |
| 12359 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(kBufferSize); | 12297 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(kBufferSize); |
| 12360 buffer[kBufferSize - 1] = '\0'; | 12298 buffer[kBufferSize - 1] = '\0'; |
| 12361 DoubleToCString(value(), buffer, kBufferSize); | 12299 DoubleToCString(value(), buffer, kBufferSize); |
| 12362 return buffer; | 12300 return buffer; |
| 12363 } | 12301 } |
| 12364 | 12302 |
| 12365 | 12303 |
| 12366 void Double::PrintToJSONStream(JSONStream* stream, bool ref) const { | 12304 void Double::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 12367 stream->OpenObject(); | 12305 JSONObject jsobj(stream); |
| 12368 stream->CloseObject(); | |
| 12369 } | 12306 } |
| 12370 | 12307 |
| 12371 | 12308 |
| 12372 RawBigint* Integer::AsBigint() const { | 12309 RawBigint* Integer::AsBigint() const { |
| 12373 ASSERT(!IsNull()); | 12310 ASSERT(!IsNull()); |
| 12374 if (IsSmi()) { | 12311 if (IsSmi()) { |
| 12375 Smi& smi = Smi::Handle(); | 12312 Smi& smi = Smi::Handle(); |
| 12376 smi ^= raw(); | 12313 smi ^= raw(); |
| 12377 return BigintOperations::NewFromSmi(smi); | 12314 return BigintOperations::NewFromSmi(smi); |
| 12378 } else if (IsMint()) { | 12315 } else if (IsMint()) { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12529 return zone->AllocUnsafe(size); | 12466 return zone->AllocUnsafe(size); |
| 12530 } | 12467 } |
| 12531 | 12468 |
| 12532 | 12469 |
| 12533 const char* Bigint::ToCString() const { | 12470 const char* Bigint::ToCString() const { |
| 12534 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); | 12471 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); |
| 12535 } | 12472 } |
| 12536 | 12473 |
| 12537 | 12474 |
| 12538 void Bigint::PrintToJSONStream(JSONStream* stream, bool ref) const { | 12475 void Bigint::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 12539 stream->OpenObject(); | 12476 JSONObject jsobj(stream); |
| 12540 stream->CloseObject(); | |
| 12541 } | 12477 } |
| 12542 | 12478 |
| 12543 | 12479 |
| 12544 // Synchronize with implementation in compiler (intrinsifier). | 12480 // Synchronize with implementation in compiler (intrinsifier). |
| 12545 class StringHasher : ValueObject { | 12481 class StringHasher : ValueObject { |
| 12546 public: | 12482 public: |
| 12547 StringHasher() : hash_(0) {} | 12483 StringHasher() : hash_(0) {} |
| 12548 void Add(int32_t ch) { | 12484 void Add(int32_t ch) { |
| 12549 hash_ += ch; | 12485 hash_ += ch; |
| 12550 hash_ += hash_ << 10; | 12486 hash_ += hash_ << 10; |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13133 const intptr_t len = Utf8::Length(*this); | 13069 const intptr_t len = Utf8::Length(*this); |
| 13134 Zone* zone = Isolate::Current()->current_zone(); | 13070 Zone* zone = Isolate::Current()->current_zone(); |
| 13135 uint8_t* result = zone->Alloc<uint8_t>(len + 1); | 13071 uint8_t* result = zone->Alloc<uint8_t>(len + 1); |
| 13136 ToUTF8(result, len); | 13072 ToUTF8(result, len); |
| 13137 result[len] = 0; | 13073 result[len] = 0; |
| 13138 return reinterpret_cast<const char*>(result); | 13074 return reinterpret_cast<const char*>(result); |
| 13139 } | 13075 } |
| 13140 | 13076 |
| 13141 | 13077 |
| 13142 void String::PrintToJSONStream(JSONStream* stream, bool ref) const { | 13078 void String::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13143 stream->OpenObject(); | 13079 JSONObject jsobj(stream); |
| 13144 stream->CloseObject(); | |
| 13145 } | 13080 } |
| 13146 | 13081 |
| 13147 | 13082 |
| 13148 void String::ToUTF8(uint8_t* utf8_array, intptr_t array_len) const { | 13083 void String::ToUTF8(uint8_t* utf8_array, intptr_t array_len) const { |
| 13149 ASSERT(array_len >= Utf8::Length(*this)); | 13084 ASSERT(array_len >= Utf8::Length(*this)); |
| 13150 Utf8::Encode(*this, reinterpret_cast<char*>(utf8_array), array_len); | 13085 Utf8::Encode(*this, reinterpret_cast<char*>(utf8_array), array_len); |
| 13151 } | 13086 } |
| 13152 | 13087 |
| 13153 | 13088 |
| 13154 static FinalizablePersistentHandle* AddFinalizer( | 13089 static FinalizablePersistentHandle* AddFinalizer( |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13855 return result.raw(); | 13790 return result.raw(); |
| 13856 } | 13791 } |
| 13857 | 13792 |
| 13858 | 13793 |
| 13859 const char* Bool::ToCString() const { | 13794 const char* Bool::ToCString() const { |
| 13860 return value() ? "true" : "false"; | 13795 return value() ? "true" : "false"; |
| 13861 } | 13796 } |
| 13862 | 13797 |
| 13863 | 13798 |
| 13864 void Bool::PrintToJSONStream(JSONStream* stream, bool ref) const { | 13799 void Bool::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13865 stream->OpenObject(); | 13800 JSONObject jsobj(stream); |
| 13866 stream->CloseObject(); | |
| 13867 } | 13801 } |
| 13868 | 13802 |
| 13869 | 13803 |
| 13870 bool Array::Equals(const Instance& other) const { | 13804 bool Array::Equals(const Instance& other) const { |
| 13871 if (this->raw() == other.raw()) { | 13805 if (this->raw() == other.raw()) { |
| 13872 // Both handles point to the same raw instance. | 13806 // Both handles point to the same raw instance. |
| 13873 return true; | 13807 return true; |
| 13874 } | 13808 } |
| 13875 | 13809 |
| 13876 if (!other.IsArray() || other.IsNull()) { | 13810 if (!other.IsArray() || other.IsNull()) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13939 const char* format = !IsImmutable() ? "Array len:%" Pd "" : | 13873 const char* format = !IsImmutable() ? "Array len:%" Pd "" : |
| 13940 "Immutable Array len:%" Pd ""; | 13874 "Immutable Array len:%" Pd ""; |
| 13941 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; | 13875 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; |
| 13942 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 13876 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 13943 OS::SNPrint(chars, len, format, Length()); | 13877 OS::SNPrint(chars, len, format, Length()); |
| 13944 return chars; | 13878 return chars; |
| 13945 } | 13879 } |
| 13946 | 13880 |
| 13947 | 13881 |
| 13948 void Array::PrintToJSONStream(JSONStream* stream, bool ref) const { | 13882 void Array::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13949 stream->OpenObject(); | 13883 JSONObject jsobj(stream); |
| 13950 stream->CloseObject(); | |
| 13951 } | 13884 } |
| 13952 | 13885 |
| 13953 | 13886 |
| 13954 RawArray* Array::Grow(const Array& source, int new_length, Heap::Space space) { | 13887 RawArray* Array::Grow(const Array& source, int new_length, Heap::Space space) { |
| 13955 const Array& result = Array::Handle(Array::New(new_length, space)); | 13888 const Array& result = Array::Handle(Array::New(new_length, space)); |
| 13956 intptr_t len = 0; | 13889 intptr_t len = 0; |
| 13957 if (!source.IsNull()) { | 13890 if (!source.IsNull()) { |
| 13958 len = source.Length(); | 13891 len = source.Length(); |
| 13959 result.SetTypeArguments( | 13892 result.SetTypeArguments( |
| 13960 AbstractTypeArguments::Handle(source.GetTypeArguments())); | 13893 AbstractTypeArguments::Handle(source.GetTypeArguments())); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14151 const char* format = "GrowableObjectArray len:%" Pd ""; | 14084 const char* format = "GrowableObjectArray len:%" Pd ""; |
| 14152 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; | 14085 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; |
| 14153 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 14086 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 14154 OS::SNPrint(chars, len, format, Length()); | 14087 OS::SNPrint(chars, len, format, Length()); |
| 14155 return chars; | 14088 return chars; |
| 14156 } | 14089 } |
| 14157 | 14090 |
| 14158 | 14091 |
| 14159 void GrowableObjectArray::PrintToJSONStream(JSONStream* stream, | 14092 void GrowableObjectArray::PrintToJSONStream(JSONStream* stream, |
| 14160 bool ref) const { | 14093 bool ref) const { |
| 14161 stream->OpenObject(); | 14094 JSONObject jsobj(stream); |
| 14162 stream->CloseObject(); | |
| 14163 } | 14095 } |
| 14164 | 14096 |
| 14165 | 14097 |
| 14166 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, | 14098 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, |
| 14167 Heap::Space space) { | 14099 Heap::Space space) { |
| 14168 ASSERT(Isolate::Current()->object_store()->float32x4_class() != | 14100 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
| 14169 Class::null()); | 14101 Class::null()); |
| 14170 Float32x4& result = Float32x4::Handle(); | 14102 Float32x4& result = Float32x4::Handle(); |
| 14171 { | 14103 { |
| 14172 RawObject* raw = Object::Allocate(Float32x4::kClassId, | 14104 RawObject* raw = Object::Allocate(Float32x4::kClassId, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14257 float _w = w(); | 14189 float _w = w(); |
| 14258 // Calculate the size of the string. | 14190 // Calculate the size of the string. |
| 14259 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; | 14191 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; |
| 14260 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 14192 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 14261 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); | 14193 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); |
| 14262 return chars; | 14194 return chars; |
| 14263 } | 14195 } |
| 14264 | 14196 |
| 14265 | 14197 |
| 14266 void Float32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14198 void Float32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14267 stream->OpenObject(); | 14199 JSONObject jsobj(stream); |
| 14268 stream->CloseObject(); | |
| 14269 } | 14200 } |
| 14270 | 14201 |
| 14271 | 14202 |
| 14272 RawUint32x4* Uint32x4::New(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3, | 14203 RawUint32x4* Uint32x4::New(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3, |
| 14273 Heap::Space space) { | 14204 Heap::Space space) { |
| 14274 ASSERT(Isolate::Current()->object_store()->uint32x4_class() != | 14205 ASSERT(Isolate::Current()->object_store()->uint32x4_class() != |
| 14275 Class::null()); | 14206 Class::null()); |
| 14276 Uint32x4& result = Uint32x4::Handle(); | 14207 Uint32x4& result = Uint32x4::Handle(); |
| 14277 { | 14208 { |
| 14278 RawObject* raw = Object::Allocate(Uint32x4::kClassId, | 14209 RawObject* raw = Object::Allocate(Uint32x4::kClassId, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14363 uint32_t _w = w(); | 14294 uint32_t _w = w(); |
| 14364 // Calculate the size of the string. | 14295 // Calculate the size of the string. |
| 14365 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; | 14296 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; |
| 14366 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 14297 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 14367 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); | 14298 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); |
| 14368 return chars; | 14299 return chars; |
| 14369 } | 14300 } |
| 14370 | 14301 |
| 14371 | 14302 |
| 14372 void Uint32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14303 void Uint32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14373 stream->OpenObject(); | 14304 JSONObject jsobj(stream); |
| 14374 stream->CloseObject(); | |
| 14375 } | 14305 } |
| 14376 | 14306 |
| 14377 | 14307 |
| 14378 const intptr_t TypedData::element_size[] = { | 14308 const intptr_t TypedData::element_size[] = { |
| 14379 1, // kTypedDataInt8ArrayCid. | 14309 1, // kTypedDataInt8ArrayCid. |
| 14380 1, // kTypedDataUint8ArrayCid. | 14310 1, // kTypedDataUint8ArrayCid. |
| 14381 1, // kTypedDataUint8ClampedArrayCid. | 14311 1, // kTypedDataUint8ClampedArrayCid. |
| 14382 2, // kTypedDataInt16ArrayCid. | 14312 2, // kTypedDataInt16ArrayCid. |
| 14383 2, // kTypedDataUint16ArrayCid. | 14313 2, // kTypedDataUint16ArrayCid. |
| 14384 4, // kTypedDataInt32ArrayCid. | 14314 4, // kTypedDataInt32ArrayCid. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 14413 return result.raw(); | 14343 return result.raw(); |
| 14414 } | 14344 } |
| 14415 | 14345 |
| 14416 | 14346 |
| 14417 const char* TypedData::ToCString() const { | 14347 const char* TypedData::ToCString() const { |
| 14418 return "TypedData"; | 14348 return "TypedData"; |
| 14419 } | 14349 } |
| 14420 | 14350 |
| 14421 | 14351 |
| 14422 void TypedData::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14352 void TypedData::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14423 stream->OpenObject(); | 14353 JSONObject jsobj(stream); |
| 14424 stream->CloseObject(); | |
| 14425 } | 14354 } |
| 14426 | 14355 |
| 14427 | 14356 |
| 14428 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( | 14357 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( |
| 14429 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { | 14358 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { |
| 14430 SetPeer(peer); | 14359 SetPeer(peer); |
| 14431 return dart::AddFinalizer(*this, peer, callback); | 14360 return dart::AddFinalizer(*this, peer, callback); |
| 14432 } | 14361 } |
| 14433 | 14362 |
| 14434 | 14363 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 14450 } | 14379 } |
| 14451 | 14380 |
| 14452 | 14381 |
| 14453 const char* ExternalTypedData::ToCString() const { | 14382 const char* ExternalTypedData::ToCString() const { |
| 14454 return "ExternalTypedData"; | 14383 return "ExternalTypedData"; |
| 14455 } | 14384 } |
| 14456 | 14385 |
| 14457 | 14386 |
| 14458 void ExternalTypedData::PrintToJSONStream(JSONStream* stream, | 14387 void ExternalTypedData::PrintToJSONStream(JSONStream* stream, |
| 14459 bool ref) const { | 14388 bool ref) const { |
| 14460 stream->OpenObject(); | 14389 JSONObject jsobj(stream); |
| 14461 stream->CloseObject(); | |
| 14462 } | 14390 } |
| 14463 | 14391 |
| 14464 | 14392 |
| 14465 | 14393 |
| 14466 const char* Closure::ToCString(const Instance& closure) { | 14394 const char* Closure::ToCString(const Instance& closure) { |
| 14467 const Function& fun = Function::Handle(Closure::function(closure)); | 14395 const Function& fun = Function::Handle(Closure::function(closure)); |
| 14468 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); | 14396 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); |
| 14469 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString(); | 14397 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString(); |
| 14470 const char* from = is_implicit_closure ? " from " : ""; | 14398 const char* from = is_implicit_closure ? " from " : ""; |
| 14471 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; | 14399 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14638 } | 14566 } |
| 14639 | 14567 |
| 14640 | 14568 |
| 14641 const char* Stacktrace::ToCString() const { | 14569 const char* Stacktrace::ToCString() const { |
| 14642 const String& trace = String::Handle(FullStacktrace()); | 14570 const String& trace = String::Handle(FullStacktrace()); |
| 14643 return trace.ToCString(); | 14571 return trace.ToCString(); |
| 14644 } | 14572 } |
| 14645 | 14573 |
| 14646 | 14574 |
| 14647 void Stacktrace::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14575 void Stacktrace::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14648 stream->OpenObject(); | 14576 JSONObject jsobj(stream); |
| 14649 stream->CloseObject(); | |
| 14650 } | 14577 } |
| 14651 | 14578 |
| 14652 | 14579 |
| 14653 static intptr_t PrintOneStacktrace(Isolate* isolate, | 14580 static intptr_t PrintOneStacktrace(Isolate* isolate, |
| 14654 GrowableArray<char*>* frame_strings, | 14581 GrowableArray<char*>* frame_strings, |
| 14655 uword pc, | 14582 uword pc, |
| 14656 const Function& function, | 14583 const Function& function, |
| 14657 const Code& code, | 14584 const Code& code, |
| 14658 intptr_t frame_index) { | 14585 intptr_t frame_index) { |
| 14659 const char* kFormat = "#%-6d %s (%s:%d:%d)\n"; | 14586 const char* kFormat = "#%-6d %s (%s:%d:%d)\n"; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14836 const String& str = String::Handle(pattern()); | 14763 const String& str = String::Handle(pattern()); |
| 14837 const char* format = "JSRegExp: pattern=%s flags=%s"; | 14764 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 14838 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 14765 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 14839 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 14766 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); |
| 14840 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 14767 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 14841 return chars; | 14768 return chars; |
| 14842 } | 14769 } |
| 14843 | 14770 |
| 14844 | 14771 |
| 14845 void JSRegExp::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14772 void JSRegExp::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14846 stream->OpenObject(); | 14773 JSONObject jsobj(stream); |
| 14847 stream->CloseObject(); | |
| 14848 } | 14774 } |
| 14849 | 14775 |
| 14850 | 14776 |
| 14851 RawWeakProperty* WeakProperty::New(Heap::Space space) { | 14777 RawWeakProperty* WeakProperty::New(Heap::Space space) { |
| 14852 ASSERT(Isolate::Current()->object_store()->weak_property_class() | 14778 ASSERT(Isolate::Current()->object_store()->weak_property_class() |
| 14853 != Class::null()); | 14779 != Class::null()); |
| 14854 RawObject* raw = Object::Allocate(WeakProperty::kClassId, | 14780 RawObject* raw = Object::Allocate(WeakProperty::kClassId, |
| 14855 WeakProperty::InstanceSize(), | 14781 WeakProperty::InstanceSize(), |
| 14856 space); | 14782 space); |
| 14857 return reinterpret_cast<RawWeakProperty*>(raw); | 14783 return reinterpret_cast<RawWeakProperty*>(raw); |
| 14858 } | 14784 } |
| 14859 | 14785 |
| 14860 | 14786 |
| 14861 const char* WeakProperty::ToCString() const { | 14787 const char* WeakProperty::ToCString() const { |
| 14862 return "_WeakProperty"; | 14788 return "_WeakProperty"; |
| 14863 } | 14789 } |
| 14864 | 14790 |
| 14865 | 14791 |
| 14866 void WeakProperty::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14792 void WeakProperty::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14867 stream->OpenObject(); | 14793 JSONObject jsobj(stream); |
| 14868 stream->CloseObject(); | |
| 14869 } | 14794 } |
| 14870 | 14795 |
| 14871 RawAbstractType* MirrorReference::GetAbstractTypeReferent() const { | 14796 RawAbstractType* MirrorReference::GetAbstractTypeReferent() const { |
| 14872 ASSERT(Object::Handle(referent()).IsAbstractType()); | 14797 ASSERT(Object::Handle(referent()).IsAbstractType()); |
| 14873 return AbstractType::Cast(Object::Handle(referent())).raw(); | 14798 return AbstractType::Cast(Object::Handle(referent())).raw(); |
| 14874 } | 14799 } |
| 14875 | 14800 |
| 14876 | 14801 |
| 14877 RawClass* MirrorReference::GetClassReferent() const { | 14802 RawClass* MirrorReference::GetClassReferent() const { |
| 14878 ASSERT(Object::Handle(referent()).IsClass()); | 14803 ASSERT(Object::Handle(referent()).IsClass()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14920 return result.raw(); | 14845 return result.raw(); |
| 14921 } | 14846 } |
| 14922 | 14847 |
| 14923 | 14848 |
| 14924 const char* MirrorReference::ToCString() const { | 14849 const char* MirrorReference::ToCString() const { |
| 14925 return "_MirrorReference"; | 14850 return "_MirrorReference"; |
| 14926 } | 14851 } |
| 14927 | 14852 |
| 14928 | 14853 |
| 14929 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14854 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14930 stream->OpenObject(); | 14855 JSONObject jsobj(stream); |
| 14931 stream->CloseObject(); | |
| 14932 } | 14856 } |
| 14933 | 14857 |
| 14934 | 14858 |
| 14935 } // namespace dart | 14859 } // namespace dart |
| OLD | NEW |