Title: [205625] releases/WebKitGTK/webkit-2.14/Source/_javascript_Core
Revision
205625
Author
[email protected]
Date
2016-09-08 04:19:41 -0700 (Thu, 08 Sep 2016)

Log Message

Merge r205309 - Rename WASM classes dropping the WASM prefix
https://bugs.webkit.org/show_bug.cgi?id=161500

Reviewed by Mark Lam.

Having to write WASM::WASMModule seems silly. Also, this patch
merges WASMFunctionReturnType and WASMValueType into one type
that is a typedef of B3::Type. Using B3::Type as the WASM
primitive type makes it trivial to convert a Vector of WASM
types into a Vector of B3 types.

* b3/B3Type.h:
* wasm/JSWASMModule.h:
(JSC::JSWASMModule::signatures):
(JSC::JSWASMModule::functionImports):
(JSC::JSWASMModule::functionImportSignatures):
(JSC::JSWASMModule::globalVariableTypes):
(JSC::JSWASMModule::functionDeclarations):
(JSC::JSWASMModule::functionPointerTables):
* wasm/WASMB3IRGenerator.cpp:
(JSC::WASM::toB3Op):
(JSC::WASM::B3IRGenerator::addLocal):
(JSC::WASM::B3IRGenerator::unaryOp):
(JSC::WASM::B3IRGenerator::binaryOp):
(JSC::WASM::B3IRGenerator::addConstant):
(JSC::WASM::parseAndCompile):
* wasm/WASMB3IRGenerator.h:
* wasm/WASMFormat.h:
* wasm/WASMFunctionParser.h:
(JSC::WASM::FunctionParser<Context>::FunctionParser):
(JSC::WASM::FunctionParser<Context>::parse):
(JSC::WASM::FunctionParser<Context>::parseBlock):
(JSC::WASM::FunctionParser<Context>::parseExpression):
(JSC::WASM::WASMFunctionParser<Context>::WASMFunctionParser): Deleted.
(JSC::WASM::WASMFunctionParser<Context>::parse): Deleted.
(JSC::WASM::WASMFunctionParser<Context>::parseBlock): Deleted.
(JSC::WASM::WASMFunctionParser<Context>::parseExpression): Deleted.
* wasm/WASMModuleParser.cpp:
(JSC::WASM::ModuleParser::parse):
(JSC::WASM::ModuleParser::parseFunctionTypes):
(JSC::WASM::ModuleParser::parseFunctionSignatures):
(JSC::WASM::ModuleParser::parseFunctionDefinitions):
(JSC::WASM::WASMModuleParser::parse): Deleted.
(JSC::WASM::WASMModuleParser::parseFunctionTypes): Deleted.
(JSC::WASM::WASMModuleParser::parseFunctionSignatures): Deleted.
(JSC::WASM::WASMModuleParser::parseFunctionDefinitions): Deleted.
* wasm/WASMModuleParser.h:
(JSC::WASM::ModuleParser::ModuleParser):
(JSC::WASM::ModuleParser::functionInformation):
(JSC::WASM::WASMModuleParser::WASMModuleParser): Deleted.
(JSC::WASM::WASMModuleParser::functionInformation): Deleted.
* wasm/WASMOps.h:
* wasm/WASMParser.h:
(JSC::WASM::Parser::Parser):
(JSC::WASM::Parser::consumeCharacter):
(JSC::WASM::Parser::consumeString):
(JSC::WASM::Parser::parseUInt32):
(JSC::WASM::Parser::parseUInt7):
(JSC::WASM::Parser::parseVarUInt1):
(JSC::WASM::Parser::parseValueType):
(JSC::WASM::WASMParser::WASMParser): Deleted.
(JSC::WASM::WASMParser::consumeCharacter): Deleted.
(JSC::WASM::WASMParser::consumeString): Deleted.
(JSC::WASM::WASMParser::parseUInt32): Deleted.
(JSC::WASM::WASMParser::parseUInt7): Deleted.
(JSC::WASM::WASMParser::parseVarUInt1): Deleted.
(JSC::WASM::WASMParser::parseValueType): Deleted.
* wasm/WASMPlan.cpp:
(JSC::WASM::Plan::Plan):
* wasm/WASMSections.cpp:
(JSC::WASM::Sections::lookup):
(JSC::WASM::WASMSections::lookup): Deleted.
* wasm/WASMSections.h:
(JSC::WASM::Sections::validateOrder):
(JSC::WASM::WASMSections::validateOrder): Deleted.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/ChangeLog (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/ChangeLog	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/ChangeLog	2016-09-08 11:19:41 UTC (rev 205625)
@@ -1,3 +1,81 @@
+2016-09-01  Keith Miller  <[email protected]>
+
+        Rename WASM classes dropping the WASM prefix
+        https://bugs.webkit.org/show_bug.cgi?id=161500
+
+        Reviewed by Mark Lam.
+
+        Having to write WASM::WASMModule seems silly. Also, this patch
+        merges WASMFunctionReturnType and WASMValueType into one type
+        that is a typedef of B3::Type. Using B3::Type as the WASM
+        primitive type makes it trivial to convert a Vector of WASM
+        types into a Vector of B3 types.
+
+        * b3/B3Type.h:
+        * wasm/JSWASMModule.h:
+        (JSC::JSWASMModule::signatures):
+        (JSC::JSWASMModule::functionImports):
+        (JSC::JSWASMModule::functionImportSignatures):
+        (JSC::JSWASMModule::globalVariableTypes):
+        (JSC::JSWASMModule::functionDeclarations):
+        (JSC::JSWASMModule::functionPointerTables):
+        * wasm/WASMB3IRGenerator.cpp:
+        (JSC::WASM::toB3Op):
+        (JSC::WASM::B3IRGenerator::addLocal):
+        (JSC::WASM::B3IRGenerator::unaryOp):
+        (JSC::WASM::B3IRGenerator::binaryOp):
+        (JSC::WASM::B3IRGenerator::addConstant):
+        (JSC::WASM::parseAndCompile):
+        * wasm/WASMB3IRGenerator.h:
+        * wasm/WASMFormat.h:
+        * wasm/WASMFunctionParser.h:
+        (JSC::WASM::FunctionParser<Context>::FunctionParser):
+        (JSC::WASM::FunctionParser<Context>::parse):
+        (JSC::WASM::FunctionParser<Context>::parseBlock):
+        (JSC::WASM::FunctionParser<Context>::parseExpression):
+        (JSC::WASM::WASMFunctionParser<Context>::WASMFunctionParser): Deleted.
+        (JSC::WASM::WASMFunctionParser<Context>::parse): Deleted.
+        (JSC::WASM::WASMFunctionParser<Context>::parseBlock): Deleted.
+        (JSC::WASM::WASMFunctionParser<Context>::parseExpression): Deleted.
+        * wasm/WASMModuleParser.cpp:
+        (JSC::WASM::ModuleParser::parse):
+        (JSC::WASM::ModuleParser::parseFunctionTypes):
+        (JSC::WASM::ModuleParser::parseFunctionSignatures):
+        (JSC::WASM::ModuleParser::parseFunctionDefinitions):
+        (JSC::WASM::WASMModuleParser::parse): Deleted.
+        (JSC::WASM::WASMModuleParser::parseFunctionTypes): Deleted.
+        (JSC::WASM::WASMModuleParser::parseFunctionSignatures): Deleted.
+        (JSC::WASM::WASMModuleParser::parseFunctionDefinitions): Deleted.
+        * wasm/WASMModuleParser.h:
+        (JSC::WASM::ModuleParser::ModuleParser):
+        (JSC::WASM::ModuleParser::functionInformation):
+        (JSC::WASM::WASMModuleParser::WASMModuleParser): Deleted.
+        (JSC::WASM::WASMModuleParser::functionInformation): Deleted.
+        * wasm/WASMOps.h:
+        * wasm/WASMParser.h:
+        (JSC::WASM::Parser::Parser):
+        (JSC::WASM::Parser::consumeCharacter):
+        (JSC::WASM::Parser::consumeString):
+        (JSC::WASM::Parser::parseUInt32):
+        (JSC::WASM::Parser::parseUInt7):
+        (JSC::WASM::Parser::parseVarUInt1):
+        (JSC::WASM::Parser::parseValueType):
+        (JSC::WASM::WASMParser::WASMParser): Deleted.
+        (JSC::WASM::WASMParser::consumeCharacter): Deleted.
+        (JSC::WASM::WASMParser::consumeString): Deleted.
+        (JSC::WASM::WASMParser::parseUInt32): Deleted.
+        (JSC::WASM::WASMParser::parseUInt7): Deleted.
+        (JSC::WASM::WASMParser::parseVarUInt1): Deleted.
+        (JSC::WASM::WASMParser::parseValueType): Deleted.
+        * wasm/WASMPlan.cpp:
+        (JSC::WASM::Plan::Plan):
+        * wasm/WASMSections.cpp:
+        (JSC::WASM::Sections::lookup):
+        (JSC::WASM::WASMSections::lookup): Deleted.
+        * wasm/WASMSections.h:
+        (JSC::WASM::Sections::validateOrder):
+        (JSC::WASM::WASMSections::validateOrder): Deleted.
+
 2016-09-01  Filip Pizlo  <[email protected]>
 
         ObjectAllocationSinkingPhase::insertOSRHintsForUpdate() fails to emit updated hints in some cases

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/b3/B3Type.h (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/b3/B3Type.h	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/b3/B3Type.h	2016-09-08 11:19:41 UTC (rev 205625)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -39,11 +39,12 @@
 namespace JSC { namespace B3 {
 
 enum Type : int8_t {
-    Void,
     Int32,
     Int64,
     Float,
-    Double
+    Double,
+    LastValueType = Double,
+    Void
 };
 
 inline bool isInt(Type type)

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/JSWASMModule.h (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/JSWASMModule.h	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/JSWASMModule.h	2016-09-08 11:19:41 UTC (rev 205625)
@@ -75,12 +75,12 @@
     Vector<uint32_t>& i32Constants() { return m_i32Constants; }
     Vector<float>& f32Constants() { return m_f32Constants; }
     Vector<double>& f64Constants() { return m_f64Constants; }
-    Vector<WASMSignature>& signatures() { return m_signatures; }
-    Vector<WASMFunctionImport>& functionImports() { return m_functionImports; }
-    Vector<WASMFunctionImportSignature>& functionImportSignatures() { return m_functionImportSignatures; }
-    Vector<WASMValueType>& globalVariableTypes() { return m_globalVariableTypes; }
-    Vector<WASMFunctionDeclaration>& functionDeclarations() { return m_functionDeclarations; }
-    Vector<WASMFunctionPointerTable>& functionPointerTables() { return m_functionPointerTables; }
+    Vector<WASM::Signature>& signatures() { return m_signatures; }
+    Vector<WASM::FunctionImport>& functionImports() { return m_functionImports; }
+    Vector<WASM::FunctionImportSignature>& functionImportSignatures() { return m_functionImportSignatures; }
+    Vector<WASM::Type>& globalVariableTypes() { return m_globalVariableTypes; }
+    Vector<WASM::FunctionDeclaration>& functionDeclarations() { return m_functionDeclarations; }
+    Vector<WASM::FunctionPointerTable>& functionPointerTables() { return m_functionPointerTables; }
 
     const JSArrayBuffer* arrayBuffer() const { return m_arrayBuffer.get(); }
     Vector<WriteBarrier<JSFunction>>& functions() { return m_functions; }
@@ -95,12 +95,12 @@
     Vector<uint32_t> m_i32Constants;
     Vector<float> m_f32Constants;
     Vector<double> m_f64Constants;
-    Vector<WASMSignature> m_signatures;
-    Vector<WASMFunctionImport> m_functionImports;
-    Vector<WASMFunctionImportSignature> m_functionImportSignatures;
-    Vector<WASMValueType> m_globalVariableTypes;
-    Vector<WASMFunctionDeclaration> m_functionDeclarations;
-    Vector<WASMFunctionPointerTable> m_functionPointerTables;
+    Vector<WASM::Signature> m_signatures;
+    Vector<WASM::FunctionImport> m_functionImports;
+    Vector<WASM::FunctionImportSignature> m_functionImportSignatures;
+    Vector<WASM::Type> m_globalVariableTypes;
+    Vector<WASM::FunctionDeclaration> m_functionDeclarations;
+    Vector<WASM::FunctionPointerTable> m_functionPointerTables;
 
     WriteBarrier<JSArrayBuffer> m_arrayBuffer;
     Vector<WriteBarrier<JSFunction>> m_functions;

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMB3IRGenerator.cpp (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMB3IRGenerator.cpp	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMB3IRGenerator.cpp	2016-09-08 11:19:41 UTC (rev 205625)
@@ -41,10 +41,10 @@
 
 using namespace B3;
 
-inline B3::Opcode toB3Op(WASMBinaryOpType op)
+inline B3::Opcode toB3Op(BinaryOpType op)
 {
     switch (op) {
-#define CREATE_CASE(name, op, b3op) case WASMBinaryOpType::name: return b3op;
+#define CREATE_CASE(name, op, b3op) case BinaryOpType::name: return b3op;
     FOR_EACH_WASM_BINARY_OP(CREATE_CASE)
 #undef CREATE_CASE
     }
@@ -51,10 +51,10 @@
     RELEASE_ASSERT_NOT_REACHED();
 }
 
-inline B3::Opcode toB3Op(WASMUnaryOpType op)
+inline B3::Opcode toB3Op(UnaryOpType op)
 {
     switch (op) {
-#define CREATE_CASE(name, op, b3op) case WASMUnaryOpType::name: return b3op;
+#define CREATE_CASE(name, op, b3op) case UnaryOpType::name: return b3op;
     FOR_EACH_WASM_UNARY_OP(CREATE_CASE)
 #undef CREATE_CASE
     }
@@ -67,11 +67,11 @@
 
     B3IRGenerator(Procedure&);
 
-    void addLocal(WASMValueType, uint32_t);
-    ExpressionType addConstant(WASMValueType, uint64_t);
+    void addLocal(Type, uint32_t);
+    ExpressionType addConstant(Type, uint64_t);
 
-    bool WARN_UNUSED_RETURN binaryOp(WASMBinaryOpType, ExpressionType left, ExpressionType right, ExpressionType& result);
-    bool WARN_UNUSED_RETURN unaryOp(WASMUnaryOpType, ExpressionType arg, ExpressionType& result);
+    bool WARN_UNUSED_RETURN binaryOp(BinaryOpType, ExpressionType left, ExpressionType right, ExpressionType& result);
+    bool WARN_UNUSED_RETURN unaryOp(UnaryOpType, ExpressionType arg, ExpressionType& result);
 
     bool WARN_UNUSED_RETURN addBlock();
     bool WARN_UNUSED_RETURN endBlock(Vector<ExpressionType>& expressionStack);
@@ -96,33 +96,33 @@
     m_currentBlock = m_proc.addBlock();
 }
 
-void B3IRGenerator::addLocal(WASMValueType, uint32_t)
+void B3IRGenerator::addLocal(Type, uint32_t)
 {
     // TODO: Add locals.
 }
 
-bool B3IRGenerator::unaryOp(WASMUnaryOpType op, ExpressionType arg, ExpressionType& result)
+bool B3IRGenerator::unaryOp(UnaryOpType op, ExpressionType arg, ExpressionType& result)
 {
     result = m_currentBlock->appendNew<Value>(m_proc, toB3Op(op), Origin(), arg);
     return true;
 }
 
-bool B3IRGenerator::binaryOp(WASMBinaryOpType op, ExpressionType left, ExpressionType right, ExpressionType& result)
+bool B3IRGenerator::binaryOp(BinaryOpType op, ExpressionType left, ExpressionType right, ExpressionType& result)
 {
     result = m_currentBlock->appendNew<Value>(m_proc, toB3Op(op), Origin(), left, right);
     return true;
 }
 
-B3IRGenerator::ExpressionType B3IRGenerator::addConstant(WASMValueType type, uint64_t value)
+B3IRGenerator::ExpressionType B3IRGenerator::addConstant(Type type, uint64_t value)
 {
     switch (type) {
-    case WASMValueType::I32:
+    case Int32:
         return m_currentBlock->appendNew<Const32Value>(m_proc, Origin(), static_cast<int32_t>(value));
-    case WASMValueType::I64:
+    case Int64:
         return m_currentBlock->appendNew<Const64Value>(m_proc, Origin(), value);
-    case WASMValueType::F32:
+    case Float:
         return m_currentBlock->appendNew<ConstFloatValue>(m_proc, Origin(), bitwise_cast<float>(static_cast<int32_t>(value)));
-    case WASMValueType::F64:
+    case Double:
         return m_currentBlock->appendNew<ConstDoubleValue>(m_proc, Origin(), bitwise_cast<double>(value));
     default:
         RELEASE_ASSERT_NOT_REACHED();
@@ -205,11 +205,11 @@
     return m_controlStack[m_controlStack.size() - 1 - level].first;
 }
 
-std::unique_ptr<Compilation> parseAndCompile(VM& vm, Vector<uint8_t>& source, WASMFunctionInformation info, unsigned optLevel)
+std::unique_ptr<Compilation> parseAndCompile(VM& vm, Vector<uint8_t>& source, FunctionInformation info, unsigned optLevel)
 {
     Procedure procedure;
     B3IRGenerator context(procedure);
-    WASMFunctionParser<B3IRGenerator> parser(context, source, info);
+    FunctionParser<B3IRGenerator> parser(context, source, info);
     if (!parser.parse())
         RELEASE_ASSERT_NOT_REACHED();
 

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMB3IRGenerator.h (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMB3IRGenerator.h	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMB3IRGenerator.h	2016-09-08 11:19:41 UTC (rev 205625)
@@ -35,7 +35,7 @@
 
 namespace WASM {
 
-std::unique_ptr<B3::Compilation> parseAndCompile(VM&, Vector<uint8_t>&, WASMFunctionInformation, unsigned optLevel = 1);
+std::unique_ptr<B3::Compilation> parseAndCompile(VM&, Vector<uint8_t>&, FunctionInformation, unsigned optLevel = 1);
 
 } // namespace WASM
 

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMFormat.h (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMFormat.h	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMFormat.h	2016-09-08 11:19:41 UTC (rev 205625)
@@ -44,6 +44,7 @@
 
 #if ENABLE(WEBASSEMBLY)
 
+#include "B3Type.h"
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
@@ -51,52 +52,50 @@
 
 class JSFunction;
 
-enum class WASMValueType : uint8_t {
-    I32,
-    I64,
-    F32,
-    F64,
-    NumberOfTypes
-};
+namespace WASM {
 
-enum class WASMFunctionReturnType : uint8_t {
-    I32,
-    I64,
-    F32,
-    F64,
-    Void,
-    NumberOfExpressionTypes
-};
+using B3::Type;
+using B3::Int32;
+using B3::Int64;
+using B3::Float;
+using B3::Double;
 
-struct WASMSignature {
-    WASMFunctionReturnType returnType;
-    Vector<WASMValueType> arguments;
+static_assert(Int32 == 0, "WASM needs B3::Type::Int32 to have the value 0");
+static_assert(Int64 == 1, "WASM needs B3::Type::Int64 to have the value 1");
+static_assert(Float == 2, "WASM needs B3::Type::Float to have the value 2");
+static_assert(Double == 3, "WASM needs B3::Type::Double to have the value 3");
+
+struct Signature {
+    Type returnType;
+    Vector<Type> arguments;
 };
 
-struct WASMFunctionImport {
+struct FunctionImport {
     String functionName;
 };
 
-struct WASMFunctionImportSignature {
+struct FunctionImportSignature {
     uint32_t signatureIndex;
     uint32_t functionImportIndex;
 };
 
-struct WASMFunctionDeclaration {
+struct FunctionDeclaration {
     uint32_t signatureIndex;
 };
 
-struct WASMFunctionPointerTable {
+struct FunctionPointerTable {
     uint32_t signatureIndex;
     Vector<uint32_t> functionIndices;
     Vector<JSFunction*> functions;
 };
 
-struct WASMFunctionInformation {
+struct FunctionInformation {
     size_t start;
     size_t end;
 };
 
+} // namespace WASM
+
 } // namespace JSC
 
 #endif // ENABLE(WEBASSEMBLY)

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMFunctionParser.h (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMFunctionParser.h	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMFunctionParser.h	2016-09-08 11:19:41 UTC (rev 205625)
@@ -35,11 +35,11 @@
 namespace WASM {
 
 template<typename Context>
-class WASMFunctionParser : public WASMParser {
+class FunctionParser : public Parser {
 public:
     typedef typename Context::ExpressionType ExpressionType;
 
-    WASMFunctionParser(Context&, const Vector<uint8_t>& sourceBuffer, const WASMFunctionInformation&);
+    FunctionParser(Context&, const Vector<uint8_t>& sourceBuffer, const FunctionInformation&);
 
     bool WARN_UNUSED_RETURN parse();
 
@@ -47,7 +47,7 @@
     static const bool verbose = false;
 
     bool WARN_UNUSED_RETURN parseBlock();
-    bool WARN_UNUSED_RETURN parseExpression(WASMOpType);
+    bool WARN_UNUSED_RETURN parseExpression(OpType);
     bool WARN_UNUSED_RETURN unifyControl(Vector<ExpressionType>&, unsigned level);
 
     Optional<Vector<ExpressionType>>& stackForControlLevel(unsigned level);
@@ -57,14 +57,14 @@
 };
 
 template<typename Context>
-WASMFunctionParser<Context>::WASMFunctionParser(Context& context, const Vector<uint8_t>& sourceBuffer, const WASMFunctionInformation& info)
-    : WASMParser(sourceBuffer, info.start, info.end)
+FunctionParser<Context>::FunctionParser(Context& context, const Vector<uint8_t>& sourceBuffer, const FunctionInformation& info)
+    : Parser(sourceBuffer, info.start, info.end)
     , m_context(context)
 {
 }
 
 template<typename Context>
-bool WASMFunctionParser<Context>::parse()
+bool FunctionParser<Context>::parse()
 {
     uint32_t localCount;
     if (!parseVarUInt32(localCount))
@@ -75,11 +75,10 @@
         if (!parseUInt32(numberOfLocalsWithType))
             return false;
 
-        WASMValueType typeOfLocal;
+        Type typeOfLocal;
         if (!parseValueType(typeOfLocal))
             return false;
 
-        m_context.addLocal(typeOfLocal, numberOfLocalsWithType);
     }
 
     return parseBlock();
@@ -86,7 +85,7 @@
 }
 
 template<typename Context>
-bool WASMFunctionParser<Context>::parseBlock()
+bool FunctionParser<Context>::parseBlock()
 {
     while (true) {
         uint8_t op;
@@ -93,13 +92,13 @@
         if (!parseUInt7(op))
             return false;
 
-        if (!parseExpression(static_cast<WASMOpType>(op))) {
+        if (!parseExpression(static_cast<OpType>(op))) {
             if (verbose)
                 dataLogLn("failed to process op:", op);
             return false;
         }
 
-        if (op == WASMOpType::End)
+        if (op == OpType::End)
             break;
     }
 
@@ -107,7 +106,7 @@
 }
 
 template<typename Context>
-bool WASMFunctionParser<Context>::parseExpression(WASMOpType op)
+bool FunctionParser<Context>::parseExpression(OpType op)
 {
     switch (op) {
 #define CREATE_CASE(name, id, b3op) case name:
@@ -115,7 +114,7 @@
         ExpressionType left = m_expressionStack.takeLast();
         ExpressionType right = m_expressionStack.takeLast();
         ExpressionType result;
-        if (!m_context.binaryOp(static_cast<WASMBinaryOpType>(op), left, right, result))
+        if (!m_context.binaryOp(static_cast<BinaryOpType>(op), left, right, result))
             return false;
         m_expressionStack.append(result);
         return true;
@@ -124,7 +123,7 @@
     FOR_EACH_WASM_UNARY_OP(CREATE_CASE) {
         ExpressionType arg = m_expressionStack.takeLast();
         ExpressionType result;
-        if (!m_context.unaryOp(static_cast<WASMUnaryOpType>(op), arg, result))
+        if (!m_context.unaryOp(static_cast<UnaryOpType>(op), arg, result))
             return false;
         m_expressionStack.append(result);
         return true;
@@ -131,21 +130,21 @@
     }
 #undef CREATE_CASE
 
-    case WASMOpType::I32Const: {
+    case OpType::I32Const: {
         uint32_t constant;
         if (!parseVarUInt32(constant))
             return false;
-        m_expressionStack.append(m_context.addConstant(WASMValueType::I32, constant));
+        m_expressionStack.append(m_context.addConstant(Int32, constant));
         return true;
     }
 
-    case WASMOpType::Block: {
+    case OpType::Block: {
         if (!m_context.addBlock())
             return false;
         return parseBlock();
     }
 
-    case WASMOpType::Return: {
+    case OpType::Return: {
         uint8_t returnCount;
         if (!parseVarUInt1(returnCount))
             return false;
@@ -156,7 +155,7 @@
         return m_context.addReturn(returnValues);
     }
 
-    case WASMOpType::End:
+    case OpType::End:
         return m_context.endBlock(m_expressionStack);
 
     }

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMModuleParser.cpp (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMModuleParser.cpp	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMModuleParser.cpp	2016-09-08 11:19:41 UTC (rev 205625)
@@ -38,7 +38,7 @@
 
 static const bool verbose = false;
 
-bool WASMModuleParser::parse()
+bool ModuleParser::parse()
 {
     if (m_sourceLength < 8)
         return false;
@@ -59,7 +59,7 @@
     if (verbose)
         dataLogLn("Passed processing header.");
 
-    WASMSections::Section previousSection = WASMSections::Section::Unknown;
+    Sections::Section previousSection = Sections::Unknown;
     while (m_offset < m_sourceLength) {
         if (verbose)
             dataLogLn("Starting to parse next section at offset: ", m_offset);
@@ -71,8 +71,8 @@
         if (m_offset + sectionNameLength + maxLEBByteLength >= m_sourceLength)
             return false;
 
-        WASMSections::Section section = WASMSections::lookup(m_source.data() + m_offset, sectionNameLength);
-        if (!WASMSections::validateOrder(previousSection, section))
+        Sections::Section section = Sections::lookup(m_source.data() + m_offset, sectionNameLength);
+        if (!Sections::validateOrder(previousSection, section))
             return false;
         m_offset += sectionNameLength;
 
@@ -83,10 +83,10 @@
         unsigned end = m_offset + sectionLength;
 
         switch (section) {
-        case WASMSections::Section::End:
+        case Sections::End:
             return true;
 
-        case WASMSections::Section::FunctionTypes: {
+        case Sections::FunctionTypes: {
             if (verbose)
                 dataLogLn("Parsing types.");
             if (!parseFunctionTypes())
@@ -94,7 +94,7 @@
             break;
         }
 
-        case WASMSections::Section::Signatures: {
+        case Sections::Signatures: {
             if (verbose)
                 dataLogLn("Parsing function signatures.");
             if (!parseFunctionSignatures())
@@ -102,7 +102,7 @@
             break;
         }
 
-        case WASMSections::Section::Definitions: {
+        case Sections::Definitions: {
             if (verbose)
                 dataLogLn("Parsing function definitions.");
             if (!parseFunctionDefinitions())
@@ -110,7 +110,7 @@
             break;
         }
 
-        case WASMSections::Section::Unknown: {
+        case Sections::Unknown: {
             if (verbose)
                 dataLogLn("Unknown section, skipping.");
             m_offset += sectionLength;
@@ -131,7 +131,7 @@
     return true;
 }
 
-bool WASMModuleParser::parseFunctionTypes()
+bool ModuleParser::parseFunctionTypes()
 {
     uint32_t count;
     if (!parseVarUInt32(count))
@@ -157,27 +157,29 @@
         if (verbose)
             dataLogLn("argumentCount: ", argumentCount);
 
-        Vector<WASMValueType> argumentTypes;
+        Vector<Type> argumentTypes;
+        argumentTypes.resize(argumentCount);
+
         for (unsigned i = 0; i < argumentCount; ++i) {
-            if (!parseUInt7(type) || type >= static_cast<uint8_t>(WASMValueType::NumberOfTypes))
+            if (!parseUInt7(type) || type >= static_cast<uint8_t>(Type::LastValueType))
                 return false;
-            argumentTypes.append(static_cast<WASMValueType>(type));
+            argumentTypes.append(static_cast<Type>(type));
         }
 
         if (!parseVarUInt1(type))
             return false;
-        WASMFunctionReturnType returnType;
+        Type returnType;
 
         if (verbose)
             dataLogLn(type);
 
         if (type) {
-            WASMValueType value;
+            Type value;
             if (!parseValueType(value))
                 return false;
-            returnType = static_cast<WASMFunctionReturnType>(value);
+            returnType = static_cast<Type>(value);
         } else
-            returnType = WASMFunctionReturnType::Void;
+            returnType = Type::Void;
 
         // TODO: Actually do something with this data...
         UNUSED_PARAM(returnType);
@@ -185,7 +187,7 @@
     return true;
 }
 
-bool WASMModuleParser::parseFunctionSignatures()
+bool ModuleParser::parseFunctionSignatures()
 {
     uint32_t count;
     if (!parseVarUInt32(count))
@@ -202,7 +204,7 @@
     return true;
 }
 
-bool WASMModuleParser::parseFunctionDefinitions()
+bool ModuleParser::parseFunctionDefinitions()
 {
     uint32_t count;
     if (!parseVarUInt32(count))
@@ -216,7 +218,7 @@
         if (!parseVarUInt32(functionSize))
             return false;
 
-        WASMFunctionInformation& info = m_functions[i];
+        FunctionInformation& info = m_functions[i];
         info.start = m_offset;
         info.end = m_offset + functionSize;
         m_offset = info.end;

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMModuleParser.h (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMModuleParser.h	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMModuleParser.h	2016-09-08 11:19:41 UTC (rev 205625)
@@ -35,19 +35,19 @@
 
 namespace WASM {
 
-class WASMModuleParser : public WASMParser {
+class ModuleParser : public Parser {
 public:
 
     static const unsigned magicNumber = 0xc;
 
-    WASMModuleParser(const Vector<uint8_t>& sourceBuffer)
-        : WASMParser(sourceBuffer, 0, sourceBuffer.size())
+    ModuleParser(const Vector<uint8_t>& sourceBuffer)
+        : Parser(sourceBuffer, 0, sourceBuffer.size())
     {
     }
 
     bool WARN_UNUSED_RETURN parse();
 
-    const Vector<WASMFunctionInformation>& functionInformation() { return m_functions; }
+    const Vector<FunctionInformation>& functionInformation() { return m_functions; }
 
 private:
     bool WARN_UNUSED_RETURN parseFunctionTypes();
@@ -55,9 +55,9 @@
     bool WARN_UNUSED_RETURN parseFunctionDefinitions();
     bool WARN_UNUSED_RETURN parseFunctionDefinition(uint32_t number);
     bool WARN_UNUSED_RETURN parseBlock();
-    bool WARN_UNUSED_RETURN parseExpression(WASMOpType);
+    bool WARN_UNUSED_RETURN parseExpression(OpType);
 
-    Vector<WASMFunctionInformation> m_functions;
+    Vector<FunctionInformation> m_functions;
 };
 
 } // namespace WASM

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMOps.h (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMOps.h	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMOps.h	2016-09-08 11:19:41 UTC (rev 205625)
@@ -106,15 +106,15 @@
 
 #define CREATE_ENUM_VALUE(name, id, b3op) name = id,
 
-enum WASMOpType : uint8_t {
+enum OpType : uint8_t {
     FOR_EACH_WASM_OP(CREATE_ENUM_VALUE)
 };
 
-enum class WASMBinaryOpType : uint8_t {
+enum class BinaryOpType : uint8_t {
     FOR_EACH_WASM_BINARY_OP(CREATE_ENUM_VALUE)
 };
 
-enum class WASMUnaryOpType : uint8_t {
+enum class UnaryOpType : uint8_t {
     FOR_EACH_WASM_UNARY_OP(CREATE_ENUM_VALUE)
 };
 

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMParser.h (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMParser.h	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMParser.h	2016-09-08 11:19:41 UTC (rev 205625)
@@ -38,9 +38,9 @@
 
 namespace WASM {
 
-class WASMParser {
+class Parser {
 protected:
-    WASMParser(const Vector<uint8_t>&, size_t start, size_t end);
+    Parser(const Vector<uint8_t>&, size_t start, size_t end);
 
     bool WARN_UNUSED_RETURN consumeCharacter(char);
     bool WARN_UNUSED_RETURN consumeString(const char*);
@@ -51,7 +51,7 @@
     bool WARN_UNUSED_RETURN parseVarUInt32(uint32_t& result) { return decodeUInt32(m_source.data(), m_sourceLength, m_offset, result); }
 
 
-    bool WARN_UNUSED_RETURN parseValueType(WASMValueType& result);
+    bool WARN_UNUSED_RETURN parseValueType(Type& result);
 
     const Vector<uint8_t>& m_source;
     size_t m_sourceLength;
@@ -58,7 +58,7 @@
     size_t m_offset;
 };
 
-ALWAYS_INLINE WASMParser::WASMParser(const Vector<uint8_t>& sourceBuffer, size_t start, size_t end)
+ALWAYS_INLINE Parser::Parser(const Vector<uint8_t>& sourceBuffer, size_t start, size_t end)
     : m_source(sourceBuffer)
     , m_sourceLength(end)
     , m_offset(start)
@@ -67,7 +67,7 @@
     ASSERT(start < end);
 }
 
-ALWAYS_INLINE bool WASMParser::consumeCharacter(char c)
+ALWAYS_INLINE bool Parser::consumeCharacter(char c)
 {
     if (m_offset >= m_sourceLength)
         return false;
@@ -78,7 +78,7 @@
     return false;
 }
 
-ALWAYS_INLINE bool WASMParser::consumeString(const char* str)
+ALWAYS_INLINE bool Parser::consumeString(const char* str)
 {
     unsigned start = m_offset;
     for (unsigned i = 0; str[i]; i++) {
@@ -90,7 +90,7 @@
     return true;
 }
 
-ALWAYS_INLINE bool WASMParser::parseUInt32(uint32_t& result)
+ALWAYS_INLINE bool Parser::parseUInt32(uint32_t& result)
 {
     if (m_offset + 4 >= m_sourceLength)
         return false;
@@ -99,7 +99,7 @@
     return true;
 }
 
-ALWAYS_INLINE bool WASMParser::parseUInt7(uint8_t& result)
+ALWAYS_INLINE bool Parser::parseUInt7(uint8_t& result)
 {
     if (m_offset >= m_sourceLength)
         return false;
@@ -107,7 +107,7 @@
     return result < 0x80;
 }
 
-ALWAYS_INLINE bool WASMParser::parseVarUInt1(uint8_t& result)
+ALWAYS_INLINE bool Parser::parseVarUInt1(uint8_t& result)
 {
     uint32_t temp;
     if (!parseVarUInt32(temp))
@@ -116,14 +116,14 @@
     return temp <= 1;
 }
 
-ALWAYS_INLINE bool WASMParser::parseValueType(WASMValueType& result)
+ALWAYS_INLINE bool Parser::parseValueType(Type& result)
 {
     uint8_t value;
     if (!parseUInt7(value))
         return false;
-    if (value >= static_cast<uint8_t>(WASMValueType::NumberOfTypes))
+    if (value >= static_cast<uint8_t>(Type::LastValueType))
         return false;
-    result = static_cast<WASMValueType>(value);
+    result = static_cast<Type>(value);
     return true;
 }
 

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMPlan.cpp (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMPlan.cpp	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMPlan.cpp	2016-09-08 11:19:41 UTC (rev 205625)
@@ -43,7 +43,7 @@
 {
     if (verbose)
         dataLogLn("Starting plan.");
-    WASMModuleParser moduleParser(source);
+    ModuleParser moduleParser(source);
     if (!moduleParser.parse()) {
         dataLogLn("Parsing module failed.");
         return;
@@ -52,7 +52,7 @@
     if (verbose)
         dataLogLn("Parsed module.");
 
-    for (const WASMFunctionInformation& info : moduleParser.functionInformation()) {
+    for (const FunctionInformation& info : moduleParser.functionInformation()) {
         if (verbose)
             dataLogLn("Processing funcion starting at: ", info.start, " and ending at: ", info.end);
         result.append(parseAndCompile(vm, source, info));

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMSections.cpp (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMSections.cpp	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMSections.cpp	2016-09-08 11:19:41 UTC (rev 205625)
@@ -42,7 +42,7 @@
 
 static const bool verbose = false;
 
-static const unsigned sectionDataLength = static_cast<unsigned>(WASMSections::Section::Unknown);
+static const unsigned sectionDataLength = static_cast<unsigned>(Sections::Unknown);
 static const SectionData sectionData[sectionDataLength] {
 #define CREATE_SECTION_DATA(name, str) { sizeof(str) - 1, str },
     FOR_EACH_WASM_SECTION_TYPE(CREATE_SECTION_DATA)
@@ -49,7 +49,7 @@
 #undef CREATE_SECTION_DATA
 };
 
-WASMSections::Section WASMSections::lookup(const uint8_t* name, unsigned length)
+Sections::Section Sections::lookup(const uint8_t* name, unsigned length)
 {
     if (verbose)
         dataLogLn("Decoding section with name: ", String(name, length));
@@ -57,9 +57,9 @@
         if (sectionData[i].length != length)
             continue;
         if (!memcmp(name, sectionData[i].name, length))
-            return static_cast<WASMSections::Section>(i);
+            return static_cast<Sections::Section>(i);
     }
-    return WASMSections::Section::Unknown;
+    return Sections::Unknown;
 }
 
 } // namespace WASM

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMSections.h (205624 => 205625)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMSections.h	2016-09-08 11:16:34 UTC (rev 205624)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/wasm/WASMSections.h	2016-09-08 11:19:41 UTC (rev 205625)
@@ -38,8 +38,8 @@
     macro(Definitions, "code") \
     macro(End, "end")
 
-struct WASMSections {
-    enum class Section {
+struct Sections {
+    enum Section {
 #define CREATE_SECTION_ENUM(name, str) name,
         FOR_EACH_WASM_SECTION_TYPE(CREATE_SECTION_ENUM)
 #undef CREATE_SECTION_ENUM
@@ -50,7 +50,7 @@
     {
         // This allows unknown sections after End, which I doubt will ever be supported but
         // there is no reason to potentially break backwards compatability.
-        if (previous == Section::Unknown)
+        if (previous == Unknown)
             return true;
         return previous < next;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to