| 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 RUNTIME_VM_OBJECT_H_ | 5 #ifndef RUNTIME_VM_OBJECT_H_ |
| 6 #define RUNTIME_VM_OBJECT_H_ | 6 #define RUNTIME_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 8278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8289 static RawLinkedHashMap* NewUninitialized(Heap::Space space = Heap::kNew); | 8289 static RawLinkedHashMap* NewUninitialized(Heap::Space space = Heap::kNew); |
| 8290 | 8290 |
| 8291 friend class Class; | 8291 friend class Class; |
| 8292 friend class LinkedHashMapDeserializationCluster; | 8292 friend class LinkedHashMapDeserializationCluster; |
| 8293 }; | 8293 }; |
| 8294 | 8294 |
| 8295 | 8295 |
| 8296 class Closure : public Instance { | 8296 class Closure : public Instance { |
| 8297 public: | 8297 public: |
| 8298 RawFunction* function() const { return raw_ptr()->function_; } | 8298 RawFunction* function() const { return raw_ptr()->function_; } |
| 8299 void set_function(const Function& function) const { | |
| 8300 // TODO(regis): Only used from deferred_objects.cc. Remove once fixed. | |
| 8301 StorePointer(&raw_ptr()->function_, function.raw()); | |
| 8302 } | |
| 8303 static intptr_t function_offset() { return OFFSET_OF(RawClosure, function_); } | 8299 static intptr_t function_offset() { return OFFSET_OF(RawClosure, function_); } |
| 8304 | 8300 |
| 8305 RawContext* context() const { return raw_ptr()->context_; } | 8301 RawContext* context() const { return raw_ptr()->context_; } |
| 8306 void set_context(const Context& context) const { | |
| 8307 // TODO(regis): Only used from deferred_objects.cc. Remove once fixed. | |
| 8308 StorePointer(&raw_ptr()->context_, context.raw()); | |
| 8309 } | |
| 8310 static intptr_t context_offset() { return OFFSET_OF(RawClosure, context_); } | 8302 static intptr_t context_offset() { return OFFSET_OF(RawClosure, context_); } |
| 8311 | 8303 |
| 8312 static intptr_t type_arguments_offset() { | 8304 RawTypeArguments* instantiator() const { return raw_ptr()->instantiator_; } |
| 8313 return OFFSET_OF(RawClosure, type_arguments_); | 8305 static intptr_t instantiator_offset() { |
| 8306 return OFFSET_OF(RawClosure, instantiator_); |
| 8314 } | 8307 } |
| 8315 | 8308 |
| 8316 static intptr_t InstanceSize() { | 8309 static intptr_t InstanceSize() { |
| 8317 return RoundedAllocationSize(sizeof(RawClosure)); | 8310 return RoundedAllocationSize(sizeof(RawClosure)); |
| 8318 } | 8311 } |
| 8319 | 8312 |
| 8320 // Returns true if all elements are OK for canonicalization. | 8313 // Returns true if all elements are OK for canonicalization. |
| 8321 virtual bool CheckAndCanonicalizeFields(Thread* thread, | 8314 virtual bool CheckAndCanonicalizeFields(Thread* thread, |
| 8322 const char** error_str) const { | 8315 const char** error_str) const { |
| 8323 // None of the fields of a closure are instances. | 8316 // None of the fields of a closure are instances. |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8917 | 8910 |
| 8918 inline void TypeArguments::SetHash(intptr_t value) const { | 8911 inline void TypeArguments::SetHash(intptr_t value) const { |
| 8919 // This is only safe because we create a new Smi, which does not cause | 8912 // This is only safe because we create a new Smi, which does not cause |
| 8920 // heap allocation. | 8913 // heap allocation. |
| 8921 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8914 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
| 8922 } | 8915 } |
| 8923 | 8916 |
| 8924 } // namespace dart | 8917 } // namespace dart |
| 8925 | 8918 |
| 8926 #endif // RUNTIME_VM_OBJECT_H_ | 8919 #endif // RUNTIME_VM_OBJECT_H_ |
| OLD | NEW |