Title: [175172] trunk/Source/_javascript_Core
Revision
175172
Author
[email protected]
Date
2014-10-24 12:16:29 -0700 (Fri, 24 Oct 2014)

Log Message

Simplified IndexingType's hasAnyArrayStorage().
<https://webkit.org/b/138051>

Reviewed by Michael Saboff.

IndexingType's hasAnyArrayStorage() currently does subtraction of ArrayStorageShape
with the purpose of making non-ArrayStorage types underflow (with that subtraction)
and have a result that exceeds SlowPutArrayStorageShape.  What it is doing is
basically checking for a shape value that is greater equal to ArrayStorageShape.
We can just simplify the code as such.

Also added a comment to describe the structure of the bits in IndexingType.

* runtime/IndexingType.h:
(JSC::hasAnyArrayStorage):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (175171 => 175172)


--- trunk/Source/_javascript_Core/ChangeLog	2014-10-24 19:13:15 UTC (rev 175171)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-10-24 19:16:29 UTC (rev 175172)
@@ -1,3 +1,21 @@
+2014-10-24  Mark Lam  <[email protected]>
+
+        Simplified IndexingType's hasAnyArrayStorage().
+        <https://webkit.org/b/138051>
+
+        Reviewed by Michael Saboff.
+
+        IndexingType's hasAnyArrayStorage() currently does subtraction of ArrayStorageShape
+        with the purpose of making non-ArrayStorage types underflow (with that subtraction)
+        and have a result that exceeds SlowPutArrayStorageShape.  What it is doing is
+        basically checking for a shape value that is greater equal to ArrayStorageShape.
+        We can just simplify the code as such.
+
+        Also added a comment to describe the structure of the bits in IndexingType.
+
+        * runtime/IndexingType.h:
+        (JSC::hasAnyArrayStorage):
+
 2014-10-23  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Provide a way to have alternate inspector agents

Modified: trunk/Source/_javascript_Core/runtime/IndexingType.h (175171 => 175172)


--- trunk/Source/_javascript_Core/runtime/IndexingType.h	2014-10-24 19:13:15 UTC (rev 175171)
+++ trunk/Source/_javascript_Core/runtime/IndexingType.h	2014-10-24 19:16:29 UTC (rev 175172)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,6 +31,22 @@
 
 namespace JSC {
 
+/*
+    Structure of the IndexingType
+    =============================
+    Conceptually, the IndexingType looks like this:
+
+    struct IndexingType {
+        uint8_t isArray:1;                    // bit 0
+        uint8_t shape:4;                      // bit 1 - 4
+        uint8_t mayHaveIndexedAccessors:1;    // bit 5
+    };
+
+    The shape values (e.g. Int32Shape, ContiguousShape, etc) are an enumeration of
+    various shapes (though not necessarily sequential in terms of their values).
+    Hence, shape values are not bitwise exclusive with respect to each other.
+*/
+
 typedef uint8_t IndexingType;
 
 // Flags for testing the presence of capabilities.
@@ -128,7 +144,7 @@
 
 static inline bool hasAnyArrayStorage(IndexingType indexingType)
 {
-    return static_cast<uint8_t>((indexingType & IndexingShapeMask) - ArrayStorageShape) <= static_cast<uint8_t>(SlowPutArrayStorageShape - ArrayStorageShape);
+    return static_cast<uint8_t>(indexingType & IndexingShapeMask) >= ArrayStorageShape;
 }
 
 static inline bool shouldUseSlowPut(IndexingType indexingType)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to