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

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

Issue 391693002: In-object double fields unboxing (for 64-bit only). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebasing Created 6 years, 1 month 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/flag-definitions.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
(...skipping 16 matching lines...) Expand all
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 static FieldIndex FromFieldAccessStubKey(int key);
30 30
31 int GetLoadByFieldIndex() const; 31 int GetLoadByFieldIndex() const;
32 32
33 bool is_inobject() const { 33 bool is_inobject() const {
34 return IsInObjectBits::decode(bit_field_); 34 return IsInObjectBits::decode(bit_field_);
35 } 35 }
36 36
37 bool is_hidden_field() const { return IsHiddenField::decode(bit_field_); }
38
37 bool is_double() const { 39 bool is_double() const {
38 return IsDoubleBits::decode(bit_field_); 40 return IsDoubleBits::decode(bit_field_);
39 } 41 }
40 42
41 int offset() const { 43 int offset() const {
42 return index() * kPointerSize; 44 return index() * kPointerSize;
43 } 45 }
44 46
45 // Zero-indexed from beginning of the object. 47 // Zero-indexed from beginning of the object.
46 int index() const { 48 int index() const {
47 return IndexBits::decode(bit_field_); 49 return IndexBits::decode(bit_field_);
48 } 50 }
49 51
50 int outobject_array_index() const { 52 int outobject_array_index() const {
51 DCHECK(!is_inobject()); 53 DCHECK(!is_inobject());
52 return index() - first_inobject_property_offset() / kPointerSize; 54 return index() - first_inobject_property_offset() / kPointerSize;
53 } 55 }
54 56
55 // Zero-based from the first inobject property. Overflows to out-of-object 57 // Zero-based from the first inobject property. Overflows to out-of-object
56 // properties. 58 // properties.
57 int property_index() const { 59 int property_index() const {
58 DCHECK(!IsHiddenField::decode(bit_field_)); 60 DCHECK(!is_hidden_field());
59 int result = index() - first_inobject_property_offset() / kPointerSize; 61 int result = index() - first_inobject_property_offset() / kPointerSize;
60 if (!is_inobject()) { 62 if (!is_inobject()) {
61 result += InObjectPropertyBits::decode(bit_field_); 63 result += InObjectPropertyBits::decode(bit_field_);
62 } 64 }
63 return result; 65 return result;
64 } 66 }
65 67
66 int GetKeyedLookupCacheIndex() const; 68 int GetKeyedLookupCacheIndex() const;
67 69
68 int GetFieldAccessStubKey() const { 70 int GetFieldAccessStubKey() const {
(...skipping 10 matching lines...) Expand all
79 IsDoubleBits::encode(is_double) | 81 IsDoubleBits::encode(is_double) |
80 FirstInobjectPropertyOffsetBits::encode(first_inobject_property_offset) | 82 FirstInobjectPropertyOffsetBits::encode(first_inobject_property_offset) |
81 IsHiddenField::encode(is_hidden) | 83 IsHiddenField::encode(is_hidden) |
82 IndexBits::encode(local_index) | 84 IndexBits::encode(local_index) |
83 InObjectPropertyBits::encode(inobject_properties); 85 InObjectPropertyBits::encode(inobject_properties);
84 } 86 }
85 87
86 explicit FieldIndex(int bit_field) : bit_field_(bit_field) {} 88 explicit FieldIndex(int bit_field) : bit_field_(bit_field) {}
87 89
88 int first_inobject_property_offset() const { 90 int first_inobject_property_offset() const {
89 DCHECK(!IsHiddenField::decode(bit_field_)); 91 DCHECK(!is_hidden_field());
90 return FirstInobjectPropertyOffsetBits::decode(bit_field_); 92 return FirstInobjectPropertyOffsetBits::decode(bit_field_);
91 } 93 }
92 94
93 static const int kIndexBitsSize = kDescriptorIndexBitCount + 1; 95 static const int kIndexBitsSize = kDescriptorIndexBitCount + 1;
94 96
95 // Index from beginning of object. 97 // Index from beginning of object.
96 class IndexBits: public BitField<int, 0, kIndexBitsSize> {}; 98 class IndexBits: public BitField<int, 0, kIndexBitsSize> {};
97 class IsInObjectBits: public BitField<bool, IndexBits::kNext, 1> {}; 99 class IsInObjectBits: public BitField<bool, IndexBits::kNext, 1> {};
98 class IsDoubleBits: public BitField<bool, IsInObjectBits::kNext, 1> {}; 100 class IsDoubleBits: public BitField<bool, IsInObjectBits::kNext, 1> {};
99 // Number of inobject properties. 101 // Number of inobject properties.
100 class InObjectPropertyBits 102 class InObjectPropertyBits
101 : public BitField<int, IsDoubleBits::kNext, kDescriptorIndexBitCount> {}; 103 : public BitField<int, IsDoubleBits::kNext, kDescriptorIndexBitCount> {};
102 // Offset of first inobject property from beginning of object. 104 // Offset of first inobject property from beginning of object.
103 class FirstInobjectPropertyOffsetBits 105 class FirstInobjectPropertyOffsetBits
104 : public BitField<int, InObjectPropertyBits::kNext, 7> {}; 106 : public BitField<int, InObjectPropertyBits::kNext, 7> {};
105 class IsHiddenField 107 class IsHiddenField
106 : public BitField<bool, FirstInobjectPropertyOffsetBits::kNext, 1> {}; 108 : public BitField<bool, FirstInobjectPropertyOffsetBits::kNext, 1> {};
107 STATIC_ASSERT(IsHiddenField::kNext <= 32); 109 STATIC_ASSERT(IsHiddenField::kNext <= 32);
108 110
109 int bit_field_; 111 int bit_field_;
110 }; 112 };
111 113
112 } } // namespace v8::internal 114 } } // namespace v8::internal
113 115
114 #endif 116 #endif
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698