| 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 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 | 1717 |
| 1718 return Error::null(); | 1718 return Error::null(); |
| 1719 } | 1719 } |
| 1720 | 1720 |
| 1721 | 1721 |
| 1722 void Object::Print() const { | 1722 void Object::Print() const { |
| 1723 THR_Print("%s\n", ToCString()); | 1723 THR_Print("%s\n", ToCString()); |
| 1724 } | 1724 } |
| 1725 | 1725 |
| 1726 | 1726 |
| 1727 static void AddNameProperties(JSONObject* jsobj, | |
| 1728 const String& name, | |
| 1729 const String& vm_name) { | |
| 1730 jsobj->AddProperty("name", name.ToCString()); | |
| 1731 if (!name.Equals(vm_name)) { | |
| 1732 jsobj->AddProperty("_vmName", vm_name.ToCString()); | |
| 1733 } | |
| 1734 } | |
| 1735 | |
| 1736 | |
| 1737 void Object::AddCommonObjectProperties(JSONObject* jsobj, | |
| 1738 const char* protocol_type, | |
| 1739 bool ref) const { | |
| 1740 const char* vm_type = JSONType(); | |
| 1741 bool same_type = (strcmp(protocol_type, vm_type) == 0); | |
| 1742 if (ref) { | |
| 1743 jsobj->AddPropertyF("type", "@%s", protocol_type); | |
| 1744 } else { | |
| 1745 jsobj->AddProperty("type", protocol_type); | |
| 1746 } | |
| 1747 if (!same_type) { | |
| 1748 jsobj->AddProperty("_vmType", vm_type); | |
| 1749 } | |
| 1750 if (!ref || IsInstance() || IsNull()) { | |
| 1751 // TODO(turnidge): Provide the type arguments here too? | |
| 1752 const Class& cls = Class::Handle(this->clazz()); | |
| 1753 jsobj->AddProperty("class", cls); | |
| 1754 } | |
| 1755 if (!ref) { | |
| 1756 if (raw()->IsHeapObject()) { | |
| 1757 jsobj->AddProperty("size", raw()->Size()); | |
| 1758 } else { | |
| 1759 jsobj->AddProperty("size", (intptr_t)0); | |
| 1760 } | |
| 1761 } | |
| 1762 } | |
| 1763 | |
| 1764 | |
| 1765 void Object::PrintJSON(JSONStream* stream, bool ref) const { | |
| 1766 if (IsNull()) { | |
| 1767 JSONObject jsobj(stream); | |
| 1768 AddCommonObjectProperties(&jsobj, "Instance", ref); | |
| 1769 jsobj.AddProperty("kind", "Null"); | |
| 1770 jsobj.AddFixedServiceId("objects/null"); | |
| 1771 jsobj.AddProperty("valueAsString", "null"); | |
| 1772 } else { | |
| 1773 PrintJSONImpl(stream, ref); | |
| 1774 } | |
| 1775 } | |
| 1776 | |
| 1777 | |
| 1778 void Object::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 1779 JSONObject jsobj(stream); | |
| 1780 AddCommonObjectProperties(&jsobj, "Object", ref); | |
| 1781 jsobj.AddServiceId(*this); | |
| 1782 if (ref) { | |
| 1783 return; | |
| 1784 } | |
| 1785 } | |
| 1786 | |
| 1787 | |
| 1788 RawString* Object::DictionaryName() const { | 1727 RawString* Object::DictionaryName() const { |
| 1789 return String::null(); | 1728 return String::null(); |
| 1790 } | 1729 } |
| 1791 | 1730 |
| 1792 | 1731 |
| 1793 void Object::InitializeObject(uword address, | 1732 void Object::InitializeObject(uword address, |
| 1794 intptr_t class_id, | 1733 intptr_t class_id, |
| 1795 intptr_t size, | 1734 intptr_t size, |
| 1796 bool is_vm_object) { | 1735 bool is_vm_object) { |
| 1797 uword initial_value = (class_id == kInstructionsCid) | 1736 uword initial_value = (class_id == kInstructionsCid) |
| (...skipping 2329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4127 const char* Class::ToCString() const { | 4066 const char* Class::ToCString() const { |
| 4128 const Library& lib = Library::Handle(library()); | 4067 const Library& lib = Library::Handle(library()); |
| 4129 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); | 4068 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); |
| 4130 const char* patch_prefix = is_patch() ? "Patch " : ""; | 4069 const char* patch_prefix = is_patch() ? "Patch " : ""; |
| 4131 const char* class_name = String::Handle(Name()).ToCString(); | 4070 const char* class_name = String::Handle(Name()).ToCString(); |
| 4132 return OS::SCreate(Thread::Current()->zone(), | 4071 return OS::SCreate(Thread::Current()->zone(), |
| 4133 "%s %sClass: %s", library_name, patch_prefix, class_name); | 4072 "%s %sClass: %s", library_name, patch_prefix, class_name); |
| 4134 } | 4073 } |
| 4135 | 4074 |
| 4136 | 4075 |
| 4137 void Class::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 4138 Isolate* isolate = Isolate::Current(); | |
| 4139 JSONObject jsobj(stream); | |
| 4140 if ((raw() == Class::null()) || (id() == kFreeListElement)) { | |
| 4141 // TODO(turnidge): This is weird and needs to be changed. | |
| 4142 jsobj.AddProperty("type", "null"); | |
| 4143 return; | |
| 4144 } | |
| 4145 AddCommonObjectProperties(&jsobj, "Class", ref); | |
| 4146 jsobj.AddFixedServiceId("classes/%" Pd "", id()); | |
| 4147 const String& user_name = String::Handle(PrettyName()); | |
| 4148 const String& vm_name = String::Handle(Name()); | |
| 4149 AddNameProperties(&jsobj, user_name, vm_name); | |
| 4150 if (ref) { | |
| 4151 return; | |
| 4152 } | |
| 4153 | |
| 4154 const Error& err = Error::Handle(EnsureIsFinalized(Thread::Current())); | |
| 4155 if (!err.IsNull()) { | |
| 4156 jsobj.AddProperty("error", err); | |
| 4157 } | |
| 4158 jsobj.AddProperty("abstract", is_abstract()); | |
| 4159 jsobj.AddProperty("const", is_const()); | |
| 4160 jsobj.AddProperty("_finalized", is_finalized()); | |
| 4161 jsobj.AddProperty("_implemented", is_implemented()); | |
| 4162 jsobj.AddProperty("_patch", is_patch()); | |
| 4163 jsobj.AddProperty("_traceAllocations", TraceAllocation(isolate)); | |
| 4164 const Class& superClass = Class::Handle(SuperClass()); | |
| 4165 if (!superClass.IsNull()) { | |
| 4166 jsobj.AddProperty("super", superClass); | |
| 4167 } | |
| 4168 jsobj.AddProperty("library", Object::Handle(library())); | |
| 4169 const Script& script = Script::Handle(this->script()); | |
| 4170 if (!script.IsNull()) { | |
| 4171 jsobj.AddLocation(script, token_pos(), ComputeEndTokenPos()); | |
| 4172 } | |
| 4173 { | |
| 4174 JSONArray interfaces_array(&jsobj, "interfaces"); | |
| 4175 const Array& interface_array = Array::Handle(interfaces()); | |
| 4176 Type& interface_type = Type::Handle(); | |
| 4177 if (!interface_array.IsNull()) { | |
| 4178 for (intptr_t i = 0; i < interface_array.Length(); ++i) { | |
| 4179 interface_type ^= interface_array.At(i); | |
| 4180 interfaces_array.AddValue(interface_type); | |
| 4181 } | |
| 4182 } | |
| 4183 } | |
| 4184 { | |
| 4185 JSONArray fields_array(&jsobj, "fields"); | |
| 4186 const Array& field_array = Array::Handle(fields()); | |
| 4187 Field& field = Field::Handle(); | |
| 4188 if (!field_array.IsNull()) { | |
| 4189 for (intptr_t i = 0; i < field_array.Length(); ++i) { | |
| 4190 field ^= field_array.At(i); | |
| 4191 fields_array.AddValue(field); | |
| 4192 } | |
| 4193 } | |
| 4194 } | |
| 4195 { | |
| 4196 JSONArray functions_array(&jsobj, "functions"); | |
| 4197 const Array& function_array = Array::Handle(functions()); | |
| 4198 Function& function = Function::Handle(); | |
| 4199 if (!function_array.IsNull()) { | |
| 4200 for (intptr_t i = 0; i < function_array.Length(); i++) { | |
| 4201 function ^= function_array.At(i); | |
| 4202 functions_array.AddValue(function); | |
| 4203 } | |
| 4204 } | |
| 4205 } | |
| 4206 { | |
| 4207 JSONArray subclasses_array(&jsobj, "subclasses"); | |
| 4208 const GrowableObjectArray& subclasses = | |
| 4209 GrowableObjectArray::Handle(direct_subclasses()); | |
| 4210 if (!subclasses.IsNull()) { | |
| 4211 Class& subclass = Class::Handle(); | |
| 4212 for (intptr_t i = 0; i < subclasses.Length(); ++i) { | |
| 4213 // TODO(turnidge): Use the Type directly once regis has added | |
| 4214 // types to the vmservice. | |
| 4215 subclass ^= subclasses.At(i); | |
| 4216 subclasses_array.AddValue(subclass); | |
| 4217 } | |
| 4218 } | |
| 4219 } | |
| 4220 { | |
| 4221 ClassTable* class_table = Isolate::Current()->class_table(); | |
| 4222 const ClassHeapStats* stats = class_table->StatsWithUpdatedSize(id()); | |
| 4223 if (stats != NULL) { | |
| 4224 JSONObject allocation_stats(&jsobj, "_allocationStats"); | |
| 4225 stats->PrintToJSONObject(*this, &allocation_stats); | |
| 4226 } | |
| 4227 } | |
| 4228 } | |
| 4229 | |
| 4230 | |
| 4231 void Class::InsertCanonicalConstant(intptr_t index, | 4076 void Class::InsertCanonicalConstant(intptr_t index, |
| 4232 const Instance& constant) const { | 4077 const Instance& constant) const { |
| 4233 // The constant needs to be added to the list. Grow the list if it is full. | 4078 // The constant needs to be added to the list. Grow the list if it is full. |
| 4234 Array& canonical_list = Array::Handle(constants()); | 4079 Array& canonical_list = Array::Handle(constants()); |
| 4235 const intptr_t list_len = canonical_list.Length(); | 4080 const intptr_t list_len = canonical_list.Length(); |
| 4236 if (index >= list_len) { | 4081 if (index >= list_len) { |
| 4237 const intptr_t new_length = (list_len == 0) ? 4 : list_len + 4; | 4082 const intptr_t new_length = (list_len == 0) ? 4 : list_len + 4; |
| 4238 const Array& new_canonical_list = | 4083 const Array& new_canonical_list = |
| 4239 Array::Handle(Array::Grow(canonical_list, new_length, Heap::kOld)); | 4084 Array::Handle(Array::Grow(canonical_list, new_length, Heap::kOld)); |
| 4240 set_constants(new_canonical_list); | 4085 set_constants(new_canonical_list); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4299 } | 4144 } |
| 4300 | 4145 |
| 4301 | 4146 |
| 4302 const char* UnresolvedClass::ToCString() const { | 4147 const char* UnresolvedClass::ToCString() const { |
| 4303 const char* cname = String::Handle(Name()).ToCString(); | 4148 const char* cname = String::Handle(Name()).ToCString(); |
| 4304 return OS::SCreate(Thread::Current()->zone(), | 4149 return OS::SCreate(Thread::Current()->zone(), |
| 4305 "unresolved class '%s'", cname); | 4150 "unresolved class '%s'", cname); |
| 4306 } | 4151 } |
| 4307 | 4152 |
| 4308 | 4153 |
| 4309 void UnresolvedClass::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 4310 Object::PrintJSONImpl(stream, ref); | |
| 4311 } | |
| 4312 | |
| 4313 | |
| 4314 static uint32_t CombineHashes(uint32_t hash, uint32_t other_hash) { | 4154 static uint32_t CombineHashes(uint32_t hash, uint32_t other_hash) { |
| 4315 hash += other_hash; | 4155 hash += other_hash; |
| 4316 hash += hash << 10; | 4156 hash += hash << 10; |
| 4317 hash ^= hash >> 6; // Logical shift, unsigned hash. | 4157 hash ^= hash >> 6; // Logical shift, unsigned hash. |
| 4318 return hash; | 4158 return hash; |
| 4319 } | 4159 } |
| 4320 | 4160 |
| 4321 | 4161 |
| 4322 static uint32_t FinalizeHash(uint32_t hash) { | 4162 static uint32_t FinalizeHash(uint32_t hash) { |
| 4323 hash += hash << 3; | 4163 hash += hash << 3; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4454 other_type = other.TypeAt(from_index + i); | 4294 other_type = other.TypeAt(from_index + i); |
| 4455 ASSERT(!other_type.IsNull()); | 4295 ASSERT(!other_type.IsNull()); |
| 4456 if (!type.TypeTest(test_kind, other_type, bound_error, space)) { | 4296 if (!type.TypeTest(test_kind, other_type, bound_error, space)) { |
| 4457 return false; | 4297 return false; |
| 4458 } | 4298 } |
| 4459 } | 4299 } |
| 4460 return true; | 4300 return true; |
| 4461 } | 4301 } |
| 4462 | 4302 |
| 4463 | 4303 |
| 4464 void TypeArguments::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 4465 JSONObject jsobj(stream); | |
| 4466 // The index in the canonical_type_arguments table cannot be used as part of | |
| 4467 // the object id (as in typearguments/id), because the indices are not | |
| 4468 // preserved when the table grows and the entries get rehashed. Use the ring. | |
| 4469 Isolate* isolate = Isolate::Current(); | |
| 4470 ObjectStore* object_store = isolate->object_store(); | |
| 4471 const Array& table = Array::Handle(object_store->canonical_type_arguments()); | |
| 4472 ASSERT(table.Length() > 0); | |
| 4473 AddCommonObjectProperties(&jsobj, "TypeArguments", ref); | |
| 4474 jsobj.AddServiceId(*this); | |
| 4475 const String& user_name = String::Handle(PrettyName()); | |
| 4476 const String& vm_name = String::Handle(Name()); | |
| 4477 AddNameProperties(&jsobj, user_name, vm_name); | |
| 4478 if (ref) { | |
| 4479 return; | |
| 4480 } | |
| 4481 { | |
| 4482 JSONArray jsarr(&jsobj, "types"); | |
| 4483 AbstractType& type_arg = AbstractType::Handle(); | |
| 4484 for (intptr_t i = 0; i < Length(); i++) { | |
| 4485 type_arg = TypeAt(i); | |
| 4486 jsarr.AddValue(type_arg); | |
| 4487 } | |
| 4488 } | |
| 4489 if (!IsInstantiated()) { | |
| 4490 JSONArray jsarr(&jsobj, "_instantiations"); | |
| 4491 Array& prior_instantiations = Array::Handle(instantiations()); | |
| 4492 ASSERT(prior_instantiations.Length() > 0); // Always at least a sentinel. | |
| 4493 TypeArguments& type_args = TypeArguments::Handle(); | |
| 4494 intptr_t i = 0; | |
| 4495 while (true) { | |
| 4496 if (prior_instantiations.At(i) == Smi::New(StubCode::kNoInstantiator)) { | |
| 4497 break; | |
| 4498 } | |
| 4499 JSONObject instantiation(&jsarr); | |
| 4500 type_args ^= prior_instantiations.At(i); | |
| 4501 instantiation.AddProperty("instantiator", type_args, true); | |
| 4502 type_args ^= prior_instantiations.At(i + 1); | |
| 4503 instantiation.AddProperty("instantiated", type_args, true); | |
| 4504 i += 2; | |
| 4505 } | |
| 4506 } | |
| 4507 } | |
| 4508 | |
| 4509 | |
| 4510 bool TypeArguments::HasInstantiations() const { | 4304 bool TypeArguments::HasInstantiations() const { |
| 4511 const Array& prior_instantiations = Array::Handle(instantiations()); | 4305 const Array& prior_instantiations = Array::Handle(instantiations()); |
| 4512 ASSERT(prior_instantiations.Length() > 0); // Always at least a sentinel. | 4306 ASSERT(prior_instantiations.Length() > 0); // Always at least a sentinel. |
| 4513 return prior_instantiations.Length() > 1; | 4307 return prior_instantiations.Length() > 1; |
| 4514 } | 4308 } |
| 4515 | 4309 |
| 4516 | 4310 |
| 4517 intptr_t TypeArguments::NumInstantiations() const { | 4311 intptr_t TypeArguments::NumInstantiations() const { |
| 4518 const Array& prior_instantiations = Array::Handle(instantiations()); | 4312 const Array& prior_instantiations = Array::Handle(instantiations()); |
| 4519 ASSERT(prior_instantiations.Length() > 0); // Always at least a sentinel. | 4313 ASSERT(prior_instantiations.Length() > 0); // Always at least a sentinel. |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5067 | 4861 |
| 5068 | 4862 |
| 5069 const char* PatchClass::ToCString() const { | 4863 const char* PatchClass::ToCString() const { |
| 5070 const Class& cls = Class::Handle(patched_class()); | 4864 const Class& cls = Class::Handle(patched_class()); |
| 5071 const char* cls_name = cls.ToCString(); | 4865 const char* cls_name = cls.ToCString(); |
| 5072 return OS::SCreate(Thread::Current()->zone(), | 4866 return OS::SCreate(Thread::Current()->zone(), |
| 5073 "PatchClass for %s", cls_name); | 4867 "PatchClass for %s", cls_name); |
| 5074 } | 4868 } |
| 5075 | 4869 |
| 5076 | 4870 |
| 5077 void PatchClass::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 5078 Object::PrintJSONImpl(stream, ref); | |
| 5079 } | |
| 5080 | |
| 5081 | |
| 5082 RawPatchClass* PatchClass::New(const Class& patched_class, | 4871 RawPatchClass* PatchClass::New(const Class& patched_class, |
| 5083 const Class& origin_class) { | 4872 const Class& origin_class) { |
| 5084 const PatchClass& result = PatchClass::Handle(PatchClass::New()); | 4873 const PatchClass& result = PatchClass::Handle(PatchClass::New()); |
| 5085 result.set_patched_class(patched_class); | 4874 result.set_patched_class(patched_class); |
| 5086 result.set_origin_class(origin_class); | 4875 result.set_origin_class(origin_class); |
| 5087 result.set_script(Script::Handle(origin_class.script())); | 4876 result.set_script(Script::Handle(origin_class.script())); |
| 5088 return result.raw(); | 4877 return result.raw(); |
| 5089 } | 4878 } |
| 5090 | 4879 |
| 5091 | 4880 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 5117 StorePointer(&raw_ptr()->origin_class_, value.raw()); | 4906 StorePointer(&raw_ptr()->origin_class_, value.raw()); |
| 5118 } | 4907 } |
| 5119 | 4908 |
| 5120 | 4909 |
| 5121 void PatchClass::set_script(const Script& value) const { | 4910 void PatchClass::set_script(const Script& value) const { |
| 5122 StorePointer(&raw_ptr()->script_, value.raw()); | 4911 StorePointer(&raw_ptr()->script_, value.raw()); |
| 5123 } | 4912 } |
| 5124 | 4913 |
| 5125 | 4914 |
| 5126 bool Function::HasBreakpoint() const { | 4915 bool Function::HasBreakpoint() const { |
| 4916 if (!FLAG_support_debugger) { |
| 4917 return false; |
| 4918 } |
| 5127 Thread* thread = Thread::Current(); | 4919 Thread* thread = Thread::Current(); |
| 5128 return thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone()); | 4920 return thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone()); |
| 5129 } | 4921 } |
| 5130 | 4922 |
| 5131 | 4923 |
| 5132 void Function::InstallOptimizedCode(const Code& code, bool is_osr) const { | 4924 void Function::InstallOptimizedCode(const Code& code, bool is_osr) const { |
| 5133 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); | 4925 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); |
| 5134 // We may not have previous code if 'always_optimize' is set. | 4926 // We may not have previous code if 'always_optimize' is set. |
| 5135 if (!is_osr && HasCode()) { | 4927 if (!is_osr && HasCode()) { |
| 5136 Code::Handle(CurrentCode()).DisableDartCode(); | 4928 Code::Handle(CurrentCode()).DisableDartCode(); |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5777 void Function::SetIsNativeAutoSetupScope(bool value) const { | 5569 void Function::SetIsNativeAutoSetupScope(bool value) const { |
| 5778 ASSERT(is_native()); | 5570 ASSERT(is_native()); |
| 5779 set_is_optimizable(value); | 5571 set_is_optimizable(value); |
| 5780 } | 5572 } |
| 5781 | 5573 |
| 5782 | 5574 |
| 5783 bool Function::CanBeInlined() const { | 5575 bool Function::CanBeInlined() const { |
| 5784 Thread* thread = Thread::Current(); | 5576 Thread* thread = Thread::Current(); |
| 5785 return is_inlinable() && | 5577 return is_inlinable() && |
| 5786 !is_generated_body() && | 5578 !is_generated_body() && |
| 5787 !thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone()); | 5579 (!FLAG_support_debugger || |
| 5580 !thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone())); |
| 5788 } | 5581 } |
| 5789 | 5582 |
| 5790 | 5583 |
| 5791 intptr_t Function::NumParameters() const { | 5584 intptr_t Function::NumParameters() const { |
| 5792 return num_fixed_parameters() + NumOptionalParameters(); | 5585 return num_fixed_parameters() + NumOptionalParameters(); |
| 5793 } | 5586 } |
| 5794 | 5587 |
| 5795 | 5588 |
| 5796 intptr_t Function::NumImplicitParameters() const { | 5589 intptr_t Function::NumImplicitParameters() const { |
| 5797 if (kind() == RawFunction::kConstructor) { | 5590 if (kind() == RawFunction::kConstructor) { |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7055 default: | 6848 default: |
| 7056 UNREACHABLE(); | 6849 UNREACHABLE(); |
| 7057 } | 6850 } |
| 7058 const char* function_name = String::Handle(name()).ToCString(); | 6851 const char* function_name = String::Handle(name()).ToCString(); |
| 7059 return OS::SCreate(Thread::Current()->zone(), | 6852 return OS::SCreate(Thread::Current()->zone(), |
| 7060 "Function '%s':%s%s%s%s.", | 6853 "Function '%s':%s%s%s%s.", |
| 7061 function_name, static_str, abstract_str, kind_str, const_str); | 6854 function_name, static_str, abstract_str, kind_str, const_str); |
| 7062 } | 6855 } |
| 7063 | 6856 |
| 7064 | 6857 |
| 7065 static void AddFunctionServiceId(const JSONObject& jsobj, | |
| 7066 const Function& f, | |
| 7067 const Class& cls) { | |
| 7068 // Special kinds of functions use indices in their respective lists. | |
| 7069 intptr_t id = -1; | |
| 7070 const char* selector = NULL; | |
| 7071 if (f.IsNonImplicitClosureFunction()) { | |
| 7072 id = Isolate::Current()->FindClosureIndex(f); | |
| 7073 selector = "closures"; | |
| 7074 } else if (f.IsImplicitClosureFunction()) { | |
| 7075 id = cls.FindImplicitClosureFunctionIndex(f); | |
| 7076 selector = "implicit_closures"; | |
| 7077 } else if (f.IsNoSuchMethodDispatcher() || f.IsInvokeFieldDispatcher()) { | |
| 7078 id = cls.FindInvocationDispatcherFunctionIndex(f); | |
| 7079 selector = "dispatchers"; | |
| 7080 } | |
| 7081 if (id != -1) { | |
| 7082 ASSERT(selector != NULL); | |
| 7083 jsobj.AddFixedServiceId("classes/%" Pd "/%s/%" Pd "", | |
| 7084 cls.id(), selector, id); | |
| 7085 return; | |
| 7086 } | |
| 7087 // Regular functions known to their owner use their name (percent-encoded). | |
| 7088 String& name = String::Handle(f.name()); | |
| 7089 if (cls.LookupFunction(name) == f.raw()) { | |
| 7090 name = String::EncodeIRI(name); | |
| 7091 jsobj.AddFixedServiceId("classes/%" Pd "/functions/%s", | |
| 7092 cls.id(), name.ToCString()); | |
| 7093 return; | |
| 7094 } | |
| 7095 // Oddball functions (not known to their owner) fall back to use the object | |
| 7096 // id ring. Current known examples are signature functions of closures | |
| 7097 // and stubs like 'megamorphic_miss'. | |
| 7098 jsobj.AddServiceId(f); | |
| 7099 } | |
| 7100 | |
| 7101 | |
| 7102 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 7103 Class& cls = Class::Handle(Owner()); | |
| 7104 ASSERT(!cls.IsNull()); | |
| 7105 Error& err = Error::Handle(); | |
| 7106 err ^= cls.EnsureIsFinalized(Thread::Current()); | |
| 7107 ASSERT(err.IsNull()); | |
| 7108 JSONObject jsobj(stream); | |
| 7109 AddCommonObjectProperties(&jsobj, "Function", ref); | |
| 7110 AddFunctionServiceId(jsobj, *this, cls); | |
| 7111 const String& user_name = String::Handle(PrettyName()); | |
| 7112 const String& vm_name = String::Handle(name()); | |
| 7113 AddNameProperties(&jsobj, user_name, vm_name); | |
| 7114 const Function& parent = Function::Handle(parent_function()); | |
| 7115 if (!parent.IsNull()) { | |
| 7116 jsobj.AddProperty("owner", parent); | |
| 7117 } else if (cls.IsTopLevel()) { | |
| 7118 const Library& library = Library::Handle(cls.library()); | |
| 7119 jsobj.AddProperty("owner", library); | |
| 7120 } else { | |
| 7121 jsobj.AddProperty("owner", cls); | |
| 7122 } | |
| 7123 | |
| 7124 const char* kind_string = Function::KindToCString(kind()); | |
| 7125 jsobj.AddProperty("_kind", kind_string); | |
| 7126 jsobj.AddProperty("static", is_static()); | |
| 7127 jsobj.AddProperty("const", is_const()); | |
| 7128 jsobj.AddProperty("_intrinsic", is_intrinsic()); | |
| 7129 jsobj.AddProperty("_native", is_native()); | |
| 7130 if (ref) { | |
| 7131 return; | |
| 7132 } | |
| 7133 Code& code = Code::Handle(CurrentCode()); | |
| 7134 if (!code.IsNull()) { | |
| 7135 jsobj.AddProperty("code", code); | |
| 7136 } | |
| 7137 Array& ics = Array::Handle(ic_data_array()); | |
| 7138 if (!ics.IsNull()) { | |
| 7139 jsobj.AddProperty("_icDataArray", ics); | |
| 7140 } | |
| 7141 jsobj.AddProperty("_optimizable", is_optimizable()); | |
| 7142 jsobj.AddProperty("_inlinable", is_inlinable()); | |
| 7143 jsobj.AddProperty("_recognized", IsRecognized()); | |
| 7144 code = unoptimized_code(); | |
| 7145 if (!code.IsNull()) { | |
| 7146 jsobj.AddProperty("_unoptimizedCode", code); | |
| 7147 } | |
| 7148 jsobj.AddProperty("_usageCounter", usage_counter()); | |
| 7149 jsobj.AddProperty("_optimizedCallSiteCount", optimized_call_site_count()); | |
| 7150 jsobj.AddProperty("_deoptimizations", | |
| 7151 static_cast<intptr_t>(deoptimization_counter())); | |
| 7152 if ((kind() == RawFunction::kImplicitGetter) || | |
| 7153 (kind() == RawFunction::kImplicitSetter) || | |
| 7154 (kind() == RawFunction::kImplicitStaticFinalGetter)) { | |
| 7155 const Field& field = Field::Handle(LookupImplicitGetterSetterField()); | |
| 7156 if (!field.IsNull()) { | |
| 7157 jsobj.AddProperty("_field", field); | |
| 7158 } | |
| 7159 } | |
| 7160 | |
| 7161 const Script& script = Script::Handle(this->script()); | |
| 7162 if (!script.IsNull()) { | |
| 7163 jsobj.AddLocation(script, token_pos(), end_token_pos()); | |
| 7164 } | |
| 7165 } | |
| 7166 | |
| 7167 | |
| 7168 void ClosureData::set_context_scope(const ContextScope& value) const { | 6858 void ClosureData::set_context_scope(const ContextScope& value) const { |
| 7169 StorePointer(&raw_ptr()->context_scope_, value.raw()); | 6859 StorePointer(&raw_ptr()->context_scope_, value.raw()); |
| 7170 } | 6860 } |
| 7171 | 6861 |
| 7172 | 6862 |
| 7173 void ClosureData::set_implicit_static_closure(const Instance& closure) const { | 6863 void ClosureData::set_implicit_static_closure(const Instance& closure) const { |
| 7174 ASSERT(!closure.IsNull()); | 6864 ASSERT(!closure.IsNull()); |
| 7175 ASSERT(raw_ptr()->closure_ == Instance::null()); | 6865 ASSERT(raw_ptr()->closure_ == Instance::null()); |
| 7176 StorePointer(&raw_ptr()->closure_, closure.raw()); | 6866 StorePointer(&raw_ptr()->closure_, closure.raw()); |
| 7177 } | 6867 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 7194 Heap::kOld); | 6884 Heap::kOld); |
| 7195 return reinterpret_cast<RawClosureData*>(raw); | 6885 return reinterpret_cast<RawClosureData*>(raw); |
| 7196 } | 6886 } |
| 7197 | 6887 |
| 7198 | 6888 |
| 7199 const char* ClosureData::ToCString() const { | 6889 const char* ClosureData::ToCString() const { |
| 7200 return "ClosureData class"; | 6890 return "ClosureData class"; |
| 7201 } | 6891 } |
| 7202 | 6892 |
| 7203 | 6893 |
| 7204 void ClosureData::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 7205 Object::PrintJSONImpl(stream, ref); | |
| 7206 } | |
| 7207 | |
| 7208 | |
| 7209 void RedirectionData::set_type(const Type& value) const { | 6894 void RedirectionData::set_type(const Type& value) const { |
| 7210 ASSERT(!value.IsNull()); | 6895 ASSERT(!value.IsNull()); |
| 7211 StorePointer(&raw_ptr()->type_, value.raw()); | 6896 StorePointer(&raw_ptr()->type_, value.raw()); |
| 7212 } | 6897 } |
| 7213 | 6898 |
| 7214 | 6899 |
| 7215 void RedirectionData::set_identifier(const String& value) const { | 6900 void RedirectionData::set_identifier(const String& value) const { |
| 7216 StorePointer(&raw_ptr()->identifier_, value.raw()); | 6901 StorePointer(&raw_ptr()->identifier_, value.raw()); |
| 7217 } | 6902 } |
| 7218 | 6903 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 7229 Heap::kOld); | 6914 Heap::kOld); |
| 7230 return reinterpret_cast<RawRedirectionData*>(raw); | 6915 return reinterpret_cast<RawRedirectionData*>(raw); |
| 7231 } | 6916 } |
| 7232 | 6917 |
| 7233 | 6918 |
| 7234 const char* RedirectionData::ToCString() const { | 6919 const char* RedirectionData::ToCString() const { |
| 7235 return "RedirectionData class"; | 6920 return "RedirectionData class"; |
| 7236 } | 6921 } |
| 7237 | 6922 |
| 7238 | 6923 |
| 7239 void RedirectionData::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 7240 Object::PrintJSONImpl(stream, ref); | |
| 7241 } | |
| 7242 | |
| 7243 | |
| 7244 RawString* Field::GetterName(const String& field_name) { | 6924 RawString* Field::GetterName(const String& field_name) { |
| 7245 return String::Concat(Symbols::GetterPrefix(), field_name); | 6925 return String::Concat(Symbols::GetterPrefix(), field_name); |
| 7246 } | 6926 } |
| 7247 | 6927 |
| 7248 | 6928 |
| 7249 RawString* Field::GetterSymbol(const String& field_name) { | 6929 RawString* Field::GetterSymbol(const String& field_name) { |
| 7250 return Symbols::FromConcat(Symbols::GetterPrefix(), field_name); | 6930 return Symbols::FromConcat(Symbols::GetterPrefix(), field_name); |
| 7251 } | 6931 } |
| 7252 | 6932 |
| 7253 | 6933 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7479 const char* kF1 = is_final() ? " final" : ""; | 7159 const char* kF1 = is_final() ? " final" : ""; |
| 7480 const char* kF2 = is_const() ? " const" : ""; | 7160 const char* kF2 = is_const() ? " const" : ""; |
| 7481 const char* field_name = String::Handle(name()).ToCString(); | 7161 const char* field_name = String::Handle(name()).ToCString(); |
| 7482 const Class& cls = Class::Handle(owner()); | 7162 const Class& cls = Class::Handle(owner()); |
| 7483 const char* cls_name = String::Handle(cls.Name()).ToCString(); | 7163 const char* cls_name = String::Handle(cls.Name()).ToCString(); |
| 7484 return OS::SCreate(Thread::Current()->zone(), | 7164 return OS::SCreate(Thread::Current()->zone(), |
| 7485 "Field <%s.%s>:%s%s%s", cls_name, field_name, kF0, kF1, kF2); | 7165 "Field <%s.%s>:%s%s%s", cls_name, field_name, kF0, kF1, kF2); |
| 7486 } | 7166 } |
| 7487 | 7167 |
| 7488 | 7168 |
| 7489 void Field::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 7490 JSONObject jsobj(stream); | |
| 7491 Class& cls = Class::Handle(owner()); | |
| 7492 String& field_name = String::Handle(name()); | |
| 7493 field_name = String::EncodeIRI(field_name); | |
| 7494 AddCommonObjectProperties(&jsobj, "Field", ref); | |
| 7495 jsobj.AddFixedServiceId("classes/%" Pd "/fields/%s", | |
| 7496 cls.id(), field_name.ToCString()); | |
| 7497 | |
| 7498 const String& user_name = String::Handle(PrettyName()); | |
| 7499 const String& vm_name = String::Handle(name()); | |
| 7500 AddNameProperties(&jsobj, user_name, vm_name); | |
| 7501 if (cls.IsTopLevel()) { | |
| 7502 const Library& library = Library::Handle(cls.library()); | |
| 7503 jsobj.AddProperty("owner", library); | |
| 7504 } else { | |
| 7505 jsobj.AddProperty("owner", cls); | |
| 7506 } | |
| 7507 | |
| 7508 AbstractType& declared_type = AbstractType::Handle(type()); | |
| 7509 jsobj.AddProperty("declaredType", declared_type); | |
| 7510 jsobj.AddProperty("static", is_static()); | |
| 7511 jsobj.AddProperty("final", is_final()); | |
| 7512 jsobj.AddProperty("const", is_const()); | |
| 7513 if (ref) { | |
| 7514 return; | |
| 7515 } | |
| 7516 if (is_static()) { | |
| 7517 const Instance& valueObj = Instance::Handle(StaticValue()); | |
| 7518 jsobj.AddProperty("staticValue", valueObj); | |
| 7519 } | |
| 7520 | |
| 7521 jsobj.AddProperty("_guardNullable", is_nullable()); | |
| 7522 if (guarded_cid() == kIllegalCid) { | |
| 7523 jsobj.AddProperty("_guardClass", "unknown"); | |
| 7524 } else if (guarded_cid() == kDynamicCid) { | |
| 7525 jsobj.AddProperty("_guardClass", "dynamic"); | |
| 7526 } else { | |
| 7527 ClassTable* table = Isolate::Current()->class_table(); | |
| 7528 ASSERT(table->IsValidIndex(guarded_cid())); | |
| 7529 cls ^= table->At(guarded_cid()); | |
| 7530 jsobj.AddProperty("_guardClass", cls); | |
| 7531 } | |
| 7532 if (guarded_list_length() == kUnknownFixedLength) { | |
| 7533 jsobj.AddProperty("_guardLength", "unknown"); | |
| 7534 } else if (guarded_list_length() == kNoFixedLength) { | |
| 7535 jsobj.AddProperty("_guardLength", "variable"); | |
| 7536 } else { | |
| 7537 jsobj.AddProperty("_guardLength", guarded_list_length()); | |
| 7538 } | |
| 7539 const Class& origin_cls = Class::Handle(origin()); | |
| 7540 const Script& script = Script::Handle(origin_cls.script()); | |
| 7541 if (!script.IsNull()) { | |
| 7542 jsobj.AddLocation(script, token_pos()); | |
| 7543 } | |
| 7544 } | |
| 7545 | |
| 7546 | |
| 7547 // Build a closure object that gets (or sets) the contents of a static | 7169 // Build a closure object that gets (or sets) the contents of a static |
| 7548 // field f and cache the closure in a newly created static field | 7170 // field f and cache the closure in a newly created static field |
| 7549 // named #f (or #f= in case of a setter). | 7171 // named #f (or #f= in case of a setter). |
| 7550 RawInstance* Field::AccessorClosure(bool make_setter) const { | 7172 RawInstance* Field::AccessorClosure(bool make_setter) const { |
| 7551 ASSERT(is_static()); | 7173 ASSERT(is_static()); |
| 7552 const Class& field_owner = Class::Handle(owner()); | 7174 const Class& field_owner = Class::Handle(owner()); |
| 7553 | 7175 |
| 7554 String& closure_name = String::Handle(this->name()); | 7176 String& closure_name = String::Handle(this->name()); |
| 7555 closure_name = Symbols::FromConcat(Symbols::HashMark(), closure_name); | 7177 closure_name = Symbols::FromConcat(Symbols::HashMark(), closure_name); |
| 7556 if (make_setter) { | 7178 if (make_setter) { |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7938 return result.raw(); | 7560 return result.raw(); |
| 7939 } | 7561 } |
| 7940 | 7562 |
| 7941 | 7563 |
| 7942 const char* LiteralToken::ToCString() const { | 7564 const char* LiteralToken::ToCString() const { |
| 7943 const String& token = String::Handle(literal()); | 7565 const String& token = String::Handle(literal()); |
| 7944 return token.ToCString(); | 7566 return token.ToCString(); |
| 7945 } | 7567 } |
| 7946 | 7568 |
| 7947 | 7569 |
| 7948 void LiteralToken::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 7949 Object::PrintJSONImpl(stream, ref); | |
| 7950 } | |
| 7951 | |
| 7952 | |
| 7953 RawGrowableObjectArray* TokenStream::TokenObjects() const { | 7570 RawGrowableObjectArray* TokenStream::TokenObjects() const { |
| 7954 return raw_ptr()->token_objects_; | 7571 return raw_ptr()->token_objects_; |
| 7955 } | 7572 } |
| 7956 | 7573 |
| 7957 | 7574 |
| 7958 void TokenStream::SetTokenObjects(const GrowableObjectArray& value) const { | 7575 void TokenStream::SetTokenObjects(const GrowableObjectArray& value) const { |
| 7959 StorePointer(&raw_ptr()->token_objects_, value.raw()); | 7576 StorePointer(&raw_ptr()->token_objects_, value.raw()); |
| 7960 } | 7577 } |
| 7961 | 7578 |
| 7962 | 7579 |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8423 isolate->object_store()->set_token_objects(GrowableObjectArray::Handle()); | 8040 isolate->object_store()->set_token_objects(GrowableObjectArray::Handle()); |
| 8424 isolate->object_store()->set_token_objects_map(Array::null_array()); | 8041 isolate->object_store()->set_token_objects_map(Array::null_array()); |
| 8425 } | 8042 } |
| 8426 | 8043 |
| 8427 | 8044 |
| 8428 const char* TokenStream::ToCString() const { | 8045 const char* TokenStream::ToCString() const { |
| 8429 return "TokenStream"; | 8046 return "TokenStream"; |
| 8430 } | 8047 } |
| 8431 | 8048 |
| 8432 | 8049 |
| 8433 void TokenStream::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 8434 JSONObject jsobj(stream); | |
| 8435 AddCommonObjectProperties(&jsobj, "Object", ref); | |
| 8436 // TODO(johnmccutchan): Generate a stable id. TokenStreams hang off | |
| 8437 // a Script object but do not have a back reference to generate a stable id. | |
| 8438 jsobj.AddServiceId(*this); | |
| 8439 if (ref) { | |
| 8440 return; | |
| 8441 } | |
| 8442 const String& private_key = String::Handle(PrivateKey()); | |
| 8443 jsobj.AddProperty("privateKey", private_key); | |
| 8444 // TODO(johnmccutchan): Add support for printing LiteralTokens and add | |
| 8445 // them to members array. | |
| 8446 JSONArray members(&jsobj, "members"); | |
| 8447 } | |
| 8448 | |
| 8449 | |
| 8450 TokenStream::Iterator::Iterator(const TokenStream& tokens, | 8050 TokenStream::Iterator::Iterator(const TokenStream& tokens, |
| 8451 TokenPosition token_pos, | 8051 TokenPosition token_pos, |
| 8452 Iterator::StreamType stream_type) | 8052 Iterator::StreamType stream_type) |
| 8453 : tokens_(TokenStream::Handle(tokens.raw())), | 8053 : tokens_(TokenStream::Handle(tokens.raw())), |
| 8454 data_(ExternalTypedData::Handle(tokens.GetStream())), | 8054 data_(ExternalTypedData::Handle(tokens.GetStream())), |
| 8455 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), | 8055 stream_(reinterpret_cast<uint8_t*>(data_.DataAddr(0)), data_.Length()), |
| 8456 token_objects_(Array::Handle( | 8056 token_objects_(Array::Handle( |
| 8457 GrowableObjectArray::Handle(tokens.TokenObjects()).data())), | 8057 GrowableObjectArray::Handle(tokens.TokenObjects()).data())), |
| 8458 obj_(Object::Handle()), | 8058 obj_(Object::Handle()), |
| 8459 cur_token_pos_(token_pos.Pos()), | 8059 cur_token_pos_(token_pos.Pos()), |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8998 for (intptr_t j = 0; j < scripts.Length(); j++) { | 8598 for (intptr_t j = 0; j < scripts.Length(); j++) { |
| 8999 if (scripts.At(j) == raw()) { | 8599 if (scripts.At(j) == raw()) { |
| 9000 return lib.raw(); | 8600 return lib.raw(); |
| 9001 } | 8601 } |
| 9002 } | 8602 } |
| 9003 } | 8603 } |
| 9004 return Library::null(); | 8604 return Library::null(); |
| 9005 } | 8605 } |
| 9006 | 8606 |
| 9007 | 8607 |
| 9008 // See also Dart_ScriptGetTokenInfo. | |
| 9009 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 9010 JSONObject jsobj(stream); | |
| 9011 AddCommonObjectProperties(&jsobj, "Script", ref); | |
| 9012 const String& uri = String::Handle(url()); | |
| 9013 ASSERT(!uri.IsNull()); | |
| 9014 const String& encoded_uri = String::Handle(String::EncodeIRI(uri)); | |
| 9015 ASSERT(!encoded_uri.IsNull()); | |
| 9016 const Library& lib = Library::Handle(FindLibrary()); | |
| 9017 if (kind() == RawScript::kEvaluateTag) { | |
| 9018 jsobj.AddServiceId(*this); | |
| 9019 } else { | |
| 9020 ASSERT(!lib.IsNull()); | |
| 9021 jsobj.AddFixedServiceId("libraries/%" Pd "/scripts/%s", | |
| 9022 lib.index(), encoded_uri.ToCString()); | |
| 9023 } | |
| 9024 jsobj.AddPropertyStr("uri", uri); | |
| 9025 jsobj.AddProperty("_kind", GetKindAsCString()); | |
| 9026 if (ref) { | |
| 9027 return; | |
| 9028 } | |
| 9029 if (!lib.IsNull()) { | |
| 9030 jsobj.AddProperty("library", lib); | |
| 9031 } | |
| 9032 const String& source = String::Handle(Source()); | |
| 9033 jsobj.AddProperty("lineOffset", line_offset()); | |
| 9034 jsobj.AddProperty("columnOffset", col_offset()); | |
| 9035 if (!source.IsNull()) { | |
| 9036 jsobj.AddPropertyStr("source", source); | |
| 9037 } | |
| 9038 | |
| 9039 // Print the line number table | |
| 9040 if (!source.IsNull()) { | |
| 9041 JSONArray tokenPosTable(&jsobj, "tokenPosTable"); | |
| 9042 | |
| 9043 const GrowableObjectArray& lineNumberArray = | |
| 9044 GrowableObjectArray::Handle(GenerateLineNumberArray()); | |
| 9045 Object& value = Object::Handle(); | |
| 9046 intptr_t pos = 0; | |
| 9047 | |
| 9048 // Skip leading null. | |
| 9049 ASSERT(lineNumberArray.Length() > 0); | |
| 9050 value = lineNumberArray.At(pos); | |
| 9051 ASSERT(value.IsNull()); | |
| 9052 pos++; | |
| 9053 | |
| 9054 while (pos < lineNumberArray.Length()) { | |
| 9055 JSONArray lineInfo(&tokenPosTable); | |
| 9056 while (pos < lineNumberArray.Length()) { | |
| 9057 value = lineNumberArray.At(pos); | |
| 9058 pos++; | |
| 9059 if (value.IsNull()) { | |
| 9060 break; | |
| 9061 } | |
| 9062 const Smi& smi = Smi::Cast(value); | |
| 9063 lineInfo.AddValue(smi.Value()); | |
| 9064 } | |
| 9065 } | |
| 9066 } | |
| 9067 } | |
| 9068 | |
| 9069 | |
| 9070 DictionaryIterator::DictionaryIterator(const Library& library) | 8608 DictionaryIterator::DictionaryIterator(const Library& library) |
| 9071 : array_(Array::Handle(library.dictionary())), | 8609 : array_(Array::Handle(library.dictionary())), |
| 9072 // Last element in array is a Smi indicating the number of entries used. | 8610 // Last element in array is a Smi indicating the number of entries used. |
| 9073 size_(Array::Handle(library.dictionary()).Length() - 1), | 8611 size_(Array::Handle(library.dictionary()).Length() - 1), |
| 9074 next_ix_(0) { | 8612 next_ix_(0) { |
| 9075 MoveToNextObject(); | 8613 MoveToNextObject(); |
| 9076 } | 8614 } |
| 9077 | 8615 |
| 9078 | 8616 |
| 9079 RawObject* DictionaryIterator::GetNext() { | 8617 RawObject* DictionaryIterator::GetNext() { |
| (...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10459 } | 9997 } |
| 10460 | 9998 |
| 10461 | 9999 |
| 10462 const char* Library::ToCString() const { | 10000 const char* Library::ToCString() const { |
| 10463 const String& name = String::Handle(url()); | 10001 const String& name = String::Handle(url()); |
| 10464 return OS::SCreate(Thread::Current()->zone(), | 10002 return OS::SCreate(Thread::Current()->zone(), |
| 10465 "Library:'%s'", name.ToCString()); | 10003 "Library:'%s'", name.ToCString()); |
| 10466 } | 10004 } |
| 10467 | 10005 |
| 10468 | 10006 |
| 10469 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 10470 intptr_t id = index(); | |
| 10471 ASSERT(id >= 0); | |
| 10472 JSONObject jsobj(stream); | |
| 10473 AddCommonObjectProperties(&jsobj, "Library", ref); | |
| 10474 jsobj.AddFixedServiceId("libraries/%" Pd "", id); | |
| 10475 const String& vm_name = String::Handle(name()); | |
| 10476 const String& user_name = | |
| 10477 String::Handle(String::IdentifierPrettyName(vm_name)); | |
| 10478 AddNameProperties(&jsobj, user_name, vm_name); | |
| 10479 const String& library_url = String::Handle(url()); | |
| 10480 jsobj.AddPropertyStr("uri", library_url); | |
| 10481 if (ref) { | |
| 10482 return; | |
| 10483 } | |
| 10484 jsobj.AddProperty("debuggable", IsDebuggable()); | |
| 10485 { | |
| 10486 JSONArray jsarr(&jsobj, "classes"); | |
| 10487 ClassDictionaryIterator class_iter(*this); | |
| 10488 Class& klass = Class::Handle(); | |
| 10489 while (class_iter.HasNext()) { | |
| 10490 klass = class_iter.GetNextClass(); | |
| 10491 if (!klass.IsMixinApplication()) { | |
| 10492 jsarr.AddValue(klass); | |
| 10493 } | |
| 10494 } | |
| 10495 } | |
| 10496 { | |
| 10497 JSONArray jsarr(&jsobj, "dependencies"); | |
| 10498 | |
| 10499 Array& ports = Array::Handle(); | |
| 10500 Namespace& ns = Namespace::Handle(); | |
| 10501 Library& target = Library::Handle(); | |
| 10502 | |
| 10503 // Unprefixed imports. | |
| 10504 ports = imports(); | |
| 10505 for (intptr_t i = 0; i < ports.Length(); i++) { | |
| 10506 ns ^= ports.At(i); | |
| 10507 if (ns.IsNull()) continue; | |
| 10508 | |
| 10509 JSONObject jsdep(&jsarr); | |
| 10510 jsdep.AddProperty("isDeferred", false); | |
| 10511 jsdep.AddProperty("isExport", false); | |
| 10512 jsdep.AddProperty("isImport", true); | |
| 10513 target = ns.library(); | |
| 10514 jsdep.AddProperty("target", target); | |
| 10515 } | |
| 10516 | |
| 10517 // Exports. | |
| 10518 ports = exports(); | |
| 10519 for (intptr_t i = 0; i < ports.Length(); i++) { | |
| 10520 ns ^= ports.At(i); | |
| 10521 if (ns.IsNull()) continue; | |
| 10522 | |
| 10523 JSONObject jsdep(&jsarr); | |
| 10524 jsdep.AddProperty("isDeferred", false); | |
| 10525 jsdep.AddProperty("isExport", true); | |
| 10526 jsdep.AddProperty("isImport", false); | |
| 10527 target = ns.library(); | |
| 10528 jsdep.AddProperty("target", target); | |
| 10529 } | |
| 10530 | |
| 10531 // Prefixed imports. | |
| 10532 DictionaryIterator entries(*this); | |
| 10533 Object& entry = Object::Handle(); | |
| 10534 LibraryPrefix& prefix = LibraryPrefix::Handle(); | |
| 10535 String& prefixName = String::Handle(); | |
| 10536 while (entries.HasNext()) { | |
| 10537 entry = entries.GetNext(); | |
| 10538 if (entry.IsLibraryPrefix()) { | |
| 10539 prefix ^= entry.raw(); | |
| 10540 ports = prefix.imports(); | |
| 10541 for (intptr_t i = 0; i < ports.Length(); i++) { | |
| 10542 ns ^= ports.At(i); | |
| 10543 if (ns.IsNull()) continue; | |
| 10544 | |
| 10545 JSONObject jsdep(&jsarr); | |
| 10546 jsdep.AddProperty("isDeferred", prefix.is_deferred_load()); | |
| 10547 jsdep.AddProperty("isExport", false); | |
| 10548 jsdep.AddProperty("isImport", true); | |
| 10549 prefixName = prefix.name(); | |
| 10550 ASSERT(!prefixName.IsNull()); | |
| 10551 jsdep.AddProperty("prefix", prefixName.ToCString()); | |
| 10552 target = ns.library(); | |
| 10553 jsdep.AddProperty("target", target); | |
| 10554 } | |
| 10555 } | |
| 10556 } | |
| 10557 } | |
| 10558 { | |
| 10559 JSONArray jsarr(&jsobj, "variables"); | |
| 10560 DictionaryIterator entries(*this); | |
| 10561 Object& entry = Object::Handle(); | |
| 10562 while (entries.HasNext()) { | |
| 10563 entry = entries.GetNext(); | |
| 10564 if (entry.IsField()) { | |
| 10565 jsarr.AddValue(entry); | |
| 10566 } | |
| 10567 } | |
| 10568 } | |
| 10569 { | |
| 10570 JSONArray jsarr(&jsobj, "functions"); | |
| 10571 DictionaryIterator entries(*this); | |
| 10572 Object& entry = Object::Handle(); | |
| 10573 while (entries.HasNext()) { | |
| 10574 entry = entries.GetNext(); | |
| 10575 if (entry.IsFunction()) { | |
| 10576 const Function& func = Function::Cast(entry); | |
| 10577 if (func.kind() == RawFunction::kRegularFunction || | |
| 10578 func.kind() == RawFunction::kGetterFunction || | |
| 10579 func.kind() == RawFunction::kSetterFunction) { | |
| 10580 jsarr.AddValue(func); | |
| 10581 } | |
| 10582 } | |
| 10583 } | |
| 10584 } | |
| 10585 { | |
| 10586 JSONArray jsarr(&jsobj, "scripts"); | |
| 10587 Array& scripts = Array::Handle(LoadedScripts()); | |
| 10588 Script& script = Script::Handle(); | |
| 10589 for (intptr_t i = 0; i < scripts.Length(); i++) { | |
| 10590 script ^= scripts.At(i); | |
| 10591 jsarr.AddValue(script); | |
| 10592 } | |
| 10593 } | |
| 10594 } | |
| 10595 | |
| 10596 | |
| 10597 RawLibrary* LibraryPrefix::GetLibrary(int index) const { | 10007 RawLibrary* LibraryPrefix::GetLibrary(int index) const { |
| 10598 if ((index >= 0) || (index < num_imports())) { | 10008 if ((index >= 0) || (index < num_imports())) { |
| 10599 const Array& imports = Array::Handle(this->imports()); | 10009 const Array& imports = Array::Handle(this->imports()); |
| 10600 Namespace& import = Namespace::Handle(); | 10010 Namespace& import = Namespace::Handle(); |
| 10601 import ^= imports.At(index); | 10011 import ^= imports.At(index); |
| 10602 return import.library(); | 10012 return import.library(); |
| 10603 } | 10013 } |
| 10604 return Library::null(); | 10014 return Library::null(); |
| 10605 } | 10015 } |
| 10606 | 10016 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10881 } | 10291 } |
| 10882 | 10292 |
| 10883 | 10293 |
| 10884 const char* LibraryPrefix::ToCString() const { | 10294 const char* LibraryPrefix::ToCString() const { |
| 10885 const String& prefix = String::Handle(name()); | 10295 const String& prefix = String::Handle(name()); |
| 10886 return OS::SCreate(Thread::Current()->zone(), | 10296 return OS::SCreate(Thread::Current()->zone(), |
| 10887 "LibraryPrefix:'%s'", prefix.ToCString()); | 10297 "LibraryPrefix:'%s'", prefix.ToCString()); |
| 10888 } | 10298 } |
| 10889 | 10299 |
| 10890 | 10300 |
| 10891 void LibraryPrefix::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 10892 Object::PrintJSONImpl(stream, ref); | |
| 10893 } | |
| 10894 | |
| 10895 | |
| 10896 void Namespace::set_metadata_field(const Field& value) const { | 10301 void Namespace::set_metadata_field(const Field& value) const { |
| 10897 StorePointer(&raw_ptr()->metadata_field_, value.raw()); | 10302 StorePointer(&raw_ptr()->metadata_field_, value.raw()); |
| 10898 } | 10303 } |
| 10899 | 10304 |
| 10900 | 10305 |
| 10901 void Namespace::AddMetadata(const Object& owner, TokenPosition token_pos) { | 10306 void Namespace::AddMetadata(const Object& owner, TokenPosition token_pos) { |
| 10902 ASSERT(Field::Handle(metadata_field()).IsNull()); | 10307 ASSERT(Field::Handle(metadata_field()).IsNull()); |
| 10903 Field& field = Field::Handle(Field::NewTopLevel(Symbols::TopLevel(), | 10308 Field& field = Field::Handle(Field::NewTopLevel(Symbols::TopLevel(), |
| 10904 false, // is_final | 10309 false, // is_final |
| 10905 false, // is_const | 10310 false, // is_const |
| (...skipping 25 matching lines...) Expand all Loading... |
| 10931 } | 10336 } |
| 10932 | 10337 |
| 10933 | 10338 |
| 10934 const char* Namespace::ToCString() const { | 10339 const char* Namespace::ToCString() const { |
| 10935 const Library& lib = Library::Handle(library()); | 10340 const Library& lib = Library::Handle(library()); |
| 10936 return OS::SCreate(Thread::Current()->zone(), | 10341 return OS::SCreate(Thread::Current()->zone(), |
| 10937 "Namespace for library '%s'", lib.ToCString()); | 10342 "Namespace for library '%s'", lib.ToCString()); |
| 10938 } | 10343 } |
| 10939 | 10344 |
| 10940 | 10345 |
| 10941 void Namespace::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 10942 Object::PrintJSONImpl(stream, ref); | |
| 10943 } | |
| 10944 | |
| 10945 | |
| 10946 bool Namespace::HidesName(const String& name) const { | 10346 bool Namespace::HidesName(const String& name) const { |
| 10947 // Quick check for common case with no combinators. | 10347 // Quick check for common case with no combinators. |
| 10948 if (hide_names() == show_names()) { | 10348 if (hide_names() == show_names()) { |
| 10949 ASSERT(hide_names() == Array::null()); | 10349 ASSERT(hide_names() == Array::null()); |
| 10950 return false; | 10350 return false; |
| 10951 } | 10351 } |
| 10952 const String* plain_name = &name; | 10352 const String* plain_name = &name; |
| 10953 if (Field::IsGetterName(name)) { | 10353 if (Field::IsGetterName(name)) { |
| 10954 plain_name = &String::Handle(Field::NameFromGetter(name)); | 10354 plain_name = &String::Handle(Field::NameFromGetter(name)); |
| 10955 } else if (Field::IsSetterName(name)) { | 10355 } else if (Field::IsSetterName(name)) { |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11207 } | 10607 } |
| 11208 return result.raw(); | 10608 return result.raw(); |
| 11209 } | 10609 } |
| 11210 | 10610 |
| 11211 | 10611 |
| 11212 const char* Instructions::ToCString() const { | 10612 const char* Instructions::ToCString() const { |
| 11213 return "Instructions"; | 10613 return "Instructions"; |
| 11214 } | 10614 } |
| 11215 | 10615 |
| 11216 | 10616 |
| 11217 void Instructions::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 11218 JSONObject jsobj(stream); | |
| 11219 AddCommonObjectProperties(&jsobj, "Object", ref); | |
| 11220 jsobj.AddServiceId(*this); | |
| 11221 if (ref) { | |
| 11222 return; | |
| 11223 } | |
| 11224 } | |
| 11225 | |
| 11226 | |
| 11227 // Encode integer |value| in SLEB128 format and store into |data|. | 10617 // Encode integer |value| in SLEB128 format and store into |data|. |
| 11228 static void EncodeSLEB128(GrowableArray<uint8_t>* data, | 10618 static void EncodeSLEB128(GrowableArray<uint8_t>* data, |
| 11229 intptr_t value) { | 10619 intptr_t value) { |
| 11230 bool is_last_part = false; | 10620 bool is_last_part = false; |
| 11231 while (!is_last_part) { | 10621 while (!is_last_part) { |
| 11232 uint8_t part = value & 0x7f; | 10622 uint8_t part = value & 0x7f; |
| 11233 value >>= 7; | 10623 value >>= 7; |
| 11234 if ((value == 0 && (part & 0x40) == 0) || | 10624 if ((value == 0 && (part & 0x40) == 0) || |
| 11235 (value == static_cast<intptr_t>(-1) && (part & 0x40) != 0)) { | 10625 (value == static_cast<intptr_t>(-1) && (part & 0x40) != 0)) { |
| 11236 is_last_part = true; | 10626 is_last_part = true; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11314 return static_cast<EntryType>(array.GetInt8(index)); | 10704 return static_cast<EntryType>(array.GetInt8(index)); |
| 11315 } | 10705 } |
| 11316 | 10706 |
| 11317 | 10707 |
| 11318 const char* ObjectPool::ToCString() const { | 10708 const char* ObjectPool::ToCString() const { |
| 11319 Zone* zone = Thread::Current()->zone(); | 10709 Zone* zone = Thread::Current()->zone(); |
| 11320 return zone->PrintToString("ObjectPool len:%" Pd, Length()); | 10710 return zone->PrintToString("ObjectPool len:%" Pd, Length()); |
| 11321 } | 10711 } |
| 11322 | 10712 |
| 11323 | 10713 |
| 11324 void ObjectPool::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 11325 JSONObject jsobj(stream); | |
| 11326 AddCommonObjectProperties(&jsobj, "Object", ref); | |
| 11327 jsobj.AddServiceId(*this); | |
| 11328 jsobj.AddProperty("length", Length()); | |
| 11329 if (ref) { | |
| 11330 return; | |
| 11331 } | |
| 11332 | |
| 11333 { | |
| 11334 JSONArray jsarr(&jsobj, "_entries"); | |
| 11335 uword imm; | |
| 11336 Object& obj = Object::Handle(); | |
| 11337 for (intptr_t i = 0; i < Length(); i++) { | |
| 11338 JSONObject jsentry(stream); | |
| 11339 jsentry.AddProperty("offset", OffsetFromIndex(i)); | |
| 11340 switch (InfoAt(i)) { | |
| 11341 case ObjectPool::kTaggedObject: | |
| 11342 obj = ObjectAt(i); | |
| 11343 jsentry.AddProperty("kind", "Object"); | |
| 11344 jsentry.AddProperty("value", obj); | |
| 11345 break; | |
| 11346 case ObjectPool::kImmediate: | |
| 11347 imm = RawValueAt(i); | |
| 11348 jsentry.AddProperty("kind", "Immediate"); | |
| 11349 jsentry.AddProperty64("value", imm); | |
| 11350 break; | |
| 11351 case ObjectPool::kNativeEntry: | |
| 11352 imm = RawValueAt(i); | |
| 11353 jsentry.AddProperty("kind", "NativeEntry"); | |
| 11354 jsentry.AddProperty64("value", imm); | |
| 11355 break; | |
| 11356 default: | |
| 11357 UNREACHABLE(); | |
| 11358 } | |
| 11359 } | |
| 11360 } | |
| 11361 } | |
| 11362 | |
| 11363 | |
| 11364 void ObjectPool::DebugPrint() const { | 10714 void ObjectPool::DebugPrint() const { |
| 11365 THR_Print("Object Pool: {\n"); | 10715 THR_Print("Object Pool: {\n"); |
| 11366 for (intptr_t i = 0; i < Length(); i++) { | 10716 for (intptr_t i = 0; i < Length(); i++) { |
| 11367 intptr_t offset = OffsetFromIndex(i); | 10717 intptr_t offset = OffsetFromIndex(i); |
| 11368 THR_Print(" %" Pd " PP+0x%" Px ": ", i, offset); | 10718 THR_Print(" %" Pd " PP+0x%" Px ": ", i, offset); |
| 11369 if (InfoAt(i) == kTaggedObject) { | 10719 if (InfoAt(i) == kTaggedObject) { |
| 11370 RawObject* obj = ObjectAt(i); | 10720 RawObject* obj = ObjectAt(i); |
| 11371 THR_Print("0x%" Px " %s (obj)\n", | 10721 THR_Print("0x%" Px " %s (obj)\n", |
| 11372 reinterpret_cast<uword>(obj), | 10722 reinterpret_cast<uword>(obj), |
| 11373 Object::Handle(obj).ToCString()); | 10723 Object::Handle(obj).ToCString()); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11497 KindAsStr(iter.Kind()), | 10847 KindAsStr(iter.Kind()), |
| 11498 iter.DeoptId(), | 10848 iter.DeoptId(), |
| 11499 iter.TokenPos().ToCString(), | 10849 iter.TokenPos().ToCString(), |
| 11500 iter.TryIndex()); | 10850 iter.TryIndex()); |
| 11501 } | 10851 } |
| 11502 return buffer; | 10852 return buffer; |
| 11503 #undef FORMAT | 10853 #undef FORMAT |
| 11504 } | 10854 } |
| 11505 | 10855 |
| 11506 | 10856 |
| 11507 void PcDescriptors::PrintToJSONObject(JSONObject* jsobj, bool ref) const { | |
| 11508 AddCommonObjectProperties(jsobj, "Object", ref); | |
| 11509 // TODO(johnmccutchan): Generate a stable id. PcDescriptors hang off a Code | |
| 11510 // object but do not have a back reference to generate an ID. | |
| 11511 jsobj->AddServiceId(*this); | |
| 11512 if (ref) { | |
| 11513 return; | |
| 11514 } | |
| 11515 JSONArray members(jsobj, "members"); | |
| 11516 Iterator iter(*this, RawPcDescriptors::kAnyKind); | |
| 11517 while (iter.MoveNext()) { | |
| 11518 JSONObject descriptor(&members); | |
| 11519 descriptor.AddPropertyF("pcOffset", "%" Px "", iter.PcOffset()); | |
| 11520 descriptor.AddProperty("kind", KindAsStr(iter.Kind())); | |
| 11521 descriptor.AddProperty("deoptId", iter.DeoptId()); | |
| 11522 // TODO(turnidge): Use AddLocation instead. | |
| 11523 descriptor.AddProperty("tokenPos", iter.TokenPos()); | |
| 11524 descriptor.AddProperty("tryIndex", iter.TryIndex()); | |
| 11525 } | |
| 11526 } | |
| 11527 | |
| 11528 | |
| 11529 void PcDescriptors::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 11530 JSONObject jsobj(stream); | |
| 11531 PrintToJSONObject(&jsobj, ref); | |
| 11532 } | |
| 11533 | |
| 11534 | |
| 11535 // Verify assumptions (in debug mode only). | 10857 // Verify assumptions (in debug mode only). |
| 11536 // - No two deopt descriptors have the same deoptimization id. | 10858 // - No two deopt descriptors have the same deoptimization id. |
| 11537 // - No two ic-call descriptors have the same deoptimization id (type feedback). | 10859 // - No two ic-call descriptors have the same deoptimization id (type feedback). |
| 11538 // A function without unique ids is marked as non-optimizable (e.g., because of | 10860 // A function without unique ids is marked as non-optimizable (e.g., because of |
| 11539 // finally blocks). | 10861 // finally blocks). |
| 11540 void PcDescriptors::Verify(const Function& function) const { | 10862 void PcDescriptors::Verify(const Function& function) const { |
| 11541 #if defined(DEBUG) | 10863 #if defined(DEBUG) |
| 11542 // Only check ids for unoptimized code that is optimizable. | 10864 // Only check ids for unoptimized code that is optimizable. |
| 11543 if (!function.IsOptimizable()) { | 10865 if (!function.IsOptimizable()) { |
| 11544 return; | 10866 return; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11623 size, | 10945 size, |
| 11624 Heap::kOld); | 10946 Heap::kOld); |
| 11625 NoSafepointScope no_safepoint; | 10947 NoSafepointScope no_safepoint; |
| 11626 result ^= raw; | 10948 result ^= raw; |
| 11627 result.SetLength(length); | 10949 result.SetLength(length); |
| 11628 } | 10950 } |
| 11629 return result.raw(); | 10951 return result.raw(); |
| 11630 } | 10952 } |
| 11631 | 10953 |
| 11632 | 10954 |
| 11633 void CodeSourceMap::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 11634 Object::PrintJSONImpl(stream, ref); | |
| 11635 } | |
| 11636 | |
| 11637 | |
| 11638 const char* CodeSourceMap::ToCString() const { | 10955 const char* CodeSourceMap::ToCString() const { |
| 11639 // "*" in a printf format specifier tells it to read the field width from | 10956 // "*" in a printf format specifier tells it to read the field width from |
| 11640 // the printf argument list. | 10957 // the printf argument list. |
| 11641 #define FORMAT "%#-*" Px "\t%s\n" | 10958 #define FORMAT "%#-*" Px "\t%s\n" |
| 11642 if (Length() == 0) { | 10959 if (Length() == 0) { |
| 11643 return "empty CodeSourceMap\n"; | 10960 return "empty CodeSourceMap\n"; |
| 11644 } | 10961 } |
| 11645 // 4 bits per hex digit. | 10962 // 4 bits per hex digit. |
| 11646 const int addr_width = kBitsPerWord / 4; | 10963 const int addr_width = kBitsPerWord / 4; |
| 11647 // First compute the buffer size required. | 10964 // First compute the buffer size required. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11802 for (intptr_t i = 0; i < Length(); i++) { | 11119 for (intptr_t i = 0; i < Length(); i++) { |
| 11803 chars[index++] = IsObject(i) ? '1' : '0'; | 11120 chars[index++] = IsObject(i) ? '1' : '0'; |
| 11804 } | 11121 } |
| 11805 chars[index] = '\0'; | 11122 chars[index] = '\0'; |
| 11806 return chars; | 11123 return chars; |
| 11807 } | 11124 } |
| 11808 #undef FORMAT | 11125 #undef FORMAT |
| 11809 } | 11126 } |
| 11810 | 11127 |
| 11811 | 11128 |
| 11812 void Stackmap::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 11813 Object::PrintJSONImpl(stream, ref); | |
| 11814 } | |
| 11815 | |
| 11816 | |
| 11817 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { | 11129 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { |
| 11818 ASSERT(var_index < Length()); | 11130 ASSERT(var_index < Length()); |
| 11819 ASSERT(Object::Handle(*raw()->nameAddrAt(var_index)).IsString()); | 11131 ASSERT(Object::Handle(*raw()->nameAddrAt(var_index)).IsString()); |
| 11820 return *raw()->nameAddrAt(var_index); | 11132 return *raw()->nameAddrAt(var_index); |
| 11821 } | 11133 } |
| 11822 | 11134 |
| 11823 | 11135 |
| 11824 void LocalVarDescriptors::SetVar(intptr_t var_index, | 11136 void LocalVarDescriptors::SetVar(intptr_t var_index, |
| 11825 const String& name, | 11137 const String& name, |
| 11826 RawLocalVarDescriptors::VarInfo* info) const { | 11138 RawLocalVarDescriptors::VarInfo* info) const { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11903 var_name = GetName(i); | 11215 var_name = GetName(i); |
| 11904 GetInfo(i, &info); | 11216 GetInfo(i, &info); |
| 11905 num_chars += PrintVarInfo((buffer + num_chars), | 11217 num_chars += PrintVarInfo((buffer + num_chars), |
| 11906 (len - num_chars), | 11218 (len - num_chars), |
| 11907 i, var_name, info); | 11219 i, var_name, info); |
| 11908 } | 11220 } |
| 11909 return buffer; | 11221 return buffer; |
| 11910 } | 11222 } |
| 11911 | 11223 |
| 11912 | 11224 |
| 11913 void LocalVarDescriptors::PrintJSONImpl(JSONStream* stream, | |
| 11914 bool ref) const { | |
| 11915 JSONObject jsobj(stream); | |
| 11916 AddCommonObjectProperties(&jsobj, "Object", ref); | |
| 11917 // TODO(johnmccutchan): Generate a stable id. LocalVarDescriptors hang off | |
| 11918 // a Code object but do not have a back reference to generate an ID. | |
| 11919 jsobj.AddServiceId(*this); | |
| 11920 if (ref) { | |
| 11921 return; | |
| 11922 } | |
| 11923 JSONArray members(&jsobj, "members"); | |
| 11924 String& var_name = String::Handle(); | |
| 11925 for (intptr_t i = 0; i < Length(); i++) { | |
| 11926 RawLocalVarDescriptors::VarInfo info; | |
| 11927 var_name = GetName(i); | |
| 11928 GetInfo(i, &info); | |
| 11929 JSONObject var(&members); | |
| 11930 var.AddProperty("name", var_name.ToCString()); | |
| 11931 var.AddProperty("index", static_cast<intptr_t>(info.index())); | |
| 11932 var.AddProperty("beginPos", info.begin_pos); | |
| 11933 var.AddProperty("endPos", info.end_pos); | |
| 11934 var.AddProperty("scopeId", static_cast<intptr_t>(info.scope_id)); | |
| 11935 var.AddProperty("kind", KindToCString(info.kind())); | |
| 11936 } | |
| 11937 } | |
| 11938 | |
| 11939 | |
| 11940 const char* LocalVarDescriptors::KindToCString( | 11225 const char* LocalVarDescriptors::KindToCString( |
| 11941 RawLocalVarDescriptors::VarInfoKind kind) { | 11226 RawLocalVarDescriptors::VarInfoKind kind) { |
| 11942 switch (kind) { | 11227 switch (kind) { |
| 11943 case RawLocalVarDescriptors::kStackVar: | 11228 case RawLocalVarDescriptors::kStackVar: |
| 11944 return "StackVar"; | 11229 return "StackVar"; |
| 11945 case RawLocalVarDescriptors::kContextVar: | 11230 case RawLocalVarDescriptors::kContextVar: |
| 11946 return "ContextVar"; | 11231 return "ContextVar"; |
| 11947 case RawLocalVarDescriptors::kContextLevel: | 11232 case RawLocalVarDescriptors::kContextLevel: |
| 11948 return "ContextLevel"; | 11233 return "ContextLevel"; |
| 11949 case RawLocalVarDescriptors::kSavedCurrentContext: | 11234 case RawLocalVarDescriptors::kSavedCurrentContext: |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12159 (len - num_chars), | 11444 (len - num_chars), |
| 12160 FORMAT2, k, type.ToCString()); | 11445 FORMAT2, k, type.ToCString()); |
| 12161 } | 11446 } |
| 12162 } | 11447 } |
| 12163 return buffer; | 11448 return buffer; |
| 12164 #undef FORMAT1 | 11449 #undef FORMAT1 |
| 12165 #undef FORMAT2 | 11450 #undef FORMAT2 |
| 12166 } | 11451 } |
| 12167 | 11452 |
| 12168 | 11453 |
| 12169 void ExceptionHandlers::PrintJSONImpl(JSONStream* stream, | |
| 12170 bool ref) const { | |
| 12171 Object::PrintJSONImpl(stream, ref); | |
| 12172 } | |
| 12173 | |
| 12174 | |
| 12175 intptr_t DeoptInfo::FrameSize(const TypedData& packed) { | 11454 intptr_t DeoptInfo::FrameSize(const TypedData& packed) { |
| 12176 NoSafepointScope no_safepoint; | 11455 NoSafepointScope no_safepoint; |
| 12177 typedef ReadStream::Raw<sizeof(intptr_t), intptr_t> Reader; | 11456 typedef ReadStream::Raw<sizeof(intptr_t), intptr_t> Reader; |
| 12178 ReadStream read_stream(reinterpret_cast<uint8_t*>(packed.DataAddr(0)), | 11457 ReadStream read_stream(reinterpret_cast<uint8_t*>(packed.DataAddr(0)), |
| 12179 packed.LengthInBytes()); | 11458 packed.LengthInBytes()); |
| 12180 return Reader::Read(&read_stream); | 11459 return Reader::Read(&read_stream); |
| 12181 } | 11460 } |
| 12182 | 11461 |
| 12183 | 11462 |
| 12184 intptr_t DeoptInfo::NumMaterializations( | 11463 intptr_t DeoptInfo::NumMaterializations( |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12984 from.deopt_id(), | 12263 from.deopt_id(), |
| 12985 from.NumArgsTested())); | 12264 from.NumArgsTested())); |
| 12986 // Preserve entry array. | 12265 // Preserve entry array. |
| 12987 result.set_ic_data_array(Array::Handle(zone, from.ic_data())); | 12266 result.set_ic_data_array(Array::Handle(zone, from.ic_data())); |
| 12988 // Copy deoptimization reasons. | 12267 // Copy deoptimization reasons. |
| 12989 result.SetDeoptReasons(from.DeoptReasons()); | 12268 result.SetDeoptReasons(from.DeoptReasons()); |
| 12990 return result.raw(); | 12269 return result.raw(); |
| 12991 } | 12270 } |
| 12992 | 12271 |
| 12993 | 12272 |
| 12994 void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 12995 JSONObject jsobj(stream); | |
| 12996 AddCommonObjectProperties(&jsobj, "Object", ref); | |
| 12997 jsobj.AddServiceId(*this); | |
| 12998 jsobj.AddProperty("_owner", Object::Handle(Owner())); | |
| 12999 jsobj.AddProperty("_selector", String::Handle(target_name()).ToCString()); | |
| 13000 if (ref) { | |
| 13001 return; | |
| 13002 } | |
| 13003 jsobj.AddProperty("_argumentsDescriptor", | |
| 13004 Object::Handle(arguments_descriptor())); | |
| 13005 jsobj.AddProperty("_entries", Object::Handle(ic_data())); | |
| 13006 } | |
| 13007 | |
| 13008 | |
| 13009 void ICData::PrintToJSONArray(const JSONArray& jsarray, | |
| 13010 TokenPosition token_pos, | |
| 13011 bool is_static_call) const { | |
| 13012 Isolate* isolate = Isolate::Current(); | |
| 13013 Class& cls = Class::Handle(); | |
| 13014 Function& func = Function::Handle(); | |
| 13015 | |
| 13016 JSONObject jsobj(&jsarray); | |
| 13017 jsobj.AddProperty("name", String::Handle(target_name()).ToCString()); | |
| 13018 jsobj.AddProperty("tokenPos", token_pos); | |
| 13019 // TODO(rmacnak): Figure out how to stringify DeoptReasons(). | |
| 13020 // jsobj.AddProperty("deoptReasons", ...); | |
| 13021 | |
| 13022 JSONArray cache_entries(&jsobj, "cacheEntries"); | |
| 13023 for (intptr_t i = 0; i < NumberOfChecks(); i++) { | |
| 13024 func = GetTargetAt(i); | |
| 13025 if (is_static_call) { | |
| 13026 cls ^= func.Owner(); | |
| 13027 } else { | |
| 13028 intptr_t cid = GetReceiverClassIdAt(i); | |
| 13029 cls ^= isolate->class_table()->At(cid); | |
| 13030 } | |
| 13031 intptr_t count = GetCountAt(i); | |
| 13032 JSONObject cache_entry(&cache_entries); | |
| 13033 if (cls.IsTopLevel()) { | |
| 13034 cache_entry.AddProperty("receiverContainer", | |
| 13035 Library::Handle(cls.library())); | |
| 13036 } else { | |
| 13037 cache_entry.AddProperty("receiverContainer", cls); | |
| 13038 } | |
| 13039 cache_entry.AddProperty("count", count); | |
| 13040 cache_entry.AddProperty("target", func); | |
| 13041 } | |
| 13042 } | |
| 13043 | |
| 13044 | |
| 13045 void ICData::PrintToJSONArrayNew(const JSONArray& jsarray, | |
| 13046 TokenPosition token_pos, | |
| 13047 bool is_static_call) const { | |
| 13048 Isolate* isolate = Isolate::Current(); | |
| 13049 Class& cls = Class::Handle(); | |
| 13050 Function& func = Function::Handle(); | |
| 13051 | |
| 13052 JSONObject jsobj(&jsarray); | |
| 13053 jsobj.AddProperty("name", String::Handle(target_name()).ToCString()); | |
| 13054 jsobj.AddProperty("tokenPos", token_pos.value()); | |
| 13055 // TODO(rmacnak): Figure out how to stringify DeoptReasons(). | |
| 13056 // jsobj.AddProperty("deoptReasons", ...); | |
| 13057 | |
| 13058 JSONArray cache_entries(&jsobj, "cacheEntries"); | |
| 13059 for (intptr_t i = 0; i < NumberOfChecks(); i++) { | |
| 13060 JSONObject cache_entry(&cache_entries); | |
| 13061 func = GetTargetAt(i); | |
| 13062 intptr_t count = GetCountAt(i); | |
| 13063 if (!is_static_call) { | |
| 13064 intptr_t cid = GetReceiverClassIdAt(i); | |
| 13065 cls ^= isolate->class_table()->At(cid); | |
| 13066 cache_entry.AddProperty("receiver", cls); | |
| 13067 } | |
| 13068 cache_entry.AddProperty("target", func); | |
| 13069 cache_entry.AddProperty("count", count); | |
| 13070 } | |
| 13071 } | |
| 13072 | |
| 13073 | |
| 13074 static Token::Kind RecognizeArithmeticOp(const String& name) { | 12273 static Token::Kind RecognizeArithmeticOp(const String& name) { |
| 13075 ASSERT(name.IsSymbol()); | 12274 ASSERT(name.IsSymbol()); |
| 13076 if (name.raw() == Symbols::Plus().raw()) { | 12275 if (name.raw() == Symbols::Plus().raw()) { |
| 13077 return Token::kADD; | 12276 return Token::kADD; |
| 13078 } else if (name.raw() == Symbols::Minus().raw()) { | 12277 } else if (name.raw() == Symbols::Minus().raw()) { |
| 13079 return Token::kSUB; | 12278 return Token::kSUB; |
| 13080 } else if (name.raw() == Symbols::Star().raw()) { | 12279 } else if (name.raw() == Symbols::Star().raw()) { |
| 13081 return Token::kMUL; | 12280 return Token::kMUL; |
| 13082 } else if (name.raw() == Symbols::Slash().raw()) { | 12281 } else if (name.raw() == Symbols::Slash().raw()) { |
| 13083 return Token::kDIV; | 12282 return Token::kDIV; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13265 for (intptr_t i = kSCallTableEntryLength; | 12464 for (intptr_t i = kSCallTableEntryLength; |
| 13266 i < value.Length(); | 12465 i < value.Length(); |
| 13267 i += kSCallTableEntryLength) { | 12466 i += kSCallTableEntryLength) { |
| 13268 ASSERT(value.At(i - kSCallTableEntryLength) < value.At(i)); | 12467 ASSERT(value.At(i - kSCallTableEntryLength) < value.At(i)); |
| 13269 } | 12468 } |
| 13270 #endif // DEBUG | 12469 #endif // DEBUG |
| 13271 } | 12470 } |
| 13272 | 12471 |
| 13273 | 12472 |
| 13274 bool Code::HasBreakpoint() const { | 12473 bool Code::HasBreakpoint() const { |
| 12474 if (!FLAG_support_debugger) { |
| 12475 return false; |
| 12476 } |
| 13275 return Isolate::Current()->debugger()->HasBreakpoint(*this); | 12477 return Isolate::Current()->debugger()->HasBreakpoint(*this); |
| 13276 } | 12478 } |
| 13277 | 12479 |
| 13278 | 12480 |
| 13279 RawTypedData* Code::GetDeoptInfoAtPc(uword pc, | 12481 RawTypedData* Code::GetDeoptInfoAtPc(uword pc, |
| 13280 ICData::DeoptReasonId* deopt_reason, | 12482 ICData::DeoptReasonId* deopt_reason, |
| 13281 uint32_t* deopt_flags) const { | 12483 uint32_t* deopt_flags) const { |
| 13282 ASSERT(is_optimized()); | 12484 ASSERT(is_optimized()); |
| 13283 const Instructions& instrs = Instructions::Handle(instructions()); | 12485 const Instructions& instrs = Instructions::Handle(instructions()); |
| 13284 uword code_entry = instrs.EntryPoint(); | 12486 uword code_entry = instrs.EntryPoint(); |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13811 DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive()); | 13013 DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive()); |
| 13812 // RawInstructions are never allocated in New space and hence a | 13014 // RawInstructions are never allocated in New space and hence a |
| 13813 // store buffer update is not needed here. | 13015 // store buffer update is not needed here. |
| 13814 StorePointer(&raw_ptr()->active_instructions_, instructions); | 13016 StorePointer(&raw_ptr()->active_instructions_, instructions); |
| 13815 StoreNonPointer(&raw_ptr()->entry_point_, | 13017 StoreNonPointer(&raw_ptr()->entry_point_, |
| 13816 reinterpret_cast<uword>(instructions->ptr()) + | 13018 reinterpret_cast<uword>(instructions->ptr()) + |
| 13817 Instructions::HeaderSize()); | 13019 Instructions::HeaderSize()); |
| 13818 } | 13020 } |
| 13819 | 13021 |
| 13820 | 13022 |
| 13821 void Code::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 13822 JSONObject jsobj(stream); | |
| 13823 AddCommonObjectProperties(&jsobj, "Code", ref); | |
| 13824 jsobj.AddFixedServiceId("code/%" Px64"-%" Px "", | |
| 13825 compile_timestamp(), | |
| 13826 EntryPoint()); | |
| 13827 const String& user_name = String::Handle(PrettyName()); | |
| 13828 const String& vm_name = String::Handle(Name()); | |
| 13829 AddNameProperties(&jsobj, user_name, vm_name); | |
| 13830 const bool is_stub = IsStubCode() || IsAllocationStubCode(); | |
| 13831 if (is_stub) { | |
| 13832 jsobj.AddProperty("kind", "Stub"); | |
| 13833 } else { | |
| 13834 jsobj.AddProperty("kind", "Dart"); | |
| 13835 } | |
| 13836 jsobj.AddProperty("_optimized", is_optimized()); | |
| 13837 const Object& obj = Object::Handle(owner()); | |
| 13838 if (obj.IsFunction()) { | |
| 13839 const Function& func = Function::Cast(obj); | |
| 13840 jsobj.AddProperty("_intrinsic", func.is_intrinsic()); | |
| 13841 jsobj.AddProperty("_native", func.is_native()); | |
| 13842 } else { | |
| 13843 jsobj.AddProperty("_intrinsic", false); | |
| 13844 jsobj.AddProperty("_native", false); | |
| 13845 } | |
| 13846 if (ref) { | |
| 13847 return; | |
| 13848 } | |
| 13849 if (obj.IsFunction()) { | |
| 13850 jsobj.AddProperty("function", obj); | |
| 13851 } else { | |
| 13852 // Generate a fake function reference. | |
| 13853 JSONObject func(&jsobj, "function"); | |
| 13854 func.AddProperty("type", "@Function"); | |
| 13855 func.AddProperty("_kind", "Stub"); | |
| 13856 func.AddProperty("name", user_name.ToCString()); | |
| 13857 AddNameProperties(&func, user_name, vm_name); | |
| 13858 } | |
| 13859 jsobj.AddPropertyF("_startAddress", "%" Px "", EntryPoint()); | |
| 13860 jsobj.AddPropertyF("_endAddress", "%" Px "", EntryPoint() + Size()); | |
| 13861 jsobj.AddProperty("_alive", is_alive()); | |
| 13862 const ObjectPool& object_pool = ObjectPool::Handle(GetObjectPool()); | |
| 13863 jsobj.AddProperty("_objectPool", object_pool); | |
| 13864 { | |
| 13865 JSONArray jsarr(&jsobj, "_disassembly"); | |
| 13866 if (is_alive()) { | |
| 13867 // Only disassemble alive code objects. | |
| 13868 DisassembleToJSONStream formatter(jsarr); | |
| 13869 Disassemble(&formatter); | |
| 13870 } | |
| 13871 } | |
| 13872 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | |
| 13873 if (!descriptors.IsNull()) { | |
| 13874 JSONObject desc(&jsobj, "_descriptors"); | |
| 13875 descriptors.PrintToJSONObject(&desc, false); | |
| 13876 } | |
| 13877 const Array& inlined_function_table = Array::Handle(GetInlinedIdToFunction()); | |
| 13878 if (!inlined_function_table.IsNull() && | |
| 13879 (inlined_function_table.Length() > 0)) { | |
| 13880 JSONArray inlined_functions(&jsobj, "_inlinedFunctions"); | |
| 13881 Function& function = Function::Handle(); | |
| 13882 for (intptr_t i = 0; i < inlined_function_table.Length(); i++) { | |
| 13883 function ^= inlined_function_table.At(i); | |
| 13884 ASSERT(!function.IsNull()); | |
| 13885 inlined_functions.AddValue(function); | |
| 13886 } | |
| 13887 } | |
| 13888 const Array& intervals = Array::Handle(GetInlinedIntervals()); | |
| 13889 if (!intervals.IsNull() && (intervals.Length() > 0)) { | |
| 13890 Smi& start = Smi::Handle(); | |
| 13891 Smi& end = Smi::Handle(); | |
| 13892 Smi& temp_smi = Smi::Handle(); | |
| 13893 JSONArray inline_intervals(&jsobj, "_inlinedIntervals"); | |
| 13894 for (intptr_t i = 0; i < intervals.Length() - Code::kInlIntNumEntries; | |
| 13895 i += Code::kInlIntNumEntries) { | |
| 13896 start ^= intervals.At(i + Code::kInlIntStart); | |
| 13897 if (start.IsNull()) { | |
| 13898 continue; | |
| 13899 } | |
| 13900 end ^= intervals.At(i + Code::kInlIntNumEntries + Code::kInlIntStart); | |
| 13901 | |
| 13902 // Format: [start, end, inline functions...] | |
| 13903 JSONArray inline_interval(&inline_intervals); | |
| 13904 inline_interval.AddValue(start.Value()); | |
| 13905 inline_interval.AddValue(end.Value()); | |
| 13906 | |
| 13907 temp_smi ^= intervals.At(i + Code::kInlIntInliningId); | |
| 13908 intptr_t inlining_id = temp_smi.Value(); | |
| 13909 ASSERT(inlining_id >= 0); | |
| 13910 intptr_t caller_id = GetCallerId(inlining_id); | |
| 13911 while (inlining_id >= 0) { | |
| 13912 inline_interval.AddValue(inlining_id); | |
| 13913 inlining_id = caller_id; | |
| 13914 caller_id = GetCallerId(inlining_id); | |
| 13915 } | |
| 13916 } | |
| 13917 } | |
| 13918 } | |
| 13919 | |
| 13920 | |
| 13921 uword Code::GetLazyDeoptPc() const { | 13023 uword Code::GetLazyDeoptPc() const { |
| 13922 return (lazy_deopt_pc_offset() != kInvalidPc) | 13024 return (lazy_deopt_pc_offset() != kInvalidPc) |
| 13923 ? EntryPoint() + lazy_deopt_pc_offset() : 0; | 13025 ? EntryPoint() + lazy_deopt_pc_offset() : 0; |
| 13924 } | 13026 } |
| 13925 | 13027 |
| 13926 | 13028 |
| 13927 RawStackmap* Code::GetStackmap( | 13029 RawStackmap* Code::GetStackmap( |
| 13928 uint32_t pc_offset, Array* maps, Stackmap* map) const { | 13030 uint32_t pc_offset, Array* maps, Stackmap* map) const { |
| 13929 // This code is used during iterating frames during a GC and hence it | 13031 // This code is used during iterating frames during a GC and hence it |
| 13930 // should not in turn start a GC. | 13032 // should not in turn start a GC. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14121 | 13223 |
| 14122 const Context& parent_ctx = Context::Handle(parent()); | 13224 const Context& parent_ctx = Context::Handle(parent()); |
| 14123 if (!parent_ctx.IsNull()) { | 13225 if (!parent_ctx.IsNull()) { |
| 14124 parent_ctx.Dump(indent + 2); | 13226 parent_ctx.Dump(indent + 2); |
| 14125 } | 13227 } |
| 14126 IndentN(indent); | 13228 IndentN(indent); |
| 14127 THR_Print("}\n"); | 13229 THR_Print("}\n"); |
| 14128 } | 13230 } |
| 14129 | 13231 |
| 14130 | 13232 |
| 14131 void Context::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 14132 JSONObject jsobj(stream); | |
| 14133 // TODO(turnidge): Should the user level type for Context be Context | |
| 14134 // or Object? | |
| 14135 AddCommonObjectProperties(&jsobj, "Context", ref); | |
| 14136 jsobj.AddServiceId(*this); | |
| 14137 | |
| 14138 jsobj.AddProperty("length", num_variables()); | |
| 14139 | |
| 14140 if (ref) { | |
| 14141 return; | |
| 14142 } | |
| 14143 | |
| 14144 const Context& parent_context = Context::Handle(parent()); | |
| 14145 if (!parent_context.IsNull()) { | |
| 14146 jsobj.AddProperty("parent", parent_context); | |
| 14147 } | |
| 14148 | |
| 14149 JSONArray jsarr(&jsobj, "variables"); | |
| 14150 Object& var = Object::Handle(); | |
| 14151 for (intptr_t index = 0; index < num_variables(); index++) { | |
| 14152 var = At(index); | |
| 14153 JSONObject jselement(&jsarr); | |
| 14154 jselement.AddProperty("value", var); | |
| 14155 } | |
| 14156 } | |
| 14157 | |
| 14158 | |
| 14159 RawContextScope* ContextScope::New(intptr_t num_variables, bool is_implicit) { | 13233 RawContextScope* ContextScope::New(intptr_t num_variables, bool is_implicit) { |
| 14160 ASSERT(Object::context_scope_class() != Class::null()); | 13234 ASSERT(Object::context_scope_class() != Class::null()); |
| 14161 if (num_variables < 0 || num_variables > kMaxElements) { | 13235 if (num_variables < 0 || num_variables > kMaxElements) { |
| 14162 // This should be caught before we reach here. | 13236 // This should be caught before we reach here. |
| 14163 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n", | 13237 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n", |
| 14164 num_variables); | 13238 num_variables); |
| 14165 } | 13239 } |
| 14166 intptr_t size = ContextScope::InstanceSize(num_variables); | 13240 intptr_t size = ContextScope::InstanceSize(num_variables); |
| 14167 ContextScope& result = ContextScope::Handle(); | 13241 ContextScope& result = ContextScope::Handle(); |
| 14168 { | 13242 { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14282 intptr_t lvl = ContextLevelAt(i); | 13356 intptr_t lvl = ContextLevelAt(i); |
| 14283 char* chars = OS::SCreate(Thread::Current()->zone(), | 13357 char* chars = OS::SCreate(Thread::Current()->zone(), |
| 14284 "%s\nvar %s token-pos %s ctx lvl %" Pd " index %" Pd "", | 13358 "%s\nvar %s token-pos %s ctx lvl %" Pd " index %" Pd "", |
| 14285 prev_cstr, cname, pos.ToCString(), lvl, idx); | 13359 prev_cstr, cname, pos.ToCString(), lvl, idx); |
| 14286 prev_cstr = chars; | 13360 prev_cstr = chars; |
| 14287 } | 13361 } |
| 14288 return prev_cstr; | 13362 return prev_cstr; |
| 14289 } | 13363 } |
| 14290 | 13364 |
| 14291 | 13365 |
| 14292 void ContextScope::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 14293 Object::PrintJSONImpl(stream, ref); | |
| 14294 } | |
| 14295 | |
| 14296 | |
| 14297 RawArray* MegamorphicCache::buckets() const { | 13366 RawArray* MegamorphicCache::buckets() const { |
| 14298 return raw_ptr()->buckets_; | 13367 return raw_ptr()->buckets_; |
| 14299 } | 13368 } |
| 14300 | 13369 |
| 14301 | 13370 |
| 14302 void MegamorphicCache::set_buckets(const Array& buckets) const { | 13371 void MegamorphicCache::set_buckets(const Array& buckets) const { |
| 14303 StorePointer(&raw_ptr()->buckets_, buckets.raw()); | 13372 StorePointer(&raw_ptr()->buckets_, buckets.raw()); |
| 14304 } | 13373 } |
| 14305 | 13374 |
| 14306 | 13375 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14427 } | 13496 } |
| 14428 | 13497 |
| 14429 | 13498 |
| 14430 const char* MegamorphicCache::ToCString() const { | 13499 const char* MegamorphicCache::ToCString() const { |
| 14431 const String& name = String::Handle(target_name()); | 13500 const String& name = String::Handle(target_name()); |
| 14432 return OS::SCreate(Thread::Current()->zone(), | 13501 return OS::SCreate(Thread::Current()->zone(), |
| 14433 "MegamorphicCache(%s)", name.ToCString()); | 13502 "MegamorphicCache(%s)", name.ToCString()); |
| 14434 } | 13503 } |
| 14435 | 13504 |
| 14436 | 13505 |
| 14437 void MegamorphicCache::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 14438 JSONObject jsobj(stream); | |
| 14439 AddCommonObjectProperties(&jsobj, "Object", ref); | |
| 14440 jsobj.AddServiceId(*this); | |
| 14441 jsobj.AddProperty("_selector", String::Handle(target_name()).ToCString()); | |
| 14442 if (ref) { | |
| 14443 return; | |
| 14444 } | |
| 14445 jsobj.AddProperty("_buckets", Object::Handle(buckets())); | |
| 14446 jsobj.AddProperty("_mask", mask()); | |
| 14447 jsobj.AddProperty("_argumentsDescriptor", | |
| 14448 Object::Handle(arguments_descriptor())); | |
| 14449 } | |
| 14450 | |
| 14451 | |
| 14452 RawSubtypeTestCache* SubtypeTestCache::New() { | 13506 RawSubtypeTestCache* SubtypeTestCache::New() { |
| 14453 ASSERT(Object::subtypetestcache_class() != Class::null()); | 13507 ASSERT(Object::subtypetestcache_class() != Class::null()); |
| 14454 SubtypeTestCache& result = SubtypeTestCache::Handle(); | 13508 SubtypeTestCache& result = SubtypeTestCache::Handle(); |
| 14455 { | 13509 { |
| 14456 // SubtypeTestCache objects are long living objects, allocate them in the | 13510 // SubtypeTestCache objects are long living objects, allocate them in the |
| 14457 // old generation. | 13511 // old generation. |
| 14458 RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId, | 13512 RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId, |
| 14459 SubtypeTestCache::InstanceSize(), | 13513 SubtypeTestCache::InstanceSize(), |
| 14460 Heap::kOld); | 13514 Heap::kOld); |
| 14461 NoSafepointScope no_safepoint; | 13515 NoSafepointScope no_safepoint; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14513 data.At(data_pos + kInstantiatorTypeArguments); | 13567 data.At(data_pos + kInstantiatorTypeArguments); |
| 14514 *test_result ^= data.At(data_pos + kTestResult); | 13568 *test_result ^= data.At(data_pos + kTestResult); |
| 14515 } | 13569 } |
| 14516 | 13570 |
| 14517 | 13571 |
| 14518 const char* SubtypeTestCache::ToCString() const { | 13572 const char* SubtypeTestCache::ToCString() const { |
| 14519 return "SubtypeTestCache"; | 13573 return "SubtypeTestCache"; |
| 14520 } | 13574 } |
| 14521 | 13575 |
| 14522 | 13576 |
| 14523 void SubtypeTestCache::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 14524 Object::PrintJSONImpl(stream, ref); | |
| 14525 } | |
| 14526 | |
| 14527 | |
| 14528 const char* Error::ToErrorCString() const { | 13577 const char* Error::ToErrorCString() const { |
| 14529 UNREACHABLE(); | 13578 UNREACHABLE(); |
| 14530 return "Internal Error"; | 13579 return "Internal Error"; |
| 14531 } | 13580 } |
| 14532 | 13581 |
| 14533 | 13582 |
| 14534 const char* Error::ToCString() const { | 13583 const char* Error::ToCString() const { |
| 14535 // Error is an abstract class. We should never reach here. | 13584 // Error is an abstract class. We should never reach here. |
| 14536 UNREACHABLE(); | 13585 UNREACHABLE(); |
| 14537 return "Error"; | 13586 return "Error"; |
| 14538 } | 13587 } |
| 14539 | 13588 |
| 14540 | 13589 |
| 14541 void Error::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 14542 UNREACHABLE(); | |
| 14543 } | |
| 14544 | |
| 14545 | |
| 14546 RawApiError* ApiError::New() { | 13590 RawApiError* ApiError::New() { |
| 14547 ASSERT(Object::api_error_class() != Class::null()); | 13591 ASSERT(Object::api_error_class() != Class::null()); |
| 14548 RawObject* raw = Object::Allocate(ApiError::kClassId, | 13592 RawObject* raw = Object::Allocate(ApiError::kClassId, |
| 14549 ApiError::InstanceSize(), | 13593 ApiError::InstanceSize(), |
| 14550 Heap::kOld); | 13594 Heap::kOld); |
| 14551 return reinterpret_cast<RawApiError*>(raw); | 13595 return reinterpret_cast<RawApiError*>(raw); |
| 14552 } | 13596 } |
| 14553 | 13597 |
| 14554 | 13598 |
| 14555 RawApiError* ApiError::New(const String& message, Heap::Space space) { | 13599 RawApiError* ApiError::New(const String& message, Heap::Space space) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 14576 const String& msg_str = String::Handle(message()); | 13620 const String& msg_str = String::Handle(message()); |
| 14577 return msg_str.ToCString(); | 13621 return msg_str.ToCString(); |
| 14578 } | 13622 } |
| 14579 | 13623 |
| 14580 | 13624 |
| 14581 const char* ApiError::ToCString() const { | 13625 const char* ApiError::ToCString() const { |
| 14582 return "ApiError"; | 13626 return "ApiError"; |
| 14583 } | 13627 } |
| 14584 | 13628 |
| 14585 | 13629 |
| 14586 void ApiError::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 14587 JSONObject jsobj(stream); | |
| 14588 AddCommonObjectProperties(&jsobj, "Error", ref); | |
| 14589 jsobj.AddProperty("kind", "InternalError"); | |
| 14590 jsobj.AddServiceId(*this); | |
| 14591 jsobj.AddProperty("message", ToErrorCString()); | |
| 14592 } | |
| 14593 | |
| 14594 | |
| 14595 RawLanguageError* LanguageError::New() { | 13630 RawLanguageError* LanguageError::New() { |
| 14596 ASSERT(Object::language_error_class() != Class::null()); | 13631 ASSERT(Object::language_error_class() != Class::null()); |
| 14597 RawObject* raw = Object::Allocate(LanguageError::kClassId, | 13632 RawObject* raw = Object::Allocate(LanguageError::kClassId, |
| 14598 LanguageError::InstanceSize(), | 13633 LanguageError::InstanceSize(), |
| 14599 Heap::kOld); | 13634 Heap::kOld); |
| 14600 return reinterpret_cast<RawLanguageError*>(raw); | 13635 return reinterpret_cast<RawLanguageError*>(raw); |
| 14601 } | 13636 } |
| 14602 | 13637 |
| 14603 | 13638 |
| 14604 RawLanguageError* LanguageError::NewFormattedV(const Error& prev_error, | 13639 RawLanguageError* LanguageError::NewFormattedV(const Error& prev_error, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14726 const String& msg_str = String::Handle(FormatMessage()); | 13761 const String& msg_str = String::Handle(FormatMessage()); |
| 14727 return msg_str.ToCString(); | 13762 return msg_str.ToCString(); |
| 14728 } | 13763 } |
| 14729 | 13764 |
| 14730 | 13765 |
| 14731 const char* LanguageError::ToCString() const { | 13766 const char* LanguageError::ToCString() const { |
| 14732 return "LanguageError"; | 13767 return "LanguageError"; |
| 14733 } | 13768 } |
| 14734 | 13769 |
| 14735 | 13770 |
| 14736 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 14737 JSONObject jsobj(stream); | |
| 14738 AddCommonObjectProperties(&jsobj, "Error", ref); | |
| 14739 jsobj.AddProperty("kind", "LanguageError"); | |
| 14740 jsobj.AddServiceId(*this); | |
| 14741 jsobj.AddProperty("message", ToErrorCString()); | |
| 14742 } | |
| 14743 | |
| 14744 | |
| 14745 RawUnhandledException* UnhandledException::New(const Instance& exception, | 13771 RawUnhandledException* UnhandledException::New(const Instance& exception, |
| 14746 const Instance& stacktrace, | 13772 const Instance& stacktrace, |
| 14747 Heap::Space space) { | 13773 Heap::Space space) { |
| 14748 ASSERT(Object::unhandled_exception_class() != Class::null()); | 13774 ASSERT(Object::unhandled_exception_class() != Class::null()); |
| 14749 UnhandledException& result = UnhandledException::Handle(); | 13775 UnhandledException& result = UnhandledException::Handle(); |
| 14750 { | 13776 { |
| 14751 RawObject* raw = Object::Allocate(UnhandledException::kClassId, | 13777 RawObject* raw = Object::Allocate(UnhandledException::kClassId, |
| 14752 UnhandledException::InstanceSize(), | 13778 UnhandledException::InstanceSize(), |
| 14753 space); | 13779 space); |
| 14754 NoSafepointScope no_safepoint; | 13780 NoSafepointScope no_safepoint; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14815 return OS::SCreate(thread->zone(), | 13841 return OS::SCreate(thread->zone(), |
| 14816 "Unhandled exception:\n%s\n%s", exc_str, stack_str); | 13842 "Unhandled exception:\n%s\n%s", exc_str, stack_str); |
| 14817 } | 13843 } |
| 14818 | 13844 |
| 14819 | 13845 |
| 14820 const char* UnhandledException::ToCString() const { | 13846 const char* UnhandledException::ToCString() const { |
| 14821 return "UnhandledException"; | 13847 return "UnhandledException"; |
| 14822 } | 13848 } |
| 14823 | 13849 |
| 14824 | 13850 |
| 14825 | |
| 14826 void UnhandledException::PrintJSONImpl(JSONStream* stream, | |
| 14827 bool ref) const { | |
| 14828 JSONObject jsobj(stream); | |
| 14829 AddCommonObjectProperties(&jsobj, "Error", ref); | |
| 14830 jsobj.AddProperty("kind", "UnhandledException"); | |
| 14831 jsobj.AddServiceId(*this); | |
| 14832 jsobj.AddProperty("message", ToErrorCString()); | |
| 14833 if (ref) { | |
| 14834 return; | |
| 14835 } | |
| 14836 Instance& instance = Instance::Handle(); | |
| 14837 instance = exception(); | |
| 14838 jsobj.AddProperty("exception", instance); | |
| 14839 instance = stacktrace(); | |
| 14840 jsobj.AddProperty("stacktrace", instance); | |
| 14841 } | |
| 14842 | |
| 14843 | |
| 14844 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { | 13851 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { |
| 14845 ASSERT(Object::unwind_error_class() != Class::null()); | 13852 ASSERT(Object::unwind_error_class() != Class::null()); |
| 14846 UnwindError& result = UnwindError::Handle(); | 13853 UnwindError& result = UnwindError::Handle(); |
| 14847 { | 13854 { |
| 14848 RawObject* raw = Object::Allocate(UnwindError::kClassId, | 13855 RawObject* raw = Object::Allocate(UnwindError::kClassId, |
| 14849 UnwindError::InstanceSize(), | 13856 UnwindError::InstanceSize(), |
| 14850 space); | 13857 space); |
| 14851 NoSafepointScope no_safepoint; | 13858 NoSafepointScope no_safepoint; |
| 14852 result ^= raw; | 13859 result ^= raw; |
| 14853 } | 13860 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 14877 const String& msg_str = String::Handle(message()); | 13884 const String& msg_str = String::Handle(message()); |
| 14878 return msg_str.ToCString(); | 13885 return msg_str.ToCString(); |
| 14879 } | 13886 } |
| 14880 | 13887 |
| 14881 | 13888 |
| 14882 const char* UnwindError::ToCString() const { | 13889 const char* UnwindError::ToCString() const { |
| 14883 return "UnwindError"; | 13890 return "UnwindError"; |
| 14884 } | 13891 } |
| 14885 | 13892 |
| 14886 | 13893 |
| 14887 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 14888 JSONObject jsobj(stream); | |
| 14889 AddCommonObjectProperties(&jsobj, "Error", ref); | |
| 14890 jsobj.AddProperty("kind", "TerminationError"); | |
| 14891 jsobj.AddServiceId(*this); | |
| 14892 jsobj.AddProperty("message", ToErrorCString()); | |
| 14893 jsobj.AddProperty("_is_user_initiated", is_user_initiated()); | |
| 14894 jsobj.AddProperty("_is_vm_restart", is_vm_restart()); | |
| 14895 } | |
| 14896 | |
| 14897 | |
| 14898 RawObject* Instance::Evaluate(const String& expr, | 13894 RawObject* Instance::Evaluate(const String& expr, |
| 14899 const Array& param_names, | 13895 const Array& param_names, |
| 14900 const Array& param_values) const { | 13896 const Array& param_values) const { |
| 14901 const Class& cls = Class::Handle(clazz()); | 13897 const Class& cls = Class::Handle(clazz()); |
| 14902 const Function& eval_func = | 13898 const Function& eval_func = |
| 14903 Function::Handle(EvaluateHelper(cls, expr, param_names, false)); | 13899 Function::Handle(EvaluateHelper(cls, expr, param_names, false)); |
| 14904 const Array& args = Array::Handle(Array::New(1 + param_values.Length())); | 13900 const Array& args = Array::Handle(Array::New(1 + param_values.Length())); |
| 14905 PassiveObject& param = PassiveObject::Handle(); | 13901 PassiveObject& param = PassiveObject::Handle(); |
| 14906 args.SetAt(0, *this); | 13902 args.SetAt(0, *this); |
| 14907 for (intptr_t i = 0; i < param_values.Length(); i++) { | 13903 for (intptr_t i = 0; i < param_values.Length(); i++) { |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15430 } | 14426 } |
| 15431 const Type& type = Type::Handle( | 14427 const Type& type = Type::Handle( |
| 15432 Type::New(cls, type_arguments, TokenPosition::kNoSource)); | 14428 Type::New(cls, type_arguments, TokenPosition::kNoSource)); |
| 15433 const String& type_name = String::Handle(type.UserVisibleName()); | 14429 const String& type_name = String::Handle(type.UserVisibleName()); |
| 15434 return OS::SCreate(Thread::Current()->zone(), | 14430 return OS::SCreate(Thread::Current()->zone(), |
| 15435 "Instance of '%s'", type_name.ToCString()); | 14431 "Instance of '%s'", type_name.ToCString()); |
| 15436 } | 14432 } |
| 15437 } | 14433 } |
| 15438 | 14434 |
| 15439 | 14435 |
| 15440 void Instance::PrintSharedInstanceJSON(JSONObject* jsobj, | |
| 15441 bool ref) const { | |
| 15442 AddCommonObjectProperties(jsobj, "Instance", ref); | |
| 15443 if (ref) { | |
| 15444 return; | |
| 15445 } | |
| 15446 | |
| 15447 // Walk the superclass chain, adding all instance fields. | |
| 15448 Class& cls = Class::Handle(this->clazz()); | |
| 15449 { | |
| 15450 Instance& fieldValue = Instance::Handle(); | |
| 15451 JSONArray jsarr(jsobj, "fields"); | |
| 15452 while (!cls.IsNull()) { | |
| 15453 const Array& field_array = Array::Handle(cls.fields()); | |
| 15454 Field& field = Field::Handle(); | |
| 15455 if (!field_array.IsNull()) { | |
| 15456 for (intptr_t i = 0; i < field_array.Length(); i++) { | |
| 15457 field ^= field_array.At(i); | |
| 15458 if (!field.is_static()) { | |
| 15459 fieldValue ^= GetField(field); | |
| 15460 JSONObject jsfield(&jsarr); | |
| 15461 jsfield.AddProperty("type", "BoundField"); | |
| 15462 jsfield.AddProperty("decl", field); | |
| 15463 jsfield.AddProperty("value", fieldValue); | |
| 15464 } | |
| 15465 } | |
| 15466 } | |
| 15467 cls = cls.SuperClass(); | |
| 15468 } | |
| 15469 } | |
| 15470 | |
| 15471 if (NumNativeFields() > 0) { | |
| 15472 JSONArray jsarr(jsobj, "_nativeFields"); | |
| 15473 for (intptr_t i = 0; i < NumNativeFields(); i++) { | |
| 15474 intptr_t value = GetNativeField(i); | |
| 15475 JSONObject jsfield(&jsarr); | |
| 15476 jsfield.AddProperty("index", i); | |
| 15477 jsfield.AddProperty("value", value); | |
| 15478 } | |
| 15479 } | |
| 15480 } | |
| 15481 | |
| 15482 | |
| 15483 void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 15484 JSONObject jsobj(stream); | |
| 15485 | |
| 15486 // Handle certain special instance values. | |
| 15487 if (raw() == Object::sentinel().raw()) { | |
| 15488 jsobj.AddProperty("type", "Sentinel"); | |
| 15489 jsobj.AddProperty("kind", "NotInitialized"); | |
| 15490 jsobj.AddProperty("valueAsString", "<not initialized>"); | |
| 15491 return; | |
| 15492 } else if (raw() == Object::transition_sentinel().raw()) { | |
| 15493 jsobj.AddProperty("type", "Sentinel"); | |
| 15494 jsobj.AddProperty("kind", "BeingInitialized"); | |
| 15495 jsobj.AddProperty("valueAsString", "<being initialized>"); | |
| 15496 return; | |
| 15497 } | |
| 15498 | |
| 15499 PrintSharedInstanceJSON(&jsobj, ref); | |
| 15500 if (IsClosure()) { | |
| 15501 jsobj.AddProperty("kind", "Closure"); | |
| 15502 } else { | |
| 15503 jsobj.AddProperty("kind", "PlainInstance"); | |
| 15504 } | |
| 15505 jsobj.AddServiceId(*this); | |
| 15506 if (IsClosure()) { | |
| 15507 jsobj.AddProperty("closureFunction", | |
| 15508 Function::Handle(Closure::Cast(*this).function())); | |
| 15509 jsobj.AddProperty("closureContext", | |
| 15510 Context::Handle(Closure::Cast(*this).context())); | |
| 15511 } | |
| 15512 if (ref) { | |
| 15513 return; | |
| 15514 } | |
| 15515 if (IsClosure()) { | |
| 15516 Debugger* debugger = Isolate::Current()->debugger(); | |
| 15517 Breakpoint* bpt = debugger->BreakpointAtActivation(*this); | |
| 15518 if (bpt != NULL) { | |
| 15519 jsobj.AddProperty("_activationBreakpoint", bpt); | |
| 15520 } | |
| 15521 } | |
| 15522 } | |
| 15523 | |
| 15524 | |
| 15525 bool AbstractType::IsResolved() const { | 14436 bool AbstractType::IsResolved() const { |
| 15526 // AbstractType is an abstract class. | 14437 // AbstractType is an abstract class. |
| 15527 UNREACHABLE(); | 14438 UNREACHABLE(); |
| 15528 return false; | 14439 return false; |
| 15529 } | 14440 } |
| 15530 | 14441 |
| 15531 | 14442 |
| 15532 void AbstractType::SetIsResolved() const { | 14443 void AbstractType::SetIsResolved() const { |
| 15533 // AbstractType is an abstract class. | 14444 // AbstractType is an abstract class. |
| 15534 UNREACHABLE(); | 14445 UNREACHABLE(); |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16066 } | 14977 } |
| 16067 | 14978 |
| 16068 | 14979 |
| 16069 const char* AbstractType::ToCString() const { | 14980 const char* AbstractType::ToCString() const { |
| 16070 // AbstractType is an abstract class. | 14981 // AbstractType is an abstract class. |
| 16071 UNREACHABLE(); | 14982 UNREACHABLE(); |
| 16072 return "AbstractType"; | 14983 return "AbstractType"; |
| 16073 } | 14984 } |
| 16074 | 14985 |
| 16075 | 14986 |
| 16076 void AbstractType::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 16077 UNREACHABLE(); | |
| 16078 } | |
| 16079 | |
| 16080 | |
| 16081 RawType* Type::NullType() { | 14987 RawType* Type::NullType() { |
| 16082 return Isolate::Current()->object_store()->null_type(); | 14988 return Isolate::Current()->object_store()->null_type(); |
| 16083 } | 14989 } |
| 16084 | 14990 |
| 16085 | 14991 |
| 16086 RawType* Type::DynamicType() { | 14992 RawType* Type::DynamicType() { |
| 16087 return Object::dynamic_type().raw(); | 14993 return Object::dynamic_type().raw(); |
| 16088 } | 14994 } |
| 16089 | 14995 |
| 16090 | 14996 |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16667 "Type: (@%p H%" Px ") class '%s', args:[%s]", | 15573 "Type: (@%p H%" Px ") class '%s', args:[%s]", |
| 16668 raw(), hash, class_name, args_cstr); | 15574 raw(), hash, class_name, args_cstr); |
| 16669 } else { | 15575 } else { |
| 16670 const char* args_cstr = TypeArguments::Handle(arguments()).ToCString(); | 15576 const char* args_cstr = TypeArguments::Handle(arguments()).ToCString(); |
| 16671 return OS::SCreate(Thread::Current()->zone(), | 15577 return OS::SCreate(Thread::Current()->zone(), |
| 16672 "%sType: class '%s', args:[%s]", unresolved, class_name, args_cstr); | 15578 "%sType: class '%s', args:[%s]", unresolved, class_name, args_cstr); |
| 16673 } | 15579 } |
| 16674 } | 15580 } |
| 16675 | 15581 |
| 16676 | 15582 |
| 16677 void Type::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 16678 JSONObject jsobj(stream); | |
| 16679 PrintSharedInstanceJSON(&jsobj, ref); | |
| 16680 jsobj.AddProperty("kind", "Type"); | |
| 16681 if (IsCanonical()) { | |
| 16682 const Class& type_cls = Class::Handle(type_class()); | |
| 16683 intptr_t id = type_cls.FindCanonicalTypeIndex(*this); | |
| 16684 ASSERT(id >= 0); | |
| 16685 intptr_t cid = type_cls.id(); | |
| 16686 jsobj.AddFixedServiceId("classes/%" Pd "/types/%" Pd "", cid, id); | |
| 16687 jsobj.AddProperty("typeClass", type_cls); | |
| 16688 } else { | |
| 16689 jsobj.AddServiceId(*this); | |
| 16690 } | |
| 16691 const String& user_name = String::Handle(PrettyName()); | |
| 16692 const String& vm_name = String::Handle(Name()); | |
| 16693 AddNameProperties(&jsobj, user_name, vm_name); | |
| 16694 if (ref) { | |
| 16695 return; | |
| 16696 } | |
| 16697 const TypeArguments& typeArgs = TypeArguments::Handle(arguments()); | |
| 16698 if (!typeArgs.IsNull()) { | |
| 16699 jsobj.AddProperty("typeArguments", typeArgs); | |
| 16700 } | |
| 16701 } | |
| 16702 | |
| 16703 | |
| 16704 void FunctionType::SetIsFinalized() const { | 15583 void FunctionType::SetIsFinalized() const { |
| 16705 ASSERT(!IsFinalized()); | 15584 ASSERT(!IsFinalized()); |
| 16706 if (IsInstantiated()) { | 15585 if (IsInstantiated()) { |
| 16707 set_type_state(RawFunctionType::kFinalizedInstantiated); | 15586 set_type_state(RawFunctionType::kFinalizedInstantiated); |
| 16708 } else { | 15587 } else { |
| 16709 set_type_state(RawFunctionType::kFinalizedUninstantiated); | 15588 set_type_state(RawFunctionType::kFinalizedUninstantiated); |
| 16710 } | 15589 } |
| 16711 } | 15590 } |
| 16712 | 15591 |
| 16713 | 15592 |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17213 return OS::SCreate( | 16092 return OS::SCreate( |
| 17214 Thread::Current()->zone(), | 16093 Thread::Current()->zone(), |
| 17215 "%s FunctionType: %s (scope_cls: %s, args: %s)", | 16094 "%s FunctionType: %s (scope_cls: %s, args: %s)", |
| 17216 unresolved, | 16095 unresolved, |
| 17217 signature_string.ToCString(), | 16096 signature_string.ToCString(), |
| 17218 class_name, | 16097 class_name, |
| 17219 args_cstr); | 16098 args_cstr); |
| 17220 } | 16099 } |
| 17221 | 16100 |
| 17222 | 16101 |
| 17223 void FunctionType::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 17224 JSONObject jsobj(stream); | |
| 17225 PrintSharedInstanceJSON(&jsobj, ref); | |
| 17226 jsobj.AddProperty("kind", "FunctionType"); | |
| 17227 if (IsCanonical()) { | |
| 17228 const Class& scope_cls = Class::Handle(scope_class()); | |
| 17229 intptr_t id = scope_cls.FindCanonicalTypeIndex(*this); | |
| 17230 ASSERT(id >= 0); | |
| 17231 intptr_t cid = scope_cls.id(); | |
| 17232 jsobj.AddFixedServiceId("classes/%" Pd "/types/%" Pd "", cid, id); | |
| 17233 jsobj.AddProperty("scopeClass", scope_cls); | |
| 17234 } else { | |
| 17235 jsobj.AddServiceId(*this); | |
| 17236 } | |
| 17237 const String& user_name = String::Handle(PrettyName()); | |
| 17238 const String& vm_name = String::Handle(Name()); | |
| 17239 AddNameProperties(&jsobj, user_name, vm_name); | |
| 17240 if (ref) { | |
| 17241 return; | |
| 17242 } | |
| 17243 const TypeArguments& typeArgs = TypeArguments::Handle(arguments()); | |
| 17244 if (!typeArgs.IsNull()) { | |
| 17245 jsobj.AddProperty("typeArguments", typeArgs); | |
| 17246 } | |
| 17247 } | |
| 17248 | |
| 17249 | |
| 17250 bool TypeRef::IsInstantiated(TrailPtr trail) const { | 16102 bool TypeRef::IsInstantiated(TrailPtr trail) const { |
| 17251 if (TestAndAddToTrail(&trail)) { | 16103 if (TestAndAddToTrail(&trail)) { |
| 17252 return true; | 16104 return true; |
| 17253 } | 16105 } |
| 17254 return AbstractType::Handle(type()).IsInstantiated(trail); | 16106 return AbstractType::Handle(type()).IsInstantiated(trail); |
| 17255 } | 16107 } |
| 17256 | 16108 |
| 17257 | 16109 |
| 17258 bool TypeRef::IsEquivalent(const Instance& other, TrailPtr trail) const { | 16110 bool TypeRef::IsEquivalent(const Instance& other, TrailPtr trail) const { |
| 17259 if (raw() == other.raw()) { | 16111 if (raw() == other.raw()) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17400 const intptr_t hash = ref_type.Hash(); | 16252 const intptr_t hash = ref_type.Hash(); |
| 17401 return OS::SCreate(Thread::Current()->zone(), | 16253 return OS::SCreate(Thread::Current()->zone(), |
| 17402 "TypeRef: %s<...> (@%p H%" Px ")", type_cstr, ref_type.raw(), hash); | 16254 "TypeRef: %s<...> (@%p H%" Px ")", type_cstr, ref_type.raw(), hash); |
| 17403 } else { | 16255 } else { |
| 17404 return OS::SCreate(Thread::Current()->zone(), | 16256 return OS::SCreate(Thread::Current()->zone(), |
| 17405 "TypeRef: %s<...>", type_cstr); | 16257 "TypeRef: %s<...>", type_cstr); |
| 17406 } | 16258 } |
| 17407 } | 16259 } |
| 17408 | 16260 |
| 17409 | 16261 |
| 17410 void TypeRef::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 17411 JSONObject jsobj(stream); | |
| 17412 PrintSharedInstanceJSON(&jsobj, ref); | |
| 17413 jsobj.AddProperty("kind", "TypeRef"); | |
| 17414 jsobj.AddServiceId(*this); | |
| 17415 const String& user_name = String::Handle(PrettyName()); | |
| 17416 const String& vm_name = String::Handle(Name()); | |
| 17417 AddNameProperties(&jsobj, user_name, vm_name); | |
| 17418 if (ref) { | |
| 17419 return; | |
| 17420 } | |
| 17421 jsobj.AddProperty("targetType", AbstractType::Handle(type())); | |
| 17422 } | |
| 17423 | |
| 17424 | |
| 17425 void TypeParameter::SetIsFinalized() const { | 16262 void TypeParameter::SetIsFinalized() const { |
| 17426 ASSERT(!IsFinalized()); | 16263 ASSERT(!IsFinalized()); |
| 17427 set_type_state(RawTypeParameter::kFinalizedUninstantiated); | 16264 set_type_state(RawTypeParameter::kFinalizedUninstantiated); |
| 17428 } | 16265 } |
| 17429 | 16266 |
| 17430 | 16267 |
| 17431 bool TypeParameter::IsEquivalent(const Instance& other, TrailPtr trail) const { | 16268 bool TypeParameter::IsEquivalent(const Instance& other, TrailPtr trail) const { |
| 17432 if (raw() == other.raw()) { | 16269 if (raw() == other.raw()) { |
| 17433 return true; | 16270 return true; |
| 17434 } | 16271 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17636 const AbstractType& upper_bound = AbstractType::Handle(bound()); | 16473 const AbstractType& upper_bound = AbstractType::Handle(bound()); |
| 17637 const char* bound_cstr = String::Handle(upper_bound.Name()).ToCString(); | 16474 const char* bound_cstr = String::Handle(upper_bound.Name()).ToCString(); |
| 17638 intptr_t len = OS::SNPrint( | 16475 intptr_t len = OS::SNPrint( |
| 17639 NULL, 0, format, name_cstr, index(), cls_cstr, bound_cstr) + 1; | 16476 NULL, 0, format, name_cstr, index(), cls_cstr, bound_cstr) + 1; |
| 17640 char* chars = Thread::Current()->zone()->Alloc<char>(len); | 16477 char* chars = Thread::Current()->zone()->Alloc<char>(len); |
| 17641 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr, bound_cstr); | 16478 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr, bound_cstr); |
| 17642 return chars; | 16479 return chars; |
| 17643 } | 16480 } |
| 17644 | 16481 |
| 17645 | 16482 |
| 17646 void TypeParameter::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 17647 JSONObject jsobj(stream); | |
| 17648 PrintSharedInstanceJSON(&jsobj, ref); | |
| 17649 jsobj.AddProperty("kind", "TypeParameter"); | |
| 17650 jsobj.AddServiceId(*this); | |
| 17651 const String& user_name = String::Handle(PrettyName()); | |
| 17652 const String& vm_name = String::Handle(Name()); | |
| 17653 AddNameProperties(&jsobj, user_name, vm_name); | |
| 17654 const Class& param_cls = Class::Handle(parameterized_class()); | |
| 17655 jsobj.AddProperty("parameterizedClass", param_cls); | |
| 17656 if (ref) { | |
| 17657 return; | |
| 17658 } | |
| 17659 jsobj.AddProperty("parameterIndex", index()); | |
| 17660 const AbstractType& upper_bound = AbstractType::Handle(bound()); | |
| 17661 jsobj.AddProperty("bound", upper_bound); | |
| 17662 } | |
| 17663 | |
| 17664 | |
| 17665 bool BoundedType::IsMalformed() const { | 16483 bool BoundedType::IsMalformed() const { |
| 17666 return AbstractType::Handle(type()).IsMalformed(); | 16484 return AbstractType::Handle(type()).IsMalformed(); |
| 17667 } | 16485 } |
| 17668 | 16486 |
| 17669 | 16487 |
| 17670 bool BoundedType::IsMalbounded() const { | 16488 bool BoundedType::IsMalbounded() const { |
| 17671 return AbstractType::Handle(type()).IsMalbounded(); | 16489 return AbstractType::Handle(type()).IsMalbounded(); |
| 17672 } | 16490 } |
| 17673 | 16491 |
| 17674 | 16492 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17867 const char* cls_cstr = String::Handle(cls.Name()).ToCString(); | 16685 const char* cls_cstr = String::Handle(cls.Name()).ToCString(); |
| 17868 intptr_t len = OS::SNPrint( | 16686 intptr_t len = OS::SNPrint( |
| 17869 NULL, 0, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr) + 1; | 16687 NULL, 0, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr) + 1; |
| 17870 char* chars = Thread::Current()->zone()->Alloc<char>(len); | 16688 char* chars = Thread::Current()->zone()->Alloc<char>(len); |
| 17871 OS::SNPrint( | 16689 OS::SNPrint( |
| 17872 chars, len, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr); | 16690 chars, len, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr); |
| 17873 return chars; | 16691 return chars; |
| 17874 } | 16692 } |
| 17875 | 16693 |
| 17876 | 16694 |
| 17877 void BoundedType::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 17878 JSONObject jsobj(stream); | |
| 17879 PrintSharedInstanceJSON(&jsobj, ref); | |
| 17880 jsobj.AddProperty("kind", "BoundedType"); | |
| 17881 jsobj.AddServiceId(*this); | |
| 17882 const String& user_name = String::Handle(PrettyName()); | |
| 17883 const String& vm_name = String::Handle(Name()); | |
| 17884 AddNameProperties(&jsobj, user_name, vm_name); | |
| 17885 if (ref) { | |
| 17886 return; | |
| 17887 } | |
| 17888 jsobj.AddProperty("targetType", AbstractType::Handle(type())); | |
| 17889 jsobj.AddProperty("bound", AbstractType::Handle(bound())); | |
| 17890 } | |
| 17891 | |
| 17892 | |
| 17893 TokenPosition MixinAppType::token_pos() const { | 16695 TokenPosition MixinAppType::token_pos() const { |
| 17894 return AbstractType::Handle(MixinTypeAt(0)).token_pos(); | 16696 return AbstractType::Handle(MixinTypeAt(0)).token_pos(); |
| 17895 } | 16697 } |
| 17896 | 16698 |
| 17897 | 16699 |
| 17898 intptr_t MixinAppType::Depth() const { | 16700 intptr_t MixinAppType::Depth() const { |
| 17899 return Array::Handle(mixin_types()).Length(); | 16701 return Array::Handle(mixin_types()).Length(); |
| 17900 } | 16702 } |
| 17901 | 16703 |
| 17902 | 16704 |
| 17903 RawString* MixinAppType::Name() const { | 16705 RawString* MixinAppType::Name() const { |
| 17904 return String::New("MixinAppType"); | 16706 return String::New("MixinAppType"); |
| 17905 } | 16707 } |
| 17906 | 16708 |
| 17907 | 16709 |
| 17908 const char* MixinAppType::ToCString() const { | 16710 const char* MixinAppType::ToCString() const { |
| 17909 const char* format = "MixinAppType: super type: %s; first mixin type: %s"; | 16711 const char* format = "MixinAppType: super type: %s; first mixin type: %s"; |
| 17910 const char* super_type_cstr = String::Handle(AbstractType::Handle( | 16712 const char* super_type_cstr = String::Handle(AbstractType::Handle( |
| 17911 super_type()).Name()).ToCString(); | 16713 super_type()).Name()).ToCString(); |
| 17912 const char* first_mixin_type_cstr = String::Handle(AbstractType::Handle( | 16714 const char* first_mixin_type_cstr = String::Handle(AbstractType::Handle( |
| 17913 MixinTypeAt(0)).Name()).ToCString(); | 16715 MixinTypeAt(0)).Name()).ToCString(); |
| 17914 intptr_t len = OS::SNPrint( | 16716 intptr_t len = OS::SNPrint( |
| 17915 NULL, 0, format, super_type_cstr, first_mixin_type_cstr) + 1; | 16717 NULL, 0, format, super_type_cstr, first_mixin_type_cstr) + 1; |
| 17916 char* chars = Thread::Current()->zone()->Alloc<char>(len); | 16718 char* chars = Thread::Current()->zone()->Alloc<char>(len); |
| 17917 OS::SNPrint(chars, len, format, super_type_cstr, first_mixin_type_cstr); | 16719 OS::SNPrint(chars, len, format, super_type_cstr, first_mixin_type_cstr); |
| 17918 return chars; | 16720 return chars; |
| 17919 } | 16721 } |
| 17920 | 16722 |
| 17921 | 16723 |
| 17922 void MixinAppType::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 17923 UNREACHABLE(); | |
| 17924 } | |
| 17925 | |
| 17926 | |
| 17927 RawAbstractType* MixinAppType::MixinTypeAt(intptr_t depth) const { | 16724 RawAbstractType* MixinAppType::MixinTypeAt(intptr_t depth) const { |
| 17928 return AbstractType::RawCast(Array::Handle(mixin_types()).At(depth)); | 16725 return AbstractType::RawCast(Array::Handle(mixin_types()).At(depth)); |
| 17929 } | 16726 } |
| 17930 | 16727 |
| 17931 | 16728 |
| 17932 void MixinAppType::set_super_type(const AbstractType& value) const { | 16729 void MixinAppType::set_super_type(const AbstractType& value) const { |
| 17933 StorePointer(&raw_ptr()->super_type_, value.raw()); | 16730 StorePointer(&raw_ptr()->super_type_, value.raw()); |
| 17934 } | 16731 } |
| 17935 | 16732 |
| 17936 | 16733 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 17958 } | 16755 } |
| 17959 | 16756 |
| 17960 | 16757 |
| 17961 const char* Number::ToCString() const { | 16758 const char* Number::ToCString() const { |
| 17962 // Number is an interface. No instances of Number should exist. | 16759 // Number is an interface. No instances of Number should exist. |
| 17963 UNREACHABLE(); | 16760 UNREACHABLE(); |
| 17964 return "Number"; | 16761 return "Number"; |
| 17965 } | 16762 } |
| 17966 | 16763 |
| 17967 | 16764 |
| 17968 void Number::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 17969 UNREACHABLE(); | |
| 17970 } | |
| 17971 | |
| 17972 | |
| 17973 const char* Integer::ToCString() const { | 16765 const char* Integer::ToCString() const { |
| 17974 // Integer is an interface. No instances of Integer should exist except null. | 16766 // Integer is an interface. No instances of Integer should exist except null. |
| 17975 ASSERT(IsNull()); | 16767 ASSERT(IsNull()); |
| 17976 return "NULL Integer"; | 16768 return "NULL Integer"; |
| 17977 } | 16769 } |
| 17978 | 16770 |
| 17979 | 16771 |
| 17980 void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 17981 JSONObject jsobj(stream); | |
| 17982 PrintSharedInstanceJSON(&jsobj, ref); | |
| 17983 jsobj.AddProperty("kind", "Int"); | |
| 17984 jsobj.AddServiceId(*this); | |
| 17985 jsobj.AddProperty("valueAsString", ToCString()); | |
| 17986 } | |
| 17987 | |
| 17988 | |
| 17989 // Throw JavascriptIntegerOverflow exception. | 16772 // Throw JavascriptIntegerOverflow exception. |
| 17990 static void ThrowJavascriptIntegerOverflow(const Integer& i) { | 16773 static void ThrowJavascriptIntegerOverflow(const Integer& i) { |
| 17991 const Array& exc_args = Array::Handle(Array::New(1)); | 16774 const Array& exc_args = Array::Handle(Array::New(1)); |
| 17992 const String& i_str = String::Handle(String::New(i.ToCString())); | 16775 const String& i_str = String::Handle(String::New(i.ToCString())); |
| 17993 exc_args.SetAt(0, i_str); | 16776 exc_args.SetAt(0, i_str); |
| 17994 Exceptions::ThrowByType(Exceptions::kJavascriptIntegerOverflowError, | 16777 Exceptions::ThrowByType(Exceptions::kJavascriptIntegerOverflowError, |
| 17995 exc_args); | 16778 exc_args); |
| 17996 } | 16779 } |
| 17997 | 16780 |
| 17998 | 16781 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18398 UNREACHABLE(); | 17181 UNREACHABLE(); |
| 18399 return 0; | 17182 return 0; |
| 18400 } | 17183 } |
| 18401 | 17184 |
| 18402 | 17185 |
| 18403 const char* Smi::ToCString() const { | 17186 const char* Smi::ToCString() const { |
| 18404 return OS::SCreate(Thread::Current()->zone(), "%" Pd "", Value()); | 17187 return OS::SCreate(Thread::Current()->zone(), "%" Pd "", Value()); |
| 18405 } | 17188 } |
| 18406 | 17189 |
| 18407 | 17190 |
| 18408 void Smi::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 18409 JSONObject jsobj(stream); | |
| 18410 PrintSharedInstanceJSON(&jsobj, ref); | |
| 18411 jsobj.AddProperty("kind", "Int"); | |
| 18412 jsobj.AddFixedServiceId("objects/int-%" Pd "", Value()); | |
| 18413 jsobj.AddPropertyF("valueAsString", "%" Pd "", Value()); | |
| 18414 } | |
| 18415 | |
| 18416 | |
| 18417 RawClass* Smi::Class() { | 17191 RawClass* Smi::Class() { |
| 18418 return Isolate::Current()->object_store()->smi_class(); | 17192 return Isolate::Current()->object_store()->smi_class(); |
| 18419 } | 17193 } |
| 18420 | 17194 |
| 18421 | 17195 |
| 18422 void Mint::set_value(int64_t value) const { | 17196 void Mint::set_value(int64_t value) const { |
| 18423 StoreNonPointer(&raw_ptr()->value_, value); | 17197 StoreNonPointer(&raw_ptr()->value_, value); |
| 18424 } | 17198 } |
| 18425 | 17199 |
| 18426 | 17200 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18524 } | 17298 } |
| 18525 return this->IsNegative() ? -1 : 1; | 17299 return this->IsNegative() ? -1 : 1; |
| 18526 } | 17300 } |
| 18527 | 17301 |
| 18528 | 17302 |
| 18529 const char* Mint::ToCString() const { | 17303 const char* Mint::ToCString() const { |
| 18530 return OS::SCreate(Thread::Current()->zone(), "%" Pd64 "", value()); | 17304 return OS::SCreate(Thread::Current()->zone(), "%" Pd64 "", value()); |
| 18531 } | 17305 } |
| 18532 | 17306 |
| 18533 | 17307 |
| 18534 void Mint::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 18535 Integer::PrintJSONImpl(stream, ref); | |
| 18536 } | |
| 18537 | |
| 18538 | |
| 18539 void Double::set_value(double value) const { | 17308 void Double::set_value(double value) const { |
| 18540 StoreNonPointer(&raw_ptr()->value_, value); | 17309 StoreNonPointer(&raw_ptr()->value_, value); |
| 18541 } | 17310 } |
| 18542 | 17311 |
| 18543 | 17312 |
| 18544 bool Double::BitwiseEqualsToDouble(double value) const { | 17313 bool Double::BitwiseEqualsToDouble(double value) const { |
| 18545 intptr_t value_offset = Double::value_offset(); | 17314 intptr_t value_offset = Double::value_offset(); |
| 18546 void* this_addr = reinterpret_cast<void*>( | 17315 void* this_addr = reinterpret_cast<void*>( |
| 18547 reinterpret_cast<uword>(this->raw_ptr()) + value_offset); | 17316 reinterpret_cast<uword>(this->raw_ptr()) + value_offset); |
| 18548 void* other_addr = reinterpret_cast<void*>(&value); | 17317 void* other_addr = reinterpret_cast<void*>(&value); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18656 return value() < 0 ? "-Infinity" : "Infinity"; | 17425 return value() < 0 ? "-Infinity" : "Infinity"; |
| 18657 } | 17426 } |
| 18658 const int kBufferSize = 128; | 17427 const int kBufferSize = 128; |
| 18659 char* buffer = Thread::Current()->zone()->Alloc<char>(kBufferSize); | 17428 char* buffer = Thread::Current()->zone()->Alloc<char>(kBufferSize); |
| 18660 buffer[kBufferSize - 1] = '\0'; | 17429 buffer[kBufferSize - 1] = '\0'; |
| 18661 DoubleToCString(value(), buffer, kBufferSize); | 17430 DoubleToCString(value(), buffer, kBufferSize); |
| 18662 return buffer; | 17431 return buffer; |
| 18663 } | 17432 } |
| 18664 | 17433 |
| 18665 | 17434 |
| 18666 void Double::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 18667 JSONObject jsobj(stream); | |
| 18668 PrintSharedInstanceJSON(&jsobj, ref); | |
| 18669 jsobj.AddProperty("kind", "Double"); | |
| 18670 jsobj.AddServiceId(*this); | |
| 18671 jsobj.AddProperty("valueAsString", ToCString()); | |
| 18672 } | |
| 18673 | |
| 18674 | |
| 18675 bool Bigint::Neg() const { | 17435 bool Bigint::Neg() const { |
| 18676 return Bool::Handle(neg()).value(); | 17436 return Bool::Handle(neg()).value(); |
| 18677 } | 17437 } |
| 18678 | 17438 |
| 18679 | 17439 |
| 18680 void Bigint::SetNeg(bool value) const { | 17440 void Bigint::SetNeg(bool value) const { |
| 18681 StorePointer(&raw_ptr()->neg_, Bool::Get(value).raw()); | 17441 StorePointer(&raw_ptr()->neg_, Bool::Get(value).raw()); |
| 18682 } | 17442 } |
| 18683 | 17443 |
| 18684 | 17444 |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19412 Zone* zone = Thread::Current()->zone(); | 18172 Zone* zone = Thread::Current()->zone(); |
| 19413 return zone->AllocUnsafe(size); | 18173 return zone->AllocUnsafe(size); |
| 19414 } | 18174 } |
| 19415 | 18175 |
| 19416 | 18176 |
| 19417 const char* Bigint::ToCString() const { | 18177 const char* Bigint::ToCString() const { |
| 19418 return ToDecCString(&BigintAllocator); | 18178 return ToDecCString(&BigintAllocator); |
| 19419 } | 18179 } |
| 19420 | 18180 |
| 19421 | 18181 |
| 19422 void Bigint::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 19423 Integer::PrintJSONImpl(stream, ref); | |
| 19424 } | |
| 19425 | |
| 19426 | |
| 19427 // Synchronize with implementation in compiler (intrinsifier). | 18182 // Synchronize with implementation in compiler (intrinsifier). |
| 19428 class StringHasher : ValueObject { | 18183 class StringHasher : ValueObject { |
| 19429 public: | 18184 public: |
| 19430 StringHasher() : hash_(0) {} | 18185 StringHasher() : hash_(0) {} |
| 19431 void Add(int32_t ch) { | 18186 void Add(int32_t ch) { |
| 19432 hash_ = CombineHashes(hash_, ch); | 18187 hash_ = CombineHashes(hash_, ch); |
| 19433 } | 18188 } |
| 19434 void Add(const String& str, intptr_t begin_index, intptr_t len); | 18189 void Add(const String& str, intptr_t begin_index, intptr_t len); |
| 19435 | 18190 |
| 19436 // Return a non-zero hash of at most 'bits' bits. | 18191 // Return a non-zero hash of at most 'bits' bits. |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20247 } | 19002 } |
| 20248 const intptr_t len = Utf8::Length(*this); | 19003 const intptr_t len = Utf8::Length(*this); |
| 20249 Zone* zone = Thread::Current()->zone(); | 19004 Zone* zone = Thread::Current()->zone(); |
| 20250 uint8_t* result = zone->Alloc<uint8_t>(len + 1); | 19005 uint8_t* result = zone->Alloc<uint8_t>(len + 1); |
| 20251 ToUTF8(result, len); | 19006 ToUTF8(result, len); |
| 20252 result[len] = 0; | 19007 result[len] = 0; |
| 20253 return reinterpret_cast<const char*>(result); | 19008 return reinterpret_cast<const char*>(result); |
| 20254 } | 19009 } |
| 20255 | 19010 |
| 20256 | 19011 |
| 20257 void String::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 20258 JSONObject jsobj(stream); | |
| 20259 if (raw() == Symbols::OptimizedOut().raw()) { | |
| 20260 // TODO(turnidge): This is a hack. The user could have this | |
| 20261 // special string in their program. Fixing this involves updating | |
| 20262 // the debugging api a bit. | |
| 20263 jsobj.AddProperty("type", "Sentinel"); | |
| 20264 jsobj.AddProperty("kind", "OptimizedOut"); | |
| 20265 jsobj.AddProperty("valueAsString", "<optimized out>"); | |
| 20266 return; | |
| 20267 } | |
| 20268 PrintSharedInstanceJSON(&jsobj, ref); | |
| 20269 jsobj.AddProperty("kind", "String"); | |
| 20270 jsobj.AddServiceId(*this); | |
| 20271 jsobj.AddProperty("length", Length()); | |
| 20272 if (ref) { | |
| 20273 // String refs always truncate to a fixed count; | |
| 20274 const intptr_t kFixedCount = 128; | |
| 20275 if (jsobj.AddPropertyStr("valueAsString", *this, 0, kFixedCount)) { | |
| 20276 jsobj.AddProperty("count", kFixedCount); | |
| 20277 jsobj.AddProperty("valueAsStringIsTruncated", true); | |
| 20278 } | |
| 20279 return; | |
| 20280 } | |
| 20281 | |
| 20282 intptr_t offset; | |
| 20283 intptr_t count; | |
| 20284 stream->ComputeOffsetAndCount(Length(), &offset, &count); | |
| 20285 if (offset > 0) { | |
| 20286 jsobj.AddProperty("offset", offset); | |
| 20287 } | |
| 20288 if (count < Length()) { | |
| 20289 jsobj.AddProperty("count", count); | |
| 20290 } | |
| 20291 jsobj.AddPropertyStr("valueAsString", *this, offset, count); | |
| 20292 } | |
| 20293 | |
| 20294 | |
| 20295 void String::ToUTF8(uint8_t* utf8_array, intptr_t array_len) const { | 19012 void String::ToUTF8(uint8_t* utf8_array, intptr_t array_len) const { |
| 20296 ASSERT(array_len >= Utf8::Length(*this)); | 19013 ASSERT(array_len >= Utf8::Length(*this)); |
| 20297 Utf8::Encode(*this, reinterpret_cast<char*>(utf8_array), array_len); | 19014 Utf8::Encode(*this, reinterpret_cast<char*>(utf8_array), array_len); |
| 20298 } | 19015 } |
| 20299 | 19016 |
| 20300 | 19017 |
| 20301 static FinalizablePersistentHandle* AddFinalizer( | 19018 static FinalizablePersistentHandle* AddFinalizer( |
| 20302 const Object& referent, | 19019 const Object& referent, |
| 20303 void* peer, | 19020 void* peer, |
| 20304 Dart_WeakPersistentHandleFinalizer callback) { | 19021 Dart_WeakPersistentHandleFinalizer callback) { |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21174 result.SetCanonical(); | 19891 result.SetCanonical(); |
| 21175 return result.raw(); | 19892 return result.raw(); |
| 21176 } | 19893 } |
| 21177 | 19894 |
| 21178 | 19895 |
| 21179 const char* Bool::ToCString() const { | 19896 const char* Bool::ToCString() const { |
| 21180 return value() ? "true" : "false"; | 19897 return value() ? "true" : "false"; |
| 21181 } | 19898 } |
| 21182 | 19899 |
| 21183 | 19900 |
| 21184 void Bool::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 21185 const char* str = ToCString(); | |
| 21186 JSONObject jsobj(stream); | |
| 21187 PrintSharedInstanceJSON(&jsobj, ref); | |
| 21188 jsobj.AddProperty("kind", "Bool"); | |
| 21189 jsobj.AddFixedServiceId("objects/bool-%s", str); | |
| 21190 jsobj.AddPropertyF("valueAsString", "%s", str); | |
| 21191 } | |
| 21192 | |
| 21193 | |
| 21194 bool Array::CanonicalizeEquals(const Instance& other) const { | 19901 bool Array::CanonicalizeEquals(const Instance& other) const { |
| 21195 if (this->raw() == other.raw()) { | 19902 if (this->raw() == other.raw()) { |
| 21196 // Both handles point to the same raw instance. | 19903 // Both handles point to the same raw instance. |
| 21197 return true; | 19904 return true; |
| 21198 } | 19905 } |
| 21199 | 19906 |
| 21200 // An Array may be compared to an ImmutableArray. | 19907 // An Array may be compared to an ImmutableArray. |
| 21201 if (!other.IsArray() || other.IsNull()) { | 19908 if (!other.IsArray() || other.IsNull()) { |
| 21202 return false; | 19909 return false; |
| 21203 } | 19910 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21286 if (IsNull()) { | 19993 if (IsNull()) { |
| 21287 return IsImmutable() ? "_ImmutableList NULL" : "_List NULL"; | 19994 return IsImmutable() ? "_ImmutableList NULL" : "_List NULL"; |
| 21288 } | 19995 } |
| 21289 Zone* zone = Thread::Current()->zone(); | 19996 Zone* zone = Thread::Current()->zone(); |
| 21290 const char* format = IsImmutable() ? "_ImmutableList len:%" Pd | 19997 const char* format = IsImmutable() ? "_ImmutableList len:%" Pd |
| 21291 : "_List len:%" Pd; | 19998 : "_List len:%" Pd; |
| 21292 return zone->PrintToString(format, Length()); | 19999 return zone->PrintToString(format, Length()); |
| 21293 } | 20000 } |
| 21294 | 20001 |
| 21295 | 20002 |
| 21296 void Array::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 21297 JSONObject jsobj(stream); | |
| 21298 PrintSharedInstanceJSON(&jsobj, ref); | |
| 21299 jsobj.AddProperty("kind", "List"); | |
| 21300 jsobj.AddServiceId(*this); | |
| 21301 jsobj.AddProperty("length", Length()); | |
| 21302 if (ref) { | |
| 21303 return; | |
| 21304 } | |
| 21305 intptr_t offset; | |
| 21306 intptr_t count; | |
| 21307 stream->ComputeOffsetAndCount(Length(), &offset, &count); | |
| 21308 if (offset > 0) { | |
| 21309 jsobj.AddProperty("offset", offset); | |
| 21310 } | |
| 21311 if (count < Length()) { | |
| 21312 jsobj.AddProperty("count", count); | |
| 21313 } | |
| 21314 intptr_t limit = offset + count; | |
| 21315 ASSERT(limit <= Length()); | |
| 21316 { | |
| 21317 JSONArray jsarr(&jsobj, "elements"); | |
| 21318 Object& element = Object::Handle(); | |
| 21319 for (intptr_t index = offset; index < limit; index++) { | |
| 21320 element = At(index); | |
| 21321 jsarr.AddValue(element); | |
| 21322 } | |
| 21323 } | |
| 21324 } | |
| 21325 | |
| 21326 | |
| 21327 RawArray* Array::Grow(const Array& source, | 20003 RawArray* Array::Grow(const Array& source, |
| 21328 intptr_t new_length, | 20004 intptr_t new_length, |
| 21329 Heap::Space space) { | 20005 Heap::Space space) { |
| 21330 Zone* zone = Thread::Current()->zone(); | 20006 Zone* zone = Thread::Current()->zone(); |
| 21331 const Array& result = Array::Handle(zone, Array::New(new_length, space)); | 20007 const Array& result = Array::Handle(zone, Array::New(new_length, space)); |
| 21332 intptr_t len = 0; | 20008 intptr_t len = 0; |
| 21333 if (!source.IsNull()) { | 20009 if (!source.IsNull()) { |
| 21334 len = source.Length(); | 20010 len = source.Length(); |
| 21335 result.SetTypeArguments( | 20011 result.SetTypeArguments( |
| 21336 TypeArguments::Handle(zone, source.GetTypeArguments())); | 20012 TypeArguments::Handle(zone, source.GetTypeArguments())); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21534 | 20210 |
| 21535 const char* GrowableObjectArray::ToCString() const { | 20211 const char* GrowableObjectArray::ToCString() const { |
| 21536 if (IsNull()) { | 20212 if (IsNull()) { |
| 21537 return "_GrowableList NULL"; | 20213 return "_GrowableList NULL"; |
| 21538 } | 20214 } |
| 21539 return OS::SCreate(Thread::Current()->zone(), | 20215 return OS::SCreate(Thread::Current()->zone(), |
| 21540 "Instance(length:%" Pd ") of '_GrowableList'", Length()); | 20216 "Instance(length:%" Pd ") of '_GrowableList'", Length()); |
| 21541 } | 20217 } |
| 21542 | 20218 |
| 21543 | 20219 |
| 21544 void GrowableObjectArray::PrintJSONImpl(JSONStream* stream, | |
| 21545 bool ref) const { | |
| 21546 JSONObject jsobj(stream); | |
| 21547 PrintSharedInstanceJSON(&jsobj, ref); | |
| 21548 jsobj.AddProperty("kind", "List"); | |
| 21549 jsobj.AddServiceId(*this); | |
| 21550 jsobj.AddProperty("length", Length()); | |
| 21551 if (ref) { | |
| 21552 return; | |
| 21553 } | |
| 21554 intptr_t offset; | |
| 21555 intptr_t count; | |
| 21556 stream->ComputeOffsetAndCount(Length(), &offset, &count); | |
| 21557 if (offset > 0) { | |
| 21558 jsobj.AddProperty("offset", offset); | |
| 21559 } | |
| 21560 if (count < Length()) { | |
| 21561 jsobj.AddProperty("count", count); | |
| 21562 } | |
| 21563 intptr_t limit = offset + count; | |
| 21564 ASSERT(limit <= Length()); | |
| 21565 { | |
| 21566 JSONArray jsarr(&jsobj, "elements"); | |
| 21567 Object& element = Object::Handle(); | |
| 21568 for (intptr_t index = offset; index < limit; index++) { | |
| 21569 element = At(index); | |
| 21570 jsarr.AddValue(element); | |
| 21571 } | |
| 21572 } | |
| 21573 } | |
| 21574 | |
| 21575 | |
| 21576 // Equivalent to Dart's operator "==" and hashCode. | 20220 // Equivalent to Dart's operator "==" and hashCode. |
| 21577 class DefaultHashTraits { | 20221 class DefaultHashTraits { |
| 21578 public: | 20222 public: |
| 21579 static bool IsMatch(const Object& a, const Object& b) { | 20223 static bool IsMatch(const Object& a, const Object& b) { |
| 21580 if (a.IsNull() || b.IsNull()) { | 20224 if (a.IsNull() || b.IsNull()) { |
| 21581 return (a.IsNull() && b.IsNull()); | 20225 return (a.IsNull() && b.IsNull()); |
| 21582 } else { | 20226 } else { |
| 21583 return Instance::Cast(a).OperatorEquals(Instance::Cast(b)); | 20227 return Instance::Cast(a).OperatorEquals(Instance::Cast(b)); |
| 21584 } | 20228 } |
| 21585 } | 20229 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21652 return result.raw(); | 20296 return result.raw(); |
| 21653 } | 20297 } |
| 21654 | 20298 |
| 21655 | 20299 |
| 21656 const char* LinkedHashMap::ToCString() const { | 20300 const char* LinkedHashMap::ToCString() const { |
| 21657 Zone* zone = Thread::Current()->zone(); | 20301 Zone* zone = Thread::Current()->zone(); |
| 21658 return zone->PrintToString("_LinkedHashMap len:%" Pd, Length()); | 20302 return zone->PrintToString("_LinkedHashMap len:%" Pd, Length()); |
| 21659 } | 20303 } |
| 21660 | 20304 |
| 21661 | 20305 |
| 21662 void LinkedHashMap::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 21663 JSONObject jsobj(stream); | |
| 21664 PrintSharedInstanceJSON(&jsobj, ref); | |
| 21665 jsobj.AddProperty("kind", "Map"); | |
| 21666 jsobj.AddServiceId(*this); | |
| 21667 jsobj.AddProperty("length", Length()); | |
| 21668 if (ref) { | |
| 21669 return; | |
| 21670 } | |
| 21671 intptr_t offset; | |
| 21672 intptr_t count; | |
| 21673 stream->ComputeOffsetAndCount(Length(), &offset, &count); | |
| 21674 if (offset > 0) { | |
| 21675 jsobj.AddProperty("offset", offset); | |
| 21676 } | |
| 21677 if (count < Length()) { | |
| 21678 jsobj.AddProperty("count", count); | |
| 21679 } | |
| 21680 intptr_t limit = offset + count; | |
| 21681 ASSERT(limit <= Length()); | |
| 21682 { | |
| 21683 JSONArray jsarr(&jsobj, "associations"); | |
| 21684 Object& object = Object::Handle(); | |
| 21685 LinkedHashMap::Iterator iterator(*this); | |
| 21686 int i = 0; | |
| 21687 while (iterator.MoveNext() && i < limit) { | |
| 21688 if (i >= offset) { | |
| 21689 JSONObject jsassoc(&jsarr); | |
| 21690 object = iterator.CurrentKey(); | |
| 21691 jsassoc.AddProperty("key", object); | |
| 21692 object = iterator.CurrentValue(); | |
| 21693 jsassoc.AddProperty("value", object); | |
| 21694 } | |
| 21695 i++; | |
| 21696 } | |
| 21697 } | |
| 21698 } | |
| 21699 | |
| 21700 | |
| 21701 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, | 20306 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, |
| 21702 Heap::Space space) { | 20307 Heap::Space space) { |
| 21703 ASSERT(Isolate::Current()->object_store()->float32x4_class() != | 20308 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
| 21704 Class::null()); | 20309 Class::null()); |
| 21705 Float32x4& result = Float32x4::Handle(); | 20310 Float32x4& result = Float32x4::Handle(); |
| 21706 { | 20311 { |
| 21707 RawObject* raw = Object::Allocate(Float32x4::kClassId, | 20312 RawObject* raw = Object::Allocate(Float32x4::kClassId, |
| 21708 Float32x4::InstanceSize(), | 20313 Float32x4::InstanceSize(), |
| 21709 space); | 20314 space); |
| 21710 NoSafepointScope no_safepoint; | 20315 NoSafepointScope no_safepoint; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21787 const char* Float32x4::ToCString() const { | 20392 const char* Float32x4::ToCString() const { |
| 21788 float _x = x(); | 20393 float _x = x(); |
| 21789 float _y = y(); | 20394 float _y = y(); |
| 21790 float _z = z(); | 20395 float _z = z(); |
| 21791 float _w = w(); | 20396 float _w = w(); |
| 21792 return OS::SCreate(Thread::Current()->zone(), | 20397 return OS::SCreate(Thread::Current()->zone(), |
| 21793 "[%f, %f, %f, %f]", _x, _y, _z, _w); | 20398 "[%f, %f, %f, %f]", _x, _y, _z, _w); |
| 21794 } | 20399 } |
| 21795 | 20400 |
| 21796 | 20401 |
| 21797 void Float32x4::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 21798 JSONObject jsobj(stream); | |
| 21799 PrintSharedInstanceJSON(&jsobj, ref); | |
| 21800 jsobj.AddProperty("kind", "Float32x4"); | |
| 21801 jsobj.AddServiceId(*this); | |
| 21802 jsobj.AddProperty("valueAsString", ToCString()); | |
| 21803 } | |
| 21804 | |
| 21805 | |
| 21806 RawInt32x4* Int32x4::New(int32_t v0, int32_t v1, int32_t v2, int32_t v3, | 20402 RawInt32x4* Int32x4::New(int32_t v0, int32_t v1, int32_t v2, int32_t v3, |
| 21807 Heap::Space space) { | 20403 Heap::Space space) { |
| 21808 ASSERT(Isolate::Current()->object_store()->int32x4_class() != | 20404 ASSERT(Isolate::Current()->object_store()->int32x4_class() != |
| 21809 Class::null()); | 20405 Class::null()); |
| 21810 Int32x4& result = Int32x4::Handle(); | 20406 Int32x4& result = Int32x4::Handle(); |
| 21811 { | 20407 { |
| 21812 RawObject* raw = Object::Allocate(Int32x4::kClassId, | 20408 RawObject* raw = Object::Allocate(Int32x4::kClassId, |
| 21813 Int32x4::InstanceSize(), | 20409 Int32x4::InstanceSize(), |
| 21814 space); | 20410 space); |
| 21815 NoSafepointScope no_safepoint; | 20411 NoSafepointScope no_safepoint; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21892 const char* Int32x4::ToCString() const { | 20488 const char* Int32x4::ToCString() const { |
| 21893 int32_t _x = x(); | 20489 int32_t _x = x(); |
| 21894 int32_t _y = y(); | 20490 int32_t _y = y(); |
| 21895 int32_t _z = z(); | 20491 int32_t _z = z(); |
| 21896 int32_t _w = w(); | 20492 int32_t _w = w(); |
| 21897 return OS::SCreate(Thread::Current()->zone(), | 20493 return OS::SCreate(Thread::Current()->zone(), |
| 21898 "[%08x, %08x, %08x, %08x]", _x, _y, _z, _w); | 20494 "[%08x, %08x, %08x, %08x]", _x, _y, _z, _w); |
| 21899 } | 20495 } |
| 21900 | 20496 |
| 21901 | 20497 |
| 21902 void Int32x4::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 21903 JSONObject jsobj(stream); | |
| 21904 PrintSharedInstanceJSON(&jsobj, ref); | |
| 21905 jsobj.AddProperty("kind", "Int32x4"); | |
| 21906 jsobj.AddServiceId(*this); | |
| 21907 jsobj.AddProperty("valueAsString", ToCString()); | |
| 21908 } | |
| 21909 | |
| 21910 | |
| 21911 RawFloat64x2* Float64x2::New(double value0, double value1, Heap::Space space) { | 20498 RawFloat64x2* Float64x2::New(double value0, double value1, Heap::Space space) { |
| 21912 ASSERT(Isolate::Current()->object_store()->float64x2_class() != | 20499 ASSERT(Isolate::Current()->object_store()->float64x2_class() != |
| 21913 Class::null()); | 20500 Class::null()); |
| 21914 Float64x2& result = Float64x2::Handle(); | 20501 Float64x2& result = Float64x2::Handle(); |
| 21915 { | 20502 { |
| 21916 RawObject* raw = Object::Allocate(Float64x2::kClassId, | 20503 RawObject* raw = Object::Allocate(Float64x2::kClassId, |
| 21917 Float64x2::InstanceSize(), | 20504 Float64x2::InstanceSize(), |
| 21918 space); | 20505 space); |
| 21919 NoSafepointScope no_safepoint; | 20506 NoSafepointScope no_safepoint; |
| 21920 result ^= raw; | 20507 result ^= raw; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21971 } | 20558 } |
| 21972 | 20559 |
| 21973 | 20560 |
| 21974 const char* Float64x2::ToCString() const { | 20561 const char* Float64x2::ToCString() const { |
| 21975 double _x = x(); | 20562 double _x = x(); |
| 21976 double _y = y(); | 20563 double _y = y(); |
| 21977 return OS::SCreate(Thread::Current()->zone(), "[%f, %f]", _x, _y); | 20564 return OS::SCreate(Thread::Current()->zone(), "[%f, %f]", _x, _y); |
| 21978 } | 20565 } |
| 21979 | 20566 |
| 21980 | 20567 |
| 21981 void Float64x2::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 21982 JSONObject jsobj(stream); | |
| 21983 PrintSharedInstanceJSON(&jsobj, ref); | |
| 21984 jsobj.AddProperty("kind", "Float64x2"); | |
| 21985 jsobj.AddServiceId(*this); | |
| 21986 jsobj.AddProperty("valueAsString", ToCString()); | |
| 21987 } | |
| 21988 | |
| 21989 | |
| 21990 const intptr_t TypedData::element_size_table[TypedData::kNumElementSizes] = { | 20568 const intptr_t TypedData::element_size_table[TypedData::kNumElementSizes] = { |
| 21991 1, // kTypedDataInt8ArrayCid. | 20569 1, // kTypedDataInt8ArrayCid. |
| 21992 1, // kTypedDataUint8ArrayCid. | 20570 1, // kTypedDataUint8ArrayCid. |
| 21993 1, // kTypedDataUint8ClampedArrayCid. | 20571 1, // kTypedDataUint8ClampedArrayCid. |
| 21994 2, // kTypedDataInt16ArrayCid. | 20572 2, // kTypedDataInt16ArrayCid. |
| 21995 2, // kTypedDataUint16ArrayCid. | 20573 2, // kTypedDataUint16ArrayCid. |
| 21996 4, // kTypedDataInt32ArrayCid. | 20574 4, // kTypedDataInt32ArrayCid. |
| 21997 4, // kTypedDataUint32ArrayCid. | 20575 4, // kTypedDataUint32ArrayCid. |
| 21998 8, // kTypedDataInt64ArrayCid. | 20576 8, // kTypedDataInt64ArrayCid. |
| 21999 8, // kTypedDataUint64ArrayCid. | 20577 8, // kTypedDataUint64ArrayCid. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22068 isolate->object_store()->set_empty_uint32_array(array); | 20646 isolate->object_store()->set_empty_uint32_array(array); |
| 22069 return array.raw(); | 20647 return array.raw(); |
| 22070 } | 20648 } |
| 22071 | 20649 |
| 22072 | 20650 |
| 22073 const char* TypedData::ToCString() const { | 20651 const char* TypedData::ToCString() const { |
| 22074 return "TypedData"; | 20652 return "TypedData"; |
| 22075 } | 20653 } |
| 22076 | 20654 |
| 22077 | 20655 |
| 22078 void TypedData::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 22079 JSONObject jsobj(stream); | |
| 22080 PrintSharedInstanceJSON(&jsobj, ref); | |
| 22081 const Class& cls = Class::Handle(clazz()); | |
| 22082 const String& kind = String::Handle(cls.UserVisibleName()); | |
| 22083 jsobj.AddProperty("kind", kind.ToCString()); | |
| 22084 jsobj.AddServiceId(*this); | |
| 22085 jsobj.AddProperty("length", Length()); | |
| 22086 if (ref) { | |
| 22087 return; | |
| 22088 } | |
| 22089 intptr_t offset; | |
| 22090 intptr_t count; | |
| 22091 stream->ComputeOffsetAndCount(Length(), &offset, &count); | |
| 22092 if (offset > 0) { | |
| 22093 jsobj.AddProperty("offset", offset); | |
| 22094 } | |
| 22095 if (count < Length()) { | |
| 22096 jsobj.AddProperty("count", count); | |
| 22097 } | |
| 22098 if (count == 0) { | |
| 22099 jsobj.AddProperty("bytes", ""); | |
| 22100 } else { | |
| 22101 NoSafepointScope no_safepoint; | |
| 22102 jsobj.AddPropertyBase64("bytes", | |
| 22103 reinterpret_cast<const uint8_t*>( | |
| 22104 DataAddr(offset * ElementSizeInBytes())), | |
| 22105 count * ElementSizeInBytes()); | |
| 22106 } | |
| 22107 } | |
| 22108 | |
| 22109 | |
| 22110 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( | 20656 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( |
| 22111 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { | 20657 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { |
| 22112 return dart::AddFinalizer(*this, peer, callback); | 20658 return dart::AddFinalizer(*this, peer, callback); |
| 22113 } | 20659 } |
| 22114 | 20660 |
| 22115 | 20661 |
| 22116 RawExternalTypedData* ExternalTypedData::New(intptr_t class_id, | 20662 RawExternalTypedData* ExternalTypedData::New(intptr_t class_id, |
| 22117 uint8_t* data, | 20663 uint8_t* data, |
| 22118 intptr_t len, | 20664 intptr_t len, |
| 22119 Heap::Space space) { | 20665 Heap::Space space) { |
| 22120 ExternalTypedData& result = ExternalTypedData::Handle(); | 20666 ExternalTypedData& result = ExternalTypedData::Handle(); |
| 22121 { | 20667 { |
| 22122 RawObject* raw = Object::Allocate(class_id, | 20668 RawObject* raw = Object::Allocate(class_id, |
| 22123 ExternalTypedData::InstanceSize(), | 20669 ExternalTypedData::InstanceSize(), |
| 22124 space); | 20670 space); |
| 22125 NoSafepointScope no_safepoint; | 20671 NoSafepointScope no_safepoint; |
| 22126 result ^= raw; | 20672 result ^= raw; |
| 22127 result.SetLength(len); | 20673 result.SetLength(len); |
| 22128 result.SetData(data); | 20674 result.SetData(data); |
| 22129 } | 20675 } |
| 22130 return result.raw(); | 20676 return result.raw(); |
| 22131 } | 20677 } |
| 22132 | 20678 |
| 22133 | 20679 |
| 22134 const char* ExternalTypedData::ToCString() const { | 20680 const char* ExternalTypedData::ToCString() const { |
| 22135 return "ExternalTypedData"; | 20681 return "ExternalTypedData"; |
| 22136 } | 20682 } |
| 22137 | 20683 |
| 22138 | 20684 |
| 22139 void ExternalTypedData::PrintJSONImpl(JSONStream* stream, | |
| 22140 bool ref) const { | |
| 22141 JSONObject jsobj(stream); | |
| 22142 PrintSharedInstanceJSON(&jsobj, ref); | |
| 22143 const Class& cls = Class::Handle(clazz()); | |
| 22144 const String& kind = String::Handle(cls.UserVisibleName()); | |
| 22145 jsobj.AddProperty("kind", kind.ToCString()); | |
| 22146 jsobj.AddServiceId(*this); | |
| 22147 jsobj.AddProperty("length", Length()); | |
| 22148 if (ref) { | |
| 22149 return; | |
| 22150 } | |
| 22151 intptr_t offset; | |
| 22152 intptr_t count; | |
| 22153 stream->ComputeOffsetAndCount(Length(), &offset, &count); | |
| 22154 if (offset > 0) { | |
| 22155 jsobj.AddProperty("offset", offset); | |
| 22156 } | |
| 22157 if (count < Length()) { | |
| 22158 jsobj.AddProperty("count", count); | |
| 22159 } | |
| 22160 if (count == 0) { | |
| 22161 jsobj.AddProperty("bytes", ""); | |
| 22162 } else { | |
| 22163 NoSafepointScope no_safepoint; | |
| 22164 jsobj.AddPropertyBase64("bytes", | |
| 22165 reinterpret_cast<const uint8_t*>( | |
| 22166 DataAddr(offset * ElementSizeInBytes())), | |
| 22167 count * ElementSizeInBytes()); | |
| 22168 } | |
| 22169 } | |
| 22170 | |
| 22171 | |
| 22172 RawCapability* Capability::New(uint64_t id, Heap::Space space) { | 20685 RawCapability* Capability::New(uint64_t id, Heap::Space space) { |
| 22173 Capability& result = Capability::Handle(); | 20686 Capability& result = Capability::Handle(); |
| 22174 { | 20687 { |
| 22175 RawObject* raw = Object::Allocate(Capability::kClassId, | 20688 RawObject* raw = Object::Allocate(Capability::kClassId, |
| 22176 Capability::InstanceSize(), | 20689 Capability::InstanceSize(), |
| 22177 space); | 20690 space); |
| 22178 NoSafepointScope no_safepoint; | 20691 NoSafepointScope no_safepoint; |
| 22179 result ^= raw; | 20692 result ^= raw; |
| 22180 result.StoreNonPointer(&result.raw_ptr()->id_, id); | 20693 result.StoreNonPointer(&result.raw_ptr()->id_, id); |
| 22181 } | 20694 } |
| 22182 return result.raw(); | 20695 return result.raw(); |
| 22183 } | 20696 } |
| 22184 | 20697 |
| 22185 | 20698 |
| 22186 const char* Capability::ToCString() const { | 20699 const char* Capability::ToCString() const { |
| 22187 return "Capability"; | 20700 return "Capability"; |
| 22188 } | 20701 } |
| 22189 | 20702 |
| 22190 | 20703 |
| 22191 void Capability::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 22192 Instance::PrintJSONImpl(stream, ref); | |
| 22193 } | |
| 22194 | |
| 22195 | |
| 22196 RawReceivePort* ReceivePort::New(Dart_Port id, | 20704 RawReceivePort* ReceivePort::New(Dart_Port id, |
| 22197 bool is_control_port, | 20705 bool is_control_port, |
| 22198 Heap::Space space) { | 20706 Heap::Space space) { |
| 22199 ASSERT(id != ILLEGAL_PORT); | 20707 ASSERT(id != ILLEGAL_PORT); |
| 22200 Thread* thread = Thread::Current(); | 20708 Thread* thread = Thread::Current(); |
| 22201 Zone* zone = thread->zone(); | 20709 Zone* zone = thread->zone(); |
| 22202 const SendPort& send_port = | 20710 const SendPort& send_port = |
| 22203 SendPort::Handle(zone, SendPort::New(id, thread->isolate()->origin_id())); | 20711 SendPort::Handle(zone, SendPort::New(id, thread->isolate()->origin_id())); |
| 22204 | 20712 |
| 22205 ReceivePort& result = ReceivePort::Handle(zone); | 20713 ReceivePort& result = ReceivePort::Handle(zone); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 22218 } | 20726 } |
| 22219 return result.raw(); | 20727 return result.raw(); |
| 22220 } | 20728 } |
| 22221 | 20729 |
| 22222 | 20730 |
| 22223 const char* ReceivePort::ToCString() const { | 20731 const char* ReceivePort::ToCString() const { |
| 22224 return "ReceivePort"; | 20732 return "ReceivePort"; |
| 22225 } | 20733 } |
| 22226 | 20734 |
| 22227 | 20735 |
| 22228 void ReceivePort::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 22229 Instance::PrintJSONImpl(stream, ref); | |
| 22230 } | |
| 22231 | |
| 22232 | |
| 22233 RawSendPort* SendPort::New(Dart_Port id, Heap::Space space) { | 20736 RawSendPort* SendPort::New(Dart_Port id, Heap::Space space) { |
| 22234 return New(id, Isolate::Current()->origin_id(), space); | 20737 return New(id, Isolate::Current()->origin_id(), space); |
| 22235 } | 20738 } |
| 22236 | 20739 |
| 22237 | 20740 |
| 22238 RawSendPort* SendPort::New(Dart_Port id, | 20741 RawSendPort* SendPort::New(Dart_Port id, |
| 22239 Dart_Port origin_id, | 20742 Dart_Port origin_id, |
| 22240 Heap::Space space) { | 20743 Heap::Space space) { |
| 22241 ASSERT(id != ILLEGAL_PORT); | 20744 ASSERT(id != ILLEGAL_PORT); |
| 22242 SendPort& result = SendPort::Handle(); | 20745 SendPort& result = SendPort::Handle(); |
| 22243 { | 20746 { |
| 22244 RawObject* raw = Object::Allocate(SendPort::kClassId, | 20747 RawObject* raw = Object::Allocate(SendPort::kClassId, |
| 22245 SendPort::InstanceSize(), | 20748 SendPort::InstanceSize(), |
| 22246 space); | 20749 space); |
| 22247 NoSafepointScope no_safepoint; | 20750 NoSafepointScope no_safepoint; |
| 22248 result ^= raw; | 20751 result ^= raw; |
| 22249 result.StoreNonPointer(&result.raw_ptr()->id_, id); | 20752 result.StoreNonPointer(&result.raw_ptr()->id_, id); |
| 22250 result.StoreNonPointer(&result.raw_ptr()->origin_id_, origin_id); | 20753 result.StoreNonPointer(&result.raw_ptr()->origin_id_, origin_id); |
| 22251 } | 20754 } |
| 22252 return result.raw(); | 20755 return result.raw(); |
| 22253 } | 20756 } |
| 22254 | 20757 |
| 22255 | 20758 |
| 22256 const char* SendPort::ToCString() const { | 20759 const char* SendPort::ToCString() const { |
| 22257 return "SendPort"; | 20760 return "SendPort"; |
| 22258 } | 20761 } |
| 22259 | 20762 |
| 22260 | 20763 |
| 22261 void SendPort::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 22262 Instance::PrintJSONImpl(stream, ref); | |
| 22263 } | |
| 22264 | |
| 22265 | |
| 22266 const char* Closure::ToCString() const { | 20764 const char* Closure::ToCString() const { |
| 22267 const Function& fun = Function::Handle(function()); | 20765 const Function& fun = Function::Handle(function()); |
| 22268 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); | 20766 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); |
| 22269 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString(); | 20767 const char* fun_sig = String::Handle(fun.UserVisibleSignature()).ToCString(); |
| 22270 const char* from = is_implicit_closure ? " from " : ""; | 20768 const char* from = is_implicit_closure ? " from " : ""; |
| 22271 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; | 20769 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; |
| 22272 return OS::SCreate(Thread::Current()->zone(), | 20770 return OS::SCreate(Thread::Current()->zone(), |
| 22273 "Closure: %s%s%s", fun_sig, from, fun_desc); | 20771 "Closure: %s%s%s", fun_sig, from, fun_desc); |
| 22274 } | 20772 } |
| 22275 | 20773 |
| 22276 | 20774 |
| 22277 void Closure::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 22278 Instance::PrintJSONImpl(stream, ref); | |
| 22279 } | |
| 22280 | |
| 22281 | |
| 22282 RawClosure* Closure::New(const Function& function, | 20775 RawClosure* Closure::New(const Function& function, |
| 22283 const Context& context, | 20776 const Context& context, |
| 22284 Heap::Space space) { | 20777 Heap::Space space) { |
| 22285 Closure& result = Closure::Handle(); | 20778 Closure& result = Closure::Handle(); |
| 22286 { | 20779 { |
| 22287 RawObject* raw = Object::Allocate(Closure::kClassId, | 20780 RawObject* raw = Object::Allocate(Closure::kClassId, |
| 22288 Closure::InstanceSize(), | 20781 Closure::InstanceSize(), |
| 22289 space); | 20782 space); |
| 22290 NoSafepointScope no_safepoint; | 20783 NoSafepointScope no_safepoint; |
| 22291 result ^= raw; | 20784 result ^= raw; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22379 return result.raw(); | 20872 return result.raw(); |
| 22380 } | 20873 } |
| 22381 | 20874 |
| 22382 | 20875 |
| 22383 const char* Stacktrace::ToCString() const { | 20876 const char* Stacktrace::ToCString() const { |
| 22384 intptr_t idx = 0; | 20877 intptr_t idx = 0; |
| 22385 return ToCStringInternal(&idx); | 20878 return ToCStringInternal(&idx); |
| 22386 } | 20879 } |
| 22387 | 20880 |
| 22388 | 20881 |
| 22389 void Stacktrace::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 22390 JSONObject jsobj(stream); | |
| 22391 PrintSharedInstanceJSON(&jsobj, ref); | |
| 22392 jsobj.AddProperty("kind", "StackTrace"); | |
| 22393 jsobj.AddServiceId(*this); | |
| 22394 intptr_t idx = 0; | |
| 22395 jsobj.AddProperty("valueAsString", ToCStringInternal(&idx)); | |
| 22396 } | |
| 22397 | |
| 22398 | |
| 22399 static intptr_t PrintOneStacktrace(Zone* zone, | 20882 static intptr_t PrintOneStacktrace(Zone* zone, |
| 22400 GrowableArray<char*>* frame_strings, | 20883 GrowableArray<char*>* frame_strings, |
| 22401 uword pc, | 20884 uword pc, |
| 22402 const Function& function, | 20885 const Function& function, |
| 22403 const Code& code, | 20886 const Code& code, |
| 22404 intptr_t frame_index) { | 20887 intptr_t frame_index) { |
| 22405 const TokenPosition token_pos = code.GetTokenIndexOfPC(pc); | 20888 const TokenPosition token_pos = code.GetTokenIndexOfPC(pc); |
| 22406 const Script& script = Script::Handle(zone, function.script()); | 20889 const Script& script = Script::Handle(zone, function.script()); |
| 22407 const String& function_name = | 20890 const String& function_name = |
| 22408 String::Handle(zone, function.QualifiedUserVisibleName()); | 20891 String::Handle(zone, function.QualifiedUserVisibleName()); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22638 } | 21121 } |
| 22639 | 21122 |
| 22640 | 21123 |
| 22641 const char* JSRegExp::ToCString() const { | 21124 const char* JSRegExp::ToCString() const { |
| 22642 const String& str = String::Handle(pattern()); | 21125 const String& str = String::Handle(pattern()); |
| 22643 return OS::SCreate(Thread::Current()->zone(), | 21126 return OS::SCreate(Thread::Current()->zone(), |
| 22644 "JSRegExp: pattern=%s flags=%s", str.ToCString(), Flags()); | 21127 "JSRegExp: pattern=%s flags=%s", str.ToCString(), Flags()); |
| 22645 } | 21128 } |
| 22646 | 21129 |
| 22647 | 21130 |
| 22648 void JSRegExp::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 22649 JSONObject jsobj(stream); | |
| 22650 PrintSharedInstanceJSON(&jsobj, ref); | |
| 22651 jsobj.AddProperty("kind", "RegExp"); | |
| 22652 jsobj.AddServiceId(*this); | |
| 22653 | |
| 22654 jsobj.AddProperty("pattern", String::Handle(pattern())); | |
| 22655 | |
| 22656 if (ref) { | |
| 22657 return; | |
| 22658 } | |
| 22659 | |
| 22660 jsobj.AddProperty("isCaseSensitive", !is_ignore_case()); | |
| 22661 jsobj.AddProperty("isMultiLine", is_multi_line()); | |
| 22662 | |
| 22663 Function& func = Function::Handle(); | |
| 22664 func = function(kOneByteStringCid); | |
| 22665 jsobj.AddProperty("_oneByteFunction", func); | |
| 22666 func = function(kTwoByteStringCid); | |
| 22667 jsobj.AddProperty("_twoByteFunction", func); | |
| 22668 func = function(kExternalOneByteStringCid); | |
| 22669 jsobj.AddProperty("_externalOneByteFunction", func); | |
| 22670 func = function(kExternalTwoByteStringCid); | |
| 22671 jsobj.AddProperty("_externalTwoByteFunction", func); | |
| 22672 } | |
| 22673 | |
| 22674 | |
| 22675 RawWeakProperty* WeakProperty::New(Heap::Space space) { | 21131 RawWeakProperty* WeakProperty::New(Heap::Space space) { |
| 22676 ASSERT(Isolate::Current()->object_store()->weak_property_class() | 21132 ASSERT(Isolate::Current()->object_store()->weak_property_class() |
| 22677 != Class::null()); | 21133 != Class::null()); |
| 22678 RawObject* raw = Object::Allocate(WeakProperty::kClassId, | 21134 RawObject* raw = Object::Allocate(WeakProperty::kClassId, |
| 22679 WeakProperty::InstanceSize(), | 21135 WeakProperty::InstanceSize(), |
| 22680 space); | 21136 space); |
| 22681 return reinterpret_cast<RawWeakProperty*>(raw); | 21137 return reinterpret_cast<RawWeakProperty*>(raw); |
| 22682 } | 21138 } |
| 22683 | 21139 |
| 22684 | 21140 |
| 22685 const char* WeakProperty::ToCString() const { | 21141 const char* WeakProperty::ToCString() const { |
| 22686 return "_WeakProperty"; | 21142 return "_WeakProperty"; |
| 22687 } | 21143 } |
| 22688 | 21144 |
| 22689 | 21145 |
| 22690 void WeakProperty::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 22691 JSONObject jsobj(stream); | |
| 22692 PrintSharedInstanceJSON(&jsobj, ref); | |
| 22693 jsobj.AddProperty("kind", "WeakProperty"); | |
| 22694 jsobj.AddServiceId(*this); | |
| 22695 if (ref) { | |
| 22696 return; | |
| 22697 } | |
| 22698 | |
| 22699 const Object& key_handle = Object::Handle(key()); | |
| 22700 jsobj.AddProperty("propertyKey", key_handle); | |
| 22701 const Object& value_handle = Object::Handle(value()); | |
| 22702 jsobj.AddProperty("propertyValue", value_handle); | |
| 22703 } | |
| 22704 | |
| 22705 RawAbstractType* MirrorReference::GetAbstractTypeReferent() const { | 21146 RawAbstractType* MirrorReference::GetAbstractTypeReferent() const { |
| 22706 ASSERT(Object::Handle(referent()).IsAbstractType()); | 21147 ASSERT(Object::Handle(referent()).IsAbstractType()); |
| 22707 return AbstractType::Cast(Object::Handle(referent())).raw(); | 21148 return AbstractType::Cast(Object::Handle(referent())).raw(); |
| 22708 } | 21149 } |
| 22709 | 21150 |
| 22710 | 21151 |
| 22711 RawClass* MirrorReference::GetClassReferent() const { | 21152 RawClass* MirrorReference::GetClassReferent() const { |
| 22712 ASSERT(Object::Handle(referent()).IsClass()); | 21153 ASSERT(Object::Handle(referent()).IsClass()); |
| 22713 return Class::Cast(Object::Handle(referent())).raw(); | 21154 return Class::Cast(Object::Handle(referent())).raw(); |
| 22714 } | 21155 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22751 result.set_referent(referent); | 21192 result.set_referent(referent); |
| 22752 return result.raw(); | 21193 return result.raw(); |
| 22753 } | 21194 } |
| 22754 | 21195 |
| 22755 | 21196 |
| 22756 const char* MirrorReference::ToCString() const { | 21197 const char* MirrorReference::ToCString() const { |
| 22757 return "_MirrorReference"; | 21198 return "_MirrorReference"; |
| 22758 } | 21199 } |
| 22759 | 21200 |
| 22760 | 21201 |
| 22761 void MirrorReference::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 22762 JSONObject jsobj(stream); | |
| 22763 PrintSharedInstanceJSON(&jsobj, ref); | |
| 22764 jsobj.AddProperty("kind", "MirrorReference"); | |
| 22765 jsobj.AddServiceId(*this); | |
| 22766 | |
| 22767 if (ref) { | |
| 22768 return; | |
| 22769 } | |
| 22770 | |
| 22771 const Object& referent_handle = Object::Handle(referent()); | |
| 22772 jsobj.AddProperty("mirrorReferent", referent_handle); | |
| 22773 } | |
| 22774 | |
| 22775 | |
| 22776 void UserTag::MakeActive() const { | 21202 void UserTag::MakeActive() const { |
| 22777 Isolate* isolate = Isolate::Current(); | 21203 Isolate* isolate = Isolate::Current(); |
| 22778 ASSERT(isolate != NULL); | 21204 ASSERT(isolate != NULL); |
| 22779 isolate->set_current_tag(*this); | 21205 isolate->set_current_tag(*this); |
| 22780 } | 21206 } |
| 22781 | 21207 |
| 22782 | 21208 |
| 22783 RawUserTag* UserTag::New(const String& label, Heap::Space space) { | 21209 RawUserTag* UserTag::New(const String& label, Heap::Space space) { |
| 22784 Thread* thread = Thread::Current(); | 21210 Thread* thread = Thread::Current(); |
| 22785 Isolate* isolate = thread->isolate(); | 21211 Isolate* isolate = thread->isolate(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22903 } | 21329 } |
| 22904 return UserTag::null(); | 21330 return UserTag::null(); |
| 22905 } | 21331 } |
| 22906 | 21332 |
| 22907 | 21333 |
| 22908 const char* UserTag::ToCString() const { | 21334 const char* UserTag::ToCString() const { |
| 22909 const String& tag_label = String::Handle(label()); | 21335 const String& tag_label = String::Handle(label()); |
| 22910 return tag_label.ToCString(); | 21336 return tag_label.ToCString(); |
| 22911 } | 21337 } |
| 22912 | 21338 |
| 22913 | |
| 22914 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 22915 Instance::PrintJSONImpl(stream, ref); | |
| 22916 } | |
| 22917 | |
| 22918 | |
| 22919 } // namespace dart | 21339 } // namespace dart |
| OLD | NEW |