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

Side by Side Diff: src/field-index.h

Issue 528773002: Sub-minor-key-ify HandlerStubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/field-index-inl.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_FIELD_INDEX_H_ 5 #ifndef V8_FIELD_INDEX_H_
6 #define V8_FIELD_INDEX_H_ 6 #define V8_FIELD_INDEX_H_
7 7
8 #include "src/property-details.h" 8 #include "src/property-details.h"
9 #include "src/utils.h" 9 #include "src/utils.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 class Map; 14 class Map;
15 15
16 // Wrapper class to hold a field index, usually but not necessarily generated 16 // Wrapper class to hold a field index, usually but not necessarily generated
17 // from a property index. When available, the wrapper class captures additional 17 // from a property index. When available, the wrapper class captures additional
18 // information to allow the field index to be translated back into the property 18 // information to allow the field index to be translated back into the property
19 // index it was originally generated from. 19 // index it was originally generated from.
20 class FieldIndex V8_FINAL { 20 class FieldIndex V8_FINAL {
21 public: 21 public:
22 static FieldIndex ForPropertyIndex(Map* map, 22 static FieldIndex ForPropertyIndex(Map* map,
23 int index, 23 int index,
24 bool is_double = false); 24 bool is_double = false);
25 static FieldIndex ForInObjectOffset(int offset, Map* map = NULL); 25 static FieldIndex ForInObjectOffset(int offset, Map* map = NULL);
26 static FieldIndex ForDescriptor(Map* map, int descriptor_index); 26 static FieldIndex ForDescriptor(Map* map, int descriptor_index);
27 static FieldIndex ForLoadByFieldIndex(Map* map, int index); 27 static FieldIndex ForLoadByFieldIndex(Map* map, int index);
28 static FieldIndex ForKeyedLookupCacheIndex(Map* map, int index); 28 static FieldIndex ForKeyedLookupCacheIndex(Map* map, int index);
29 static FieldIndex FromFieldAccessStubKey(int key);
29 30
30 int GetLoadByFieldIndex() const; 31 int GetLoadByFieldIndex() const;
31 32
32 bool is_inobject() const { 33 bool is_inobject() const {
33 return IsInObjectBits::decode(bit_field_); 34 return IsInObjectBits::decode(bit_field_);
34 } 35 }
35 36
36 bool is_double() const { 37 bool is_double() const {
37 return IsDoubleBits::decode(bit_field_); 38 return IsDoubleBits::decode(bit_field_);
38 } 39 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 bool is_hidden = false) { 76 bool is_hidden = false) {
76 DCHECK((first_inobject_property_offset & (kPointerSize - 1)) == 0); 77 DCHECK((first_inobject_property_offset & (kPointerSize - 1)) == 0);
77 bit_field_ = IsInObjectBits::encode(is_inobject) | 78 bit_field_ = IsInObjectBits::encode(is_inobject) |
78 IsDoubleBits::encode(is_double) | 79 IsDoubleBits::encode(is_double) |
79 FirstInobjectPropertyOffsetBits::encode(first_inobject_property_offset) | 80 FirstInobjectPropertyOffsetBits::encode(first_inobject_property_offset) |
80 IsHiddenField::encode(is_hidden) | 81 IsHiddenField::encode(is_hidden) |
81 IndexBits::encode(local_index) | 82 IndexBits::encode(local_index) |
82 InObjectPropertyBits::encode(inobject_properties); 83 InObjectPropertyBits::encode(inobject_properties);
83 } 84 }
84 85
86 explicit FieldIndex(int bit_field) : bit_field_(bit_field) {}
87
85 int first_inobject_property_offset() const { 88 int first_inobject_property_offset() const {
86 DCHECK(!IsHiddenField::decode(bit_field_)); 89 DCHECK(!IsHiddenField::decode(bit_field_));
87 return FirstInobjectPropertyOffsetBits::decode(bit_field_); 90 return FirstInobjectPropertyOffsetBits::decode(bit_field_);
88 } 91 }
89 92
90 static const int kIndexBitsSize = kDescriptorIndexBitCount + 1; 93 static const int kIndexBitsSize = kDescriptorIndexBitCount + 1;
91 94
92 // Index from beginning of object. 95 // Index from beginning of object.
93 class IndexBits: public BitField<int, 0, kIndexBitsSize> {}; 96 class IndexBits: public BitField<int, 0, kIndexBitsSize> {};
94 class IsInObjectBits: public BitField<bool, IndexBits::kNext, 1> {}; 97 class IsInObjectBits: public BitField<bool, IndexBits::kNext, 1> {};
95 class IsDoubleBits: public BitField<bool, IsInObjectBits::kNext, 1> {}; 98 class IsDoubleBits: public BitField<bool, IsInObjectBits::kNext, 1> {};
96 // Number of inobject properties. 99 // Number of inobject properties.
97 class InObjectPropertyBits 100 class InObjectPropertyBits
98 : public BitField<int, IsDoubleBits::kNext, kDescriptorIndexBitCount> {}; 101 : public BitField<int, IsDoubleBits::kNext, kDescriptorIndexBitCount> {};
99 // Offset of first inobject property from beginning of object. 102 // Offset of first inobject property from beginning of object.
100 class FirstInobjectPropertyOffsetBits 103 class FirstInobjectPropertyOffsetBits
101 : public BitField<int, InObjectPropertyBits::kNext, 7> {}; 104 : public BitField<int, InObjectPropertyBits::kNext, 7> {};
102 class IsHiddenField 105 class IsHiddenField
103 : public BitField<bool, FirstInobjectPropertyOffsetBits::kNext, 1> {}; 106 : public BitField<bool, FirstInobjectPropertyOffsetBits::kNext, 1> {};
104 STATIC_ASSERT(IsHiddenField::kNext <= 32); 107 STATIC_ASSERT(IsHiddenField::kNext <= 32);
105 108
106 int bit_field_; 109 int bit_field_;
107 }; 110 };
108 111
109 } } // namespace v8::internal 112 } } // namespace v8::internal
110 113
111 #endif 114 #endif
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/field-index-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698