Title: [220078] trunk/Source/_javascript_Core
Revision
220078
Author
keith_mil...@apple.com
Date
2017-07-31 15:47:04 -0700 (Mon, 31 Jul 2017)

Log Message

Make more things LLInt constexprs
https://bugs.webkit.org/show_bug.cgi?id=174994

Reviewed by Saam Barati.

This patch makes more const values in the LLInt constexprs.
It also deletes all of the no longer necessary static_asserts in
LLIntData.cpp. Finally, it fixes a typo in parser.rb.

* interpreter/ShadowChicken.h:
(JSC::ShadowChicken::Packet::tailMarker):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
* offlineasm/generate_offset_extractor.rb:
* offlineasm/parser.rb:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (220077 => 220078)


--- trunk/Source/_javascript_Core/ChangeLog	2017-07-31 22:34:47 UTC (rev 220077)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-07-31 22:47:04 UTC (rev 220078)
@@ -1,3 +1,22 @@
+2017-07-31  Keith Miller  <keith_mil...@apple.com>
+
+        Make more things LLInt constexprs
+        https://bugs.webkit.org/show_bug.cgi?id=174994
+
+        Reviewed by Saam Barati.
+
+        This patch makes more const values in the LLInt constexprs.
+        It also deletes all of the no longer necessary static_asserts in
+        LLIntData.cpp. Finally, it fixes a typo in parser.rb.
+
+        * interpreter/ShadowChicken.h:
+        (JSC::ShadowChicken::Packet::tailMarker):
+        * llint/LLIntData.cpp:
+        (JSC::LLInt::Data::performAssertions):
+        * llint/LowLevelInterpreter.asm:
+        * offlineasm/generate_offset_extractor.rb:
+        * offlineasm/parser.rb:
+
 2017-07-31  Matt Lewis  <jlew...@apple.com>
 
         Unreviewed, rolling out r220060.

Modified: trunk/Source/_javascript_Core/interpreter/ShadowChicken.h (220077 => 220078)


--- trunk/Source/_javascript_Core/interpreter/ShadowChicken.h	2017-07-31 22:34:47 UTC (rev 220077)
+++ trunk/Source/_javascript_Core/interpreter/ShadowChicken.h	2017-07-31 22:47:04 UTC (rev 220078)
@@ -77,11 +77,12 @@
         {
         }
         
-        static const unsigned unlikelyValue = 0x7a11;
-        
+        static const constexpr unsigned unlikelyValue = 0x7a11;
+
+        static const constexpr intptr_t tailMarkerValue = static_cast<intptr_t>(unlikelyValue);
         static JSObject* tailMarker()
         {
-            return bitwise_cast<JSObject*>(static_cast<intptr_t>(unlikelyValue));
+            return bitwise_cast<JSObject*>(tailMarkerValue);
         }
         
         static JSObject* throwMarker()

Modified: trunk/Source/_javascript_Core/llint/LLIntData.cpp (220077 => 220078)


--- trunk/Source/_javascript_Core/llint/LLIntData.cpp	2017-07-31 22:34:47 UTC (rev 220077)
+++ trunk/Source/_javascript_Core/llint/LLIntData.cpp	2017-07-31 22:47:04 UTC (rev 220078)
@@ -153,80 +153,9 @@
 #elif (CPU(X86_64) && OS(WINDOWS))
     ASSERT(CodeBlock::llintBaselineCalleeSaveSpaceAsVirtualRegisters() == 3);
 #endif
-    
-    STATIC_ASSERT(StringType == 6);
-    STATIC_ASSERT(SymbolType == 7);
-    STATIC_ASSERT(ObjectType == 23);
-    STATIC_ASSERT(FinalObjectType == 24);
-    STATIC_ASSERT(JSFunctionType == 26);
-    STATIC_ASSERT(ArrayType == 34);
-    STATIC_ASSERT(DerivedArrayType == 35);
-    STATIC_ASSERT(ProxyObjectType == 53);
-    STATIC_ASSERT(Int8ArrayType == 36);
-    STATIC_ASSERT(Int16ArrayType == 37);
-    STATIC_ASSERT(Int32ArrayType == 38);
-    STATIC_ASSERT(Uint8ArrayType == 39);
-    STATIC_ASSERT(Uint8ClampedArrayType == 40);
-    STATIC_ASSERT(Uint16ArrayType == 41);
-    STATIC_ASSERT(Uint32ArrayType == 42);
-    STATIC_ASSERT(Float32ArrayType == 43);
-    STATIC_ASSERT(Float64ArrayType == 44);
-    STATIC_ASSERT(MasqueradesAsUndefined == 1);
-    STATIC_ASSERT(ImplementsDefaultHasInstance == 2);
-    STATIC_ASSERT(FirstConstantRegisterIndex == 0x40000000);
-    STATIC_ASSERT(GlobalCode == 0);
-    STATIC_ASSERT(EvalCode == 1);
-    STATIC_ASSERT(FunctionCode == 2);
-    STATIC_ASSERT(ModuleCode == 3);
-    
-    STATIC_ASSERT(IsArray == 0x01);
-    STATIC_ASSERT(IndexingShapeMask == 0x0E);
-    STATIC_ASSERT(NoIndexingShape == 0x00);
-    STATIC_ASSERT(Int32Shape == 0x04);
-    STATIC_ASSERT(DoubleShape == 0x06);
-    STATIC_ASSERT(ContiguousShape == 0x08);
-    STATIC_ASSERT(ArrayStorageShape == 0x0A);
-    STATIC_ASSERT(SlowPutArrayStorageShape == 0x0C);
 
     ASSERT(!(reinterpret_cast<ptrdiff_t>((reinterpret_cast<WriteBarrier<JSCell>*>(0x4000)->slot())) - 0x4000));
-    static_assert(PutByIdPrimaryTypeMask == 0x6, "LLInt assumes PutByIdPrimaryTypeMask is == 0x6");
-    static_assert(PutByIdPrimaryTypeSecondary == 0x0, "LLInt assumes PutByIdPrimaryTypeSecondary is == 0x0");
-    static_assert(PutByIdPrimaryTypeObjectWithStructure == 0x2, "LLInt assumes PutByIdPrimaryTypeObjectWithStructure is == 0x2");
-    static_assert(PutByIdPrimaryTypeObjectWithStructureOrOther == 0x4, "LLInt assumes PutByIdPrimaryTypeObjectWithStructureOrOther is == 0x4");
-    static_assert(PutByIdSecondaryTypeMask == -0x8, "LLInt assumes PutByIdSecondaryTypeMask is == -0x8");
-    static_assert(PutByIdSecondaryTypeBottom == 0x0, "LLInt assumes PutByIdSecondaryTypeBottom is == 0x0");
-    static_assert(PutByIdSecondaryTypeBoolean == 0x8, "LLInt assumes PutByIdSecondaryTypeBoolean is == 0x8");
-    static_assert(PutByIdSecondaryTypeOther == 0x10, "LLInt assumes PutByIdSecondaryTypeOther is == 0x10");
-    static_assert(PutByIdSecondaryTypeInt32 == 0x18, "LLInt assumes PutByIdSecondaryTypeInt32 is == 0x18");
-    static_assert(PutByIdSecondaryTypeNumber == 0x20, "LLInt assumes PutByIdSecondaryTypeNumber is == 0x20");
-    static_assert(PutByIdSecondaryTypeString == 0x28, "LLInt assumes PutByIdSecondaryTypeString is == 0x28");
-    static_assert(PutByIdSecondaryTypeSymbol == 0x30, "LLInt assumes PutByIdSecondaryTypeSymbol is == 0x30");
-    static_assert(PutByIdSecondaryTypeObject == 0x38, "LLInt assumes PutByIdSecondaryTypeObject is == 0x38");
-    static_assert(PutByIdSecondaryTypeObjectOrOther == 0x40, "LLInt assumes PutByIdSecondaryTypeObjectOrOther is == 0x40");
-    static_assert(PutByIdSecondaryTypeTop == 0x48, "LLInt assumes PutByIdSecondaryTypeTop is == 0x48");
 
-    static_assert(GlobalProperty == 0, "LLInt assumes GlobalProperty ResultType is == 0");
-    static_assert(GlobalVar == 1, "LLInt assumes GlobalVar ResultType is == 1");
-    static_assert(GlobalLexicalVar == 2, "LLInt assumes GlobalLexicalVar ResultType is == 2");
-    static_assert(ClosureVar == 3, "LLInt assumes ClosureVar ResultType is == 3");
-    static_assert(LocalClosureVar == 4, "LLInt assumes LocalClosureVar ResultType is == 4");
-    static_assert(ModuleVar == 5, "LLInt assumes ModuleVar ResultType is == 5");
-    static_assert(GlobalPropertyWithVarInjectionChecks == 6, "LLInt assumes GlobalPropertyWithVarInjectionChecks ResultType is == 6");
-    static_assert(GlobalVarWithVarInjectionChecks == 7, "LLInt assumes GlobalVarWithVarInjectionChecks ResultType is == 7");
-    static_assert(GlobalLexicalVarWithVarInjectionChecks == 8, "LLInt assumes GlobalLexicalVarWithVarInjectionChecks ResultType is == 8");
-    static_assert(ClosureVarWithVarInjectionChecks == 9, "LLInt assumes ClosureVarWithVarInjectionChecks ResultType is == 9");
-
-    static_assert(static_cast<unsigned>(InitializationMode::NotInitialization) == 2, "LLInt assumes that InitializationMode::NotInitialization is 0");
-    
-    STATIC_ASSERT(GetPutInfo::typeBits == 0x3ff);
-    STATIC_ASSERT(GetPutInfo::initializationShift == 10);
-    STATIC_ASSERT(GetPutInfo::initializationBits == 0xffc00);
-
-    STATIC_ASSERT(MarkedBlock::blockSize == 16 * 1024);
-    STATIC_ASSERT(blackThreshold == 0);
-
-    ASSERT(bitwise_cast<uintptr_t>(ShadowChicken::Packet::tailMarker()) == static_cast<uintptr_t>(0x7a11));
-
     // FIXME: make these assertions less horrible.
 #if !ASSERT_DISABLED
     Vector<int> testVector;

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (220077 => 220078)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2017-07-31 22:34:47 UTC (rev 220077)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2017-07-31 22:47:04 UTC (rev 220078)
@@ -204,7 +204,7 @@
     const LowestTag = DeletedValueTag
 end
 
-# NOTE: The values below must be in sync with what is in PutByIdFlags.h.
+# PutByIdFlags data
 const PutByIdPrimaryTypeMask = constexpr PutByIdPrimaryTypeMask
 const PutByIdPrimaryTypeSecondary = constexpr PutByIdPrimaryTypeSecondary
 const PutByIdPrimaryTypeObjectWithStructure = constexpr PutByIdPrimaryTypeObjectWithStructure
@@ -250,7 +250,7 @@
 const IsInvalidated = constexpr IsInvalidated
 
 # ShadowChicken data
-const ShadowChickenTailMarker = 0x7a11
+const ShadowChickenTailMarker = constexpr ShadowChicken::Packet::tailMarkerValue
 
 # ArithProfile data
 const ArithProfileInt = 0x100000
@@ -401,15 +401,15 @@
 const GlobalLexicalVarWithVarInjectionChecks = constexpr GlobalLexicalVarWithVarInjectionChecks
 const ClosureVarWithVarInjectionChecks = constexpr ClosureVarWithVarInjectionChecks
 
-const ResolveTypeMask = 0x3ff
-const InitializationModeMask = 0xffc00
-const InitializationModeShift = 10
-const NotInitialization = 2
+const ResolveTypeMask = constexpr GetPutInfo::typeBits
+const InitializationModeMask = constexpr GetPutInfo::initializationBits
+const InitializationModeShift = constexpr GetPutInfo::initializationShift
+const NotInitialization = constexpr InitializationMode::NotInitialization
 
-const MarkedBlockSize = 16 * 1024
+const MarkedBlockSize = constexpr MarkedBlock::blockSize
 const MarkedBlockMask = ~(MarkedBlockSize - 1)
 
-const BlackThreshold = 0
+const BlackThreshold = constexpr blackThreshold
 
 # Allocation constants
 if JSVALUE64

Modified: trunk/Source/_javascript_Core/offlineasm/generate_offset_extractor.rb (220077 => 220078)


--- trunk/Source/_javascript_Core/offlineasm/generate_offset_extractor.rb	2017-07-31 22:34:47 UTC (rev 220077)
+++ trunk/Source/_javascript_Core/offlineasm/generate_offset_extractor.rb	2017-07-31 22:47:04 UTC (rev 220078)
@@ -121,8 +121,19 @@
     $output = outp
     outp.puts inputHash
     length = 0
+
     emitCodeInAllConfigurations(prunedAST) {
         | settings, ast, backend, index |
+        constsList = ast.filter(ConstExpr).uniq.sort
+
+        constsList.each_with_index {
+            | const, index |
+            outp.puts "constexpr int64_t constValue#{index} = static_cast<int64_t>(#{const.value});"
+        }
+    }
+
+    emitCodeInAllConfigurations(prunedAST) {
+        | settings, ast, backend, index |
         offsetsList = ast.filter(StructOffset).uniq.sort
         sizesList = ast.filter(Sizeof).uniq.sort
         constsList = ast.filter(ConstExpr).uniq.sort
@@ -152,24 +163,12 @@
             emitMagicNumber
             outp.puts "sizeof(#{sizeof.struct}),"
         }
-        constsList.each {
-            | const |
+        constsList.each_index {
+            | index |
             emitMagicNumber
-            outp.puts "static_cast<int64_t>(#{const.value}),"
+            outp.puts "constValue#{index},"
         }
     }
     outp.puts "};"
 
-    emitCodeInAllConfigurations(prunedAST) {
-        | settings, ast, backend, index |
-        constsList = ast.filter(ConstExpr).uniq.sort
-
-        constsList.each_with_index {
-            | const, index |
-            outp.puts "constexpr int64_t isConst#{index} = static_cast<int64_t>(#{const.value});"
-            # Make a trivally true static assert that uses the last value...
-            outp.puts "static_assert(isConst#{index} || true, \"\");"
-        }
-    }
-
 }

Modified: trunk/Source/_javascript_Core/offlineasm/parser.rb (220077 => 220078)


--- trunk/Source/_javascript_Core/offlineasm/parser.rb	2017-07-31 22:34:47 UTC (rev 220077)
+++ trunk/Source/_javascript_Core/offlineasm/parser.rb	2017-07-31 22:47:04 UTC (rev 220078)
@@ -3,7 +3,7 @@
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
 # are met:
-# 1. Redistributions of source code must retain the above copyrighht
+# 1. Redistributions of source code must retain the above copyright
 #    notice, this list of conditions and the following disclaimer.
 # 2. Redistributions in binary form must reproduce the above copyright
 #    notice, this list of conditions and the following disclaimer in the
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to