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 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2403 // If none exists yet, create one and remember it. | 2403 // If none exists yet, create one and remember it. |
2404 RawFunction* ImplicitClosureFunction() const; | 2404 RawFunction* ImplicitClosureFunction() const; |
2405 void DropUncompiledImplicitClosureFunction() const; | 2405 void DropUncompiledImplicitClosureFunction() const; |
2406 | 2406 |
2407 // Return the closure implicitly created for this function. | 2407 // Return the closure implicitly created for this function. |
2408 // If none exists yet, create one and remember it. | 2408 // If none exists yet, create one and remember it. |
2409 RawInstance* ImplicitStaticClosure() const; | 2409 RawInstance* ImplicitStaticClosure() const; |
2410 | 2410 |
2411 RawInstance* ImplicitInstanceClosure(const Instance& receiver) const; | 2411 RawInstance* ImplicitInstanceClosure(const Instance& receiver) const; |
2412 | 2412 |
2413 RawSmi* GetClosureHashCode() const; | 2413 intptr_t ComputeClosureHash() const; |
2414 | 2414 |
2415 // Redirection information for a redirecting factory. | 2415 // Redirection information for a redirecting factory. |
2416 bool IsRedirectingFactory() const; | 2416 bool IsRedirectingFactory() const; |
2417 RawType* RedirectionType() const; | 2417 RawType* RedirectionType() const; |
2418 void SetRedirectionType(const Type& type) const; | 2418 void SetRedirectionType(const Type& type) const; |
2419 RawString* RedirectionIdentifier() const; | 2419 RawString* RedirectionIdentifier() const; |
2420 void SetRedirectionIdentifier(const String& identifier) const; | 2420 void SetRedirectionIdentifier(const String& identifier) const; |
2421 RawFunction* RedirectionTarget() const; | 2421 RawFunction* RedirectionTarget() const; |
2422 void SetRedirectionTarget(const Function& target) const; | 2422 void SetRedirectionTarget(const Function& target) const; |
2423 | 2423 |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3074 RawFunction* parent_function() const { return raw_ptr()->parent_function_; } | 3074 RawFunction* parent_function() const { return raw_ptr()->parent_function_; } |
3075 void set_parent_function(const Function& value) const; | 3075 void set_parent_function(const Function& value) const; |
3076 | 3076 |
3077 // Signature type of this closure function. | 3077 // Signature type of this closure function. |
3078 RawType* signature_type() const { return raw_ptr()->signature_type_; } | 3078 RawType* signature_type() const { return raw_ptr()->signature_type_; } |
3079 void set_signature_type(const Type& value) const; | 3079 void set_signature_type(const Type& value) const; |
3080 | 3080 |
3081 RawInstance* implicit_static_closure() const { return raw_ptr()->closure_; } | 3081 RawInstance* implicit_static_closure() const { return raw_ptr()->closure_; } |
3082 void set_implicit_static_closure(const Instance& closure) const; | 3082 void set_implicit_static_closure(const Instance& closure) const; |
3083 | 3083 |
3084 RawObject* hash() const { return raw_ptr()->hash_; } | |
3085 void set_hash(intptr_t value) const; | |
3086 | |
3087 static RawClosureData* New(); | 3084 static RawClosureData* New(); |
3088 | 3085 |
3089 FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object); | 3086 FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object); |
3090 friend class Class; | 3087 friend class Class; |
3091 friend class Function; | 3088 friend class Function; |
3092 friend class HeapProfiler; | 3089 friend class HeapProfiler; |
3093 }; | 3090 }; |
3094 | 3091 |
3095 class SignatureData : public Object { | 3092 class SignatureData : public Object { |
3096 public: | 3093 public: |
(...skipping 2437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5534 // the formal parameters given in param_names, and is invoked with | 5531 // the formal parameters given in param_names, and is invoked with |
5535 // the argument values given in param_values. | 5532 // the argument values given in param_values. |
5536 RawObject* Evaluate(const Class& method_cls, | 5533 RawObject* Evaluate(const Class& method_cls, |
5537 const String& expr, | 5534 const String& expr, |
5538 const Array& param_names, | 5535 const Array& param_names, |
5539 const Array& param_values) const; | 5536 const Array& param_values) const; |
5540 | 5537 |
5541 // Equivalent to invoking hashCode on this instance. | 5538 // Equivalent to invoking hashCode on this instance. |
5542 virtual RawObject* HashCode() const; | 5539 virtual RawObject* HashCode() const; |
5543 | 5540 |
| 5541 // Equivalent to invoking identityHashCode with this instance. |
| 5542 RawObject* IdentityHashCode() const; |
| 5543 |
5544 static intptr_t InstanceSize() { | 5544 static intptr_t InstanceSize() { |
5545 return RoundedAllocationSize(sizeof(RawInstance)); | 5545 return RoundedAllocationSize(sizeof(RawInstance)); |
5546 } | 5546 } |
5547 | 5547 |
5548 static RawInstance* New(const Class& cls, Heap::Space space = Heap::kNew); | 5548 static RawInstance* New(const Class& cls, Heap::Space space = Heap::kNew); |
5549 | 5549 |
5550 // Array/list element address computations. | 5550 // Array/list element address computations. |
5551 static intptr_t DataOffsetFor(intptr_t cid); | 5551 static intptr_t DataOffsetFor(intptr_t cid); |
5552 static intptr_t ElementSizeFor(intptr_t cid); | 5552 static intptr_t ElementSizeFor(intptr_t cid); |
5553 | 5553 |
(...skipping 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8349 static intptr_t function_type_arguments_offset() { | 8349 static intptr_t function_type_arguments_offset() { |
8350 return OFFSET_OF(RawClosure, function_type_arguments_); | 8350 return OFFSET_OF(RawClosure, function_type_arguments_); |
8351 } | 8351 } |
8352 | 8352 |
8353 RawFunction* function() const { return raw_ptr()->function_; } | 8353 RawFunction* function() const { return raw_ptr()->function_; } |
8354 static intptr_t function_offset() { return OFFSET_OF(RawClosure, function_); } | 8354 static intptr_t function_offset() { return OFFSET_OF(RawClosure, function_); } |
8355 | 8355 |
8356 RawContext* context() const { return raw_ptr()->context_; } | 8356 RawContext* context() const { return raw_ptr()->context_; } |
8357 static intptr_t context_offset() { return OFFSET_OF(RawClosure, context_); } | 8357 static intptr_t context_offset() { return OFFSET_OF(RawClosure, context_); } |
8358 | 8358 |
| 8359 RawSmi* hash() const { return raw_ptr()->hash_; } |
| 8360 static intptr_t hash_offset() { return OFFSET_OF(RawClosure, hash_); } |
| 8361 |
8359 static intptr_t InstanceSize() { | 8362 static intptr_t InstanceSize() { |
8360 return RoundedAllocationSize(sizeof(RawClosure)); | 8363 return RoundedAllocationSize(sizeof(RawClosure)); |
8361 } | 8364 } |
8362 | 8365 |
8363 // Returns true if all elements are OK for canonicalization. | 8366 // Returns true if all elements are OK for canonicalization. |
8364 virtual bool CheckAndCanonicalizeFields(Thread* thread, | 8367 virtual bool CheckAndCanonicalizeFields(Thread* thread, |
8365 const char** error_str) const { | 8368 const char** error_str) const { |
8366 // None of the fields of a closure are instances. | 8369 // None of the fields of a closure are instances. |
8367 return true; | 8370 return true; |
8368 } | 8371 } |
8369 | 8372 |
| 8373 int64_t ComputeHash() const; |
| 8374 |
8370 static RawClosure* New(const TypeArguments& instantiator_type_arguments, | 8375 static RawClosure* New(const TypeArguments& instantiator_type_arguments, |
8371 const TypeArguments& function_type_arguments, | 8376 const TypeArguments& function_type_arguments, |
8372 const Function& function, | 8377 const Function& function, |
8373 const Context& context, | 8378 const Context& context, |
8374 Heap::Space space = Heap::kNew); | 8379 Heap::Space space = Heap::kNew); |
8375 | 8380 |
8376 private: | 8381 private: |
8377 static RawClosure* New(); | 8382 static RawClosure* New(); |
8378 | 8383 |
8379 FINAL_HEAP_OBJECT_IMPLEMENTATION(Closure, Instance); | 8384 FINAL_HEAP_OBJECT_IMPLEMENTATION(Closure, Instance); |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8929 | 8934 |
8930 inline void TypeArguments::SetHash(intptr_t value) const { | 8935 inline void TypeArguments::SetHash(intptr_t value) const { |
8931 // This is only safe because we create a new Smi, which does not cause | 8936 // This is only safe because we create a new Smi, which does not cause |
8932 // heap allocation. | 8937 // heap allocation. |
8933 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8938 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
8934 } | 8939 } |
8935 | 8940 |
8936 } // namespace dart | 8941 } // namespace dart |
8937 | 8942 |
8938 #endif // RUNTIME_VM_OBJECT_H_ | 8943 #endif // RUNTIME_VM_OBJECT_H_ |
OLD | NEW |