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

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

Issue 2598623002: Cache hash code for closures. (Closed)
Patch Set: remove redundant assertion Created 4 years 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/clustered_snapshot.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 2329 matching lines...) Expand 10 before | Expand all | Expand 10 after
2340 // If none exists yet, create one and remember it. 2340 // If none exists yet, create one and remember it.
2341 RawFunction* ImplicitClosureFunction() const; 2341 RawFunction* ImplicitClosureFunction() const;
2342 void DropUncompiledImplicitClosureFunction() const; 2342 void DropUncompiledImplicitClosureFunction() const;
2343 2343
2344 // Return the closure implicitly created for this function. 2344 // Return the closure implicitly created for this function.
2345 // If none exists yet, create one and remember it. 2345 // If none exists yet, create one and remember it.
2346 RawInstance* ImplicitStaticClosure() const; 2346 RawInstance* ImplicitStaticClosure() const;
2347 2347
2348 RawInstance* ImplicitInstanceClosure(const Instance& receiver) const; 2348 RawInstance* ImplicitInstanceClosure(const Instance& receiver) const;
2349 2349
2350 RawSmi* GetClosureHashCode() const;
2351
2350 // Redirection information for a redirecting factory. 2352 // Redirection information for a redirecting factory.
2351 bool IsRedirectingFactory() const; 2353 bool IsRedirectingFactory() const;
2352 RawType* RedirectionType() const; 2354 RawType* RedirectionType() const;
2353 void SetRedirectionType(const Type& type) const; 2355 void SetRedirectionType(const Type& type) const;
2354 RawString* RedirectionIdentifier() const; 2356 RawString* RedirectionIdentifier() const;
2355 void SetRedirectionIdentifier(const String& identifier) const; 2357 void SetRedirectionIdentifier(const String& identifier) const;
2356 RawFunction* RedirectionTarget() const; 2358 RawFunction* RedirectionTarget() const;
2357 void SetRedirectionTarget(const Function& target) const; 2359 void SetRedirectionTarget(const Function& target) const;
2358 2360
2359 RawFunction::Kind kind() const { 2361 RawFunction::Kind kind() const {
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
3008 RawFunction* parent_function() const { return raw_ptr()->parent_function_; } 3010 RawFunction* parent_function() const { return raw_ptr()->parent_function_; }
3009 void set_parent_function(const Function& value) const; 3011 void set_parent_function(const Function& value) const;
3010 3012
3011 // Signature type of this closure function. 3013 // Signature type of this closure function.
3012 RawType* signature_type() const { return raw_ptr()->signature_type_; } 3014 RawType* signature_type() const { return raw_ptr()->signature_type_; }
3013 void set_signature_type(const Type& value) const; 3015 void set_signature_type(const Type& value) const;
3014 3016
3015 RawInstance* implicit_static_closure() const { return raw_ptr()->closure_; } 3017 RawInstance* implicit_static_closure() const { return raw_ptr()->closure_; }
3016 void set_implicit_static_closure(const Instance& closure) const; 3018 void set_implicit_static_closure(const Instance& closure) const;
3017 3019
3020 RawObject* hash() const { return raw_ptr()->hash_; }
3021 void set_hash(intptr_t value) const;
3022
3018 static RawClosureData* New(); 3023 static RawClosureData* New();
3019 3024
3020 FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object); 3025 FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object);
3021 friend class Class; 3026 friend class Class;
3022 friend class Function; 3027 friend class Function;
3023 friend class HeapProfiler; 3028 friend class HeapProfiler;
3024 }; 3029 };
3025 3030
3026 3031
3027 class SignatureData : public Object { 3032 class SignatureData : public Object {
(...skipping 5902 matching lines...) Expand 10 before | Expand all | Expand 10 after
8930 8935
8931 inline void TypeArguments::SetHash(intptr_t value) const { 8936 inline void TypeArguments::SetHash(intptr_t value) const {
8932 // This is only safe because we create a new Smi, which does not cause 8937 // This is only safe because we create a new Smi, which does not cause
8933 // heap allocation. 8938 // heap allocation.
8934 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8939 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8935 } 8940 }
8936 8941
8937 } // namespace dart 8942 } // namespace dart
8938 8943
8939 #endif // RUNTIME_VM_OBJECT_H_ 8944 #endif // RUNTIME_VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/clustered_snapshot.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698