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

Side by Side Diff: runtime/vm/object.cc

Issue 1722733002: In background compilation make a copy of Field in order to freeze its state (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: s Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after
3010 3010
3011 3011
3012 void Class::SetFields(const Array& value) const { 3012 void Class::SetFields(const Array& value) const {
3013 ASSERT(!value.IsNull()); 3013 ASSERT(!value.IsNull());
3014 #if defined(DEBUG) 3014 #if defined(DEBUG)
3015 // Verify that all the fields in the array have this class as owner. 3015 // Verify that all the fields in the array have this class as owner.
3016 Field& field = Field::Handle(); 3016 Field& field = Field::Handle();
3017 intptr_t len = value.Length(); 3017 intptr_t len = value.Length();
3018 for (intptr_t i = 0; i < len; i++) { 3018 for (intptr_t i = 0; i < len; i++) {
3019 field ^= value.At(i); 3019 field ^= value.At(i);
3020 ASSERT(field.owner() == raw()); 3020 ASSERT(field.IsOriginal());
3021 ASSERT(field.Owner() == raw());
3021 } 3022 }
3022 #endif 3023 #endif
3023 // The value of static fields is already initialized to null. 3024 // The value of static fields is already initialized to null.
3024 StorePointer(&raw_ptr()->fields_, value.raw()); 3025 StorePointer(&raw_ptr()->fields_, value.raw());
3025 } 3026 }
3026 3027
3027 3028
3028 void Class::AddField(const Field& field) const { 3029 void Class::AddField(const Field& field) const {
3029 const Array& arr = Array::Handle(fields()); 3030 const Array& arr = Array::Handle(fields());
3030 const Array& new_arr = Array::Handle(Array::Grow(arr, arr.Length() + 1)); 3031 const Array& new_arr = Array::Handle(Array::Grow(arr, arr.Length() + 1));
(...skipping 3748 matching lines...) Expand 10 before | Expand all | Expand 10 after
6779 } 6780 }
6780 } 6781 }
6781 array.SetAt(0, edge_counters_array); 6782 array.SetAt(0, edge_counters_array);
6782 set_ic_data_array(array); 6783 set_ic_data_array(array);
6783 } 6784 }
6784 6785
6785 6786
6786 void Function::RestoreICDataMap( 6787 void Function::RestoreICDataMap(
6787 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data, 6788 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data,
6788 bool clone_ic_data) const { 6789 bool clone_ic_data) const {
6790 if (FLAG_force_clone_compiler_objects) {
6791 clone_ic_data = true;
6792 }
6789 ASSERT(deopt_id_to_ic_data->is_empty()); 6793 ASSERT(deopt_id_to_ic_data->is_empty());
6790 Zone* zone = Thread::Current()->zone(); 6794 Zone* zone = Thread::Current()->zone();
6791 const Array& saved_ic_data = Array::Handle(zone, ic_data_array()); 6795 const Array& saved_ic_data = Array::Handle(zone, ic_data_array());
6792 if (saved_ic_data.IsNull()) { 6796 if (saved_ic_data.IsNull()) {
6793 // Could happen with deferred loading. 6797 // Could happen with deferred loading.
6794 return; 6798 return;
6795 } 6799 }
6796 const intptr_t saved_length = saved_ic_data.Length(); 6800 const intptr_t saved_length = saved_ic_data.Length();
6797 ASSERT(saved_length > 0); 6801 ASSERT(saved_length > 0);
6798 if (saved_length > 1) { 6802 if (saved_length > 1) {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
6975 Heap::kOld); 6979 Heap::kOld);
6976 return reinterpret_cast<RawRedirectionData*>(raw); 6980 return reinterpret_cast<RawRedirectionData*>(raw);
6977 } 6981 }
6978 6982
6979 6983
6980 const char* RedirectionData::ToCString() const { 6984 const char* RedirectionData::ToCString() const {
6981 return "RedirectionData class"; 6985 return "RedirectionData class";
6982 } 6986 }
6983 6987
6984 6988
6989 RawField* Field::CloneFromOriginal() const {
6990 return this->Clone(*this);
6991 }
6992
6993
6994 RawField* Field::Original() const {
6995 if (IsNull()) {
6996 return Field::null();
6997 }
6998 Object& obj = Object::Handle(raw_ptr()->owner_);
6999 if (obj.IsField()) {
7000 return Field::RawCast(obj.raw());
7001 } else {
7002 return this->raw();
7003 }
7004 }
7005
7006
7007 void Field::SetOriginal(const Field& value) const {
7008 ASSERT(value.IsOriginal());
7009 ASSERT(!value.IsNull());
7010 StorePointer(&raw_ptr()->owner_, reinterpret_cast<RawObject*>(value.raw()));
7011 }
7012
7013
6985 RawString* Field::GetterName(const String& field_name) { 7014 RawString* Field::GetterName(const String& field_name) {
6986 return String::Concat(Symbols::GetterPrefix(), field_name); 7015 return String::Concat(Symbols::GetterPrefix(), field_name);
6987 } 7016 }
6988 7017
6989 7018
6990 RawString* Field::GetterSymbol(const String& field_name) { 7019 RawString* Field::GetterSymbol(const String& field_name) {
6991 return Symbols::FromConcat(Symbols::GetterPrefix(), field_name); 7020 return Symbols::FromConcat(Symbols::GetterPrefix(), field_name);
6992 } 7021 }
6993 7022
6994 7023
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
7029 } 7058 }
7030 7059
7031 7060
7032 bool Field::IsSetterName(const String& function_name) { 7061 bool Field::IsSetterName(const String& function_name) {
7033 return function_name.StartsWith(Symbols::SetterPrefix()); 7062 return function_name.StartsWith(Symbols::SetterPrefix());
7034 } 7063 }
7035 7064
7036 7065
7037 void Field::set_name(const String& value) const { 7066 void Field::set_name(const String& value) const {
7038 ASSERT(value.IsSymbol()); 7067 ASSERT(value.IsSymbol());
7068 ASSERT(IsOriginal());
7039 StorePointer(&raw_ptr()->name_, value.raw()); 7069 StorePointer(&raw_ptr()->name_, value.raw());
7040 } 7070 }
7041 7071
7042 7072
7043 RawClass* Field::owner() const { 7073 RawObject* Field::RawOwner() const {
7044 const Object& obj = Object::Handle(raw_ptr()->owner_); 7074 if (Original()) {
7075 return raw_ptr()->owner_;
7076 } else {
7077 const Field& field = Field::Handle(Original());
7078 ASSERT(field.IsOriginal());
7079 ASSERT(!Object::Handle(field.raw_ptr()->owner_).IsField());
7080 return field.raw_ptr()->owner_;
7081 }
7082 }
7083
7084
7085 RawClass* Field::Owner() const {
7086 const Field& field = Field::Handle(Original());
7087 ASSERT(field.IsOriginal());
7088 const Object& obj = Object::Handle(field.raw_ptr()->owner_);
7045 if (obj.IsClass()) { 7089 if (obj.IsClass()) {
7046 return Class::Cast(obj).raw(); 7090 return Class::Cast(obj).raw();
7047 } 7091 }
7048 ASSERT(obj.IsPatchClass()); 7092 ASSERT(obj.IsPatchClass());
7049 return PatchClass::Cast(obj).patched_class(); 7093 return PatchClass::Cast(obj).patched_class();
7050 } 7094 }
7051 7095
7052 7096
7053 RawClass* Field::origin() const { 7097 RawClass* Field::Origin() const {
7054 const Object& obj = Object::Handle(raw_ptr()->owner_); 7098 const Field& field = Field::Handle(Original());
7099 ASSERT(field.IsOriginal());
7100 const Object& obj = Object::Handle(field.raw_ptr()->owner_);
7055 if (obj.IsClass()) { 7101 if (obj.IsClass()) {
7056 return Class::Cast(obj).raw(); 7102 return Class::Cast(obj).raw();
7057 } 7103 }
7058 ASSERT(obj.IsPatchClass()); 7104 ASSERT(obj.IsPatchClass());
7059 return PatchClass::Cast(obj).origin_class(); 7105 return PatchClass::Cast(obj).origin_class();
7060 } 7106 }
7061 7107
7062 7108
7063 RawScript* Field::script() const { 7109 RawScript* Field::Script() const {
7064 const Object& obj = Object::Handle(raw_ptr()->owner_); 7110 const Field& field = Field::Handle(Original());
7111 ASSERT(field.IsOriginal());
7112 const Object& obj = Object::Handle(field.raw_ptr()->owner_);
7065 if (obj.IsClass()) { 7113 if (obj.IsClass()) {
7066 return Class::Cast(obj).script(); 7114 return Class::Cast(obj).script();
7067 } 7115 }
7068 ASSERT(obj.IsPatchClass()); 7116 ASSERT(obj.IsPatchClass());
7069 return PatchClass::Cast(obj).script(); 7117 return PatchClass::Cast(obj).script();
7070 } 7118 }
7071 7119
7072 7120
7073 // Called at finalization time 7121 // Called at finalization time
7074 void Field::SetFieldType(const AbstractType& value) const { 7122 void Field::SetFieldType(const AbstractType& value) const {
7075 ASSERT(Thread::Current()->IsMutatorThread()); 7123 ASSERT(Thread::Current()->IsMutatorThread());
7124 ASSERT(IsOriginal());
7076 ASSERT(!value.IsNull()); 7125 ASSERT(!value.IsNull());
7077 if (value.raw() != type()) { 7126 if (value.raw() != type()) {
7078 StorePointer(&raw_ptr()->type_, value.raw()); 7127 StorePointer(&raw_ptr()->type_, value.raw());
7079 } 7128 }
7080 } 7129 }
7081 7130
7082 7131
7083 RawField* Field::New() { 7132 RawField* Field::New() {
7084 ASSERT(Object::field_class() != Class::null()); 7133 ASSERT(Object::field_class() != Class::null());
7085 RawObject* raw = Object::Allocate(Field::kClassId, 7134 RawObject* raw = Object::Allocate(Field::kClassId,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
7152 } else { 7201 } else {
7153 result.set_guarded_list_length(Field::kNoFixedLength); 7202 result.set_guarded_list_length(Field::kNoFixedLength);
7154 } 7203 }
7155 return result.raw(); 7204 return result.raw();
7156 } 7205 }
7157 7206
7158 7207
7159 RawField* Field::Clone(const Class& new_owner) const { 7208 RawField* Field::Clone(const Class& new_owner) const {
7160 Field& clone = Field::Handle(); 7209 Field& clone = Field::Handle();
7161 clone ^= Object::Clone(*this, Heap::kOld); 7210 clone ^= Object::Clone(*this, Heap::kOld);
7162 const Class& owner = Class::Handle(this->owner()); 7211 const Class& owner = Class::Handle(this->Owner());
7163 const PatchClass& clone_owner = 7212 const PatchClass& clone_owner =
7164 PatchClass::Handle(PatchClass::New(new_owner, owner)); 7213 PatchClass::Handle(PatchClass::New(new_owner, owner));
7165 clone.set_owner(clone_owner); 7214 clone.set_owner(clone_owner);
7166 if (!clone.is_static()) { 7215 if (!clone.is_static()) {
7167 clone.SetOffset(0); 7216 clone.SetOffset(0);
7168 } 7217 }
7169 if (new_owner.NumTypeParameters() > 0) { 7218 if (new_owner.NumTypeParameters() > 0) {
7170 // Adjust the field type to refer to type parameters of the new owner. 7219 // Adjust the field type to refer to type parameters of the new owner.
7171 AbstractType& type = AbstractType::Handle(clone.type()); 7220 AbstractType& type = AbstractType::Handle(clone.type());
7172 type ^= type.CloneUninstantiated(new_owner); 7221 type ^= type.CloneUninstantiated(new_owner);
7173 clone.SetFieldType(type); 7222 clone.SetFieldType(type);
7174 } 7223 }
7175 return clone.raw(); 7224 return clone.raw();
7176 } 7225 }
7177 7226
7178 7227
7228 RawField* Field::Clone(const Field& original) const {
7229 if (original.IsNull()) {
7230 return Field::null();
7231 }
7232 ASSERT(original.IsOriginal());
7233 Field& clone = Field::Handle();
7234 clone ^= Object::Clone(*this, Heap::kOld);
7235 clone.SetOriginal(original);
7236 return clone.raw();
7237 }
7238
7239
7179 RawString* Field::UserVisibleName() const { 7240 RawString* Field::UserVisibleName() const {
7180 if (FLAG_show_internal_names) { 7241 if (FLAG_show_internal_names) {
7181 return name(); 7242 return name();
7182 } 7243 }
7183 return String::ScrubName(String::Handle(name())); 7244 return String::ScrubName(String::Handle(name()));
7184 } 7245 }
7185 7246
7186 7247
7187 intptr_t Field::guarded_list_length() const { 7248 intptr_t Field::guarded_list_length() const {
7188 return Smi::Value(raw_ptr()->guarded_list_length_); 7249 return Smi::Value(raw_ptr()->guarded_list_length_);
7189 } 7250 }
7190 7251
7191 7252
7192 void Field::set_guarded_list_length(intptr_t list_length) const { 7253 void Field::set_guarded_list_length(intptr_t list_length) const {
7193 ASSERT(Thread::Current()->IsMutatorThread()); 7254 ASSERT(Thread::Current()->IsMutatorThread());
7255 ASSERT(IsOriginal());
7194 StoreSmi(&raw_ptr()->guarded_list_length_, Smi::New(list_length)); 7256 StoreSmi(&raw_ptr()->guarded_list_length_, Smi::New(list_length));
7195 } 7257 }
7196 7258
7197 7259
7198 intptr_t Field::guarded_list_length_in_object_offset() const { 7260 intptr_t Field::guarded_list_length_in_object_offset() const {
7199 return raw_ptr()->guarded_list_length_in_object_offset_ + kHeapObjectTag; 7261 return raw_ptr()->guarded_list_length_in_object_offset_ + kHeapObjectTag;
7200 } 7262 }
7201 7263
7202 7264
7203 void Field::set_guarded_list_length_in_object_offset( 7265 void Field::set_guarded_list_length_in_object_offset(
7204 intptr_t list_length_offset) const { 7266 intptr_t list_length_offset) const {
7205 ASSERT(Thread::Current()->IsMutatorThread()); 7267 ASSERT(Thread::Current()->IsMutatorThread());
7268 ASSERT(IsOriginal());
7206 StoreNonPointer(&raw_ptr()->guarded_list_length_in_object_offset_, 7269 StoreNonPointer(&raw_ptr()->guarded_list_length_in_object_offset_,
7207 static_cast<int8_t>(list_length_offset - kHeapObjectTag)); 7270 static_cast<int8_t>(list_length_offset - kHeapObjectTag));
7208 ASSERT(guarded_list_length_in_object_offset() == list_length_offset); 7271 ASSERT(guarded_list_length_in_object_offset() == list_length_offset);
7209 } 7272 }
7210 7273
7211 7274
7212 const char* Field::ToCString() const { 7275 const char* Field::ToCString() const {
7213 if (IsNull()) { 7276 if (IsNull()) {
7214 return "Field::null"; 7277 return "Field::null";
7215 } 7278 }
7216 const char* kF0 = is_static() ? " static" : ""; 7279 const char* kF0 = is_static() ? " static" : "";
7217 const char* kF1 = is_final() ? " final" : ""; 7280 const char* kF1 = is_final() ? " final" : "";
7218 const char* kF2 = is_const() ? " const" : ""; 7281 const char* kF2 = is_const() ? " const" : "";
7219 const char* field_name = String::Handle(name()).ToCString(); 7282 const char* field_name = String::Handle(name()).ToCString();
7220 const Class& cls = Class::Handle(owner()); 7283 const Class& cls = Class::Handle(Owner());
7221 const char* cls_name = String::Handle(cls.Name()).ToCString(); 7284 const char* cls_name = String::Handle(cls.Name()).ToCString();
7222 return OS::SCreate(Thread::Current()->zone(), 7285 return OS::SCreate(Thread::Current()->zone(),
7223 "Field <%s.%s>:%s%s%s", cls_name, field_name, kF0, kF1, kF2); 7286 "Field <%s.%s>:%s%s%s", cls_name, field_name, kF0, kF1, kF2);
7224 } 7287 }
7225 7288
7226 7289
7227 // Build a closure object that gets (or sets) the contents of a static 7290 // Build a closure object that gets (or sets) the contents of a static
7228 // field f and cache the closure in a newly created static field 7291 // field f and cache the closure in a newly created static field
7229 // named #f (or #f= in case of a setter). 7292 // named #f (or #f= in case of a setter).
7230 RawInstance* Field::AccessorClosure(bool make_setter) const { 7293 RawInstance* Field::AccessorClosure(bool make_setter) const {
7231 ASSERT(is_static()); 7294 ASSERT(is_static());
7232 const Class& field_owner = Class::Handle(owner()); 7295 const Class& field_owner = Class::Handle(Owner());
7233 7296
7234 String& closure_name = String::Handle(this->name()); 7297 String& closure_name = String::Handle(this->name());
7235 closure_name = Symbols::FromConcat(Symbols::HashMark(), closure_name); 7298 closure_name = Symbols::FromConcat(Symbols::HashMark(), closure_name);
7236 if (make_setter) { 7299 if (make_setter) {
7237 closure_name = Symbols::FromConcat(Symbols::HashMark(), closure_name); 7300 closure_name = Symbols::FromConcat(Symbols::HashMark(), closure_name);
7238 } 7301 }
7239 7302
7240 Field& closure_field = Field::Handle(); 7303 Field& closure_field = Field::Handle();
7241 closure_field = field_owner.LookupStaticField(closure_name); 7304 closure_field = field_owner.LookupStaticField(closure_name);
7242 if (!closure_field.IsNull()) { 7305 if (!closure_field.IsNull()) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
7292 return AccessorClosure(true); 7355 return AccessorClosure(true);
7293 } 7356 }
7294 7357
7295 7358
7296 RawArray* Field::dependent_code() const { 7359 RawArray* Field::dependent_code() const {
7297 return raw_ptr()->dependent_code_; 7360 return raw_ptr()->dependent_code_;
7298 } 7361 }
7299 7362
7300 7363
7301 void Field::set_dependent_code(const Array& array) const { 7364 void Field::set_dependent_code(const Array& array) const {
7365 ASSERT(IsOriginal());
7302 StorePointer(&raw_ptr()->dependent_code_, array.raw()); 7366 StorePointer(&raw_ptr()->dependent_code_, array.raw());
7303 } 7367 }
7304 7368
7305 7369
7306 class FieldDependentArray : public WeakCodeReferences { 7370 class FieldDependentArray : public WeakCodeReferences {
7307 public: 7371 public:
7308 explicit FieldDependentArray(const Field& field) 7372 explicit FieldDependentArray(const Field& field)
7309 : WeakCodeReferences(Array::Handle(field.dependent_code())), 7373 : WeakCodeReferences(Array::Handle(field.dependent_code())),
7310 field_(field) {} 7374 field_(field) {}
7311 7375
(...skipping 23 matching lines...) Expand all
7335 Isolate::Current()->IncrFieldInvalidationGen(); 7399 Isolate::Current()->IncrFieldInvalidationGen();
7336 } 7400 }
7337 7401
7338 private: 7402 private:
7339 const Field& field_; 7403 const Field& field_;
7340 DISALLOW_COPY_AND_ASSIGN(FieldDependentArray); 7404 DISALLOW_COPY_AND_ASSIGN(FieldDependentArray);
7341 }; 7405 };
7342 7406
7343 7407
7344 void Field::RegisterDependentCode(const Code& code) const { 7408 void Field::RegisterDependentCode(const Code& code) const {
7409 ASSERT(IsOriginal());
7345 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); 7410 DEBUG_ASSERT(IsMutatorOrAtSafepoint());
7346 ASSERT(code.is_optimized()); 7411 ASSERT(code.is_optimized());
7347 FieldDependentArray a(*this); 7412 FieldDependentArray a(*this);
7348 a.Register(code); 7413 a.Register(code);
7349 } 7414 }
7350 7415
7351 7416
7352 void Field::DeoptimizeDependentCode() const { 7417 void Field::DeoptimizeDependentCode() const {
7418 ASSERT(IsOriginal());
7353 ASSERT(Thread::Current()->IsMutatorThread()); 7419 ASSERT(Thread::Current()->IsMutatorThread());
7354 FieldDependentArray a(*this); 7420 FieldDependentArray a(*this);
7355 a.DisableCode(); 7421 a.DisableCode();
7356 } 7422 }
7357 7423
7358 7424
7359 bool Field::IsUninitialized() const { 7425 bool Field::IsUninitialized() const {
7360 const Instance& value = Instance::Handle(raw_ptr()->value_.static_value_); 7426 const Instance& value = Instance::Handle(raw_ptr()->value_.static_value_);
7361 ASSERT(value.raw() != Object::transition_sentinel().raw()); 7427 ASSERT(value.raw() != Object::transition_sentinel().raw());
7362 return value.raw() == Object::sentinel().raw(); 7428 return value.raw() == Object::sentinel().raw();
7363 } 7429 }
7364 7430
7365 7431
7366 void Field::SetPrecompiledInitializer(const Function& initializer) const { 7432 void Field::SetPrecompiledInitializer(const Function& initializer) const {
7433 ASSERT(IsOriginal());
7367 StorePointer(&raw_ptr()->initializer_.precompiled_, initializer.raw()); 7434 StorePointer(&raw_ptr()->initializer_.precompiled_, initializer.raw());
7368 } 7435 }
7369 7436
7370 7437
7371 bool Field::HasPrecompiledInitializer() const { 7438 bool Field::HasPrecompiledInitializer() const {
7372 return raw_ptr()->initializer_.precompiled_->IsHeapObject() && 7439 return raw_ptr()->initializer_.precompiled_->IsHeapObject() &&
7373 raw_ptr()->initializer_.precompiled_->IsFunction(); 7440 raw_ptr()->initializer_.precompiled_->IsFunction();
7374 } 7441 }
7375 7442
7376 7443
7377 void Field::SetSavedInitialStaticValue(const Instance& value) const { 7444 void Field::SetSavedInitialStaticValue(const Instance& value) const {
7445 ASSERT(IsOriginal());
7378 ASSERT(!HasPrecompiledInitializer()); 7446 ASSERT(!HasPrecompiledInitializer());
7379 StorePointer(&raw_ptr()->initializer_.saved_value_, value.raw()); 7447 StorePointer(&raw_ptr()->initializer_.saved_value_, value.raw());
7380 } 7448 }
7381 7449
7382 7450
7383 void Field::EvaluateInitializer() const { 7451 void Field::EvaluateInitializer() const {
7452 ASSERT(IsOriginal());
7384 ASSERT(is_static()); 7453 ASSERT(is_static());
7385 if (StaticValue() == Object::sentinel().raw()) { 7454 if (StaticValue() == Object::sentinel().raw()) {
7386 SetStaticValue(Object::transition_sentinel()); 7455 SetStaticValue(Object::transition_sentinel());
7387 const Object& value = 7456 const Object& value =
7388 Object::Handle(Compiler::EvaluateStaticInitializer(*this)); 7457 Object::Handle(Compiler::EvaluateStaticInitializer(*this));
7389 if (value.IsError()) { 7458 if (value.IsError()) {
7390 SetStaticValue(Object::null_instance()); 7459 SetStaticValue(Object::null_instance());
7391 Exceptions::PropagateError(Error::Cast(value)); 7460 Exceptions::PropagateError(Error::Cast(value));
7392 UNREACHABLE(); 7461 UNREACHABLE();
7393 } 7462 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
7475 } 7544 }
7476 } 7545 }
7477 7546
7478 return Thread::Current()->zone()->PrintToString("<%s %s>", 7547 return Thread::Current()->zone()->PrintToString("<%s %s>",
7479 is_nullable() ? "nullable" : "not-nullable", 7548 is_nullable() ? "nullable" : "not-nullable",
7480 class_name); 7549 class_name);
7481 } 7550 }
7482 7551
7483 7552
7484 void Field::InitializeGuardedListLengthInObjectOffset() const { 7553 void Field::InitializeGuardedListLengthInObjectOffset() const {
7554 ASSERT(IsOriginal());
7485 if (needs_length_check() && 7555 if (needs_length_check() &&
7486 (guarded_list_length() != Field::kUnknownFixedLength)) { 7556 (guarded_list_length() != Field::kUnknownFixedLength)) {
7487 const intptr_t offset = GetListLengthOffset(guarded_cid()); 7557 const intptr_t offset = GetListLengthOffset(guarded_cid());
7488 set_guarded_list_length_in_object_offset(offset); 7558 set_guarded_list_length_in_object_offset(offset);
7489 ASSERT(offset != Field::kUnknownLengthOffset); 7559 ASSERT(offset != Field::kUnknownLengthOffset);
7490 } else { 7560 } else {
7491 set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); 7561 set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset);
7492 } 7562 }
7493 } 7563 }
7494 7564
7495 7565
7496 bool Field::UpdateGuardedCidAndLength(const Object& value) const { 7566 bool Field::UpdateGuardedCidAndLength(const Object& value) const {
7567 ASSERT(IsOriginal());
7497 const intptr_t cid = value.GetClassId(); 7568 const intptr_t cid = value.GetClassId();
7498 7569
7499 if (guarded_cid() == kIllegalCid) { 7570 if (guarded_cid() == kIllegalCid) {
7500 // Field is assigned first time. 7571 // Field is assigned first time.
7501 set_guarded_cid(cid); 7572 set_guarded_cid(cid);
7502 set_is_nullable(cid == kNullCid); 7573 set_is_nullable(cid == kNullCid);
7503 7574
7504 // Start tracking length if needed. 7575 // Start tracking length if needed.
7505 ASSERT((guarded_list_length() == Field::kUnknownFixedLength) || 7576 ASSERT((guarded_list_length() == Field::kUnknownFixedLength) ||
7506 (guarded_list_length() == Field::kNoFixedLength)); 7577 (guarded_list_length() == Field::kNoFixedLength));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
7554 set_guarded_list_length(Field::kNoFixedLength); 7625 set_guarded_list_length(Field::kNoFixedLength);
7555 set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); 7626 set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset);
7556 } 7627 }
7557 7628
7558 // Expected class id or nullability of the field changed. 7629 // Expected class id or nullability of the field changed.
7559 return true; 7630 return true;
7560 } 7631 }
7561 7632
7562 7633
7563 void Field::RecordStore(const Object& value) const { 7634 void Field::RecordStore(const Object& value) const {
7635 ASSERT(IsOriginal());
7564 if (!FLAG_use_field_guards) { 7636 if (!FLAG_use_field_guards) {
7565 return; 7637 return;
7566 } 7638 }
7567 7639
7568 if (FLAG_trace_field_guards) { 7640 if (FLAG_trace_field_guards) {
7569 THR_Print("Store %s %s <- %s\n", 7641 THR_Print("Store %s %s <- %s\n",
7570 ToCString(), 7642 ToCString(),
7571 GuardedPropertiesAsCString(), 7643 GuardedPropertiesAsCString(),
7572 value.ToCString()); 7644 value.ToCString());
7573 } 7645 }
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
8915 } 8987 }
8916 8988
8917 8989
8918 static RawString* MakeClassMetaName(const Class& cls) { 8990 static RawString* MakeClassMetaName(const Class& cls) {
8919 return Symbols::FromConcat(Symbols::At(), String::Handle(cls.Name())); 8991 return Symbols::FromConcat(Symbols::At(), String::Handle(cls.Name()));
8920 } 8992 }
8921 8993
8922 8994
8923 static RawString* MakeFieldMetaName(const Field& field) { 8995 static RawString* MakeFieldMetaName(const Field& field) {
8924 const String& cname = 8996 const String& cname =
8925 String::Handle(MakeClassMetaName(Class::Handle(field.origin()))); 8997 String::Handle(MakeClassMetaName(Class::Handle(field.Origin())));
8926 GrowableHandlePtrArray<const String> pieces(Thread::Current()->zone(), 3); 8998 GrowableHandlePtrArray<const String> pieces(Thread::Current()->zone(), 3);
8927 pieces.Add(cname); 8999 pieces.Add(cname);
8928 pieces.Add(Symbols::At()); 9000 pieces.Add(Symbols::At());
8929 pieces.Add(String::Handle(field.name())); 9001 pieces.Add(String::Handle(field.name()));
8930 return Symbols::FromConcatAll(pieces); 9002 return Symbols::FromConcatAll(pieces);
8931 } 9003 }
8932 9004
8933 9005
8934 static RawString* MakeFunctionMetaName(const Function& func) { 9006 static RawString* MakeFunctionMetaName(const Function& func) {
8935 const String& cname = 9007 const String& cname =
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
9380 Class& cls = Class::Handle(); 9452 Class& cls = Class::Handle();
9381 Script& owner_script = Script::Handle(); 9453 Script& owner_script = Script::Handle();
9382 DictionaryIterator it(*this); 9454 DictionaryIterator it(*this);
9383 while (it.HasNext()) { 9455 while (it.HasNext()) {
9384 entry = it.GetNext(); 9456 entry = it.GetNext();
9385 if (entry.IsClass()) { 9457 if (entry.IsClass()) {
9386 owner_script = Class::Cast(entry).script(); 9458 owner_script = Class::Cast(entry).script();
9387 } else if (entry.IsFunction()) { 9459 } else if (entry.IsFunction()) {
9388 owner_script = Function::Cast(entry).script(); 9460 owner_script = Function::Cast(entry).script();
9389 } else if (entry.IsField()) { 9461 } else if (entry.IsField()) {
9390 owner_script = Field::Cast(entry).script(); 9462 owner_script = Field::Cast(entry).Script();
9391 } else { 9463 } else {
9392 continue; 9464 continue;
9393 } 9465 }
9394 AddScriptIfUnique(scripts, owner_script); 9466 AddScriptIfUnique(scripts, owner_script);
9395 } 9467 }
9396 9468
9397 // Add all scripts from patch classes. 9469 // Add all scripts from patch classes.
9398 GrowableObjectArray& patches = GrowableObjectArray::Handle(patch_classes()); 9470 GrowableObjectArray& patches = GrowableObjectArray::Handle(patch_classes());
9399 for (intptr_t i = 0; i < patches.Length(); i++) { 9471 for (intptr_t i = 0; i < patches.Length(); i++) {
9400 entry = patches.At(i); 9472 entry = patches.At(i);
(...skipping 12132 matching lines...) Expand 10 before | Expand all | Expand 10 after
21533 return UserTag::null(); 21605 return UserTag::null();
21534 } 21606 }
21535 21607
21536 21608
21537 const char* UserTag::ToCString() const { 21609 const char* UserTag::ToCString() const {
21538 const String& tag_label = String::Handle(label()); 21610 const String& tag_label = String::Handle(label());
21539 return tag_label.ToCString(); 21611 return tag_label.ToCString();
21540 } 21612 }
21541 21613
21542 } // namespace dart 21614 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698