LLInt VectorSizeOffset should be based on offset extraction
authorkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2018 16:40:07 +0000 (16:40 +0000)
committerkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Nov 2018 16:40:07 +0000 (16:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191468

Reviewed by Yusuke Suzuki.

Source/JavaScriptCore:

This patch also adds some usings to LLIntOffsetsExtractor that
make it possible to use the bare names of Vector/RefCountedArray
in offsets extraction.

* llint/LLIntOffsetsExtractor.cpp:
* llint/LowLevelInterpreter.asm:

Source/WTF:

Make things friends with LLIntOffsetsExtractor.

* wtf/RefCountedArray.h:
* wtf/Vector.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238031 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp
Source/JavaScriptCore/llint/LowLevelInterpreter.asm
Source/WTF/ChangeLog
Source/WTF/wtf/RefCountedArray.h
Source/WTF/wtf/Vector.h

index 56dda92..fd00af6 100644 (file)
@@ -1,3 +1,17 @@
+2018-11-09  Keith Miller  <keith_miller@apple.com>
+
+        LLInt VectorSizeOffset should be based on offset extraction
+        https://bugs.webkit.org/show_bug.cgi?id=191468
+
+        Reviewed by Yusuke Suzuki.
+
+        This patch also adds some usings to LLIntOffsetsExtractor that
+        make it possible to use the bare names of Vector/RefCountedArray
+        in offsets extraction.
+
+        * llint/LLIntOffsetsExtractor.cpp:
+        * llint/LowLevelInterpreter.asm:
+
 2018-11-09  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
 
         Unreviewed, rolling in CodeCache in r237254
index 818fb98..8dde0ce 100644 (file)
@@ -73,6 +73,10 @@ namespace JSC {
 #define OFFLINE_ASM_OFFSETOF(clazz, field) (static_cast<unsigned>(OBJECT_OFFSETOF(clazz, field)))
 
 class LLIntOffsetsExtractor {
+    // These types are useful since we can't use '<...>' syntax in LLInt offsets extraction. e.g. Vector<int>::m_data
+    using Vector = WTF::Vector<int>;
+    using RefCountedArray = WTF::RefCountedArray<int>;
+
 public:
     static const int64_t* dummy();
 };
index a5b3094..416f3ba 100644 (file)
@@ -519,13 +519,8 @@ const MarkedBlockFooterOffset = constexpr MarkedBlock::offsetOfFooter
 
 const BlackThreshold = constexpr blackThreshold
 
-# This must match wtf/Vector.h
-const VectorBufferOffset = 0
-if JSVALUE64
-    const VectorSizeOffset = 12
-else
-    const VectorSizeOffset = 8
-end
+const VectorBufferOffset = Vector::m_buffer
+const VectorSizeOffset = Vector::m_size
 
 # Some common utilities.
 macro crash()
@@ -1216,7 +1211,7 @@ macro functionInitialization(profileArgSkip)
     addp -profileArgSkip, t0 # Use addi because that's what has the peephole
     assert(macro (ok) bpgteq t0, 0, ok end)
     btpz t0, .argumentProfileDone
-    loadp CodeBlock::m_argumentValueProfiles + VectorBufferOffset[t1], t3
+    loadp CodeBlock::m_argumentValueProfiles + RefCountedArray::m_data[t1], t3
     btpz t3, .argumentProfileDone # When we can't JIT, we don't allocate any argument value profiles.
     mulp sizeof ValueProfile, t0, t2 # Aaaaahhhh! Need strength reduction!
     lshiftp 3, t0
index a7b4374..d6dd528 100644 (file)
@@ -1,3 +1,15 @@
+2018-11-09  Keith Miller  <keith_miller@apple.com>
+
+        LLInt VectorSizeOffset should be based on offset extraction
+        https://bugs.webkit.org/show_bug.cgi?id=191468
+
+        Reviewed by Yusuke Suzuki.
+
+        Make things friends with LLIntOffsetsExtractor.
+
+        * wtf/RefCountedArray.h:
+        * wtf/Vector.h:
+
 2018-11-09  Jim Mason  <jmason@ibinx.com>
 
         [WTF] Changes in bug 188867 break non-Linux Unix builds
index a46b05f..0e6a0ea 100644 (file)
@@ -235,6 +235,7 @@ private:
             Header::fromPayload(data())->refCount++;
     }
 
+    friend class JSC::LLIntOffsetsExtractor;
     typename PtrTraits::StorageType m_data { nullptr };
 };
 
index 3496fcb..05ff1a8 100644 (file)
 extern "C" void __sanitizer_annotate_contiguous_container(const void* begin, const void* end, const void* old_mid, const void* new_mid);
 #endif
 
+namespace JSC {
+class LLIntOffsetsExtractor;
+}
+
 namespace WTF {
 
 template <bool needsDestruction, typename T>
@@ -428,6 +432,7 @@ protected:
     using Base::m_size;
 
 private:
+    friend class JSC::LLIntOffsetsExtractor;
     using Base::m_buffer;
     using Base::m_capacity;
 };
@@ -607,6 +612,7 @@ class Vector : private VectorBuffer<T, inlineCapacity> {
 private:
     typedef VectorBuffer<T, inlineCapacity> Base;
     typedef VectorTypeOperations<T> TypeOperations;
+    friend class JSC::LLIntOffsetsExtractor;
 
 public:
     typedef T ValueType;