2929// across modules, we still want to legalize dynCalls so JS can call into the
3030// table even to a signature that is not legal.
3131//
32- // This pass also legalizes according to asm.js FFI rules, which
33- // disallow f32s. TODO: an option to not do that, if it matters?
34- //
3532
3633#include < utility>
3734#include " wasm.h"
@@ -124,9 +121,9 @@ struct LegalizeJSInterface : public Pass {
124121 template <typename T>
125122 bool isIllegal (T* t) {
126123 for (auto param : t->params ) {
127- if (param == i64 || param == f32 ) return true ;
124+ if (param == i64 ) return true ;
128125 }
129- return t->result == i64 || t-> result == f32 ;
126+ return t->result == i64 ;
130127 }
131128
132129 // Check if an export should be legalized.
@@ -158,9 +155,6 @@ struct LegalizeJSInterface : public Pass {
158155 call->operands .push_back (I64Utilities::recreateI64 (builder, legal->params .size (), legal->params .size () + 1 ));
159156 legal->params .push_back (i32 );
160157 legal->params .push_back (i32 );
161- } else if (param == f32 ) {
162- call->operands .push_back (builder.makeUnary (DemoteFloat64, builder.makeGetLocal (legal->params .size (), f64 )));
163- legal->params .push_back (f64 );
164158 } else {
165159 call->operands .push_back (builder.makeGetLocal (legal->params .size (), param));
166160 legal->params .push_back (param);
@@ -177,9 +171,6 @@ struct LegalizeJSInterface : public Pass {
177171 block->list .push_back (I64Utilities::getI64Low (builder, index));
178172 block->finalize ();
179173 legal->body = block;
180- } else if (func->result == f32 ) {
181- legal->result = f64 ;
182- legal->body = builder.makeUnary (PromoteFloat32, call);
183174 } else {
184175 legal->result = func->result ;
185176 legal->body = call;
@@ -216,9 +207,6 @@ struct LegalizeJSInterface : public Pass {
216207 call->operands .push_back (I64Utilities::getI64High (builder, func->params .size ()));
217208 type->params .push_back (i32 );
218209 type->params .push_back (i32 );
219- } else if (param == f32 ) {
220- call->operands .push_back (builder.makeUnary (PromoteFloat32, builder.makeGetLocal (func->params .size (), f32 )));
221- type->params .push_back (f64 );
222210 } else {
223211 call->operands .push_back (builder.makeGetLocal (func->params .size (), param));
224212 type->params .push_back (param);
@@ -232,10 +220,6 @@ struct LegalizeJSInterface : public Pass {
232220 Expression* get = builder.makeCall (f->name , {}, call->type );
233221 func->body = I64Utilities::recreateI64 (builder, call, get);
234222 type->result = i32 ;
235- } else if (imFunctionType->result == f32 ) {
236- call->type = f64 ;
237- func->body = builder.makeUnary (DemoteFloat64, call);
238- type->result = f64 ;
239223 } else {
240224 call->type = imFunctionType->result ;
241225 func->body = call;
0 commit comments