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

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

Issue 2412043003: [ic] Support non-code handlers in megamorphic stub cache. (Closed)
Patch Set: Addressing comments Created 4 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 | « src/field-index.h ('k') | src/ic/ic.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_INL_H_ 5 #ifndef V8_FIELD_INDEX_INL_H_
6 #define V8_FIELD_INDEX_INL_H_ 6 #define V8_FIELD_INDEX_INL_H_
7 7
8 #include "src/field-index.h" 8 #include "src/field-index.h"
9 #include "src/ic/handler-configuration.h" 9 #include "src/ic/handler-configuration.h"
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (is_inobject()) { 78 if (is_inobject()) {
79 result -= JSObject::kHeaderSize / kPointerSize; 79 result -= JSObject::kHeaderSize / kPointerSize;
80 } else { 80 } else {
81 result -= FixedArray::kHeaderSize / kPointerSize; 81 result -= FixedArray::kHeaderSize / kPointerSize;
82 result = -result - 1; 82 result = -result - 1;
83 } 83 }
84 result <<= 1; 84 result <<= 1;
85 return is_double() ? (result | 1) : result; 85 return is_double() ? (result | 1) : result;
86 } 86 }
87 87
88 // Takes an offset as computed by GetLoadByFieldOffset and reconstructs a
89 // FieldIndex object from it.
90 // static
91 inline FieldIndex FieldIndex::ForLoadByFieldOffset(Map* map, int offset) {
92 DCHECK(LoadHandlerTypeBit::decode(offset) == kLoadICHandlerForProperties);
93 bool is_inobject = FieldOffsetIsInobject::decode(offset);
94 bool is_double = FieldOffsetIsDouble::decode(offset);
95 int field_index = FieldOffsetOffset::decode(offset) >> kPointerSizeLog2;
96 int first_inobject_offset = 0;
97 if (is_inobject) {
98 first_inobject_offset =
99 map->IsJSObjectMap() ? map->GetInObjectPropertyOffset(0) : 0;
100 } else {
101 first_inobject_offset = FixedArray::kHeaderSize;
102 }
103 int inobject_properties =
104 map->IsJSObjectMap() ? map->GetInObjectProperties() : 0;
105 FieldIndex result(is_inobject, field_index, is_double, inobject_properties,
106 first_inobject_offset);
107 DCHECK(result.GetLoadByFieldOffset() == offset);
108 return result;
109 }
110
111 // Returns the offset format consumed by TurboFan stubs: 88 // Returns the offset format consumed by TurboFan stubs:
112 // (offset << 3) | (is_double << 2) | (is_inobject << 1) | is_property 89 // (offset << 3) | (is_double << 2) | (is_inobject << 1) | is_property
113 // Where |offset| is relative to object start or FixedArray start, respectively. 90 // Where |offset| is relative to object start or FixedArray start, respectively.
114 inline int FieldIndex::GetLoadByFieldOffset() const { 91 inline int FieldIndex::GetLoadByFieldOffset() const {
115 return FieldOffsetIsInobject::encode(is_inobject()) | 92 return FieldOffsetIsInobject::encode(is_inobject()) |
116 FieldOffsetIsDouble::encode(is_double()) | 93 FieldOffsetIsDouble::encode(is_double()) |
117 FieldOffsetOffset::encode(index() << kPointerSizeLog2) | 94 FieldOffsetOffset::encode(index() << kPointerSizeLog2) |
118 LoadHandlerTypeBit::encode(kLoadICHandlerForProperties); 95 LoadHandlerTypeBit::encode(kLoadICHandlerForProperties);
119 } 96 }
120 97
(...skipping 26 matching lines...) Expand all
147 } else { 124 } else {
148 return property_index(); 125 return property_index();
149 } 126 }
150 } 127 }
151 128
152 129
153 } // namespace internal 130 } // namespace internal
154 } // namespace v8 131 } // namespace v8
155 132
156 #endif 133 #endif
OLDNEW
« no previous file with comments | « src/field-index.h ('k') | src/ic/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698