// Copyright 2015 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/v8.h" // Required to get M_E etc. in MSVC. #if defined(_WIN32) #define _USE_MATH_DEFINES #endif #include #include "src/asmjs/asm-types.h" #include "src/asmjs/asm-wasm-builder.h" #include "src/asmjs/switch-logic.h" #include "src/wasm/wasm-macro-gen.h" #include "src/wasm/wasm-opcodes.h" #include "src/ast/ast.h" #include "src/ast/scopes.h" #include "src/codegen.h" #include "src/compilation-info.h" #include "src/compiler.h" #include "src/counters.h" #include "src/isolate.h" #include "src/objects-inl.h" #include "src/parsing/parse-info.h" namespace v8 { namespace internal { namespace wasm { #define RECURSE(call) \ do { \ DCHECK(!HasStackOverflow()); \ call; \ if (HasStackOverflow()) return; \ } while (false) namespace { enum AsmScope { kModuleScope, kInitScope, kFuncScope, kExportScope }; enum ValueFate { kDrop, kLeaveOnStack }; struct ForeignVariable { Handle name; Variable* var; ValueType type; }; enum TargetType : uint8_t { NoTarget, BreakTarget, ContinueTarget }; } // namespace class AsmWasmBuilderImpl final : public AstVisitor { public: AsmWasmBuilderImpl(Isolate* isolate, Zone* zone, CompilationInfo* info, AstValueFactory* ast_value_factory, Handle