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

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

Issue 534243002: Add %LoadMutableDouble index check. (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/field-index.h ('k') | src/runtime.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 {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 DCHECK(result.GetLoadByFieldIndex() == orig_index); 67 DCHECK(result.GetLoadByFieldIndex() == orig_index);
68 return result; 68 return result;
69 } 69 }
70 70
71 71
72 inline bool FieldIndex::LoadByFieldIndexValid(int index) {
73 index >>= 1;
74 if (index < 0) {
75 index = -(index + 1);
76 index += FixedArray::kHeaderSize / kPointerSize;
77 } else {
78 index += JSObject::kHeaderSize / kPointerSize;
79 }
80 return IndexBits::is_valid(index);
81 }
82
83
72 // Returns the index format accepted by the HLoadFieldByIndex instruction. 84 // Returns the index format accepted by the HLoadFieldByIndex instruction.
73 // (In-object: zero-based from (object start + JSObject::kHeaderSize), 85 // (In-object: zero-based from (object start + JSObject::kHeaderSize),
74 // out-of-object: zero-based from FixedArray::kHeaderSize.) 86 // out-of-object: zero-based from FixedArray::kHeaderSize.)
75 inline int FieldIndex::GetLoadByFieldIndex() const { 87 inline int FieldIndex::GetLoadByFieldIndex() const {
76 // For efficiency, the LoadByFieldIndex instruction takes an index that is 88 // For efficiency, the LoadByFieldIndex instruction takes an index that is
77 // optimized for quick access. If the property is inline, the index is 89 // optimized for quick access. If the property is inline, the index is
78 // positive. If it's out-of-line, the encoded index is -raw_index - 1 to 90 // positive. If it's out-of-line, the encoded index is -raw_index - 1 to
79 // disambiguate the zero out-of-line index from the zero inobject case. 91 // disambiguate the zero out-of-line index from the zero inobject case.
80 // The index itself is shifted up by one bit, the lower-most bit 92 // The index itself is shifted up by one bit, the lower-most bit
81 // signifying if the field is a mutable double box (1) or not (0). 93 // signifying if the field is a mutable double box (1) or not (0).
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return GetLoadByFieldIndex(); 132 return GetLoadByFieldIndex();
121 } else { 133 } else {
122 return property_index(); 134 return property_index();
123 } 135 }
124 } 136 }
125 137
126 138
127 } } // namespace v8::internal 139 } } // namespace v8::internal
128 140
129 #endif 141 #endif
OLDNEW
« no previous file with comments | « src/field-index.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698