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 8284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8295 // Used during deserialization (since map might contain itself as key/value). | 8295 // Used during deserialization (since map might contain itself as key/value). |
8296 static RawLinkedHashMap* NewUninitialized(Heap::Space space = Heap::kNew); | 8296 static RawLinkedHashMap* NewUninitialized(Heap::Space space = Heap::kNew); |
8297 | 8297 |
8298 friend class Class; | 8298 friend class Class; |
8299 friend class LinkedHashMapDeserializationCluster; | 8299 friend class LinkedHashMapDeserializationCluster; |
8300 }; | 8300 }; |
8301 | 8301 |
8302 | 8302 |
8303 class Closure : public Instance { | 8303 class Closure : public Instance { |
8304 public: | 8304 public: |
| 8305 RawTypeArguments* instantiator() const { return raw_ptr()->instantiator_; } |
| 8306 static intptr_t instantiator_offset() { |
| 8307 return OFFSET_OF(RawClosure, instantiator_); |
| 8308 } |
| 8309 |
8305 RawFunction* function() const { return raw_ptr()->function_; } | 8310 RawFunction* function() const { return raw_ptr()->function_; } |
8306 static intptr_t function_offset() { return OFFSET_OF(RawClosure, function_); } | 8311 static intptr_t function_offset() { return OFFSET_OF(RawClosure, function_); } |
8307 | 8312 |
8308 RawContext* context() const { return raw_ptr()->context_; } | 8313 RawContext* context() const { return raw_ptr()->context_; } |
8309 static intptr_t context_offset() { return OFFSET_OF(RawClosure, context_); } | 8314 static intptr_t context_offset() { return OFFSET_OF(RawClosure, context_); } |
8310 | 8315 |
8311 RawTypeArguments* instantiator() const { return raw_ptr()->instantiator_; } | |
8312 static intptr_t instantiator_offset() { | |
8313 return OFFSET_OF(RawClosure, instantiator_); | |
8314 } | |
8315 | |
8316 static intptr_t InstanceSize() { | 8316 static intptr_t InstanceSize() { |
8317 return RoundedAllocationSize(sizeof(RawClosure)); | 8317 return RoundedAllocationSize(sizeof(RawClosure)); |
8318 } | 8318 } |
8319 | 8319 |
8320 // Returns true if all elements are OK for canonicalization. | 8320 // Returns true if all elements are OK for canonicalization. |
8321 virtual bool CheckAndCanonicalizeFields(Thread* thread, | 8321 virtual bool CheckAndCanonicalizeFields(Thread* thread, |
8322 const char** error_str) const { | 8322 const char** error_str) const { |
8323 // None of the fields of a closure are instances. | 8323 // None of the fields of a closure are instances. |
8324 return true; | 8324 return true; |
8325 } | 8325 } |
8326 | 8326 |
8327 static RawClosure* New(const Function& function, | 8327 static RawClosure* New(const TypeArguments& instantiator, |
| 8328 const Function& function, |
8328 const Context& context, | 8329 const Context& context, |
8329 Heap::Space space = Heap::kNew); | 8330 Heap::Space space = Heap::kNew); |
8330 | 8331 |
8331 private: | 8332 private: |
8332 static RawClosure* New(); | 8333 static RawClosure* New(); |
8333 | 8334 |
8334 FINAL_HEAP_OBJECT_IMPLEMENTATION(Closure, Instance); | 8335 FINAL_HEAP_OBJECT_IMPLEMENTATION(Closure, Instance); |
8335 friend class Class; | 8336 friend class Class; |
8336 }; | 8337 }; |
8337 | 8338 |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8917 | 8918 |
8918 inline void TypeArguments::SetHash(intptr_t value) const { | 8919 inline void TypeArguments::SetHash(intptr_t value) const { |
8919 // This is only safe because we create a new Smi, which does not cause | 8920 // This is only safe because we create a new Smi, which does not cause |
8920 // heap allocation. | 8921 // heap allocation. |
8921 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8922 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
8922 } | 8923 } |
8923 | 8924 |
8924 } // namespace dart | 8925 } // namespace dart |
8925 | 8926 |
8926 #endif // RUNTIME_VM_OBJECT_H_ | 8927 #endif // RUNTIME_VM_OBJECT_H_ |
OLD | NEW |