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

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

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 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/field-index.h ('k') | src/fixed-dtoa.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 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 ASSERT((offset % kPointerSize) == 0); 15 DCHECK((offset % kPointerSize) == 0);
16 int index = offset / kPointerSize; 16 int index = offset / kPointerSize;
17 if (map == NULL) { 17 if (map == NULL) {
18 return FieldIndex(true, index, false, index + 1, 0, true); 18 return FieldIndex(true, index, false, index + 1, 0, true);
19 } 19 }
20 int first_inobject_offset = map->GetInObjectPropertyOffset(0); 20 int first_inobject_offset = map->GetInObjectPropertyOffset(0);
21 if (offset < first_inobject_offset) { 21 if (offset < first_inobject_offset) {
22 return FieldIndex(true, index, false, 0, 0, true); 22 return FieldIndex(true, index, false, 0, 0, true);
23 } else { 23 } else {
24 return FieldIndex::ForPropertyIndex(map, offset / kPointerSize); 24 return FieldIndex::ForPropertyIndex(map, offset / kPointerSize);
25 } 25 }
26 } 26 }
27 27
28 28
29 inline FieldIndex FieldIndex::ForPropertyIndex(Map* map, 29 inline FieldIndex FieldIndex::ForPropertyIndex(Map* map,
30 int property_index, 30 int property_index,
31 bool is_double) { 31 bool is_double) {
32 ASSERT(map->instance_type() >= FIRST_NONSTRING_TYPE); 32 DCHECK(map->instance_type() >= FIRST_NONSTRING_TYPE);
33 int inobject_properties = map->inobject_properties(); 33 int inobject_properties = map->inobject_properties();
34 bool is_inobject = property_index < inobject_properties; 34 bool is_inobject = property_index < inobject_properties;
35 int first_inobject_offset; 35 int first_inobject_offset;
36 if (is_inobject) { 36 if (is_inobject) {
37 first_inobject_offset = map->GetInObjectPropertyOffset(0); 37 first_inobject_offset = map->GetInObjectPropertyOffset(0);
38 } else { 38 } else {
39 first_inobject_offset = FixedArray::kHeaderSize; 39 first_inobject_offset = FixedArray::kHeaderSize;
40 property_index -= inobject_properties; 40 property_index -= inobject_properties;
41 } 41 }
42 return FieldIndex(is_inobject, 42 return FieldIndex(is_inobject,
(...skipping 14 matching lines...) Expand all
57 field_index = -(field_index + 1); 57 field_index = -(field_index + 1);
58 is_inobject = false; 58 is_inobject = false;
59 first_inobject_offset = FixedArray::kHeaderSize; 59 first_inobject_offset = FixedArray::kHeaderSize;
60 field_index += FixedArray::kHeaderSize / kPointerSize; 60 field_index += FixedArray::kHeaderSize / kPointerSize;
61 } else { 61 } else {
62 first_inobject_offset = map->GetInObjectPropertyOffset(0); 62 first_inobject_offset = map->GetInObjectPropertyOffset(0);
63 field_index += JSObject::kHeaderSize / kPointerSize; 63 field_index += JSObject::kHeaderSize / kPointerSize;
64 } 64 }
65 FieldIndex result(is_inobject, field_index, is_double, 65 FieldIndex result(is_inobject, field_index, is_double,
66 map->inobject_properties(), first_inobject_offset); 66 map->inobject_properties(), first_inobject_offset);
67 ASSERT(result.GetLoadByFieldIndex() == orig_index); 67 DCHECK(result.GetLoadByFieldIndex() == orig_index);
68 return result; 68 return result;
69 } 69 }
70 70
71 71
72 // Returns the index format accepted by the HLoadFieldByIndex instruction. 72 // Returns the index format accepted by the HLoadFieldByIndex instruction.
73 // (In-object: zero-based from (object start + JSObject::kHeaderSize), 73 // (In-object: zero-based from (object start + JSObject::kHeaderSize),
74 // out-of-object: zero-based from FixedArray::kHeaderSize.) 74 // out-of-object: zero-based from FixedArray::kHeaderSize.)
75 inline int FieldIndex::GetLoadByFieldIndex() const { 75 inline int FieldIndex::GetLoadByFieldIndex() const {
76 // For efficiency, the LoadByFieldIndex instruction takes an index that is 76 // For efficiency, the LoadByFieldIndex instruction takes an index that is
77 // optimized for quick access. If the property is inline, the index is 77 // optimized for quick access. If the property is inline, the index is
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return GetLoadByFieldIndex(); 115 return GetLoadByFieldIndex();
116 } else { 116 } else {
117 return property_index(); 117 return property_index();
118 } 118 }
119 } 119 }
120 120
121 121
122 } } // namespace v8::internal 122 } } // namespace v8::internal
123 123
124 #endif 124 #endif
OLDNEW
« no previous file with comments | « src/field-index.h ('k') | src/fixed-dtoa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698