Commit 637b7d64 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[asm.js] Switch StdlibSet to be a uint64_t bit set.

This switches the {StdlibSet} to be a data structure that does not
require dynamic memory allocation. This makes it easier to carry it
around as part of a {CompilationJob} and serialize it into the heap.

R=clemensh@chromium.org

Change-Id: I77b2353cfdcd9438a26f04d00749159fed9b9b6c
Reviewed-on: https://chromium-review.googlesource.com/584868
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46889}
parent 6e4d2a60
This diff is collapsed.
......@@ -550,7 +550,7 @@ void AsmJsParser::ValidateModuleVarNewStdlib(VarInfo* info) {
#define V(name, _junk1, _junk2, _junk3) \
case TOK(name): \
DeclareStdlibFunc(info, VarKind::kSpecial, AsmType::name()); \
stdlib_uses_.insert(StandardMember::k##name); \
stdlib_uses_.Add(StandardMember::k##name); \
break;
STDLIB_ARRAY_TYPE_LIST(V)
#undef V
......@@ -573,14 +573,14 @@ void AsmJsParser::ValidateModuleVarStdlib(VarInfo* info) {
case TOK(name): \
DeclareGlobal(info, false, AsmType::Double(), kWasmF64, \
WasmInitExpr(const_value)); \
stdlib_uses_.insert(StandardMember::kMath##name); \
stdlib_uses_.Add(StandardMember::kMath##name); \
break;
STDLIB_MATH_VALUE_LIST(V)
#undef V
#define V(name, Name, op, sig) \
case TOK(name): \
DeclareStdlibFunc(info, VarKind::kMath##Name, stdlib_##sig##_); \
stdlib_uses_.insert(StandardMember::kMath##Name); \
stdlib_uses_.Add(StandardMember::kMath##Name); \
break;
STDLIB_MATH_FUNCTION_LIST(V)
#undef V
......@@ -590,11 +590,11 @@ void AsmJsParser::ValidateModuleVarStdlib(VarInfo* info) {
} else if (Check(TOK(Infinity))) {
DeclareGlobal(info, false, AsmType::Double(), kWasmF64,
WasmInitExpr(std::numeric_limits<double>::infinity()));
stdlib_uses_.insert(StandardMember::kInfinity);
stdlib_uses_.Add(StandardMember::kInfinity);
} else if (Check(TOK(NaN))) {
DeclareGlobal(info, false, AsmType::Double(), kWasmF64,
WasmInitExpr(std::numeric_limits<double>::quiet_NaN()));
stdlib_uses_.insert(StandardMember::kNaN);
stdlib_uses_.Add(StandardMember::kNaN);
} else {
FAIL("Invalid member of stdlib");
}
......
......@@ -47,7 +47,7 @@ class AsmJsParser {
};
// clang-format on
typedef std::unordered_set<StandardMember, std::hash<int>> StdlibSet;
typedef EnumSet<StandardMember, uint64_t> StdlibSet;
explicit AsmJsParser(Zone* zone, uintptr_t stack_limit,
std::unique_ptr<Utf16CharacterStream> stream);
......@@ -55,7 +55,7 @@ class AsmJsParser {
const char* failure_message() const { return failure_message_; }
int failure_location() const { return failure_location_; }
WasmModuleBuilder* module_builder() { return module_builder_; }
StdlibSet* stdlib_uses() { return &stdlib_uses_; }
const StdlibSet* stdlib_uses() const { return &stdlib_uses_; }
private:
// clang-format off
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment