| 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 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ | 
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ | 
| 7 | 7 | 
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" | 
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" | 
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" | 
| (...skipping 5392 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5403     // This is only safe because we create a new Smi, which does not cause | 5403     // This is only safe because we create a new Smi, which does not cause | 
| 5404     // heap allocation. | 5404     // heap allocation. | 
| 5405     raw_ptr()->data_length_ = Smi::New(value); | 5405     raw_ptr()->data_length_ = Smi::New(value); | 
| 5406   } | 5406   } | 
| 5407 | 5407 | 
| 5408   HEAP_OBJECT_IMPLEMENTATION(JSRegExp, Instance); | 5408   HEAP_OBJECT_IMPLEMENTATION(JSRegExp, Instance); | 
| 5409   friend class Class; | 5409   friend class Class; | 
| 5410 }; | 5410 }; | 
| 5411 | 5411 | 
| 5412 | 5412 | 
|  | 5413 class WeakProperty : public Instance { | 
|  | 5414  public: | 
|  | 5415   RawObject* key() const { | 
|  | 5416     return raw_ptr()->key_; | 
|  | 5417   } | 
|  | 5418 | 
|  | 5419   void set_key(const Object& key) { | 
|  | 5420     StorePointer(&raw_ptr()->key_, key.raw()); | 
|  | 5421   } | 
|  | 5422 | 
|  | 5423   RawObject* value() const { | 
|  | 5424     return raw_ptr()->value_; | 
|  | 5425   } | 
|  | 5426 | 
|  | 5427   void set_value(const Object& value) { | 
|  | 5428     StorePointer(&raw_ptr()->value_, value.raw()); | 
|  | 5429   } | 
|  | 5430 | 
|  | 5431   static RawWeakProperty* New(Heap::Space space = Heap::kNew); | 
|  | 5432 | 
|  | 5433   static intptr_t InstanceSize() { | 
|  | 5434     return RoundedAllocationSize(sizeof(RawWeakProperty)); | 
|  | 5435   } | 
|  | 5436 | 
|  | 5437   static void Clear(RawWeakProperty* raw_weak) { | 
|  | 5438     raw_weak->ptr()->key_ = Object::null(); | 
|  | 5439     raw_weak->ptr()->value_ = Object::null(); | 
|  | 5440   } | 
|  | 5441 | 
|  | 5442  private: | 
|  | 5443   HEAP_OBJECT_IMPLEMENTATION(WeakProperty, Instance); | 
|  | 5444   friend class Class; | 
|  | 5445 }; | 
|  | 5446 | 
|  | 5447 | 
| 5413 // Breaking cycles and loops. | 5448 // Breaking cycles and loops. | 
| 5414 RawClass* Object::clazz() const { | 5449 RawClass* Object::clazz() const { | 
| 5415   uword raw_value = reinterpret_cast<uword>(raw_); | 5450   uword raw_value = reinterpret_cast<uword>(raw_); | 
| 5416   if ((raw_value & kSmiTagMask) == kSmiTag) { | 5451   if ((raw_value & kSmiTagMask) == kSmiTag) { | 
| 5417     return Smi::Class(); | 5452     return Smi::Class(); | 
| 5418   } | 5453   } | 
| 5419   return Isolate::Current()->class_table()->At(raw()->GetClassId()); | 5454   return Isolate::Current()->class_table()->At(raw()->GetClassId()); | 
| 5420 } | 5455 } | 
| 5421 | 5456 | 
| 5422 | 5457 | 
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5514     if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5549     if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 
| 5515       return false; | 5550       return false; | 
| 5516     } | 5551     } | 
| 5517   } | 5552   } | 
| 5518   return true; | 5553   return true; | 
| 5519 } | 5554 } | 
| 5520 | 5555 | 
| 5521 }  // namespace dart | 5556 }  // namespace dart | 
| 5522 | 5557 | 
| 5523 #endif  // VM_OBJECT_H_ | 5558 #endif  // VM_OBJECT_H_ | 
| OLD | NEW | 
|---|