| 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 2839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2916 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2917 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 2917 OS::SNPrint(chars, len, format, library_name, class_name); | 2918 OS::SNPrint(chars, len, format, library_name, class_name); |
| 2918 return chars; | 2919 return chars; |
| 2919 } | 2920 } |
| 2920 | 2921 |
| 2921 | 2922 |
| 2922 void Class::PrintToJSONStream(JSONStream* stream, bool ref) const { | 2923 void Class::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 2923 const char* class_name = String::Handle(UserVisibleName()).ToCString(); | 2924 const char* class_name = String::Handle(UserVisibleName()).ToCString(); |
| 2924 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 2925 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 2925 intptr_t id = ring->GetIdForObject(raw()); | 2926 intptr_t id = ring->GetIdForObject(raw()); |
| 2926 if (ref) { | 2927 JSONObject jsobj(stream); |
| 2927 stream->OpenObject(); | 2928 jsobj.AddProperty("type", JSONType(ref)); |
| 2928 stream->PrintProperty("type", "@Class"); | 2929 jsobj.AddProperty("id", id); |
| 2929 stream->PrintProperty("id", id); | 2930 jsobj.AddProperty("name", class_name); |
| 2930 stream->PrintProperty("name", class_name); | 2931 if (!ref) { |
| 2931 stream->CloseObject(); | 2932 jsobj.AddProperty("library", Object::Handle(library())); |
| 2932 return; | |
| 2933 } | 2933 } |
| 2934 stream->OpenObject(); | |
| 2935 stream->PrintProperty("type", "Class"); | |
| 2936 stream->PrintProperty("id", id); | |
| 2937 stream->PrintProperty("name", class_name); | |
| 2938 stream->PrintProperty("library", Object::Handle(library())); | |
| 2939 stream->CloseObject(); | |
| 2940 } | 2934 } |
| 2941 | 2935 |
| 2942 | 2936 |
| 2943 void Class::InsertCanonicalConstant(intptr_t index, | 2937 void Class::InsertCanonicalConstant(intptr_t index, |
| 2944 const Instance& constant) const { | 2938 const Instance& constant) const { |
| 2945 // The constant needs to be added to the list. Grow the list if it is full. | 2939 // The constant needs to be added to the list. Grow the list if it is full. |
| 2946 Array& canonical_list = Array::Handle(constants()); | 2940 Array& canonical_list = Array::Handle(constants()); |
| 2947 const intptr_t list_len = canonical_list.Length(); | 2941 const intptr_t list_len = canonical_list.Length(); |
| 2948 if (index >= list_len) { | 2942 if (index >= list_len) { |
| 2949 const intptr_t new_length = (list_len == 0) ? 4 : list_len + 4; | 2943 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... |
| 3013 const char* format = "unresolved class '%s'"; | 3007 const char* format = "unresolved class '%s'"; |
| 3014 const char* cname = String::Handle(Name()).ToCString(); | 3008 const char* cname = String::Handle(Name()).ToCString(); |
| 3015 intptr_t len = OS::SNPrint(NULL, 0, format, cname) + 1; | 3009 intptr_t len = OS::SNPrint(NULL, 0, format, cname) + 1; |
| 3016 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3010 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3017 OS::SNPrint(chars, len, format, cname); | 3011 OS::SNPrint(chars, len, format, cname); |
| 3018 return chars; | 3012 return chars; |
| 3019 } | 3013 } |
| 3020 | 3014 |
| 3021 | 3015 |
| 3022 void UnresolvedClass::PrintToJSONStream(JSONStream* stream, bool ref) const { | 3016 void UnresolvedClass::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 3023 stream->OpenObject(); | 3017 JSONObject jsobj(stream); |
| 3024 stream->CloseObject(); | |
| 3025 } | 3018 } |
| 3026 | 3019 |
| 3027 | 3020 |
| 3028 intptr_t AbstractTypeArguments::Length() const { | 3021 intptr_t AbstractTypeArguments::Length() const { |
| 3029 // AbstractTypeArguments is an abstract class. | 3022 // AbstractTypeArguments is an abstract class. |
| 3030 UNREACHABLE(); | 3023 UNREACHABLE(); |
| 3031 return -1; | 3024 return -1; |
| 3032 } | 3025 } |
| 3033 | 3026 |
| 3034 | 3027 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3237 if (IsNull()) { | 3230 if (IsNull()) { |
| 3238 return "NULL AbstractTypeArguments"; | 3231 return "NULL AbstractTypeArguments"; |
| 3239 } | 3232 } |
| 3240 UNREACHABLE(); | 3233 UNREACHABLE(); |
| 3241 return "AbstractTypeArguments"; | 3234 return "AbstractTypeArguments"; |
| 3242 } | 3235 } |
| 3243 | 3236 |
| 3244 | 3237 |
| 3245 void AbstractTypeArguments::PrintToJSONStream(JSONStream* stream, | 3238 void AbstractTypeArguments::PrintToJSONStream(JSONStream* stream, |
| 3246 bool ref) const { | 3239 bool ref) const { |
| 3247 stream->OpenObject(); | 3240 JSONObject jsobj(stream); |
| 3248 stream->CloseObject(); | |
| 3249 } | 3241 } |
| 3250 | 3242 |
| 3251 | 3243 |
| 3252 intptr_t TypeArguments::Length() const { | 3244 intptr_t TypeArguments::Length() const { |
| 3253 ASSERT(!IsNull()); | 3245 ASSERT(!IsNull()); |
| 3254 return Smi::Value(raw_ptr()->length_); | 3246 return Smi::Value(raw_ptr()->length_); |
| 3255 } | 3247 } |
| 3256 | 3248 |
| 3257 | 3249 |
| 3258 RawAbstractType* TypeArguments::TypeAt(intptr_t index) const { | 3250 RawAbstractType* TypeArguments::TypeAt(intptr_t index) const { |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3578 intptr_t len = OS::SNPrint(NULL, 0, format, prev_cstr, type_cstr) + 1; | 3570 intptr_t len = OS::SNPrint(NULL, 0, format, prev_cstr, type_cstr) + 1; |
| 3579 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3571 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3580 OS::SNPrint(chars, len, format, prev_cstr, type_cstr); | 3572 OS::SNPrint(chars, len, format, prev_cstr, type_cstr); |
| 3581 prev_cstr = chars; | 3573 prev_cstr = chars; |
| 3582 } | 3574 } |
| 3583 return prev_cstr; | 3575 return prev_cstr; |
| 3584 } | 3576 } |
| 3585 | 3577 |
| 3586 | 3578 |
| 3587 void TypeArguments::PrintToJSONStream(JSONStream* stream, bool ref) const { | 3579 void TypeArguments::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 3588 stream->OpenObject(); | 3580 JSONObject jsobj(stream); |
| 3589 stream->CloseObject(); | |
| 3590 } | 3581 } |
| 3591 | 3582 |
| 3592 | 3583 |
| 3593 intptr_t InstantiatedTypeArguments::Length() const { | 3584 intptr_t InstantiatedTypeArguments::Length() const { |
| 3594 return AbstractTypeArguments::Handle( | 3585 return AbstractTypeArguments::Handle( |
| 3595 uninstantiated_type_arguments()).Length(); | 3586 uninstantiated_type_arguments()).Length(); |
| 3596 } | 3587 } |
| 3597 | 3588 |
| 3598 | 3589 |
| 3599 RawAbstractType* InstantiatedTypeArguments::TypeAt(intptr_t index) const { | 3590 RawAbstractType* InstantiatedTypeArguments::TypeAt(intptr_t index) const { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3667 intptr_t len = | 3658 intptr_t len = |
| 3668 OS::SNPrint(NULL, 0, format, arg_cstr, instantiator_cstr) + 1; | 3659 OS::SNPrint(NULL, 0, format, arg_cstr, instantiator_cstr) + 1; |
| 3669 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3660 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3670 OS::SNPrint(chars, len, format, arg_cstr, instantiator_cstr); | 3661 OS::SNPrint(chars, len, format, arg_cstr, instantiator_cstr); |
| 3671 return chars; | 3662 return chars; |
| 3672 } | 3663 } |
| 3673 | 3664 |
| 3674 | 3665 |
| 3675 void InstantiatedTypeArguments::PrintToJSONStream(JSONStream* stream, | 3666 void InstantiatedTypeArguments::PrintToJSONStream(JSONStream* stream, |
| 3676 bool ref) const { | 3667 bool ref) const { |
| 3677 stream->OpenObject(); | 3668 JSONObject jsobj(stream); |
| 3678 stream->CloseObject(); | |
| 3679 } | 3669 } |
| 3680 | 3670 |
| 3681 | 3671 |
| 3682 const char* PatchClass::ToCString() const { | 3672 const char* PatchClass::ToCString() const { |
| 3683 const char* kFormat = "PatchClass for %s"; | 3673 const char* kFormat = "PatchClass for %s"; |
| 3684 const Class& cls = Class::Handle(patched_class()); | 3674 const Class& cls = Class::Handle(patched_class()); |
| 3685 const char* cls_name = cls.ToCString(); | 3675 const char* cls_name = cls.ToCString(); |
| 3686 intptr_t len = OS::SNPrint(NULL, 0, kFormat, cls_name) + 1; | 3676 intptr_t len = OS::SNPrint(NULL, 0, kFormat, cls_name) + 1; |
| 3687 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3677 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3688 OS::SNPrint(chars, len, kFormat, cls_name); | 3678 OS::SNPrint(chars, len, kFormat, cls_name); |
| 3689 return chars; | 3679 return chars; |
| 3690 } | 3680 } |
| 3691 | 3681 |
| 3692 | 3682 |
| 3693 void PatchClass::PrintToJSONStream(JSONStream* stream, bool ref) const { | 3683 void PatchClass::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 3694 stream->OpenObject(); | 3684 JSONObject jsobj(stream); |
| 3695 stream->CloseObject(); | |
| 3696 } | 3685 } |
| 3697 | 3686 |
| 3698 | 3687 |
| 3699 RawPatchClass* PatchClass::New(const Class& patched_class, | 3688 RawPatchClass* PatchClass::New(const Class& patched_class, |
| 3700 const Class& source_class) { | 3689 const Class& source_class) { |
| 3701 const PatchClass& result = PatchClass::Handle(PatchClass::New()); | 3690 const PatchClass& result = PatchClass::Handle(PatchClass::New()); |
| 3702 result.set_patched_class(patched_class); | 3691 result.set_patched_class(patched_class); |
| 3703 result.set_source_class(source_class); | 3692 result.set_source_class(source_class); |
| 3704 return result.raw(); | 3693 return result.raw(); |
| 3705 } | 3694 } |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4132 void Function::SetNumOptionalParameters(intptr_t num_optional_parameters, | 4121 void Function::SetNumOptionalParameters(intptr_t num_optional_parameters, |
| 4133 bool are_optional_positional) const { | 4122 bool are_optional_positional) const { |
| 4134 ASSERT(num_optional_parameters >= 0); | 4123 ASSERT(num_optional_parameters >= 0); |
| 4135 set_num_optional_parameters(are_optional_positional ? | 4124 set_num_optional_parameters(are_optional_positional ? |
| 4136 num_optional_parameters : | 4125 num_optional_parameters : |
| 4137 -num_optional_parameters); | 4126 -num_optional_parameters); |
| 4138 } | 4127 } |
| 4139 | 4128 |
| 4140 | 4129 |
| 4141 bool Function::is_optimizable() const { | 4130 bool Function::is_optimizable() const { |
| 4131 if (FLAG_print_coverage) { |
| 4132 return false; |
| 4133 } |
| 4142 if (OptimizableBit::decode(raw_ptr()->kind_tag_) && | 4134 if (OptimizableBit::decode(raw_ptr()->kind_tag_) && |
| 4143 (script() != Script::null()) && | 4135 (script() != Script::null()) && |
| 4144 ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff_in_tokens)) { | 4136 ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff_in_tokens)) { |
| 4145 // Additional check needed for implicit getters. | 4137 // Additional check needed for implicit getters. |
| 4146 if (HasCode() && | 4138 if (HasCode() && |
| 4147 (Code::Handle(unoptimized_code()).Size() >= | 4139 (Code::Handle(unoptimized_code()).Size() >= |
| 4148 FLAG_huge_method_cutoff_in_code_size)) { | 4140 FLAG_huge_method_cutoff_in_code_size)) { |
| 4149 return false; | 4141 return false; |
| 4150 } else { | 4142 } else { |
| 4151 return true; | 4143 return true; |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5090 static_str, abstract_str, kind_str, const_str); | 5082 static_str, abstract_str, kind_str, const_str); |
| 5091 return chars; | 5083 return chars; |
| 5092 } | 5084 } |
| 5093 | 5085 |
| 5094 | 5086 |
| 5095 void Function::PrintToJSONStream(JSONStream* stream, bool ref) const { | 5087 void Function::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5096 const char* function_name = | 5088 const char* function_name = |
| 5097 String::Handle(QualifiedUserVisibleName()).ToCString(); | 5089 String::Handle(QualifiedUserVisibleName()).ToCString(); |
| 5098 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 5090 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 5099 intptr_t id = ring->GetIdForObject(raw()); | 5091 intptr_t id = ring->GetIdForObject(raw()); |
| 5100 if (ref) { | 5092 JSONObject jsobj(stream); |
| 5101 stream->OpenObject(); | 5093 jsobj.AddProperty("type", JSONType(ref)); |
| 5102 stream->PrintProperty("type", "@Function"); | 5094 jsobj.AddProperty("id", id); |
| 5103 stream->PrintProperty("id", id); | 5095 jsobj.AddProperty("name", function_name); |
| 5104 stream->PrintProperty("name", function_name); | 5096 if (ref) return; |
| 5105 stream->CloseObject(); | 5097 jsobj.AddProperty("is_static", is_static()); |
| 5106 return; | 5098 jsobj.AddProperty("is_const", is_const()); |
| 5107 } | 5099 jsobj.AddProperty("is_optimizable", is_optimizable()); |
| 5108 stream->OpenObject(); | 5100 jsobj.AddProperty("is_inlinable", IsInlineable()); |
| 5109 stream->PrintProperty("type", "Function"); | |
| 5110 stream->PrintProperty("name", function_name); | |
| 5111 stream->PrintProperty("id", id); | |
| 5112 stream->PrintPropertyBool("is_static", is_static()); | |
| 5113 stream->PrintPropertyBool("is_const", is_const()); | |
| 5114 stream->PrintPropertyBool("is_optimizable", is_optimizable()); | |
| 5115 stream->PrintPropertyBool("is_inlinable", IsInlineable()); | |
| 5116 const char* kind_string = NULL; | 5101 const char* kind_string = NULL; |
| 5117 switch (kind()) { | 5102 switch (kind()) { |
| 5118 case RawFunction::kRegularFunction: | 5103 case RawFunction::kRegularFunction: |
| 5119 kind_string = "regular"; | 5104 kind_string = "regular"; |
| 5120 break; | 5105 break; |
| 5121 case RawFunction::kGetterFunction: | 5106 case RawFunction::kGetterFunction: |
| 5122 kind_string = "getter"; | 5107 kind_string = "getter"; |
| 5123 break; | 5108 break; |
| 5124 case RawFunction::kSetterFunction: | 5109 case RawFunction::kSetterFunction: |
| 5125 kind_string = "setter"; | 5110 kind_string = "setter"; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5141 break; | 5126 break; |
| 5142 case RawFunction::kConstructor: | 5127 case RawFunction::kConstructor: |
| 5143 kind_string = "constructor"; | 5128 kind_string = "constructor"; |
| 5144 break; | 5129 break; |
| 5145 case RawFunction::kImplicitStaticFinalGetter: | 5130 case RawFunction::kImplicitStaticFinalGetter: |
| 5146 kind_string = "static final getter"; | 5131 kind_string = "static final getter"; |
| 5147 break; | 5132 break; |
| 5148 default: | 5133 default: |
| 5149 UNREACHABLE(); | 5134 UNREACHABLE(); |
| 5150 } | 5135 } |
| 5151 stream->PrintProperty("kind", kind_string); | 5136 jsobj.AddProperty("kind", kind_string); |
| 5152 stream->PrintProperty("unoptimized_code", Object::Handle(unoptimized_code())); | 5137 jsobj.AddProperty("unoptimized_code", Object::Handle(unoptimized_code())); |
| 5153 stream->PrintProperty("usage_counter", usage_counter()); | 5138 jsobj.AddProperty("usage_counter", usage_counter()); |
| 5154 stream->PrintProperty("optimized_call_site_count", | 5139 jsobj.AddProperty("optimized_call_site_count", optimized_call_site_count()); |
| 5155 optimized_call_site_count()); | 5140 jsobj.AddProperty("code", Object::Handle(CurrentCode())); |
| 5156 stream->PrintProperty("code", Object::Handle(CurrentCode())); | 5141 jsobj.AddProperty("deoptimizations", |
| 5157 stream->PrintProperty("deoptimizations", | 5142 static_cast<intptr_t>(deoptimization_counter())); |
| 5158 static_cast<intptr_t>(deoptimization_counter())); | |
| 5159 stream->CloseObject(); | |
| 5160 } | 5143 } |
| 5161 | 5144 |
| 5162 | 5145 |
| 5163 void ClosureData::set_context_scope(const ContextScope& value) const { | 5146 void ClosureData::set_context_scope(const ContextScope& value) const { |
| 5164 StorePointer(&raw_ptr()->context_scope_, value.raw()); | 5147 StorePointer(&raw_ptr()->context_scope_, value.raw()); |
| 5165 } | 5148 } |
| 5166 | 5149 |
| 5167 | 5150 |
| 5168 void ClosureData::set_implicit_static_closure(const Instance& closure) const { | 5151 void ClosureData::set_implicit_static_closure(const Instance& closure) const { |
| 5169 ASSERT(!closure.IsNull()); | 5152 ASSERT(!closure.IsNull()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 5197 return reinterpret_cast<RawClosureData*>(raw); | 5180 return reinterpret_cast<RawClosureData*>(raw); |
| 5198 } | 5181 } |
| 5199 | 5182 |
| 5200 | 5183 |
| 5201 const char* ClosureData::ToCString() const { | 5184 const char* ClosureData::ToCString() const { |
| 5202 return "ClosureData class"; | 5185 return "ClosureData class"; |
| 5203 } | 5186 } |
| 5204 | 5187 |
| 5205 | 5188 |
| 5206 void ClosureData::PrintToJSONStream(JSONStream* stream, bool ref) const { | 5189 void ClosureData::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5207 stream->OpenObject(); | 5190 JSONObject jsobj(stream); |
| 5208 stream->CloseObject(); | |
| 5209 } | 5191 } |
| 5210 | 5192 |
| 5211 | 5193 |
| 5212 void RedirectionData::set_type(const Type& value) const { | 5194 void RedirectionData::set_type(const Type& value) const { |
| 5213 ASSERT(!value.IsNull()); | 5195 ASSERT(!value.IsNull()); |
| 5214 StorePointer(&raw_ptr()->type_, value.raw()); | 5196 StorePointer(&raw_ptr()->type_, value.raw()); |
| 5215 } | 5197 } |
| 5216 | 5198 |
| 5217 | 5199 |
| 5218 void RedirectionData::set_identifier(const String& value) const { | 5200 void RedirectionData::set_identifier(const String& value) const { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 5233 return reinterpret_cast<RawRedirectionData*>(raw); | 5215 return reinterpret_cast<RawRedirectionData*>(raw); |
| 5234 } | 5216 } |
| 5235 | 5217 |
| 5236 | 5218 |
| 5237 const char* RedirectionData::ToCString() const { | 5219 const char* RedirectionData::ToCString() const { |
| 5238 return "RedirectionData class"; | 5220 return "RedirectionData class"; |
| 5239 } | 5221 } |
| 5240 | 5222 |
| 5241 | 5223 |
| 5242 void RedirectionData::PrintToJSONStream(JSONStream* stream, bool ref) const { | 5224 void RedirectionData::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5243 stream->OpenObject(); | 5225 JSONObject jsobj(stream); |
| 5244 stream->CloseObject(); | |
| 5245 } | 5226 } |
| 5246 | 5227 |
| 5247 | 5228 |
| 5248 RawString* Field::GetterName(const String& field_name) { | 5229 RawString* Field::GetterName(const String& field_name) { |
| 5249 return String::Concat(Symbols::GetterPrefix(), field_name); | 5230 return String::Concat(Symbols::GetterPrefix(), field_name); |
| 5250 } | 5231 } |
| 5251 | 5232 |
| 5252 | 5233 |
| 5253 RawString* Field::GetterSymbol(const String& field_name) { | 5234 RawString* Field::GetterSymbol(const String& field_name) { |
| 5254 const String& str = String::Handle(Field::GetterName(field_name)); | 5235 const String& str = String::Handle(Field::GetterName(field_name)); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5418 const char* cls_name = String::Handle(cls.Name()).ToCString(); | 5399 const char* cls_name = String::Handle(cls.Name()).ToCString(); |
| 5419 intptr_t len = | 5400 intptr_t len = |
| 5420 OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1; | 5401 OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1; |
| 5421 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 5402 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 5422 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2); | 5403 OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2); |
| 5423 return chars; | 5404 return chars; |
| 5424 } | 5405 } |
| 5425 | 5406 |
| 5426 | 5407 |
| 5427 void Field::PrintToJSONStream(JSONStream* stream, bool ref) const { | 5408 void Field::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5428 stream->OpenObject(); | 5409 JSONObject jsobj(stream); |
| 5429 stream->CloseObject(); | |
| 5430 } | 5410 } |
| 5431 | 5411 |
| 5432 | 5412 |
| 5433 RawArray* Field::dependent_code() const { | 5413 RawArray* Field::dependent_code() const { |
| 5434 return raw_ptr()->dependent_code_; | 5414 return raw_ptr()->dependent_code_; |
| 5435 } | 5415 } |
| 5436 | 5416 |
| 5437 | 5417 |
| 5438 void Field::set_dependent_code(const Array& array) const { | 5418 void Field::set_dependent_code(const Array& array) const { |
| 5439 raw_ptr()->dependent_code_ = array.raw(); | 5419 raw_ptr()->dependent_code_ = array.raw(); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5641 } | 5621 } |
| 5642 | 5622 |
| 5643 | 5623 |
| 5644 const char* LiteralToken::ToCString() const { | 5624 const char* LiteralToken::ToCString() const { |
| 5645 const String& token = String::Handle(literal()); | 5625 const String& token = String::Handle(literal()); |
| 5646 return token.ToCString(); | 5626 return token.ToCString(); |
| 5647 } | 5627 } |
| 5648 | 5628 |
| 5649 | 5629 |
| 5650 void LiteralToken::PrintToJSONStream(JSONStream* stream, bool ref) const { | 5630 void LiteralToken::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 5651 stream->OpenObject(); | 5631 JSONObject jsobj(stream); |
| 5652 stream->CloseObject(); | |
| 5653 } | 5632 } |
| 5654 | 5633 |
| 5655 | 5634 |
| 5656 RawArray* TokenStream::TokenObjects() const { | 5635 RawArray* TokenStream::TokenObjects() const { |
| 5657 return raw_ptr()->token_objects_; | 5636 return raw_ptr()->token_objects_; |
| 5658 } | 5637 } |
| 5659 | 5638 |
| 5660 | 5639 |
| 5661 void TokenStream::SetTokenObjects(const Array& value) const { | 5640 void TokenStream::SetTokenObjects(const Array& value) const { |
| 5662 StorePointer(&raw_ptr()->token_objects_, value.raw()); | 5641 StorePointer(&raw_ptr()->token_objects_, value.raw()); |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6057 return result.raw(); | 6036 return result.raw(); |
| 6058 } | 6037 } |
| 6059 | 6038 |
| 6060 | 6039 |
| 6061 const char* TokenStream::ToCString() const { | 6040 const char* TokenStream::ToCString() const { |
| 6062 return "TokenStream"; | 6041 return "TokenStream"; |
| 6063 } | 6042 } |
| 6064 | 6043 |
| 6065 | 6044 |
| 6066 void TokenStream::PrintToJSONStream(JSONStream* stream, bool ref) const { | 6045 void TokenStream::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 6067 stream->OpenObject(); | 6046 JSONObject jsobj(stream); |
| 6068 stream->CloseObject(); | |
| 6069 } | 6047 } |
| 6070 | 6048 |
| 6071 | 6049 |
| 6072 TokenStream::Iterator::Iterator(const TokenStream& tokens, intptr_t token_pos) | 6050 TokenStream::Iterator::Iterator(const TokenStream& tokens, intptr_t token_pos) |
| 6073 : tokens_(TokenStream::Handle(tokens.raw())), | 6051 : tokens_(TokenStream::Handle(tokens.raw())), |
| 6074 data_(ExternalTypedData::Handle(tokens.GetStream())), | 6052 data_(ExternalTypedData::Handle(tokens.GetStream())), |
| 6075 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), | 6053 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), |
| 6076 token_objects_(Array::Handle(tokens.TokenObjects())), | 6054 token_objects_(Array::Handle(tokens.TokenObjects())), |
| 6077 obj_(Object::Handle()), | 6055 obj_(Object::Handle()), |
| 6078 cur_token_pos_(token_pos), | 6056 cur_token_pos_(token_pos), |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6409 return result.raw(); | 6387 return result.raw(); |
| 6410 } | 6388 } |
| 6411 | 6389 |
| 6412 | 6390 |
| 6413 const char* Script::ToCString() const { | 6391 const char* Script::ToCString() const { |
| 6414 return "Script"; | 6392 return "Script"; |
| 6415 } | 6393 } |
| 6416 | 6394 |
| 6417 | 6395 |
| 6418 void Script::PrintToJSONStream(JSONStream* stream, bool ref) const { | 6396 void Script::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 6419 stream->OpenObject(); | 6397 JSONObject jsobj(stream); |
| 6420 stream->CloseObject(); | |
| 6421 } | 6398 } |
| 6422 | 6399 |
| 6423 | 6400 |
| 6424 DictionaryIterator::DictionaryIterator(const Library& library) | 6401 DictionaryIterator::DictionaryIterator(const Library& library) |
| 6425 : array_(Array::Handle(library.dictionary())), | 6402 : array_(Array::Handle(library.dictionary())), |
| 6426 // Last element in array is a Smi indicating the number of entries used. | 6403 // Last element in array is a Smi indicating the number of entries used. |
| 6427 size_(Array::Handle(library.dictionary()).Length() - 1), | 6404 size_(Array::Handle(library.dictionary()).Length() - 1), |
| 6428 next_ix_(0) { | 6405 next_ix_(0) { |
| 6429 MoveToNextObject(); | 6406 MoveToNextObject(); |
| 6430 } | 6407 } |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7469 OS::SNPrint(chars, len, kFormat, name.ToCString()); | 7446 OS::SNPrint(chars, len, kFormat, name.ToCString()); |
| 7470 return chars; | 7447 return chars; |
| 7471 } | 7448 } |
| 7472 | 7449 |
| 7473 | 7450 |
| 7474 void Library::PrintToJSONStream(JSONStream* stream, bool ref) const { | 7451 void Library::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7475 const char* library_name = String::Handle(name()).ToCString(); | 7452 const char* library_name = String::Handle(name()).ToCString(); |
| 7476 const char* library_url = String::Handle(url()).ToCString(); | 7453 const char* library_url = String::Handle(url()).ToCString(); |
| 7477 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 7454 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 7478 intptr_t id = ring->GetIdForObject(raw()); | 7455 intptr_t id = ring->GetIdForObject(raw()); |
| 7479 if (ref) { | 7456 JSONObject jsobj(stream); |
| 7480 // Print a reference | 7457 jsobj.AddProperty("type", JSONType(ref)); |
| 7481 stream->OpenObject(); | 7458 jsobj.AddProperty("id", id); |
| 7482 stream->PrintProperty("type", "@Library"); | 7459 jsobj.AddProperty("name", library_name); |
| 7483 stream->PrintProperty("id", id); | 7460 if (ref) return; |
| 7484 stream->PrintProperty("name", library_name); | 7461 jsobj.AddProperty("url", library_url); |
| 7485 stream->CloseObject(); | 7462 { |
| 7486 return; | 7463 JSONArray jsarr(jsobj, "classes"); |
| 7464 ClassDictionaryIterator class_iter(*this); |
| 7465 Class& klass = Class::Handle(); |
| 7466 while (class_iter.HasNext()) { |
| 7467 klass = class_iter.GetNextClass(); |
| 7468 jsarr.AddValue(klass); |
| 7469 } |
| 7487 } | 7470 } |
| 7488 stream->OpenObject(); | 7471 { |
| 7489 stream->PrintProperty("type", "Library"); | 7472 JSONArray jsarr(jsobj, "libraries"); |
| 7490 stream->PrintProperty("id", id); | 7473 Library& lib = Library::Handle(); |
| 7491 stream->PrintProperty("name", library_name); | 7474 for (intptr_t i = 0; i < num_imports(); i++) { |
| 7492 stream->PrintProperty("url", library_url); | 7475 lib = ImportLibraryAt(i); |
| 7493 ClassDictionaryIterator class_iter(*this); | 7476 jsarr.AddValue(lib); |
| 7494 stream->OpenArray("classes"); | 7477 } |
| 7495 Class& klass = Class::Handle(); | |
| 7496 while (class_iter.HasNext()) { | |
| 7497 klass = class_iter.GetNextClass(); | |
| 7498 stream->PrintValue(klass); | |
| 7499 } | 7478 } |
| 7500 stream->CloseArray(); | |
| 7501 stream->OpenArray("libraries"); | |
| 7502 Library& lib = Library::Handle(); | |
| 7503 for (intptr_t i = 0; i < num_imports(); i++) { | |
| 7504 lib = ImportLibraryAt(i); | |
| 7505 stream->PrintValue(lib); | |
| 7506 } | |
| 7507 stream->CloseArray(); | |
| 7508 stream->CloseObject(); | |
| 7509 } | 7479 } |
| 7510 | 7480 |
| 7511 | 7481 |
| 7512 RawLibrary* LibraryPrefix::GetLibrary(int index) const { | 7482 RawLibrary* LibraryPrefix::GetLibrary(int index) const { |
| 7513 if ((index >= 0) || (index < num_imports())) { | 7483 if ((index >= 0) || (index < num_imports())) { |
| 7514 const Array& imports = Array::Handle(this->imports()); | 7484 const Array& imports = Array::Handle(this->imports()); |
| 7515 Namespace& import = Namespace::Handle(); | 7485 Namespace& import = Namespace::Handle(); |
| 7516 import ^= imports.At(index); | 7486 import ^= imports.At(index); |
| 7517 return import.library(); | 7487 return import.library(); |
| 7518 } | 7488 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7653 const char* kFormat = "LibraryPrefix:'%s'"; | 7623 const char* kFormat = "LibraryPrefix:'%s'"; |
| 7654 const String& prefix = String::Handle(name()); | 7624 const String& prefix = String::Handle(name()); |
| 7655 intptr_t len = OS::SNPrint(NULL, 0, kFormat, prefix.ToCString()) + 1; | 7625 intptr_t len = OS::SNPrint(NULL, 0, kFormat, prefix.ToCString()) + 1; |
| 7656 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 7626 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 7657 OS::SNPrint(chars, len, kFormat, prefix.ToCString()); | 7627 OS::SNPrint(chars, len, kFormat, prefix.ToCString()); |
| 7658 return chars; | 7628 return chars; |
| 7659 } | 7629 } |
| 7660 | 7630 |
| 7661 | 7631 |
| 7662 void LibraryPrefix::PrintToJSONStream(JSONStream* stream, bool ref) const { | 7632 void LibraryPrefix::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7663 stream->OpenObject(); | 7633 JSONObject jsobj(stream); |
| 7664 stream->CloseObject(); | |
| 7665 } | 7634 } |
| 7666 | 7635 |
| 7667 | 7636 |
| 7668 const char* Namespace::ToCString() const { | 7637 const char* Namespace::ToCString() const { |
| 7669 const char* kFormat = "Namespace for library '%s'"; | 7638 const char* kFormat = "Namespace for library '%s'"; |
| 7670 const Library& lib = Library::Handle(library()); | 7639 const Library& lib = Library::Handle(library()); |
| 7671 intptr_t len = OS::SNPrint(NULL, 0, kFormat, lib.ToCString()) + 1; | 7640 intptr_t len = OS::SNPrint(NULL, 0, kFormat, lib.ToCString()) + 1; |
| 7672 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 7641 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 7673 OS::SNPrint(chars, len, kFormat, lib.ToCString()); | 7642 OS::SNPrint(chars, len, kFormat, lib.ToCString()); |
| 7674 return chars; | 7643 return chars; |
| 7675 } | 7644 } |
| 7676 | 7645 |
| 7677 | 7646 |
| 7678 void Namespace::PrintToJSONStream(JSONStream* stream, bool ref) const { | 7647 void Namespace::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7679 stream->OpenObject(); | 7648 JSONObject jsobj(stream); |
| 7680 stream->CloseObject(); | |
| 7681 } | 7649 } |
| 7682 | 7650 |
| 7683 | 7651 |
| 7684 bool Namespace::HidesName(const String& name) const { | 7652 bool Namespace::HidesName(const String& name) const { |
| 7685 // Quick check for common case with no combinators. | 7653 // Quick check for common case with no combinators. |
| 7686 if (hide_names() == show_names()) { | 7654 if (hide_names() == show_names()) { |
| 7687 ASSERT(hide_names() == Array::null()); | 7655 ASSERT(hide_names() == Array::null()); |
| 7688 return false; | 7656 return false; |
| 7689 } | 7657 } |
| 7690 const String* plain_name = &name; | 7658 const String* plain_name = &name; |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7917 return result.raw(); | 7885 return result.raw(); |
| 7918 } | 7886 } |
| 7919 | 7887 |
| 7920 | 7888 |
| 7921 const char* Instructions::ToCString() const { | 7889 const char* Instructions::ToCString() const { |
| 7922 return "Instructions"; | 7890 return "Instructions"; |
| 7923 } | 7891 } |
| 7924 | 7892 |
| 7925 | 7893 |
| 7926 void Instructions::PrintToJSONStream(JSONStream* stream, bool ref) const { | 7894 void Instructions::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 7927 stream->OpenObject(); | 7895 JSONObject jsobj(stream); |
| 7928 stream->CloseObject(); | |
| 7929 } | 7896 } |
| 7930 | 7897 |
| 7931 | 7898 |
| 7932 intptr_t PcDescriptors::Length() const { | 7899 intptr_t PcDescriptors::Length() const { |
| 7933 return Smi::Value(raw_ptr()->length_); | 7900 return Smi::Value(raw_ptr()->length_); |
| 7934 } | 7901 } |
| 7935 | 7902 |
| 7936 | 7903 |
| 7937 void PcDescriptors::SetLength(intptr_t value) const { | 7904 void PcDescriptors::SetLength(intptr_t value) const { |
| 7938 // This is only safe because we create a new Smi, which does not cause | 7905 // 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... |
| 8072 KindAsStr(i), | 8039 KindAsStr(i), |
| 8073 DeoptId(i), | 8040 DeoptId(i), |
| 8074 TokenPos(i), | 8041 TokenPos(i), |
| 8075 TryIndex(i)); | 8042 TryIndex(i)); |
| 8076 } | 8043 } |
| 8077 return buffer; | 8044 return buffer; |
| 8078 } | 8045 } |
| 8079 | 8046 |
| 8080 | 8047 |
| 8081 void PcDescriptors::PrintToJSONStream(JSONStream* stream, bool ref) const { | 8048 void PcDescriptors::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 8082 stream->OpenObject(); | 8049 JSONObject jsobj(stream); |
| 8083 stream->CloseObject(); | |
| 8084 } | 8050 } |
| 8085 | 8051 |
| 8086 | 8052 |
| 8087 // Verify assumptions (in debug mode only). | 8053 // Verify assumptions (in debug mode only). |
| 8088 // - No two deopt descriptors have the same deoptimization id. | 8054 // - No two deopt descriptors have the same deoptimization id. |
| 8089 // - No two ic-call descriptors have the same deoptimization id (type feedback). | 8055 // - No two ic-call descriptors have the same deoptimization id (type feedback). |
| 8090 // A function without unique ids is marked as non-optimizable (e.g., because of | 8056 // A function without unique ids is marked as non-optimizable (e.g., because of |
| 8091 // finally blocks). | 8057 // finally blocks). |
| 8092 void PcDescriptors::Verify(const Function& function) const { | 8058 void PcDescriptors::Verify(const Function& function) const { |
| 8093 #if defined(DEBUG) | 8059 #if defined(DEBUG) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8228 for (intptr_t i = 0; i < Length(); i++) { | 8194 for (intptr_t i = 0; i < Length(); i++) { |
| 8229 chars[index++] = IsObject(i) ? '1' : '0'; | 8195 chars[index++] = IsObject(i) ? '1' : '0'; |
| 8230 } | 8196 } |
| 8231 chars[index] = '\0'; | 8197 chars[index] = '\0'; |
| 8232 return chars; | 8198 return chars; |
| 8233 } | 8199 } |
| 8234 } | 8200 } |
| 8235 | 8201 |
| 8236 | 8202 |
| 8237 void Stackmap::PrintToJSONStream(JSONStream* stream, bool ref) const { | 8203 void Stackmap::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 8238 stream->OpenObject(); | 8204 JSONObject jsobj(stream); |
| 8239 stream->CloseObject(); | |
| 8240 } | 8205 } |
| 8241 | 8206 |
| 8242 | 8207 |
| 8243 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { | 8208 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { |
| 8244 ASSERT(var_index < Length()); | 8209 ASSERT(var_index < Length()); |
| 8245 const Array& names = Array::Handle(raw_ptr()->names_); | 8210 const Array& names = Array::Handle(raw_ptr()->names_); |
| 8246 ASSERT(Length() == names.Length()); | 8211 ASSERT(Length() == names.Length()); |
| 8247 String& name = String::Handle(); | 8212 String& name = String::Handle(); |
| 8248 name ^= names.At(var_index); | 8213 name ^= names.At(var_index); |
| 8249 return name.raw(); | 8214 return name.raw(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8299 info.begin_pos, | 8264 info.begin_pos, |
| 8300 info.end_pos, | 8265 info.end_pos, |
| 8301 var_name.ToCString()); | 8266 var_name.ToCString()); |
| 8302 } | 8267 } |
| 8303 return buffer; | 8268 return buffer; |
| 8304 } | 8269 } |
| 8305 | 8270 |
| 8306 | 8271 |
| 8307 void LocalVarDescriptors::PrintToJSONStream(JSONStream* stream, | 8272 void LocalVarDescriptors::PrintToJSONStream(JSONStream* stream, |
| 8308 bool ref) const { | 8273 bool ref) const { |
| 8309 stream->OpenObject(); | 8274 JSONObject jsobj(stream); |
| 8310 stream->CloseObject(); | |
| 8311 } | 8275 } |
| 8312 | 8276 |
| 8313 | 8277 |
| 8314 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { | 8278 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { |
| 8315 ASSERT(Object::var_descriptors_class() != Class::null()); | 8279 ASSERT(Object::var_descriptors_class() != Class::null()); |
| 8316 if (num_variables < 0 || num_variables > kMaxElements) { | 8280 if (num_variables < 0 || num_variables > kMaxElements) { |
| 8317 // This should be caught before we reach here. | 8281 // This should be caught before we reach here. |
| 8318 FATAL1("Fatal error in LocalVarDescriptors::New: " | 8282 FATAL1("Fatal error in LocalVarDescriptors::New: " |
| 8319 "invalid num_variables %" Pd "\n", num_variables); | 8283 "invalid num_variables %" Pd "\n", num_variables); |
| 8320 } | 8284 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8484 (len - num_chars), | 8448 (len - num_chars), |
| 8485 kFormat2, k, type.ToCString()); | 8449 kFormat2, k, type.ToCString()); |
| 8486 } | 8450 } |
| 8487 } | 8451 } |
| 8488 return buffer; | 8452 return buffer; |
| 8489 } | 8453 } |
| 8490 | 8454 |
| 8491 | 8455 |
| 8492 void ExceptionHandlers::PrintToJSONStream(JSONStream* stream, | 8456 void ExceptionHandlers::PrintToJSONStream(JSONStream* stream, |
| 8493 bool ref) const { | 8457 bool ref) const { |
| 8494 stream->OpenObject(); | 8458 JSONObject jsobj(stream); |
| 8495 stream->CloseObject(); | |
| 8496 } | 8459 } |
| 8497 | 8460 |
| 8498 | 8461 |
| 8499 intptr_t DeoptInfo::Length() const { | 8462 intptr_t DeoptInfo::Length() const { |
| 8500 return Smi::Value(raw_ptr()->length_); | 8463 return Smi::Value(raw_ptr()->length_); |
| 8501 } | 8464 } |
| 8502 | 8465 |
| 8503 | 8466 |
| 8504 intptr_t DeoptInfo::FromIndex(intptr_t index) const { | 8467 intptr_t DeoptInfo::FromIndex(intptr_t index) const { |
| 8505 return *(EntryAddr(index, kFromIndex)); | 8468 return *(EntryAddr(index, kFromIndex)); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8583 index += OS::SNPrint((buffer + index), | 8546 index += OS::SNPrint((buffer + index), |
| 8584 (len - index), | 8547 (len - index), |
| 8585 "[%s]", | 8548 "[%s]", |
| 8586 deopt_instrs[i]->ToCString()); | 8549 deopt_instrs[i]->ToCString()); |
| 8587 } | 8550 } |
| 8588 return buffer; | 8551 return buffer; |
| 8589 } | 8552 } |
| 8590 | 8553 |
| 8591 | 8554 |
| 8592 void DeoptInfo::PrintToJSONStream(JSONStream* stream, bool ref) const { | 8555 void DeoptInfo::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 8593 stream->OpenObject(); | 8556 JSONObject jsobj(stream); |
| 8594 stream->CloseObject(); | |
| 8595 } | 8557 } |
| 8596 | 8558 |
| 8597 | 8559 |
| 8598 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) { | 8560 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) { |
| 8599 ASSERT(Object::deopt_info_class() != Class::null()); | 8561 ASSERT(Object::deopt_info_class() != Class::null()); |
| 8600 if ((num_commands < 0) || (num_commands > kMaxElements)) { | 8562 if ((num_commands < 0) || (num_commands > kMaxElements)) { |
| 8601 FATAL1("Fatal error in DeoptInfo::New(): invalid num_commands %" Pd "\n", | 8563 FATAL1("Fatal error in DeoptInfo::New(): invalid num_commands %" Pd "\n", |
| 8602 num_commands); | 8564 num_commands); |
| 8603 } | 8565 } |
| 8604 DeoptInfo& result = DeoptInfo::Handle(); | 8566 DeoptInfo& result = DeoptInfo::Handle(); |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8979 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; | 8941 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; |
| 8980 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 8942 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 8981 OS::SNPrint(chars, len, kFormat, EntryPoint()); | 8943 OS::SNPrint(chars, len, kFormat, EntryPoint()); |
| 8982 return chars; | 8944 return chars; |
| 8983 } | 8945 } |
| 8984 | 8946 |
| 8985 | 8947 |
| 8986 void Code::PrintToJSONStream(JSONStream* stream, bool ref) const { | 8948 void Code::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 8987 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 8949 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 8988 intptr_t id = ring->GetIdForObject(raw()); | 8950 intptr_t id = ring->GetIdForObject(raw()); |
| 8951 JSONObject jsobj(stream); |
| 8989 if (ref) { | 8952 if (ref) { |
| 8990 stream->OpenObject(); | 8953 jsobj.AddProperty("type", "@Code"); |
| 8991 stream->PrintProperty("type", "@Code"); | 8954 jsobj.AddProperty("id", id); |
| 8992 stream->PrintProperty("id", id); | |
| 8993 stream->CloseObject(); | |
| 8994 return; | 8955 return; |
| 8995 } | 8956 } |
| 8996 stream->OpenObject(); | 8957 jsobj.AddProperty("type", "Code"); |
| 8997 stream->PrintProperty("type", "Code"); | 8958 jsobj.AddProperty("id", id); |
| 8998 stream->PrintProperty("id", id); | 8959 jsobj.AddProperty("is_optimized", is_optimized()); |
| 8999 stream->PrintPropertyBool("is_optimized", is_optimized()); | 8960 jsobj.AddProperty("is_alive", is_alive()); |
| 9000 stream->PrintPropertyBool("is_alive", is_alive()); | 8961 jsobj.AddProperty("function", Object::Handle(function())); |
| 9001 stream->PrintProperty("function", Object::Handle(function())); | 8962 JSONArray jsarr(jsobj, "disassembly"); |
| 9002 stream->OpenArray("disassembly"); | 8963 DisassembleToJSONStream formatter(jsarr); |
| 9003 DisassembleToJSONStream formatter(stream); | |
| 9004 const Instructions& instr = Instructions::Handle(instructions()); | 8964 const Instructions& instr = Instructions::Handle(instructions()); |
| 9005 uword start = instr.EntryPoint(); | 8965 uword start = instr.EntryPoint(); |
| 9006 Disassembler::Disassemble(start, start + instr.size(), &formatter, | 8966 Disassembler::Disassemble(start, start + instr.size(), &formatter, |
| 9007 comments()); | 8967 comments()); |
| 9008 stream->CloseArray(); | |
| 9009 stream->CloseObject(); | |
| 9010 } | 8968 } |
| 9011 | 8969 |
| 9012 | 8970 |
| 9013 uword Code::GetPatchCodePc() const { | 8971 uword Code::GetPatchCodePc() const { |
| 9014 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | 8972 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
| 9015 return descriptors.GetPcForKind(PcDescriptors::kPatchCode); | 8973 return descriptors.GetPcForKind(PcDescriptors::kPatchCode); |
| 9016 } | 8974 } |
| 9017 | 8975 |
| 9018 | 8976 |
| 9019 uword Code::GetLazyDeoptPc() const { | 8977 uword Code::GetLazyDeoptPc() const { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9130 return result.raw(); | 9088 return result.raw(); |
| 9131 } | 9089 } |
| 9132 | 9090 |
| 9133 | 9091 |
| 9134 const char* Context::ToCString() const { | 9092 const char* Context::ToCString() const { |
| 9135 return "Context"; | 9093 return "Context"; |
| 9136 } | 9094 } |
| 9137 | 9095 |
| 9138 | 9096 |
| 9139 void Context::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9097 void Context::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9140 stream->OpenObject(); | 9098 JSONObject jsobj(stream); |
| 9141 stream->CloseObject(); | |
| 9142 } | 9099 } |
| 9143 | 9100 |
| 9144 | 9101 |
| 9145 RawContextScope* ContextScope::New(intptr_t num_variables) { | 9102 RawContextScope* ContextScope::New(intptr_t num_variables) { |
| 9146 ASSERT(Object::context_scope_class() != Class::null()); | 9103 ASSERT(Object::context_scope_class() != Class::null()); |
| 9147 if (num_variables < 0 || num_variables > kMaxElements) { | 9104 if (num_variables < 0 || num_variables > kMaxElements) { |
| 9148 // This should be caught before we reach here. | 9105 // This should be caught before we reach here. |
| 9149 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n", | 9106 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n", |
| 9150 num_variables); | 9107 num_variables); |
| 9151 } | 9108 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9250 VariableDescAddr(scope_index)->context_level = Smi::New(context_level); | 9207 VariableDescAddr(scope_index)->context_level = Smi::New(context_level); |
| 9251 } | 9208 } |
| 9252 | 9209 |
| 9253 | 9210 |
| 9254 const char* ContextScope::ToCString() const { | 9211 const char* ContextScope::ToCString() const { |
| 9255 return "ContextScope"; | 9212 return "ContextScope"; |
| 9256 } | 9213 } |
| 9257 | 9214 |
| 9258 | 9215 |
| 9259 void ContextScope::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9216 void ContextScope::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9260 stream->OpenObject(); | 9217 JSONObject jsobj(stream); |
| 9261 stream->CloseObject(); | |
| 9262 } | 9218 } |
| 9263 | 9219 |
| 9264 | 9220 |
| 9265 const char* ICData::ToCString() const { | 9221 const char* ICData::ToCString() const { |
| 9266 const char* kFormat = "ICData target:'%s' num-args: %" Pd | 9222 const char* kFormat = "ICData target:'%s' num-args: %" Pd |
| 9267 " num-checks: %" Pd ""; | 9223 " num-checks: %" Pd ""; |
| 9268 const String& name = String::Handle(target_name()); | 9224 const String& name = String::Handle(target_name()); |
| 9269 const intptr_t num_args = num_args_tested(); | 9225 const intptr_t num_args = num_args_tested(); |
| 9270 const intptr_t num_checks = NumberOfChecks(); | 9226 const intptr_t num_checks = NumberOfChecks(); |
| 9271 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString(), | 9227 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString(), |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9723 intptr_t len = result.TestEntryLength(); | 9679 intptr_t len = result.TestEntryLength(); |
| 9724 // IC data array must be null terminated (sentinel entry). | 9680 // IC data array must be null terminated (sentinel entry). |
| 9725 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); | 9681 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); |
| 9726 result.set_ic_data(ic_data); | 9682 result.set_ic_data(ic_data); |
| 9727 result.WriteSentinel(ic_data); | 9683 result.WriteSentinel(ic_data); |
| 9728 return result.raw(); | 9684 return result.raw(); |
| 9729 } | 9685 } |
| 9730 | 9686 |
| 9731 | 9687 |
| 9732 void ICData::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9688 void ICData::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9733 stream->OpenObject(); | 9689 JSONObject jsobj(stream); |
| 9734 stream->CloseObject(); | |
| 9735 } | 9690 } |
| 9736 | 9691 |
| 9737 | 9692 |
| 9738 RawArray* MegamorphicCache::buckets() const { | 9693 RawArray* MegamorphicCache::buckets() const { |
| 9739 return raw_ptr()->buckets_; | 9694 return raw_ptr()->buckets_; |
| 9740 } | 9695 } |
| 9741 | 9696 |
| 9742 | 9697 |
| 9743 void MegamorphicCache::set_buckets(const Array& buckets) const { | 9698 void MegamorphicCache::set_buckets(const Array& buckets) const { |
| 9744 StorePointer(&raw_ptr()->buckets_, buckets.raw()); | 9699 StorePointer(&raw_ptr()->buckets_, buckets.raw()); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9840 UNREACHABLE(); | 9795 UNREACHABLE(); |
| 9841 } | 9796 } |
| 9842 | 9797 |
| 9843 | 9798 |
| 9844 const char* MegamorphicCache::ToCString() const { | 9799 const char* MegamorphicCache::ToCString() const { |
| 9845 return ""; | 9800 return ""; |
| 9846 } | 9801 } |
| 9847 | 9802 |
| 9848 | 9803 |
| 9849 void MegamorphicCache::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9804 void MegamorphicCache::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9850 stream->OpenObject(); | 9805 JSONObject jsobj(stream); |
| 9851 stream->CloseObject(); | |
| 9852 } | 9806 } |
| 9853 | 9807 |
| 9854 | 9808 |
| 9855 RawSubtypeTestCache* SubtypeTestCache::New() { | 9809 RawSubtypeTestCache* SubtypeTestCache::New() { |
| 9856 ASSERT(Object::subtypetestcache_class() != Class::null()); | 9810 ASSERT(Object::subtypetestcache_class() != Class::null()); |
| 9857 SubtypeTestCache& result = SubtypeTestCache::Handle(); | 9811 SubtypeTestCache& result = SubtypeTestCache::Handle(); |
| 9858 { | 9812 { |
| 9859 // SubtypeTestCache objects are long living objects, allocate them in the | 9813 // SubtypeTestCache objects are long living objects, allocate them in the |
| 9860 // old generation. | 9814 // old generation. |
| 9861 RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId, | 9815 RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9917 *test_result ^= data.At(data_pos + kTestResult); | 9871 *test_result ^= data.At(data_pos + kTestResult); |
| 9918 } | 9872 } |
| 9919 | 9873 |
| 9920 | 9874 |
| 9921 const char* SubtypeTestCache::ToCString() const { | 9875 const char* SubtypeTestCache::ToCString() const { |
| 9922 return "SubtypeTestCache"; | 9876 return "SubtypeTestCache"; |
| 9923 } | 9877 } |
| 9924 | 9878 |
| 9925 | 9879 |
| 9926 void SubtypeTestCache::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9880 void SubtypeTestCache::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9927 stream->OpenObject(); | 9881 JSONObject jsobj(stream); |
| 9928 stream->CloseObject(); | |
| 9929 } | 9882 } |
| 9930 | 9883 |
| 9931 | 9884 |
| 9932 const char* Error::ToErrorCString() const { | 9885 const char* Error::ToErrorCString() const { |
| 9933 UNREACHABLE(); | 9886 UNREACHABLE(); |
| 9934 return "Internal Error"; | 9887 return "Internal Error"; |
| 9935 } | 9888 } |
| 9936 | 9889 |
| 9937 | 9890 |
| 9938 const char* Error::ToCString() const { | 9891 const char* Error::ToCString() const { |
| 9939 // Error is an abstract class. We should never reach here. | 9892 // Error is an abstract class. We should never reach here. |
| 9940 UNREACHABLE(); | 9893 UNREACHABLE(); |
| 9941 return "Error"; | 9894 return "Error"; |
| 9942 } | 9895 } |
| 9943 | 9896 |
| 9944 | 9897 |
| 9945 void Error::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9898 void Error::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9946 stream->OpenObject(); | 9899 JSONObject jsobj(stream); |
| 9947 stream->CloseObject(); | |
| 9948 } | 9900 } |
| 9949 | 9901 |
| 9950 | 9902 |
| 9951 RawApiError* ApiError::New() { | 9903 RawApiError* ApiError::New() { |
| 9952 ASSERT(Object::api_error_class() != Class::null()); | 9904 ASSERT(Object::api_error_class() != Class::null()); |
| 9953 RawObject* raw = Object::Allocate(ApiError::kClassId, | 9905 RawObject* raw = Object::Allocate(ApiError::kClassId, |
| 9954 ApiError::InstanceSize(), | 9906 ApiError::InstanceSize(), |
| 9955 Heap::kOld); | 9907 Heap::kOld); |
| 9956 return reinterpret_cast<RawApiError*>(raw); | 9908 return reinterpret_cast<RawApiError*>(raw); |
| 9957 } | 9909 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 9982 return msg_str.ToCString(); | 9934 return msg_str.ToCString(); |
| 9983 } | 9935 } |
| 9984 | 9936 |
| 9985 | 9937 |
| 9986 const char* ApiError::ToCString() const { | 9938 const char* ApiError::ToCString() const { |
| 9987 return "ApiError"; | 9939 return "ApiError"; |
| 9988 } | 9940 } |
| 9989 | 9941 |
| 9990 | 9942 |
| 9991 void ApiError::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9943 void ApiError::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 9992 stream->OpenObject(); | 9944 JSONObject jsobj(stream); |
| 9993 stream->CloseObject(); | |
| 9994 } | 9945 } |
| 9995 | 9946 |
| 9996 | 9947 |
| 9997 RawLanguageError* LanguageError::New() { | 9948 RawLanguageError* LanguageError::New() { |
| 9998 ASSERT(Object::language_error_class() != Class::null()); | 9949 ASSERT(Object::language_error_class() != Class::null()); |
| 9999 RawObject* raw = Object::Allocate(LanguageError::kClassId, | 9950 RawObject* raw = Object::Allocate(LanguageError::kClassId, |
| 10000 LanguageError::InstanceSize(), | 9951 LanguageError::InstanceSize(), |
| 10001 Heap::kOld); | 9952 Heap::kOld); |
| 10002 return reinterpret_cast<RawLanguageError*>(raw); | 9953 return reinterpret_cast<RawLanguageError*>(raw); |
| 10003 } | 9954 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 10028 return msg_str.ToCString(); | 9979 return msg_str.ToCString(); |
| 10029 } | 9980 } |
| 10030 | 9981 |
| 10031 | 9982 |
| 10032 const char* LanguageError::ToCString() const { | 9983 const char* LanguageError::ToCString() const { |
| 10033 return "LanguageError"; | 9984 return "LanguageError"; |
| 10034 } | 9985 } |
| 10035 | 9986 |
| 10036 | 9987 |
| 10037 void LanguageError::PrintToJSONStream(JSONStream* stream, bool ref) const { | 9988 void LanguageError::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10038 stream->OpenObject(); | 9989 JSONObject jsobj(stream); |
| 10039 stream->CloseObject(); | |
| 10040 } | 9990 } |
| 10041 | 9991 |
| 10042 | 9992 |
| 10043 RawUnhandledException* UnhandledException::New(const Instance& exception, | 9993 RawUnhandledException* UnhandledException::New(const Instance& exception, |
| 10044 const Instance& stacktrace, | 9994 const Instance& stacktrace, |
| 10045 Heap::Space space) { | 9995 Heap::Space space) { |
| 10046 ASSERT(Object::unhandled_exception_class() != Class::null()); | 9996 ASSERT(Object::unhandled_exception_class() != Class::null()); |
| 10047 UnhandledException& result = UnhandledException::Handle(); | 9997 UnhandledException& result = UnhandledException::Handle(); |
| 10048 { | 9998 { |
| 10049 RawObject* raw = Object::Allocate(UnhandledException::kClassId, | 9999 RawObject* raw = Object::Allocate(UnhandledException::kClassId, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10103 } | 10053 } |
| 10104 | 10054 |
| 10105 | 10055 |
| 10106 const char* UnhandledException::ToCString() const { | 10056 const char* UnhandledException::ToCString() const { |
| 10107 return "UnhandledException"; | 10057 return "UnhandledException"; |
| 10108 } | 10058 } |
| 10109 | 10059 |
| 10110 | 10060 |
| 10111 void UnhandledException::PrintToJSONStream(JSONStream* stream, | 10061 void UnhandledException::PrintToJSONStream(JSONStream* stream, |
| 10112 bool ref) const { | 10062 bool ref) const { |
| 10113 stream->OpenObject(); | 10063 JSONObject jsobj(stream); |
| 10114 stream->CloseObject(); | |
| 10115 } | 10064 } |
| 10116 | 10065 |
| 10117 | 10066 |
| 10118 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { | 10067 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { |
| 10119 ASSERT(Object::unwind_error_class() != Class::null()); | 10068 ASSERT(Object::unwind_error_class() != Class::null()); |
| 10120 UnwindError& result = UnwindError::Handle(); | 10069 UnwindError& result = UnwindError::Handle(); |
| 10121 { | 10070 { |
| 10122 RawObject* raw = Object::Allocate(UnwindError::kClassId, | 10071 RawObject* raw = Object::Allocate(UnwindError::kClassId, |
| 10123 UnwindError::InstanceSize(), | 10072 UnwindError::InstanceSize(), |
| 10124 space); | 10073 space); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 10140 return msg_str.ToCString(); | 10089 return msg_str.ToCString(); |
| 10141 } | 10090 } |
| 10142 | 10091 |
| 10143 | 10092 |
| 10144 const char* UnwindError::ToCString() const { | 10093 const char* UnwindError::ToCString() const { |
| 10145 return "UnwindError"; | 10094 return "UnwindError"; |
| 10146 } | 10095 } |
| 10147 | 10096 |
| 10148 | 10097 |
| 10149 void UnwindError::PrintToJSONStream(JSONStream* stream, bool ref) const { | 10098 void UnwindError::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10150 stream->OpenObject(); | 10099 JSONObject jsobj(stream); |
| 10151 stream->CloseObject(); | |
| 10152 } | 10100 } |
| 10153 | 10101 |
| 10154 | 10102 |
| 10155 RawObject* Instance::Evaluate(const String& expr) const { | 10103 RawObject* Instance::Evaluate(const String& expr) const { |
| 10156 const Class& cls = Class::Handle(clazz()); | 10104 const Class& cls = Class::Handle(clazz()); |
| 10157 const PatchClass& temp_class = | 10105 const PatchClass& temp_class = |
| 10158 PatchClass::Handle(MakeTempPatchClass(cls, expr)); | 10106 PatchClass::Handle(MakeTempPatchClass(cls, expr)); |
| 10159 const String& eval_func_name = String::Handle(Symbols::New(":eval")); | 10107 const String& eval_func_name = String::Handle(Symbols::New(":eval")); |
| 10160 const Function& eval_func = | 10108 const Function& eval_func = |
| 10161 Function::Handle(Function::New(eval_func_name, | 10109 Function::Handle(Function::New(eval_func_name, |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10495 // Calculate the size of the string. | 10443 // Calculate the size of the string. |
| 10496 intptr_t len = OS::SNPrint(NULL, 0, kFormat, type_name.ToCString()) + 1; | 10444 intptr_t len = OS::SNPrint(NULL, 0, kFormat, type_name.ToCString()) + 1; |
| 10497 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 10445 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 10498 OS::SNPrint(chars, len, kFormat, type_name.ToCString()); | 10446 OS::SNPrint(chars, len, kFormat, type_name.ToCString()); |
| 10499 return chars; | 10447 return chars; |
| 10500 } | 10448 } |
| 10501 } | 10449 } |
| 10502 | 10450 |
| 10503 | 10451 |
| 10504 void Instance::PrintToJSONStream(JSONStream* stream, bool ref) const { | 10452 void Instance::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10505 stream->OpenObject(); | 10453 JSONObject jsobj(stream); |
| 10506 stream->CloseObject(); | |
| 10507 } | 10454 } |
| 10508 | 10455 |
| 10509 | 10456 |
| 10510 bool AbstractType::IsResolved() const { | 10457 bool AbstractType::IsResolved() const { |
| 10511 // AbstractType is an abstract class. | 10458 // AbstractType is an abstract class. |
| 10512 UNREACHABLE(); | 10459 UNREACHABLE(); |
| 10513 return false; | 10460 return false; |
| 10514 } | 10461 } |
| 10515 | 10462 |
| 10516 | 10463 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10854 | 10801 |
| 10855 | 10802 |
| 10856 const char* AbstractType::ToCString() const { | 10803 const char* AbstractType::ToCString() const { |
| 10857 // AbstractType is an abstract class. | 10804 // AbstractType is an abstract class. |
| 10858 UNREACHABLE(); | 10805 UNREACHABLE(); |
| 10859 return "AbstractType"; | 10806 return "AbstractType"; |
| 10860 } | 10807 } |
| 10861 | 10808 |
| 10862 | 10809 |
| 10863 void AbstractType::PrintToJSONStream(JSONStream* stream, bool ref) const { | 10810 void AbstractType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 10864 stream->OpenObject(); | 10811 JSONObject jsobj(stream); |
| 10865 stream->CloseObject(); | |
| 10866 } | 10812 } |
| 10867 | 10813 |
| 10868 | 10814 |
| 10869 RawType* Type::NullType() { | 10815 RawType* Type::NullType() { |
| 10870 return Isolate::Current()->object_store()->null_type(); | 10816 return Isolate::Current()->object_store()->null_type(); |
| 10871 } | 10817 } |
| 10872 | 10818 |
| 10873 | 10819 |
| 10874 RawType* Type::DynamicType() { | 10820 RawType* Type::DynamicType() { |
| 10875 return Object::dynamic_type(); | 10821 return Object::dynamic_type(); |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11302 OS::SNPrint(chars, len, format, class_name, args_cstr); | 11248 OS::SNPrint(chars, len, format, class_name, args_cstr); |
| 11303 return chars; | 11249 return chars; |
| 11304 } | 11250 } |
| 11305 } else { | 11251 } else { |
| 11306 return "Unresolved Type"; | 11252 return "Unresolved Type"; |
| 11307 } | 11253 } |
| 11308 } | 11254 } |
| 11309 | 11255 |
| 11310 | 11256 |
| 11311 void Type::PrintToJSONStream(JSONStream* stream, bool ref) const { | 11257 void Type::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11312 stream->OpenObject(); | 11258 JSONObject jsobj(stream); |
| 11313 stream->CloseObject(); | |
| 11314 } | 11259 } |
| 11315 | 11260 |
| 11316 | 11261 |
| 11317 void TypeParameter::set_is_finalized() const { | 11262 void TypeParameter::set_is_finalized() const { |
| 11318 ASSERT(!IsFinalized()); | 11263 ASSERT(!IsFinalized()); |
| 11319 set_type_state(RawTypeParameter::kFinalizedUninstantiated); | 11264 set_type_state(RawTypeParameter::kFinalizedUninstantiated); |
| 11320 } | 11265 } |
| 11321 | 11266 |
| 11322 | 11267 |
| 11323 bool TypeParameter::Equals(const Instance& other) const { | 11268 bool TypeParameter::Equals(const Instance& other) const { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11490 const char* cls_cstr = | 11435 const char* cls_cstr = |
| 11491 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); | 11436 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); |
| 11492 intptr_t len = OS::SNPrint(NULL, 0, format, name_cstr, index(), cls_cstr) + 1; | 11437 intptr_t len = OS::SNPrint(NULL, 0, format, name_cstr, index(), cls_cstr) + 1; |
| 11493 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 11438 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 11494 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr); | 11439 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr); |
| 11495 return chars; | 11440 return chars; |
| 11496 } | 11441 } |
| 11497 | 11442 |
| 11498 | 11443 |
| 11499 void TypeParameter::PrintToJSONStream(JSONStream* stream, bool ref) const { | 11444 void TypeParameter::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11500 stream->OpenObject(); | 11445 JSONObject jsobj(stream); |
| 11501 stream->CloseObject(); | |
| 11502 } | 11446 } |
| 11503 | 11447 |
| 11504 | 11448 |
| 11505 bool BoundedType::IsMalformed() const { | 11449 bool BoundedType::IsMalformed() const { |
| 11506 return AbstractType::Handle(type()).IsMalformed(); | 11450 return AbstractType::Handle(type()).IsMalformed(); |
| 11507 } | 11451 } |
| 11508 | 11452 |
| 11509 | 11453 |
| 11510 bool BoundedType::IsMalboundedWithError(Error* bound_error) const { | 11454 bool BoundedType::IsMalboundedWithError(Error* bound_error) const { |
| 11511 if (!FLAG_enable_type_checks && !FLAG_error_on_bad_type) { | 11455 if (!FLAG_enable_type_checks && !FLAG_error_on_bad_type) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11659 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); | 11603 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); |
| 11660 intptr_t len = OS::SNPrint( | 11604 intptr_t len = OS::SNPrint( |
| 11661 NULL, 0, format, type_cstr, bound_cstr, cls_cstr) + 1; | 11605 NULL, 0, format, type_cstr, bound_cstr, cls_cstr) + 1; |
| 11662 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 11606 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 11663 OS::SNPrint(chars, len, format, type_cstr, bound_cstr, cls_cstr); | 11607 OS::SNPrint(chars, len, format, type_cstr, bound_cstr, cls_cstr); |
| 11664 return chars; | 11608 return chars; |
| 11665 } | 11609 } |
| 11666 | 11610 |
| 11667 | 11611 |
| 11668 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { | 11612 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11669 stream->OpenObject(); | 11613 JSONObject jsobj(stream); |
| 11670 stream->CloseObject(); | |
| 11671 } | 11614 } |
| 11672 | 11615 |
| 11673 | 11616 |
| 11674 RawString* MixinAppType::Name() const { | 11617 RawString* MixinAppType::Name() const { |
| 11675 return String::New("MixinApplication"); | 11618 return String::New("MixinApplication"); |
| 11676 } | 11619 } |
| 11677 | 11620 |
| 11678 | 11621 |
| 11679 const char* MixinAppType::ToCString() const { | 11622 const char* MixinAppType::ToCString() const { |
| 11680 return "MixinAppType"; | 11623 return "MixinAppType"; |
| 11681 } | 11624 } |
| 11682 | 11625 |
| 11683 | 11626 |
| 11684 void MixinAppType::PrintToJSONStream(JSONStream* stream, bool ref) const { | 11627 void MixinAppType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11685 stream->OpenObject(); | 11628 JSONObject jsobj(stream); |
| 11686 stream->CloseObject(); | |
| 11687 } | 11629 } |
| 11688 | 11630 |
| 11689 | 11631 |
| 11690 void MixinAppType::set_super_type(const AbstractType& value) const { | 11632 void MixinAppType::set_super_type(const AbstractType& value) const { |
| 11691 StorePointer(&raw_ptr()->super_type_, value.raw()); | 11633 StorePointer(&raw_ptr()->super_type_, value.raw()); |
| 11692 } | 11634 } |
| 11693 | 11635 |
| 11694 | 11636 |
| 11695 void MixinAppType::set_mixin_types(const Array& value) const { | 11637 void MixinAppType::set_mixin_types(const Array& value) const { |
| 11696 StorePointer(&raw_ptr()->mixin_types_, value.raw()); | 11638 StorePointer(&raw_ptr()->mixin_types_, value.raw()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 11719 | 11661 |
| 11720 | 11662 |
| 11721 const char* Number::ToCString() const { | 11663 const char* Number::ToCString() const { |
| 11722 // Number is an interface. No instances of Number should exist. | 11664 // Number is an interface. No instances of Number should exist. |
| 11723 UNREACHABLE(); | 11665 UNREACHABLE(); |
| 11724 return "Number"; | 11666 return "Number"; |
| 11725 } | 11667 } |
| 11726 | 11668 |
| 11727 | 11669 |
| 11728 void Number::PrintToJSONStream(JSONStream* stream, bool ref) const { | 11670 void Number::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11729 stream->OpenObject(); | 11671 JSONObject jsobj(stream); |
| 11730 stream->CloseObject(); | |
| 11731 } | 11672 } |
| 11732 | 11673 |
| 11733 | 11674 |
| 11734 const char* Integer::ToCString() const { | 11675 const char* Integer::ToCString() const { |
| 11735 // Integer is an interface. No instances of Integer should exist. | 11676 // Integer is an interface. No instances of Integer should exist. |
| 11736 UNREACHABLE(); | 11677 UNREACHABLE(); |
| 11737 return "Integer"; | 11678 return "Integer"; |
| 11738 } | 11679 } |
| 11739 | 11680 |
| 11740 | 11681 |
| 11741 void Integer::PrintToJSONStream(JSONStream* stream, bool ref) const { | 11682 void Integer::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 11742 stream->OpenObject(); | 11683 JSONObject jsobj(stream); |
| 11743 stream->CloseObject(); | |
| 11744 } | 11684 } |
| 11745 | 11685 |
| 11746 | 11686 |
| 11747 // Throw JavascriptIntegerOverflow exception. | 11687 // Throw JavascriptIntegerOverflow exception. |
| 11748 static void ThrowJavascriptIntegerOverflow(const Integer& i) { | 11688 static void ThrowJavascriptIntegerOverflow(const Integer& i) { |
| 11749 const Array& exc_args = Array::Handle(Array::New(1)); | 11689 const Array& exc_args = Array::Handle(Array::New(1)); |
| 11750 const String& i_str = String::Handle(String::New(i.ToCString())); | 11690 const String& i_str = String::Handle(String::New(i.ToCString())); |
| 11751 exc_args.SetAt(0, i_str); | 11691 exc_args.SetAt(0, i_str); |
| 11752 Exceptions::ThrowByType(Exceptions::kJavascriptIntegerOverflowError, | 11692 Exceptions::ThrowByType(Exceptions::kJavascriptIntegerOverflowError, |
| 11753 exc_args); | 11693 exc_args); |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12151 const char* kFormat = "%ld"; | 12091 const char* kFormat = "%ld"; |
| 12152 // Calculate the size of the string. | 12092 // Calculate the size of the string. |
| 12153 intptr_t len = OS::SNPrint(NULL, 0, kFormat, Value()) + 1; | 12093 intptr_t len = OS::SNPrint(NULL, 0, kFormat, Value()) + 1; |
| 12154 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 12094 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 12155 OS::SNPrint(chars, len, kFormat, Value()); | 12095 OS::SNPrint(chars, len, kFormat, Value()); |
| 12156 return chars; | 12096 return chars; |
| 12157 } | 12097 } |
| 12158 | 12098 |
| 12159 | 12099 |
| 12160 void Smi::PrintToJSONStream(JSONStream* stream, bool ref) const { | 12100 void Smi::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 12161 stream->OpenObject(); | 12101 JSONObject jsobj(stream); |
| 12162 stream->CloseObject(); | |
| 12163 } | 12102 } |
| 12164 | 12103 |
| 12165 | 12104 |
| 12166 RawClass* Smi::Class() { | 12105 RawClass* Smi::Class() { |
| 12167 return Isolate::Current()->object_store()->smi_class(); | 12106 return Isolate::Current()->object_store()->smi_class(); |
| 12168 } | 12107 } |
| 12169 | 12108 |
| 12170 | 12109 |
| 12171 void Mint::set_value(int64_t value) const { | 12110 void Mint::set_value(int64_t value) const { |
| 12172 raw_ptr()->value_ = value; | 12111 raw_ptr()->value_ = value; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12271 const char* kFormat = "%lld"; | 12210 const char* kFormat = "%lld"; |
| 12272 // Calculate the size of the string. | 12211 // Calculate the size of the string. |
| 12273 intptr_t len = OS::SNPrint(NULL, 0, kFormat, value()) + 1; | 12212 intptr_t len = OS::SNPrint(NULL, 0, kFormat, value()) + 1; |
| 12274 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 12213 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 12275 OS::SNPrint(chars, len, kFormat, value()); | 12214 OS::SNPrint(chars, len, kFormat, value()); |
| 12276 return chars; | 12215 return chars; |
| 12277 } | 12216 } |
| 12278 | 12217 |
| 12279 | 12218 |
| 12280 void Mint::PrintToJSONStream(JSONStream* stream, bool ref) const { | 12219 void Mint::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 12281 stream->OpenObject(); | 12220 JSONObject jsobj(stream); |
| 12282 stream->CloseObject(); | |
| 12283 } | 12221 } |
| 12284 | 12222 |
| 12285 | 12223 |
| 12286 void Double::set_value(double value) const { | 12224 void Double::set_value(double value) const { |
| 12287 raw_ptr()->value_ = value; | 12225 raw_ptr()->value_ = value; |
| 12288 } | 12226 } |
| 12289 | 12227 |
| 12290 | 12228 |
| 12291 bool Double::EqualsToDouble(double value) const { | 12229 bool Double::EqualsToDouble(double value) const { |
| 12292 intptr_t value_offset = Double::value_offset(); | 12230 intptr_t value_offset = Double::value_offset(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12378 } | 12316 } |
| 12379 const int kBufferSize = 128; | 12317 const int kBufferSize = 128; |
| 12380 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(kBufferSize); | 12318 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(kBufferSize); |
| 12381 buffer[kBufferSize - 1] = '\0'; | 12319 buffer[kBufferSize - 1] = '\0'; |
| 12382 DoubleToCString(value(), buffer, kBufferSize); | 12320 DoubleToCString(value(), buffer, kBufferSize); |
| 12383 return buffer; | 12321 return buffer; |
| 12384 } | 12322 } |
| 12385 | 12323 |
| 12386 | 12324 |
| 12387 void Double::PrintToJSONStream(JSONStream* stream, bool ref) const { | 12325 void Double::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 12388 stream->OpenObject(); | 12326 JSONObject jsobj(stream); |
| 12389 stream->CloseObject(); | |
| 12390 } | 12327 } |
| 12391 | 12328 |
| 12392 | 12329 |
| 12393 RawBigint* Integer::AsBigint() const { | 12330 RawBigint* Integer::AsBigint() const { |
| 12394 ASSERT(!IsNull()); | 12331 ASSERT(!IsNull()); |
| 12395 if (IsSmi()) { | 12332 if (IsSmi()) { |
| 12396 Smi& smi = Smi::Handle(); | 12333 Smi& smi = Smi::Handle(); |
| 12397 smi ^= raw(); | 12334 smi ^= raw(); |
| 12398 return BigintOperations::NewFromSmi(smi); | 12335 return BigintOperations::NewFromSmi(smi); |
| 12399 } else if (IsMint()) { | 12336 } else if (IsMint()) { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12550 return zone->AllocUnsafe(size); | 12487 return zone->AllocUnsafe(size); |
| 12551 } | 12488 } |
| 12552 | 12489 |
| 12553 | 12490 |
| 12554 const char* Bigint::ToCString() const { | 12491 const char* Bigint::ToCString() const { |
| 12555 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); | 12492 return BigintOperations::ToDecimalCString(*this, &BigintAllocator); |
| 12556 } | 12493 } |
| 12557 | 12494 |
| 12558 | 12495 |
| 12559 void Bigint::PrintToJSONStream(JSONStream* stream, bool ref) const { | 12496 void Bigint::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 12560 stream->OpenObject(); | 12497 JSONObject jsobj(stream); |
| 12561 stream->CloseObject(); | |
| 12562 } | 12498 } |
| 12563 | 12499 |
| 12564 | 12500 |
| 12565 // Synchronize with implementation in compiler (intrinsifier). | 12501 // Synchronize with implementation in compiler (intrinsifier). |
| 12566 class StringHasher : ValueObject { | 12502 class StringHasher : ValueObject { |
| 12567 public: | 12503 public: |
| 12568 StringHasher() : hash_(0) {} | 12504 StringHasher() : hash_(0) {} |
| 12569 void Add(int32_t ch) { | 12505 void Add(int32_t ch) { |
| 12570 hash_ += ch; | 12506 hash_ += ch; |
| 12571 hash_ += hash_ << 10; | 12507 hash_ += hash_ << 10; |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13154 const intptr_t len = Utf8::Length(*this); | 13090 const intptr_t len = Utf8::Length(*this); |
| 13155 Zone* zone = Isolate::Current()->current_zone(); | 13091 Zone* zone = Isolate::Current()->current_zone(); |
| 13156 uint8_t* result = zone->Alloc<uint8_t>(len + 1); | 13092 uint8_t* result = zone->Alloc<uint8_t>(len + 1); |
| 13157 ToUTF8(result, len); | 13093 ToUTF8(result, len); |
| 13158 result[len] = 0; | 13094 result[len] = 0; |
| 13159 return reinterpret_cast<const char*>(result); | 13095 return reinterpret_cast<const char*>(result); |
| 13160 } | 13096 } |
| 13161 | 13097 |
| 13162 | 13098 |
| 13163 void String::PrintToJSONStream(JSONStream* stream, bool ref) const { | 13099 void String::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13164 stream->OpenObject(); | 13100 JSONObject jsobj(stream); |
| 13165 stream->CloseObject(); | |
| 13166 } | 13101 } |
| 13167 | 13102 |
| 13168 | 13103 |
| 13169 void String::ToUTF8(uint8_t* utf8_array, intptr_t array_len) const { | 13104 void String::ToUTF8(uint8_t* utf8_array, intptr_t array_len) const { |
| 13170 ASSERT(array_len >= Utf8::Length(*this)); | 13105 ASSERT(array_len >= Utf8::Length(*this)); |
| 13171 Utf8::Encode(*this, reinterpret_cast<char*>(utf8_array), array_len); | 13106 Utf8::Encode(*this, reinterpret_cast<char*>(utf8_array), array_len); |
| 13172 } | 13107 } |
| 13173 | 13108 |
| 13174 | 13109 |
| 13175 static FinalizablePersistentHandle* AddFinalizer( | 13110 static FinalizablePersistentHandle* AddFinalizer( |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13876 return result.raw(); | 13811 return result.raw(); |
| 13877 } | 13812 } |
| 13878 | 13813 |
| 13879 | 13814 |
| 13880 const char* Bool::ToCString() const { | 13815 const char* Bool::ToCString() const { |
| 13881 return value() ? "true" : "false"; | 13816 return value() ? "true" : "false"; |
| 13882 } | 13817 } |
| 13883 | 13818 |
| 13884 | 13819 |
| 13885 void Bool::PrintToJSONStream(JSONStream* stream, bool ref) const { | 13820 void Bool::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13886 stream->OpenObject(); | 13821 JSONObject jsobj(stream); |
| 13887 stream->CloseObject(); | |
| 13888 } | 13822 } |
| 13889 | 13823 |
| 13890 | 13824 |
| 13891 bool Array::Equals(const Instance& other) const { | 13825 bool Array::Equals(const Instance& other) const { |
| 13892 if (this->raw() == other.raw()) { | 13826 if (this->raw() == other.raw()) { |
| 13893 // Both handles point to the same raw instance. | 13827 // Both handles point to the same raw instance. |
| 13894 return true; | 13828 return true; |
| 13895 } | 13829 } |
| 13896 | 13830 |
| 13897 if (!other.IsArray() || other.IsNull()) { | 13831 if (!other.IsArray() || other.IsNull()) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13960 const char* format = !IsImmutable() ? "Array len:%" Pd "" : | 13894 const char* format = !IsImmutable() ? "Array len:%" Pd "" : |
| 13961 "Immutable Array len:%" Pd ""; | 13895 "Immutable Array len:%" Pd ""; |
| 13962 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; | 13896 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; |
| 13963 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 13897 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 13964 OS::SNPrint(chars, len, format, Length()); | 13898 OS::SNPrint(chars, len, format, Length()); |
| 13965 return chars; | 13899 return chars; |
| 13966 } | 13900 } |
| 13967 | 13901 |
| 13968 | 13902 |
| 13969 void Array::PrintToJSONStream(JSONStream* stream, bool ref) const { | 13903 void Array::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13970 stream->OpenObject(); | 13904 JSONObject jsobj(stream); |
| 13971 stream->CloseObject(); | |
| 13972 } | 13905 } |
| 13973 | 13906 |
| 13974 | 13907 |
| 13975 RawArray* Array::Grow(const Array& source, int new_length, Heap::Space space) { | 13908 RawArray* Array::Grow(const Array& source, int new_length, Heap::Space space) { |
| 13976 const Array& result = Array::Handle(Array::New(new_length, space)); | 13909 const Array& result = Array::Handle(Array::New(new_length, space)); |
| 13977 intptr_t len = 0; | 13910 intptr_t len = 0; |
| 13978 if (!source.IsNull()) { | 13911 if (!source.IsNull()) { |
| 13979 len = source.Length(); | 13912 len = source.Length(); |
| 13980 result.SetTypeArguments( | 13913 result.SetTypeArguments( |
| 13981 AbstractTypeArguments::Handle(source.GetTypeArguments())); | 13914 AbstractTypeArguments::Handle(source.GetTypeArguments())); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14172 const char* format = "GrowableObjectArray len:%" Pd ""; | 14105 const char* format = "GrowableObjectArray len:%" Pd ""; |
| 14173 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; | 14106 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; |
| 14174 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 14107 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 14175 OS::SNPrint(chars, len, format, Length()); | 14108 OS::SNPrint(chars, len, format, Length()); |
| 14176 return chars; | 14109 return chars; |
| 14177 } | 14110 } |
| 14178 | 14111 |
| 14179 | 14112 |
| 14180 void GrowableObjectArray::PrintToJSONStream(JSONStream* stream, | 14113 void GrowableObjectArray::PrintToJSONStream(JSONStream* stream, |
| 14181 bool ref) const { | 14114 bool ref) const { |
| 14182 stream->OpenObject(); | 14115 JSONObject jsobj(stream); |
| 14183 stream->CloseObject(); | |
| 14184 } | 14116 } |
| 14185 | 14117 |
| 14186 | 14118 |
| 14187 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, | 14119 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, |
| 14188 Heap::Space space) { | 14120 Heap::Space space) { |
| 14189 ASSERT(Isolate::Current()->object_store()->float32x4_class() != | 14121 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
| 14190 Class::null()); | 14122 Class::null()); |
| 14191 Float32x4& result = Float32x4::Handle(); | 14123 Float32x4& result = Float32x4::Handle(); |
| 14192 { | 14124 { |
| 14193 RawObject* raw = Object::Allocate(Float32x4::kClassId, | 14125 RawObject* raw = Object::Allocate(Float32x4::kClassId, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14278 float _w = w(); | 14210 float _w = w(); |
| 14279 // Calculate the size of the string. | 14211 // Calculate the size of the string. |
| 14280 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; | 14212 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; |
| 14281 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 14213 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 14282 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); | 14214 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); |
| 14283 return chars; | 14215 return chars; |
| 14284 } | 14216 } |
| 14285 | 14217 |
| 14286 | 14218 |
| 14287 void Float32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14219 void Float32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14288 stream->OpenObject(); | 14220 JSONObject jsobj(stream); |
| 14289 stream->CloseObject(); | |
| 14290 } | 14221 } |
| 14291 | 14222 |
| 14292 | 14223 |
| 14293 RawUint32x4* Uint32x4::New(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3, | 14224 RawUint32x4* Uint32x4::New(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3, |
| 14294 Heap::Space space) { | 14225 Heap::Space space) { |
| 14295 ASSERT(Isolate::Current()->object_store()->uint32x4_class() != | 14226 ASSERT(Isolate::Current()->object_store()->uint32x4_class() != |
| 14296 Class::null()); | 14227 Class::null()); |
| 14297 Uint32x4& result = Uint32x4::Handle(); | 14228 Uint32x4& result = Uint32x4::Handle(); |
| 14298 { | 14229 { |
| 14299 RawObject* raw = Object::Allocate(Uint32x4::kClassId, | 14230 RawObject* raw = Object::Allocate(Uint32x4::kClassId, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14384 uint32_t _w = w(); | 14315 uint32_t _w = w(); |
| 14385 // Calculate the size of the string. | 14316 // Calculate the size of the string. |
| 14386 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; | 14317 intptr_t len = OS::SNPrint(NULL, 0, kFormat, _x, _y, _z, _w) + 1; |
| 14387 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 14318 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 14388 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); | 14319 OS::SNPrint(chars, len, kFormat, _x, _y, _z, _w); |
| 14389 return chars; | 14320 return chars; |
| 14390 } | 14321 } |
| 14391 | 14322 |
| 14392 | 14323 |
| 14393 void Uint32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14324 void Uint32x4::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14394 stream->OpenObject(); | 14325 JSONObject jsobj(stream); |
| 14395 stream->CloseObject(); | |
| 14396 } | 14326 } |
| 14397 | 14327 |
| 14398 | 14328 |
| 14399 const intptr_t TypedData::element_size[] = { | 14329 const intptr_t TypedData::element_size[] = { |
| 14400 1, // kTypedDataInt8ArrayCid. | 14330 1, // kTypedDataInt8ArrayCid. |
| 14401 1, // kTypedDataUint8ArrayCid. | 14331 1, // kTypedDataUint8ArrayCid. |
| 14402 1, // kTypedDataUint8ClampedArrayCid. | 14332 1, // kTypedDataUint8ClampedArrayCid. |
| 14403 2, // kTypedDataInt16ArrayCid. | 14333 2, // kTypedDataInt16ArrayCid. |
| 14404 2, // kTypedDataUint16ArrayCid. | 14334 2, // kTypedDataUint16ArrayCid. |
| 14405 4, // kTypedDataInt32ArrayCid. | 14335 4, // kTypedDataInt32ArrayCid. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 14434 return result.raw(); | 14364 return result.raw(); |
| 14435 } | 14365 } |
| 14436 | 14366 |
| 14437 | 14367 |
| 14438 const char* TypedData::ToCString() const { | 14368 const char* TypedData::ToCString() const { |
| 14439 return "TypedData"; | 14369 return "TypedData"; |
| 14440 } | 14370 } |
| 14441 | 14371 |
| 14442 | 14372 |
| 14443 void TypedData::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14373 void TypedData::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14444 stream->OpenObject(); | 14374 JSONObject jsobj(stream); |
| 14445 stream->CloseObject(); | |
| 14446 } | 14375 } |
| 14447 | 14376 |
| 14448 | 14377 |
| 14449 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( | 14378 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( |
| 14450 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { | 14379 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { |
| 14451 SetPeer(peer); | 14380 SetPeer(peer); |
| 14452 return dart::AddFinalizer(*this, peer, callback); | 14381 return dart::AddFinalizer(*this, peer, callback); |
| 14453 } | 14382 } |
| 14454 | 14383 |
| 14455 | 14384 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 14471 } | 14400 } |
| 14472 | 14401 |
| 14473 | 14402 |
| 14474 const char* ExternalTypedData::ToCString() const { | 14403 const char* ExternalTypedData::ToCString() const { |
| 14475 return "ExternalTypedData"; | 14404 return "ExternalTypedData"; |
| 14476 } | 14405 } |
| 14477 | 14406 |
| 14478 | 14407 |
| 14479 void ExternalTypedData::PrintToJSONStream(JSONStream* stream, | 14408 void ExternalTypedData::PrintToJSONStream(JSONStream* stream, |
| 14480 bool ref) const { | 14409 bool ref) const { |
| 14481 stream->OpenObject(); | 14410 JSONObject jsobj(stream); |
| 14482 stream->CloseObject(); | |
| 14483 } | 14411 } |
| 14484 | 14412 |
| 14485 | 14413 |
| 14486 | 14414 |
| 14487 const char* Closure::ToCString(const Instance& closure) { | 14415 const char* Closure::ToCString(const Instance& closure) { |
| 14488 const Function& fun = Function::Handle(Closure::function(closure)); | 14416 const Function& fun = Function::Handle(Closure::function(closure)); |
| 14489 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); | 14417 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); |
| 14490 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString(); | 14418 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString(); |
| 14491 const char* from = is_implicit_closure ? " from " : ""; | 14419 const char* from = is_implicit_closure ? " from " : ""; |
| 14492 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; | 14420 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14659 } | 14587 } |
| 14660 | 14588 |
| 14661 | 14589 |
| 14662 const char* Stacktrace::ToCString() const { | 14590 const char* Stacktrace::ToCString() const { |
| 14663 const String& trace = String::Handle(FullStacktrace()); | 14591 const String& trace = String::Handle(FullStacktrace()); |
| 14664 return trace.ToCString(); | 14592 return trace.ToCString(); |
| 14665 } | 14593 } |
| 14666 | 14594 |
| 14667 | 14595 |
| 14668 void Stacktrace::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14596 void Stacktrace::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14669 stream->OpenObject(); | 14597 JSONObject jsobj(stream); |
| 14670 stream->CloseObject(); | |
| 14671 } | 14598 } |
| 14672 | 14599 |
| 14673 | 14600 |
| 14674 static intptr_t PrintOneStacktrace(Isolate* isolate, | 14601 static intptr_t PrintOneStacktrace(Isolate* isolate, |
| 14675 GrowableArray<char*>* frame_strings, | 14602 GrowableArray<char*>* frame_strings, |
| 14676 uword pc, | 14603 uword pc, |
| 14677 const Function& function, | 14604 const Function& function, |
| 14678 const Code& code, | 14605 const Code& code, |
| 14679 intptr_t frame_index) { | 14606 intptr_t frame_index) { |
| 14680 const char* kFormat = "#%-6d %s (%s:%d:%d)\n"; | 14607 const char* kFormat = "#%-6d %s (%s:%d:%d)\n"; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14857 const String& str = String::Handle(pattern()); | 14784 const String& str = String::Handle(pattern()); |
| 14858 const char* format = "JSRegExp: pattern=%s flags=%s"; | 14785 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 14859 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 14786 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 14860 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 14787 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); |
| 14861 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 14788 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 14862 return chars; | 14789 return chars; |
| 14863 } | 14790 } |
| 14864 | 14791 |
| 14865 | 14792 |
| 14866 void JSRegExp::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14793 void JSRegExp::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14867 stream->OpenObject(); | 14794 JSONObject jsobj(stream); |
| 14868 stream->CloseObject(); | |
| 14869 } | 14795 } |
| 14870 | 14796 |
| 14871 | 14797 |
| 14872 RawWeakProperty* WeakProperty::New(Heap::Space space) { | 14798 RawWeakProperty* WeakProperty::New(Heap::Space space) { |
| 14873 ASSERT(Isolate::Current()->object_store()->weak_property_class() | 14799 ASSERT(Isolate::Current()->object_store()->weak_property_class() |
| 14874 != Class::null()); | 14800 != Class::null()); |
| 14875 RawObject* raw = Object::Allocate(WeakProperty::kClassId, | 14801 RawObject* raw = Object::Allocate(WeakProperty::kClassId, |
| 14876 WeakProperty::InstanceSize(), | 14802 WeakProperty::InstanceSize(), |
| 14877 space); | 14803 space); |
| 14878 return reinterpret_cast<RawWeakProperty*>(raw); | 14804 return reinterpret_cast<RawWeakProperty*>(raw); |
| 14879 } | 14805 } |
| 14880 | 14806 |
| 14881 | 14807 |
| 14882 const char* WeakProperty::ToCString() const { | 14808 const char* WeakProperty::ToCString() const { |
| 14883 return "_WeakProperty"; | 14809 return "_WeakProperty"; |
| 14884 } | 14810 } |
| 14885 | 14811 |
| 14886 | 14812 |
| 14887 void WeakProperty::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14813 void WeakProperty::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14888 stream->OpenObject(); | 14814 JSONObject jsobj(stream); |
| 14889 stream->CloseObject(); | |
| 14890 } | 14815 } |
| 14891 | 14816 |
| 14892 RawAbstractType* MirrorReference::GetAbstractTypeReferent() const { | 14817 RawAbstractType* MirrorReference::GetAbstractTypeReferent() const { |
| 14893 ASSERT(Object::Handle(referent()).IsAbstractType()); | 14818 ASSERT(Object::Handle(referent()).IsAbstractType()); |
| 14894 return AbstractType::Cast(Object::Handle(referent())).raw(); | 14819 return AbstractType::Cast(Object::Handle(referent())).raw(); |
| 14895 } | 14820 } |
| 14896 | 14821 |
| 14897 | 14822 |
| 14898 RawClass* MirrorReference::GetClassReferent() const { | 14823 RawClass* MirrorReference::GetClassReferent() const { |
| 14899 ASSERT(Object::Handle(referent()).IsClass()); | 14824 ASSERT(Object::Handle(referent()).IsClass()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14941 return result.raw(); | 14866 return result.raw(); |
| 14942 } | 14867 } |
| 14943 | 14868 |
| 14944 | 14869 |
| 14945 const char* MirrorReference::ToCString() const { | 14870 const char* MirrorReference::ToCString() const { |
| 14946 return "_MirrorReference"; | 14871 return "_MirrorReference"; |
| 14947 } | 14872 } |
| 14948 | 14873 |
| 14949 | 14874 |
| 14950 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14875 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14951 stream->OpenObject(); | 14876 JSONObject jsobj(stream); |
| 14952 stream->CloseObject(); | |
| 14953 } | 14877 } |
| 14954 | 14878 |
| 14955 | 14879 |
| 14956 } // namespace dart | 14880 } // namespace dart |
| OLD | NEW |