| OLD | NEW |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_ASMJS_ASM_PARSER_H_ | 5 #ifndef V8_ASMJS_ASM_PARSER_H_ |
| 6 #define V8_ASMJS_ASM_PARSER_H_ | 6 #define V8_ASMJS_ASM_PARSER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #define V(_unused0, Name, _unused1, _unused2) kMath##Name, | 52 #define V(_unused0, Name, _unused1, _unused2) kMath##Name, |
| 53 STDLIB_MATH_FUNCTION_LIST(V) | 53 STDLIB_MATH_FUNCTION_LIST(V) |
| 54 #undef V | 54 #undef V |
| 55 #define V(Name) kMath##Name, | 55 #define V(Name) kMath##Name, |
| 56 STDLIB_MATH_VALUE_LIST(V) | 56 STDLIB_MATH_VALUE_LIST(V) |
| 57 #undef V | 57 #undef V |
| 58 }; | 58 }; |
| 59 // clang-format on | 59 // clang-format on |
| 60 | 60 |
| 61 struct FunctionImportInfo { | 61 struct FunctionImportInfo { |
| 62 std::string name; | 62 char* function_name; |
| 63 size_t function_name_size; |
| 63 SignatureMap cache; | 64 SignatureMap cache; |
| 64 std::vector<uint32_t> cache_index; | 65 std::vector<uint32_t> cache_index; |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 struct VarInfo { | 68 struct VarInfo { |
| 68 AsmType* type; | 69 AsmType* type; |
| 69 WasmFunctionBuilder* function_builder; | 70 WasmFunctionBuilder* function_builder; |
| 70 FunctionImportInfo* import; | 71 FunctionImportInfo* import; |
| 71 int32_t mask; | 72 int32_t mask; |
| 72 uint32_t index; | 73 uint32_t index; |
| 73 VarKind kind; | 74 VarKind kind; |
| 74 bool mutable_variable; | 75 bool mutable_variable; |
| 75 bool function_defined; | 76 bool function_defined; |
| 76 | 77 |
| 77 VarInfo(); | 78 VarInfo(); |
| 78 void DeclareGlobalImport(AsmType* type, uint32_t index); | 79 void DeclareGlobalImport(AsmType* type, uint32_t index); |
| 79 void DeclareStdlibFunc(VarKind kind, AsmType* type); | 80 void DeclareStdlibFunc(VarKind kind, AsmType* type); |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 struct GlobalImport { | 83 struct GlobalImport { |
| 83 std::string import_name; | 84 char* import_name; |
| 85 size_t import_name_size; |
| 84 uint32_t import_index; | 86 uint32_t import_index; |
| 85 uint32_t global_index; | 87 uint32_t global_index; |
| 86 bool needs_init; | 88 bool needs_init; |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 enum class BlockKind { kRegular, kLoop, kOther }; | 91 enum class BlockKind { kRegular, kLoop, kOther }; |
| 90 | 92 |
| 91 struct BlockInfo { | 93 struct BlockInfo { |
| 92 BlockKind kind; | 94 BlockKind kind; |
| 93 AsmJsScanner::token_t label; | 95 AsmJsScanner::token_t label; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 const std::vector<AsmType*>& params); | 243 const std::vector<AsmType*>& params); |
| 242 | 244 |
| 243 // 6.1 ValidateModule | 245 // 6.1 ValidateModule |
| 244 void ValidateModule(); | 246 void ValidateModule(); |
| 245 void ValidateModuleParameters(); | 247 void ValidateModuleParameters(); |
| 246 void ValidateModuleVars(); | 248 void ValidateModuleVars(); |
| 247 void ValidateModuleVar(bool mutable_variable); | 249 void ValidateModuleVar(bool mutable_variable); |
| 248 bool ValidateModuleVarImport(VarInfo* info, bool mutable_variable); | 250 bool ValidateModuleVarImport(VarInfo* info, bool mutable_variable); |
| 249 void ValidateModuleVarStdlib(VarInfo* info); | 251 void ValidateModuleVarStdlib(VarInfo* info); |
| 250 void ValidateModuleVarNewStdlib(VarInfo* info); | 252 void ValidateModuleVarNewStdlib(VarInfo* info); |
| 251 void ValidateModuleVarFloat(VarInfo* info, bool mutable_variable); | 253 void ValidateModuleVarFromGlobal(VarInfo* info, bool mutable_variable); |
| 252 | 254 |
| 253 void ValidateExport(); // 6.2 ValidateExport | 255 void ValidateExport(); // 6.2 ValidateExport |
| 254 void ValidateFunctionTable(); // 6.3 ValidateFunctionTable | 256 void ValidateFunctionTable(); // 6.3 ValidateFunctionTable |
| 255 void ValidateFunction(); // 6.4 ValidateFunction | 257 void ValidateFunction(); // 6.4 ValidateFunction |
| 256 void ValidateFunctionParams(std::vector<AsmType*>* params); | 258 void ValidateFunctionParams(std::vector<AsmType*>* params); |
| 257 void ValidateFunctionLocals(size_t param_count, | 259 void ValidateFunctionLocals(size_t param_count, |
| 258 std::vector<ValueType>* locals); | 260 std::vector<ValueType>* locals); |
| 259 void ValidateStatement(); // ValidateStatement | 261 void ValidateStatement(); // ValidateStatement |
| 260 void Block(); // 6.5.1 Block | 262 void Block(); // 6.5.1 Block |
| 261 void ExpressionStatement(); // 6.5.2 ExpressionStatement | 263 void ExpressionStatement(); // 6.5.2 ExpressionStatement |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 void ValidateHeapAccess(); // 6.10 ValidateHeapAccess | 297 void ValidateHeapAccess(); // 6.10 ValidateHeapAccess |
| 296 void ValidateFloatCoercion(); // 6.11 ValidateFloatCoercion | 298 void ValidateFloatCoercion(); // 6.11 ValidateFloatCoercion |
| 297 | 299 |
| 298 void GatherCases(std::vector<int32_t>* cases); | 300 void GatherCases(std::vector<int32_t>* cases); |
| 299 }; | 301 }; |
| 300 | 302 |
| 301 } // namespace wasm | 303 } // namespace wasm |
| 302 } // namespace internal | 304 } // namespace internal |
| 303 } // namespace v8 | 305 } // namespace v8 |
| 304 #endif | 306 #endif |
| OLD | NEW |