Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: runtime/vm/object.h

Issue 2983973002: Revert "Improve hashCode for closure objects" (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 intptr_t ComputeClosureHash() const; 2413 RawSmi* GetClosureHashCode() 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
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
3084 static RawClosureData* New(); 3087 static RawClosureData* New();
3085 3088
3086 FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object); 3089 FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object);
3087 friend class Class; 3090 friend class Class;
3088 friend class Function; 3091 friend class Function;
3089 friend class HeapProfiler; 3092 friend class HeapProfiler;
3090 }; 3093 };
3091 3094
3092 class SignatureData : public Object { 3095 class SignatureData : public Object {
3093 public: 3096 public:
(...skipping 2437 matching lines...) Expand 10 before | Expand all | Expand 10 after
5531 // the formal parameters given in param_names, and is invoked with 5534 // the formal parameters given in param_names, and is invoked with
5532 // the argument values given in param_values. 5535 // the argument values given in param_values.
5533 RawObject* Evaluate(const Class& method_cls, 5536 RawObject* Evaluate(const Class& method_cls,
5534 const String& expr, 5537 const String& expr,
5535 const Array& param_names, 5538 const Array& param_names,
5536 const Array& param_values) const; 5539 const Array& param_values) const;
5537 5540
5538 // Equivalent to invoking hashCode on this instance. 5541 // Equivalent to invoking hashCode on this instance.
5539 virtual RawObject* HashCode() const; 5542 virtual RawObject* HashCode() const;
5540 5543
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
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
8362 static intptr_t InstanceSize() { 8359 static intptr_t InstanceSize() {
8363 return RoundedAllocationSize(sizeof(RawClosure)); 8360 return RoundedAllocationSize(sizeof(RawClosure));
8364 } 8361 }
8365 8362
8366 // Returns true if all elements are OK for canonicalization. 8363 // Returns true if all elements are OK for canonicalization.
8367 virtual bool CheckAndCanonicalizeFields(Thread* thread, 8364 virtual bool CheckAndCanonicalizeFields(Thread* thread,
8368 const char** error_str) const { 8365 const char** error_str) const {
8369 // None of the fields of a closure are instances. 8366 // None of the fields of a closure are instances.
8370 return true; 8367 return true;
8371 } 8368 }
8372 8369
8373 int64_t ComputeHash() const;
8374
8375 static RawClosure* New(const TypeArguments& instantiator_type_arguments, 8370 static RawClosure* New(const TypeArguments& instantiator_type_arguments,
8376 const TypeArguments& function_type_arguments, 8371 const TypeArguments& function_type_arguments,
8377 const Function& function, 8372 const Function& function,
8378 const Context& context, 8373 const Context& context,
8379 Heap::Space space = Heap::kNew); 8374 Heap::Space space = Heap::kNew);
8380 8375
8381 private: 8376 private:
8382 static RawClosure* New(); 8377 static RawClosure* New();
8383 8378
8384 FINAL_HEAP_OBJECT_IMPLEMENTATION(Closure, Instance); 8379 FINAL_HEAP_OBJECT_IMPLEMENTATION(Closure, Instance);
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
8934 8929
8935 inline void TypeArguments::SetHash(intptr_t value) const { 8930 inline void TypeArguments::SetHash(intptr_t value) const {
8936 // This is only safe because we create a new Smi, which does not cause 8931 // This is only safe because we create a new Smi, which does not cause
8937 // heap allocation. 8932 // heap allocation.
8938 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8933 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8939 } 8934 }
8940 8935
8941 } // namespace dart 8936 } // namespace dart
8942 8937
8943 #endif // RUNTIME_VM_OBJECT_H_ 8938 #endif // RUNTIME_VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698