Reviewers: jarin,

Description:
[turbofan] Specify better type for FixedArray::length field.

This avoids redundant smi checks when using the length of a FixedArray,
which is always a positve smi.

[email protected]

Please review this at https://codereview.chromium.org/1162163003/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+6, -1 lines):
  M src/compiler/access-builder.cc


Index: src/compiler/access-builder.cc
diff --git a/src/compiler/access-builder.cc b/src/compiler/access-builder.cc
index c728154d7f4e2bb263f6bdf3d9fc64ae55f97bfe..b9986f28fc3ef015b11bce76f9a2cc925fecb200 100644
--- a/src/compiler/access-builder.cc
+++ b/src/compiler/access-builder.cc
@@ -46,8 +46,13 @@ FieldAccess AccessBuilder::ForJSArrayBufferBackingStore() {

 // static
 FieldAccess AccessBuilder::ForFixedArrayLength() {
+  // TODO(turbofan): 2^30 is a valid upper limit for the FixedArray::length
+  // field, although it's not the best. If we had a Zone we could create an
+  // appropriate range type instead.
+  STATIC_ASSERT(FixedArray::kMaxLength <= 1 << 30);
   return {kTaggedBase, FixedArray::kLengthOffset, MaybeHandle<Name>(),
-          Type::TaggedSigned(), kMachAnyTagged};
+          Type::Intersect(Type::Unsigned30(), Type::TaggedSigned()),
+          kMachAnyTagged};
 }




--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to