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

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

Issue 884163004: Tiny simplification of FieldIndex::ForInObjectOffset. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | 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 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 13
14 inline FieldIndex FieldIndex::ForInObjectOffset(int offset, Map* map) { 14 inline FieldIndex FieldIndex::ForInObjectOffset(int offset, Map* map) {
15 DCHECK((offset % kPointerSize) == 0); 15 DCHECK((offset % kPointerSize) == 0);
16 int index = offset / kPointerSize; 16 int index = offset / kPointerSize;
17 if (map == NULL) { 17 return (map == NULL || offset < map->GetInObjectPropertyOffset(0))
18 return FieldIndex(true, index, false, index + 1, 0, true); 18 ? FieldIndex(true, index, false, 0, 0, true)
danno 2015/02/05 13:17:52 Where did the "index + 1" go for parameter 4? At f
19 } 19 : FieldIndex::ForPropertyIndex(map, index);
20 int first_inobject_offset = map->GetInObjectPropertyOffset(0);
21 if (offset < first_inobject_offset) {
22 return FieldIndex(true, index, false, 0, 0, true);
23 } else {
24 return FieldIndex::ForPropertyIndex(map, offset / kPointerSize);
25 }
26 } 20 }
27 21
28 22
29 inline FieldIndex FieldIndex::ForPropertyIndex(Map* map, 23 inline FieldIndex FieldIndex::ForPropertyIndex(Map* map,
30 int property_index, 24 int property_index,
31 bool is_double) { 25 bool is_double) {
32 DCHECK(map->instance_type() >= FIRST_NONSTRING_TYPE); 26 DCHECK(map->instance_type() >= FIRST_NONSTRING_TYPE);
33 int inobject_properties = map->inobject_properties(); 27 int inobject_properties = map->inobject_properties();
34 bool is_inobject = property_index < inobject_properties; 28 bool is_inobject = property_index < inobject_properties;
35 int first_inobject_offset; 29 int first_inobject_offset;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return GetLoadByFieldIndex(); 114 return GetLoadByFieldIndex();
121 } else { 115 } else {
122 return property_index(); 116 return property_index();
123 } 117 }
124 } 118 }
125 119
126 120
127 } } // namespace v8::internal 121 } } // namespace v8::internal
128 122
129 #endif 123 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698