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

Unified Diff: src/field-index-inl.h

Issue 2133233002: [LoadIC] Handle simple field loads in the dispatcher (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix release builds for realz Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/field-index.h ('k') | src/full-codegen/full-codegen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/field-index-inl.h
diff --git a/src/field-index-inl.h b/src/field-index-inl.h
index 2e6693ce388c32c175bb20643afbaed87e9f75c8..6811891d4852a9d5785076a9fbbfe950724c083b 100644
--- a/src/field-index-inl.h
+++ b/src/field-index-inl.h
@@ -39,8 +39,7 @@ inline FieldIndex FieldIndex::ForPropertyIndex(Map* map,
is_double, inobject_properties, first_inobject_offset);
}
-
-// Takes an index as computed by GetLoadFieldByIndex and reconstructs a
+// Takes an index as computed by GetLoadByFieldIndex and reconstructs a
// FieldIndex object from it.
inline FieldIndex FieldIndex::ForLoadByFieldIndex(Map* map, int orig_index) {
int field_index = orig_index;
@@ -85,6 +84,42 @@ inline int FieldIndex::GetLoadByFieldIndex() const {
return is_double() ? (result | 1) : result;
}
+// Takes an offset as computed by GetLoadByFieldOffset and reconstructs a
+// FieldIndex object from it.
+inline FieldIndex FieldIndex::ForLoadByFieldOffset(Map* map, int offset) {
+ bool is_double = offset & 1;
+ int field_index = (offset >> 1) / kPointerSize;
+ int is_inobject = true;
+ int first_inobject_offset = 0;
+ if (field_index < 0) {
+ field_index = -field_index;
+ is_inobject = false;
+ first_inobject_offset = FixedArray::kHeaderSize;
+ } else {
+ first_inobject_offset =
+ map->IsJSObjectMap() ? map->GetInObjectPropertyOffset(0) : 0;
+ }
+ int inobject_properties =
+ map->IsJSObjectMap() ? map->GetInObjectProperties() : 0;
+ FieldIndex result(is_inobject, field_index, is_double, inobject_properties,
+ first_inobject_offset);
+ DCHECK(result.GetLoadByFieldOffset() == offset);
+ return result;
+}
+
+// Returns the offset format consumed by TurboFan stubs:
+// In-object: zero-based from object start,
+// out-of-object: zero-based from FixedArray start.
+inline int FieldIndex::GetLoadByFieldOffset() const {
+ // For efficiency, stubs consume an offset that is optimized for quick
+ // access. If the property is in-object, the offset is positive.
+ // If it's out-of-object, the encoded offset is -raw_offset.
+ // In either case, the offset itself is shifted up by one bit, the lower-most
+ // bit signifying if the field is a mutable double box (1) or not (0).
+ int result = index() << kPointerSizeLog2;
+ if (!is_inobject()) result = -result;
+ return (result << 1) | (is_double() ? 1 : 0);
+}
inline FieldIndex FieldIndex::ForDescriptor(Map* map, int descriptor_index) {
PropertyDetails details =
« no previous file with comments | « src/field-index.h ('k') | src/full-codegen/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698