| 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 5337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5348 } else { | 5348 } else { |
| 5349 result.SetOffset(0); | 5349 result.SetOffset(0); |
| 5350 } | 5350 } |
| 5351 result.set_is_final(is_final); | 5351 result.set_is_final(is_final); |
| 5352 result.set_is_const(is_const); | 5352 result.set_is_const(is_const); |
| 5353 result.set_owner(owner); | 5353 result.set_owner(owner); |
| 5354 result.set_token_pos(token_pos); | 5354 result.set_token_pos(token_pos); |
| 5355 result.set_has_initializer(false); | 5355 result.set_has_initializer(false); |
| 5356 result.set_guarded_cid(kIllegalCid); | 5356 result.set_guarded_cid(kIllegalCid); |
| 5357 result.set_is_nullable(false); | 5357 result.set_is_nullable(false); |
| 5358 result.set_guarded_list_length(Field::kUnknownFixedLength); | 5358 if (is_final) { |
| 5359 result.set_guarded_list_length(Field::kUnknownFixedLength); |
| 5360 } else { |
| 5361 result.set_guarded_list_length(Field::kNoFixedLength); |
| 5362 } |
| 5359 result.set_dependent_code(Object::null_array()); | 5363 result.set_dependent_code(Object::null_array()); |
| 5360 return result.raw(); | 5364 return result.raw(); |
| 5361 } | 5365 } |
| 5362 | 5366 |
| 5363 | 5367 |
| 5364 | 5368 |
| 5365 RawField* Field::Clone(const Class& new_owner) const { | 5369 RawField* Field::Clone(const Class& new_owner) const { |
| 5366 Field& clone = Field::Handle(); | 5370 Field& clone = Field::Handle(); |
| 5367 clone ^= Object::Clone(*this, Heap::kOld); | 5371 clone ^= Object::Clone(*this, Heap::kOld); |
| 5368 const Class& owner = Class::Handle(this->owner()); | 5372 const Class& owner = Class::Handle(this->owner()); |
| 5369 const PatchClass& clone_owner = | 5373 const PatchClass& clone_owner = |
| 5370 PatchClass::Handle(PatchClass::New(new_owner, owner)); | 5374 PatchClass::Handle(PatchClass::New(new_owner, owner)); |
| 5371 clone.set_owner(clone_owner); | 5375 clone.set_owner(clone_owner); |
| 5372 clone.set_dependent_code(Object::null_array()); | 5376 clone.set_dependent_code(Object::null_array()); |
| 5373 if (!clone.is_static()) { | 5377 if (!clone.is_static()) { |
| 5374 clone.SetOffset(0); | 5378 clone.SetOffset(0); |
| 5375 } | 5379 } |
| 5376 return clone.raw(); | 5380 return clone.raw(); |
| 5377 } | 5381 } |
| 5378 | 5382 |
| 5379 | 5383 |
| 5380 RawString* Field::UserVisibleName() const { | 5384 RawString* Field::UserVisibleName() const { |
| 5381 const String& str = String::Handle(name()); | 5385 const String& str = String::Handle(name()); |
| 5382 return IdentifierPrettyName(str); | 5386 return IdentifierPrettyName(str); |
| 5383 } | 5387 } |
| 5384 | 5388 |
| 5385 | 5389 |
| 5390 intptr_t Field::guarded_list_length() const { |
| 5391 return Smi::Value(raw_ptr()->guarded_list_length_); |
| 5392 } |
| 5393 |
| 5394 |
| 5395 void Field::set_guarded_list_length(intptr_t list_length) const { |
| 5396 raw_ptr()->guarded_list_length_ = Smi::New(list_length); |
| 5397 } |
| 5398 |
| 5399 |
| 5386 const char* Field::ToCString() const { | 5400 const char* Field::ToCString() const { |
| 5387 if (IsNull()) { | 5401 if (IsNull()) { |
| 5388 return "Field::null"; | 5402 return "Field::null"; |
| 5389 } | 5403 } |
| 5390 const char* kF0 = is_static() ? " static" : ""; | 5404 const char* kF0 = is_static() ? " static" : ""; |
| 5391 const char* kF1 = is_final() ? " final" : ""; | 5405 const char* kF1 = is_final() ? " final" : ""; |
| 5392 const char* kF2 = is_const() ? " const" : ""; | 5406 const char* kF2 = is_const() ? " const" : ""; |
| 5393 const char* kFormat = "Field <%s.%s>:%s%s%s"; | 5407 const char* kFormat = "Field <%s.%s>:%s%s%s"; |
| 5394 const char* field_name = String::Handle(name()).ToCString(); | 5408 const char* field_name = String::Handle(name()).ToCString(); |
| 5395 const Class& cls = Class::Handle(owner()); | 5409 const Class& cls = Class::Handle(owner()); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5568 if (list_length_unknown && list_length_changed && !force_invalidate) { | 5582 if (list_length_unknown && list_length_changed && !force_invalidate) { |
| 5569 // List length set for first time. | 5583 // List length set for first time. |
| 5570 set_guarded_list_length(list_length); | 5584 set_guarded_list_length(list_length); |
| 5571 return; | 5585 return; |
| 5572 } | 5586 } |
| 5573 | 5587 |
| 5574 if (!list_length_changed && !force_invalidate) { | 5588 if (!list_length_changed && !force_invalidate) { |
| 5575 // List length unchanged. | 5589 // List length unchanged. |
| 5576 return; | 5590 return; |
| 5577 } | 5591 } |
| 5578 | |
| 5579 // Multiple list lengths assigned here, stop tracking length. | 5592 // Multiple list lengths assigned here, stop tracking length. |
| 5580 set_guarded_list_length(Field::kNoFixedLength); | 5593 set_guarded_list_length(Field::kNoFixedLength); |
| 5581 DeoptimizeDependentCode(); | 5594 DeoptimizeDependentCode(); |
| 5582 } | 5595 } |
| 5583 | 5596 |
| 5584 | 5597 |
| 5585 void LiteralToken::set_literal(const String& literal) const { | 5598 void LiteralToken::set_literal(const String& literal) const { |
| 5586 StorePointer(&raw_ptr()->literal_, literal.raw()); | 5599 StorePointer(&raw_ptr()->literal_, literal.raw()); |
| 5587 } | 5600 } |
| 5588 | 5601 |
| (...skipping 9210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14799 } | 14812 } |
| 14800 | 14813 |
| 14801 | 14814 |
| 14802 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14815 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14803 stream->OpenObject(); | 14816 stream->OpenObject(); |
| 14804 stream->CloseObject(); | 14817 stream->CloseObject(); |
| 14805 } | 14818 } |
| 14806 | 14819 |
| 14807 | 14820 |
| 14808 } // namespace dart | 14821 } // namespace dart |
| OLD | NEW |