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

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

Issue 1420433004: Move selector and arguments descriptor into MegamorphicCache. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: parne Created 5 years, 2 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/megamorphic_cache_table.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 VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define 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 4581 matching lines...) Expand 10 before | Expand all | Expand 10 after
4592 public: 4592 public:
4593 static const int kInitialCapacity = 16; 4593 static const int kInitialCapacity = 16;
4594 static const double kLoadFactor; 4594 static const double kLoadFactor;
4595 4595
4596 RawArray* buckets() const; 4596 RawArray* buckets() const;
4597 void set_buckets(const Array& buckets) const; 4597 void set_buckets(const Array& buckets) const;
4598 4598
4599 intptr_t mask() const; 4599 intptr_t mask() const;
4600 void set_mask(intptr_t mask) const; 4600 void set_mask(intptr_t mask) const;
4601 4601
4602 RawString* target_name() const {
4603 return raw_ptr()->target_name_;
4604 }
4605
4606 RawArray* arguments_descriptor() const {
4607 return raw_ptr()->args_descriptor_;
4608 }
4609
4602 intptr_t filled_entry_count() const; 4610 intptr_t filled_entry_count() const;
4603 void set_filled_entry_count(intptr_t num) const; 4611 void set_filled_entry_count(intptr_t num) const;
4604 4612
4605 static intptr_t buckets_offset() { 4613 static intptr_t buckets_offset() {
4606 return OFFSET_OF(RawMegamorphicCache, buckets_); 4614 return OFFSET_OF(RawMegamorphicCache, buckets_);
4607 } 4615 }
4608 static intptr_t mask_offset() { 4616 static intptr_t mask_offset() {
4609 return OFFSET_OF(RawMegamorphicCache, mask_); 4617 return OFFSET_OF(RawMegamorphicCache, mask_);
4610 } 4618 }
4619 static intptr_t arguments_descriptor_offset() {
4620 return OFFSET_OF(RawMegamorphicCache, args_descriptor_);
4621 }
4611 4622
4612 static RawMegamorphicCache* New(); 4623 static RawMegamorphicCache* New(const String& target_name,
4624 const Array& arguments_descriptor);
4613 4625
4614 void EnsureCapacity() const; 4626 void EnsureCapacity() const;
4615 4627
4616 void Insert(const Smi& class_id, const Function& target) const; 4628 void Insert(const Smi& class_id, const Function& target) const;
4617 4629
4618 static intptr_t InstanceSize() { 4630 static intptr_t InstanceSize() {
4619 return RoundedAllocationSize(sizeof(RawMegamorphicCache)); 4631 return RoundedAllocationSize(sizeof(RawMegamorphicCache));
4620 } 4632 }
4621 4633
4622 private: 4634 private:
4623 friend class Class; 4635 friend class Class;
4624 4636
4637 static RawMegamorphicCache* New();
4638
4639 void set_target_name(const String& value) const;
4640 void set_arguments_descriptor(const Array& value) const;
4641
4625 enum { 4642 enum {
4626 kClassIdIndex, 4643 kClassIdIndex,
4627 kTargetFunctionIndex, 4644 kTargetFunctionIndex,
4628 kEntryLength, 4645 kEntryLength,
4629 }; 4646 };
4630 4647
4631 static inline void SetEntry(const Array& array, 4648 static inline void SetEntry(const Array& array,
4632 intptr_t index, 4649 intptr_t index,
4633 const Smi& class_id, 4650 const Smi& class_id,
4634 const Function& target); 4651 const Function& target);
(...skipping 3513 matching lines...) Expand 10 before | Expand all | Expand 10 after
8148 8165
8149 8166
8150 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8167 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8151 intptr_t index) { 8168 intptr_t index) {
8152 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8169 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8153 } 8170 }
8154 8171
8155 } // namespace dart 8172 } // namespace dart
8156 8173
8157 #endif // VM_OBJECT_H_ 8174 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/megamorphic_cache_table.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698