Version 2.12.0-42.0.dev

Merge commit '504e9a32f9187a59625d713cd5264cb8c93ab89f' into 'dev'
diff --git a/DEPS b/DEPS
index cd20336..4003414 100644
--- a/DEPS
+++ b/DEPS
@@ -65,7 +65,7 @@
   # Scripts that make 'git cl format' work.
   "clang_format_scripts_rev": "c09c8deeac31f05bd801995c475e7c8070f9ecda",
 
-  "gperftools_revision": "e9ab4c53041ac62feefbbb076d326e9a77dd1567",
+  "gperftools_revision": "180bfa10d7cb38e8b3784d60943d50e8fcef0dcb",
 
   # Revisions of /third_party/* dependencies.
   "args_tag": "1.6.0",
diff --git a/pkg/compiler/lib/src/kernel/transformations/list_factory_specializer.dart b/pkg/compiler/lib/src/kernel/transformations/list_factory_specializer.dart
index e61d1dd..5c10d5f 100644
--- a/pkg/compiler/lib/src/kernel/transformations/list_factory_specializer.dart
+++ b/pkg/compiler/lib/src/kernel/transformations/list_factory_specializer.dart
@@ -251,9 +251,22 @@
     if (function.namedParameters.isNotEmpty) return false;
 
     final body = function.body;
-    // For now, only arrow functions.
+
+    // Arrow functions.
     if (body is ReturnStatement) return true;
 
+    if (body is Block) {
+      // Simple body containing just a return.
+      final statements = body.statements;
+      if (statements.length == 1 && statements.single is ReturnStatement) {
+        return true;
+      }
+
+      // TODO(sra): We can accept more complex closures but, with diminishing
+      // returns. It would probably be best to handle more complex cases by
+      // improving environment design and inlining.
+    }
+
     return false;
   }
 
diff --git a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
index 97bb616..7311e2e 100644
--- a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
+++ b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
@@ -109,6 +109,13 @@
     return const InvokeDynamicSpecializer();
   }
 
+  bool requiresBoundsCheck(HInvokeDynamic node, JClosedWorld closedWorld) {
+    if (node.isBoundsSafe) return false;
+    return closedWorld.annotationsData
+        .getIndexBoundsCheckPolicy(node.instructionContext)
+        .isEmitted;
+  }
+
   HBoundsCheck insertBoundsCheck(HInstruction indexerNode, HInstruction array,
       HInstruction indexArgument, JClosedWorld closedWorld) {
     final abstractValueDomain = closedWorld.abstractValueDomain;
@@ -202,9 +209,7 @@
     }
 
     HInstruction checkedIndex = index;
-    if (closedWorld.annotationsData
-        .getIndexBoundsCheckPolicy(instruction.instructionContext)
-        .isEmitted) {
+    if (requiresBoundsCheck(instruction, closedWorld)) {
       checkedIndex =
           insertBoundsCheck(instruction, receiver, index, closedWorld);
     }
@@ -283,9 +288,7 @@
     }
 
     HInstruction checkedIndex = index;
-    if (closedWorld.annotationsData
-        .getIndexBoundsCheckPolicy(instruction.instructionContext)
-        .isEmitted) {
+    if (requiresBoundsCheck(instruction, closedWorld)) {
       checkedIndex =
           insertBoundsCheck(instruction, receiver, index, closedWorld);
     }
@@ -315,9 +318,7 @@
     // We are essentially inlining `result = a[a.length - 1]`. `0` is the only
     // index that can fail so we check zero directly, but we want to report the
     // error index as `-1`, so we add `-1` as an extra input that to the check.
-    if (closedWorld.annotationsData
-        .getIndexBoundsCheckPolicy(instruction.instructionContext)
-        .isEmitted) {
+    if (requiresBoundsCheck(instruction, closedWorld)) {
       HConstant zeroIndex = graph.addConstantInt(0, closedWorld);
       HBoundsCheck check =
           insertBoundsCheck(instruction, receiver, zeroIndex, closedWorld);
diff --git a/pkg/compiler/test/kernel/data/list_generate_3.dart b/pkg/compiler/test/kernel/data/list_generate_3.dart
new file mode 100644
index 0000000..dd6ce5c
--- /dev/null
+++ b/pkg/compiler/test/kernel/data/list_generate_3.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2020, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+var list1 = List<int>.generate(10, (i) {
+  return i;
+});
+
+var list2 = List<int>.generate(10, (i) {
+  return i;
+}, growable: true);
+
+var list3 = List<int>.generate(10, (i) {
+  return i;
+}, growable: false);
+
+var list4 = List<int>.generate(10, (i) {
+  return i;
+}, growable: someGrowable);
+
+// Not expanded - complex closure.
+var list5 = List<int>.generate(10, (i) {
+  if (i.isEven) return i + 1;
+  return i - 1;
+});
+
+// Not expanded - inscrutable closure.
+var list6 = List<int>.generate(10, foo);
+int foo(int i) => i;
+
+// Not expanded - inscrutable closure.
+var list7 = List<int>.generate(10, bar);
+int Function(int) get bar => foo;
+
+bool someGrowable = true;
+
+void main() {
+  someGrowable = !someGrowable;
+  print([list1, list2, list3, list4, list5, list6, list7]);
+}
diff --git a/pkg/compiler/test/kernel/data/list_generate_3.dart.expect b/pkg/compiler/test/kernel/data/list_generate_3.dart.expect
new file mode 100644
index 0000000..05df05d
--- /dev/null
+++ b/pkg/compiler/test/kernel/data/list_generate_3.dart.expect
@@ -0,0 +1,51 @@
+library #lib;
+import self as self;
+import "dart:core" as core;
+import "dart:_interceptors" as _in;
+
+static field core::List<core::int*>* list1 = block {
+  final _in::JSArray<core::int*> _list = _in::JSArray::allocateGrowable<core::int*>(10);
+  for (core::int i = 0; i.{core::num::<}(10); i = i.{core::num::+}(1)) {
+    core::int* i = i;
+    {
+      _list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i);
+    }
+  }
+} =>_list;
+static field core::List<core::int*>* list2 = block {
+  final _in::JSArray<core::int*> _list = _in::JSArray::allocateGrowable<core::int*>(10);
+  for (core::int i = 0; i.{core::num::<}(10); i = i.{core::num::+}(1)) {
+    core::int* i = i;
+    {
+      _list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i);
+    }
+  }
+} =>_list;
+static field core::List<core::int*>* list3 = block {
+  final _in::JSArray<core::int*> _list = _in::JSArray::allocateFixed<core::int*>(10);
+  for (core::int i = 0; i.{core::num::<}(10); i = i.{core::num::+}(1)) {
+    core::int* i = i;
+    {
+      _list.{_in::JSArray::[]=}{Invariant,BoundsSafe}(i, i);
+    }
+  }
+} =>_list;
+static field core::List<core::int*>* list4 = core::List::generate<core::int*>(10, (core::int* i) → core::int* {
+  return i;
+}, growable: self::someGrowable);
+static field core::List<core::int*>* list5 = core::List::generate<core::int*>(10, (core::int* i) → core::int* {
+  if(i.{core::int::isEven})
+    return i.{core::num::+}(1);
+  return i.{core::num::-}(1);
+});
+static field core::List<core::int*>* list6 = core::List::generate<core::int*>(10, #C1);
+static field core::List<core::int*>* list7 = core::List::generate<core::int*>(10, self::bar);
+static field core::bool* someGrowable = true;
+static method foo(core::int* i) → core::int*
+  return i;
+static get bar() → (core::int*) →* core::int*
+  return #C1;
+static method main() → void {
+  self::someGrowable = !self::someGrowable;
+  core::print(<core::List<core::int*>*>[self::list1, self::list2, self::list3, self::list4, self::list5, self::list6, self::list7]);
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/await_in_non_async.yaml.world.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/await_in_non_async.yaml.world.1.expect
index a871263..8a0cc29 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/await_in_non_async.yaml.world.1.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/await_in_non_async.yaml.world.1.expect
@@ -7,7 +7,7 @@
   static method foo() → dynamic {}
 }
 
-And 19 platform libraries:
+And 18 platform libraries:
  - dart:_http
  - dart:_builtin
  - dart:vmservice_io
@@ -26,4 +26,3 @@
  - dart:mirrors
  - dart:typed_data
  - dart:_vmservice
- - dart:wasm
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/await_in_non_async.yaml.world.2.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/await_in_non_async.yaml.world.2.expect
index 42ee856..0e7c789 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/await_in_non_async.yaml.world.2.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/await_in_non_async.yaml.world.2.expect
@@ -14,7 +14,7 @@
   static method foo() → dynamic {}
 }
 
-And 19 platform libraries:
+And 18 platform libraries:
  - dart:_http
  - dart:_builtin
  - dart:vmservice_io
@@ -33,4 +33,3 @@
  - dart:mirrors
  - dart:typed_data
  - dart:_vmservice
- - dart:wasm
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/bad_sdk_uri.yaml.world.3.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/bad_sdk_uri.yaml.world.3.expect
index 6480cc2..69312e6 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/bad_sdk_uri.yaml.world.3.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/bad_sdk_uri.yaml.world.3.expect
@@ -20,7 +20,7 @@
   }
 }
 
-And 18 platform libraries:
+And 17 platform libraries:
  - dart:_builtin
  - dart:_internal
  - dart:_vmservice
@@ -38,4 +38,3 @@
  - dart:nativewrappers
  - dart:typed_data
  - dart:vmservice_io
- - dart:wasm
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/load_from_component_explicitly_import_dart_core.yaml.world.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/load_from_component_explicitly_import_dart_core.yaml.world.1.expect
index 5a49451..2360766 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/load_from_component_explicitly_import_dart_core.yaml.world.1.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/load_from_component_explicitly_import_dart_core.yaml.world.1.expect
@@ -16,7 +16,7 @@
   }
 }
 
-And 19 platform libraries:
+And 18 platform libraries:
  - dart:_http
  - dart:_builtin
  - dart:vmservice_io
@@ -35,4 +35,3 @@
  - dart:mirrors
  - dart:typed_data
  - dart:_vmservice
- - dart:wasm
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/load_from_component_explicitly_import_dart_core.yaml.world.2.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/load_from_component_explicitly_import_dart_core.yaml.world.2.expect
index 5a49451..2360766 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/load_from_component_explicitly_import_dart_core.yaml.world.2.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/load_from_component_explicitly_import_dart_core.yaml.world.2.expect
@@ -16,7 +16,7 @@
   }
 }
 
-And 19 platform libraries:
+And 18 platform libraries:
  - dart:_http
  - dart:_builtin
  - dart:vmservice_io
@@ -35,4 +35,3 @@
  - dart:mirrors
  - dart:typed_data
  - dart:_vmservice
- - dart:wasm
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/omit_platform_works_3.yaml.world.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/omit_platform_works_3.yaml.world.1.expect
index aa1db3e..4981234 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/omit_platform_works_3.yaml.world.1.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/omit_platform_works_3.yaml.world.1.expect
@@ -6,7 +6,7 @@
   }
 }
 
-And 19 platform libraries:
+And 18 platform libraries:
  - dart:_http
  - dart:_builtin
  - dart:vmservice_io
@@ -25,4 +25,3 @@
  - dart:mirrors
  - dart:typed_data
  - dart:_vmservice
- - dart:wasm
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/omit_platform_works_3.yaml.world.4.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/omit_platform_works_3.yaml.world.4.expect
index c0b1b18..b1013a0 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/omit_platform_works_3.yaml.world.4.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/omit_platform_works_3.yaml.world.4.expect
@@ -14,7 +14,7 @@
   }
 }
 
-And 19 platform libraries:
+And 18 platform libraries:
  - dart:_http
  - dart:_builtin
  - dart:vmservice_io
@@ -33,4 +33,3 @@
  - dart:mirrors
  - dart:typed_data
  - dart:_vmservice
- - dart:wasm
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/omit_platform_works_3.yaml.world.5.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/omit_platform_works_3.yaml.world.5.expect
index 6afed6a..a4d9f55 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/omit_platform_works_3.yaml.world.5.expect
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/omit_platform_works_3.yaml.world.5.expect
@@ -14,7 +14,7 @@
   }
 }
 
-And 19 platform libraries:
+And 18 platform libraries:
  - dart:_http
  - dart:_builtin
  - dart:vmservice_io
@@ -33,4 +33,3 @@
  - dart:mirrors
  - dart:typed_data
  - dart:_vmservice
- - dart:wasm
diff --git a/pkg/nnbd_migration/lib/src/front_end/info_builder.dart b/pkg/nnbd_migration/lib/src/front_end/info_builder.dart
index b5b8e56..7943e53 100644
--- a/pkg/nnbd_migration/lib/src/front_end/info_builder.dart
+++ b/pkg/nnbd_migration/lib/src/front_end/info_builder.dart
@@ -361,7 +361,7 @@
 
     var lineInfo = result.unit.lineInfo;
     var insertions = <int, List<AtomicEdit>>{};
-    var hintsSeen = <HintComment>{};
+    var infosSeen = Set<AtomicEditInfo>.identity();
 
     // Apply edits and build the regions.
     var changes = sourceInfo.changes ?? {};
@@ -392,8 +392,7 @@
             ? const <TraceInfo>[]
             : _computeTraces(info.fixReasons);
         var description = info?.description;
-        var hint = info?.hintComment;
-        var isCounted = hint == null || hintsSeen.add(hint);
+        var isCounted = info != null && infosSeen.add(info);
         var explanation = description?.appliedMessage;
         var kind = description?.kind;
         if (edit.isInsertion) {
diff --git a/pkg/nnbd_migration/test/front_end/unit_renderer_test.dart b/pkg/nnbd_migration/test/front_end/unit_renderer_test.dart
index 79a0fbf..9ea346f 100644
--- a/pkg/nnbd_migration/test/front_end/unit_renderer_test.dart
+++ b/pkg/nnbd_migration/test/front_end/unit_renderer_test.dart
@@ -161,6 +161,26 @@
             ['1 late final hint converted to late and final keywords']));
   }
 
+  Future<void> test_editList_countsWhereOrNullSingly() async {
+    await buildInfoForSingleTestFile(
+        '''
+import 'package:collection/collection.dart';
+
+int firstEven(Iterable<int> x)
+    => x.firstWhere((x) => x.isEven, orElse: () => null);
+''',
+        removeViaComments: false,
+        migratedContent: '''
+import 'package:collection/collection.dart';
+
+int? firstEven(Iterable<int >  x)
+    => x.firstWherefirstWhereOrNull((x) => x.isEven, orElse: () => null);
+''');
+    var output = renderUnits()[0];
+    expect(output.edits.keys,
+        unorderedEquals(['1 method name changed', '1 type made nullable']));
+  }
+
   Future<void> test_editList_pluralHeader() async {
     await buildInfoForSingleTestFile('''
 int a = null;
diff --git a/pkg/vm/lib/target/dart_runner.dart b/pkg/vm/lib/target/dart_runner.dart
index fc814ac..928863c 100644
--- a/pkg/vm/lib/target/dart_runner.dart
+++ b/pkg/vm/lib/target/dart_runner.dart
@@ -35,7 +35,6 @@
         'dart:typed_data',
         'dart:nativewrappers',
         'dart:io',
-        'dart:wasm',
 
         // Required for dart_runner.
         'dart:fuchsia.builtin',
diff --git a/pkg/vm/lib/target/flutter.dart b/pkg/vm/lib/target/flutter.dart
index dc3b107..7746e98 100644
--- a/pkg/vm/lib/target/flutter.dart
+++ b/pkg/vm/lib/target/flutter.dart
@@ -41,7 +41,6 @@
         'dart:typed_data',
         'dart:nativewrappers',
         'dart:io',
-        'dart:wasm',
 
         // Required for flutter.
         'dart:ui',
diff --git a/pkg/vm/lib/target/flutter_runner.dart b/pkg/vm/lib/target/flutter_runner.dart
index 816c030..9a2b477 100644
--- a/pkg/vm/lib/target/flutter_runner.dart
+++ b/pkg/vm/lib/target/flutter_runner.dart
@@ -35,7 +35,6 @@
         'dart:typed_data',
         'dart:nativewrappers',
         'dart:io',
-        'dart:wasm',
 
         // Required for flutter_runner.
         'dart:fuchsia.builtin',
diff --git a/pkg/vm/lib/target/vm.dart b/pkg/vm/lib/target/vm.dart
index 3df5836..c5c5f57 100644
--- a/pkg/vm/lib/target/vm.dart
+++ b/pkg/vm/lib/target/vm.dart
@@ -90,7 +90,6 @@
         'dart:nativewrappers',
         'dart:io',
         'dart:cli',
-        'dart:wasm',
       ];
 
   @override
diff --git a/pkg/vm/testcases/transformations/deferred_loading/main.dart.expect b/pkg/vm/testcases/transformations/deferred_loading/main.dart.expect
index e069735..7c07613 100644
--- a/pkg/vm/testcases/transformations/deferred_loading/main.dart.expect
+++ b/pkg/vm/testcases/transformations/deferred_loading/main.dart.expect
@@ -4,7 +4,6 @@
   #lib
   dart:_http
   dart:core
-  dart:wasm
   dart:cli
   dart:io
   dart:nativewrappers
diff --git a/runtime/lib/wasm.cc b/runtime/lib/wasm.cc
deleted file mode 100644
index 639c72a..0000000
--- a/runtime/lib/wasm.cc
+++ /dev/null
@@ -1,1045 +0,0 @@
-// Copyright (c) 2019, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-#ifdef DART_ENABLE_WASM
-
-#include <memory>
-#include <sstream>
-
-#include "platform/unicode.h"
-#include "third_party/wasmer/wasmer.hh"
-#include "vm/bootstrap_natives.h"
-#include "vm/dart_api_state.h"
-#include "vm/dart_entry.h"
-#include "vm/exceptions.h"
-
-namespace dart {
-
-static void ThrowWasmerError() {
-  String& error = String::Handle();
-  {
-    int len = wasmer_last_error_length();
-    auto raw_error = std::unique_ptr<char[]>(new char[len]);
-    int read_len = wasmer_last_error_message(raw_error.get(), len);
-    ASSERT(read_len == len);
-    error = String::NewFormatted("Wasmer error: %s", raw_error.get());
-  }
-  Exceptions::ThrowArgumentError(error);
-  UNREACHABLE();
-}
-
-template <typename T>
-static void Finalize(void* isolate_callback_data,
-                     Dart_WeakPersistentHandle handle,
-                     void* peer) {
-  delete reinterpret_cast<T*>(peer);
-}
-
-static void FinalizeWasmModule(void* isolate_callback_data,
-                               Dart_WeakPersistentHandle handle,
-                               void* module) {
-  wasmer_module_destroy(reinterpret_cast<wasmer_module_t*>(module));
-}
-
-static void FinalizeWasmMemory(void* isolate_callback_data,
-                               Dart_WeakPersistentHandle handle,
-                               void* memory) {
-  wasmer_memory_destroy(reinterpret_cast<wasmer_memory_t*>(memory));
-}
-
-static std::unique_ptr<char[]> ToUTF8(const String& str) {
-  const intptr_t str_size = Utf8::Length(str);
-  auto str_raw = std::unique_ptr<char[]>(new char[str_size + 1]);
-  str.ToUTF8(reinterpret_cast<uint8_t*>(str_raw.get()), str_size);
-  str_raw[str_size] = '\0';
-  return str_raw;
-}
-
-static bool ToWasmValue(const Number& value,
-                        classid_t type,
-                        wasmer_value_t* out) {
-  switch (type) {
-    case kWasmInt32Cid:
-      if (!value.IsInteger()) return false;
-      out->tag = wasmer_value_tag::WASM_I32;
-      out->value.I32 = Integer::Cast(value).AsInt64Value();
-      return true;
-    case kWasmInt64Cid:
-      if (!value.IsInteger()) return false;
-      out->tag = wasmer_value_tag::WASM_I64;
-      out->value.I64 = Integer::Cast(value).AsInt64Value();
-      return true;
-    case kWasmFloatCid:
-      if (!value.IsDouble()) return false;
-      out->tag = wasmer_value_tag::WASM_F32;
-      out->value.F32 = Double::Cast(value).value();
-      return true;
-    case kWasmDoubleCid:
-      if (!value.IsDouble()) return false;
-      out->tag = wasmer_value_tag::WASM_F64;
-      out->value.F64 = Double::Cast(value).value();
-      return true;
-    default:
-      return false;
-  }
-}
-
-static Dart_Handle ToWasmValue(Dart_Handle value,
-                               wasmer_value_tag type,
-                               wasmer_value* out) {
-  switch (type) {
-    case wasmer_value_tag::WASM_I32: {
-      int64_t i64;
-      Dart_Handle result = Dart_IntegerToInt64(value, &i64);
-      out->I32 = i64;
-      if (out->I32 != i64) {
-        return Dart_NewApiError("Int doesn't fit into 32-bits");
-      }
-      return result;
-    }
-    case wasmer_value_tag::WASM_I64:
-      return Dart_IntegerToInt64(value, &out->I64);
-    case wasmer_value_tag::WASM_F32: {
-      double f64;
-      Dart_Handle result = Dart_DoubleValue(value, &f64);
-      out->F32 = f64;
-      return result;
-    }
-    case wasmer_value_tag::WASM_F64:
-      return Dart_DoubleValue(value, &out->F64);
-    default:
-      FATAL("Unknown WASM type");
-      return nullptr;
-  }
-}
-
-static bool ToWasmValueTag(classid_t type, wasmer_value_tag* out) {
-  switch (type) {
-    case kWasmInt32Cid:
-      *out = wasmer_value_tag::WASM_I32;
-      return true;
-    case kWasmInt64Cid:
-      *out = wasmer_value_tag::WASM_I64;
-      return true;
-    case kWasmFloatCid:
-      *out = wasmer_value_tag::WASM_F32;
-      return true;
-    case kWasmDoubleCid:
-      *out = wasmer_value_tag::WASM_F64;
-      return true;
-    default:
-      return false;
-  }
-}
-
-static ObjectPtr ToDartObject(wasmer_value_t ret) {
-  switch (ret.tag) {
-    case wasmer_value_tag::WASM_I32:
-      return Integer::New(ret.value.I32);
-    case wasmer_value_tag::WASM_I64:
-      return Integer::New(ret.value.I64);
-    case wasmer_value_tag::WASM_F32:
-      return Double::New(ret.value.F32);
-    case wasmer_value_tag::WASM_F64:
-      return Double::New(ret.value.F64);
-    default:
-      FATAL("Unknown WASM type");
-      return nullptr;
-  }
-}
-
-static Dart_Handle ToDartApiObject(wasmer_value value, wasmer_value_tag type) {
-  switch (type) {
-    case wasmer_value_tag::WASM_I32:
-      return Dart_NewInteger(value.I32);
-    case wasmer_value_tag::WASM_I64:
-      return Dart_NewInteger(value.I64);
-    case wasmer_value_tag::WASM_F32:
-      return Dart_NewDouble(value.F32);
-    case wasmer_value_tag::WASM_F64:
-      return Dart_NewDouble(value.F64);
-    default:
-      FATAL("Unknown WASM type");
-      return nullptr;
-  }
-}
-
-ExternalTypedDataPtr WasmMemoryToExternalTypedData(wasmer_memory_t* memory) {
-  uint8_t* data = wasmer_memory_data(memory);
-  uint32_t size = wasmer_memory_data_length(memory);
-  return ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, data, size);
-}
-
-std::ostream& operator<<(std::ostream& o, const wasmer_byte_array& str) {
-  for (uint32_t i = 0; i < str.bytes_len; ++i) {
-    o << str.bytes[i];
-  }
-  return o;
-}
-
-std::ostream& operator<<(std::ostream& o, const wasmer_import_export_kind& io) {
-  switch (io) {
-    case wasmer_import_export_kind::WASM_FUNCTION:
-      return o << "WASM_FUNCTION";
-    case wasmer_import_export_kind::WASM_GLOBAL:
-      return o << "WASM_GLOBAL";
-    case wasmer_import_export_kind::WASM_MEMORY:
-      return o << "WASM_MEMORY";
-    case wasmer_import_export_kind::WASM_TABLE:
-      return o << "WASM_TABLE";
-  }
-}
-
-StringPtr DescribeModule(const wasmer_module_t* module) {
-  std::stringstream desc;
-
-  desc << "Imports:\n";
-  wasmer_import_descriptors_t* imports;
-  wasmer_import_descriptors(module, &imports);
-  unsigned num_imports = wasmer_import_descriptors_len(imports);
-  for (unsigned i = 0; i < num_imports; ++i) {
-    wasmer_import_descriptor_t* imp = wasmer_import_descriptors_get(imports, i);
-    desc << "\t" << wasmer_import_descriptor_module_name(imp);
-    desc << "\t" << wasmer_import_descriptor_name(imp);
-    desc << "\t" << wasmer_import_descriptor_kind(imp);
-    desc << "\n";
-  }
-  wasmer_import_descriptors_destroy(imports);
-
-  desc << "\nExports:\n";
-  wasmer_export_descriptors_t* exports;
-  wasmer_export_descriptors(module, &exports);
-  unsigned num_exports = wasmer_export_descriptors_len(exports);
-  for (unsigned i = 0; i < num_exports; ++i) {
-    wasmer_export_descriptor_t* exp = wasmer_export_descriptors_get(exports, i);
-    desc << "\t" << wasmer_export_descriptor_name(exp);
-    desc << "\t" << wasmer_export_descriptor_kind(exp);
-    desc << "\n";
-  }
-  wasmer_export_descriptors_destroy(exports);
-
-  return String::New(desc.str().c_str());
-}
-
-class WasmImports;
-
-struct WasmFunctionImport {
-  WasmImports* imports;
-  std::unique_ptr<wasmer_value_tag[]> args;
-  intptr_t num_args;
-  wasmer_value_tag ret;
-  intptr_t num_rets;
-  int64_t fn_id;
-  wasmer_import_func_t* wasm_fn;
-  wasmer_trampoline_buffer_t* buffer;
-  WasmFunctionImport(WasmImports* imports_,
-                     std::unique_ptr<wasmer_value_tag[]> args_,
-                     intptr_t num_args_,
-                     wasmer_value_tag ret_,
-                     intptr_t num_rets_,
-                     int64_t fn_id_)
-      : imports(imports_),
-        args(std::move(args_)),
-        num_args(num_args_),
-        ret(ret_),
-        num_rets(num_rets_),
-        fn_id(fn_id_),
-        wasm_fn(nullptr),
-        buffer(nullptr) {}
-  ~WasmFunctionImport() {
-    wasmer_trampoline_buffer_destroy(buffer);
-    wasmer_import_func_destroy(wasm_fn);
-  }
-};
-
-extern "C" {
-int64_t Trampoline(void* context, int64_t* args);
-}
-
-class WasmImports {
- public:
-  WasmImports() {}
-
-  ~WasmImports() {
-    for (wasmer_global_t* global : _globals) {
-      wasmer_global_destroy(global);
-    }
-    for (WasmFunctionImport* fn_imp : _functions) {
-      delete fn_imp;
-    }
-    for (const char* name : _import_names) {
-      delete[] name;
-    }
-  }
-
-  void SetHandle(FinalizablePersistentHandle* handle) { _handle = handle; }
-  size_t NumImports() const { return _imports.length(); }
-  wasmer_import_t* RawImports() { return _imports.data(); }
-
-  void AddMemory(std::unique_ptr<char[]> module_name,
-                 std::unique_ptr<char[]> name,
-                 wasmer_memory_t* memory) {
-    AddImport(std::move(module_name), std::move(name),
-              wasmer_import_export_kind::WASM_MEMORY)
-        ->memory = memory;
-  }
-
-  void AddGlobal(std::unique_ptr<char[]> module_name,
-                 std::unique_ptr<char[]> name,
-                 wasmer_value_t value,
-                 bool mutable_) {
-    wasmer_global_t* global = wasmer_global_new(value, mutable_);
-    _globals.Add(global);
-    AddImport(std::move(module_name), std::move(name),
-              wasmer_import_export_kind::WASM_GLOBAL)
-        ->global = global;
-  }
-
-  void AddFunction(std::unique_ptr<char[]> module_name,
-                   std::unique_ptr<char[]> name,
-                   int64_t fn_id,
-                   std::unique_ptr<wasmer_value_tag[]> args,
-                   intptr_t num_args,
-                   wasmer_value_tag ret,
-                   intptr_t num_rets) {
-    // Trampoline args include the context pointer.
-    const intptr_t num_trampoline_args = num_args + 1;
-
-    WasmFunctionImport* fn_imp = new WasmFunctionImport(
-        this, std::move(args), num_args, ret, num_rets, fn_id);
-    _functions.Add(fn_imp);
-
-    wasmer_trampoline_buffer_builder_t* builder =
-        wasmer_trampoline_buffer_builder_new();
-    uintptr_t trampoline_id =
-        wasmer_trampoline_buffer_builder_add_callinfo_trampoline(
-            builder,
-            reinterpret_cast<wasmer_trampoline_callable_t*>(Trampoline),
-            reinterpret_cast<void*>(fn_imp), num_trampoline_args);
-    fn_imp->buffer = wasmer_trampoline_buffer_builder_build(builder);
-
-    const wasmer_trampoline_callable_t* trampoline =
-        wasmer_trampoline_buffer_get_trampoline(fn_imp->buffer, trampoline_id);
-    fn_imp->wasm_fn = wasmer_import_func_new(
-        reinterpret_cast<void (*)(void*)>(
-            const_cast<wasmer_trampoline_callable_t*>(trampoline)),
-        fn_imp->args.get(), num_args, &ret, num_rets);
-
-    AddImport(std::move(module_name), std::move(name),
-              wasmer_import_export_kind::WASM_FUNCTION)
-        ->func = fn_imp->wasm_fn;
-  }
-
-  int64_t CallImportedFunction(WasmFunctionImport* fn_imp, int64_t* raw_args) {
-    wasmer_value* wasm_args = reinterpret_cast<wasmer_value*>(raw_args);
-    Dart_Handle inst = Dart_HandleFromWeakPersistent(_handle->apiHandle());
-    Dart_Handle dart_args[2] = {
-        inst,
-        Dart_NewInteger(fn_imp->fn_id),
-    };
-    Dart_Handle closure = Dart_Invoke(Dart_InstanceGetType(inst),
-                                      Dart_NewStringFromCString("getFunction"),
-                                      ARRAY_SIZE(dart_args), dart_args);
-    if (Dart_IsError(closure)) {
-      Dart_ThrowException(closure);
-      UNREACHABLE();
-    }
-    Dart_Handle result;
-    {
-      auto args =
-          std::unique_ptr<Dart_Handle[]>(new Dart_Handle[fn_imp->num_args]);
-      for (intptr_t i = 0; i < fn_imp->num_args; ++i) {
-        args[i] = ToDartApiObject(wasm_args[i], fn_imp->args[i]);
-      }
-      result = Dart_InvokeClosure(closure, fn_imp->num_args, args.get());
-    }
-    if (Dart_IsError(result)) {
-      Dart_ThrowException(result);
-      UNREACHABLE();
-    }
-    if (fn_imp->num_rets == 0) {
-      // Wasmer ignores the result of this function if it expects no results,
-      // so skip the converters below (we get errors if we run them).
-      return 0;
-    }
-    wasmer_value wasm_result;
-    result = ToWasmValue(result, fn_imp->ret, &wasm_result);
-    if (Dart_IsError(result)) {
-      Dart_ThrowException(result);
-      UNREACHABLE();
-    }
-    return wasm_result.I64;
-  }
-
- private:
-  FinalizablePersistentHandle* _handle;
-  MallocGrowableArray<const char*> _import_names;
-  MallocGrowableArray<wasmer_global_t*> _globals;
-  MallocGrowableArray<WasmFunctionImport*> _functions;
-  MallocGrowableArray<wasmer_import_t> _imports;
-
-  wasmer_import_export_value* AddImport(std::unique_ptr<char[]> module_name,
-                                        std::unique_ptr<char[]> name,
-                                        wasmer_import_export_kind tag) {
-    wasmer_import_t import;
-    import.module_name.bytes =
-        reinterpret_cast<const uint8_t*>(module_name.get());
-    import.module_name.bytes_len = (uint32_t)strlen(module_name.get());
-    import.import_name.bytes = reinterpret_cast<const uint8_t*>(name.get());
-    import.import_name.bytes_len = (uint32_t)strlen(name.get());
-    import.tag = tag;
-    _import_names.Add(module_name.release());
-    _import_names.Add(name.release());
-    _imports.Add(import);
-    return &_imports.Last().value;
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(WasmImports);
-};
-
-extern "C" {
-int64_t Trampoline(void* context, int64_t* args) {
-  WasmFunctionImport* fn_imp = reinterpret_cast<WasmFunctionImport*>(context);
-  // Skip the first arg (it's another context pointer).
-  return fn_imp->imports->CallImportedFunction(fn_imp, args + 1);
-}
-}
-
-class WasmFunction {
- public:
-  WasmFunction(MallocGrowableArray<classid_t> args,
-               classid_t ret,
-               const wasmer_export_func_t* fn)
-      : _args(std::move(args)), _ret(ret), _fn(fn) {}
-  bool IsVoid() const { return _ret == kWasmVoidCid; }
-  const MallocGrowableArray<classid_t>& args() const { return _args; }
-
-  bool SignatureMatches(const MallocGrowableArray<classid_t>& dart_args,
-                        classid_t dart_ret) {
-    if (dart_args.length() != _args.length()) {
-      return false;
-    }
-    for (intptr_t i = 0; i < dart_args.length(); ++i) {
-      if (dart_args[i] != _args[i]) {
-        return false;
-      }
-    }
-    return dart_ret == _ret;
-  }
-
-  wasmer_result_t Call(const wasmer_value_t* params, wasmer_value_t* result) {
-    return wasmer_export_func_call(_fn, params, _args.length(), result,
-                                   IsVoid() ? 0 : 1);
-  }
-
-  void Print(std::ostream& o, const char* name) const {
-    PrintDartType(o, _ret);
-    o << ' ' << name << '(';
-    for (intptr_t i = 0; i < _args.length(); ++i) {
-      if (i > 0) o << ", ";
-      PrintDartType(o, _args[i]);
-    }
-    o << ')';
-  }
-
- private:
-  MallocGrowableArray<classid_t> _args;
-  const classid_t _ret;
-  const wasmer_export_func_t* _fn;
-
-  static void PrintDartType(std::ostream& o, classid_t type) {
-    switch (type) {
-      case kWasmInt32Cid:
-        o << "i32";
-        break;
-      case kWasmInt64Cid:
-        o << "i64";
-        break;
-      case kWasmFloatCid:
-        o << "f32";
-        break;
-      case kWasmDoubleCid:
-        o << "f64";
-        break;
-      case kWasmVoidCid:
-        o << "void";
-        break;
-    }
-  }
-};
-
-class WasmInstance {
- public:
-  WasmInstance() : _instance(nullptr), _exports(nullptr), _memory(nullptr) {}
-
-  bool Instantiate(wasmer_module_t* module, WasmImports* imports) {
-    ASSERT(_instance == nullptr);
-
-    // Instantiate module.
-    if (wasmer_module_instantiate(module, &_instance, imports->RawImports(),
-                                  imports->NumImports()) !=
-        wasmer_result_t::WASMER_OK) {
-      return false;
-    }
-
-    // Load all exports.
-    wasmer_instance_exports(_instance, &_exports);
-    intptr_t num_exports = wasmer_exports_len(_exports);
-    for (intptr_t i = 0; i < num_exports; ++i) {
-      wasmer_export_t* exp = wasmer_exports_get(_exports, i);
-      wasmer_import_export_kind kind = wasmer_export_kind(exp);
-      if (kind == wasmer_import_export_kind::WASM_FUNCTION) {
-        if (!AddFunction(exp)) {
-          return false;
-        }
-      } else if (kind == wasmer_import_export_kind::WASM_MEMORY) {
-        ASSERT(_memory == nullptr);
-        if (wasmer_export_to_memory(exp, &_memory) !=
-            wasmer_result_t::WASMER_OK) {
-          return false;
-        }
-      }
-    }
-
-    return true;
-  }
-
-  ~WasmInstance() {
-    auto it = _functions.GetIterator();
-    for (auto* kv = it.Next(); kv; kv = it.Next()) {
-      delete[] kv->key;
-      delete kv->value;
-    }
-    if (_exports != nullptr) {
-      wasmer_exports_destroy(_exports);
-    }
-    if (_instance != nullptr) {
-      wasmer_instance_destroy(_instance);
-    }
-  }
-
-  WasmFunction* GetFunction(const char* name,
-                            const MallocGrowableArray<classid_t>& dart_args,
-                            classid_t dart_ret,
-                            String* error) {
-    WasmFunction* fn = _functions.LookupValue(name);
-    if (fn == nullptr) {
-      *error = String::NewFormatted(
-          "Couldn't find a function called %s in the WASM module's exports",
-          name);
-      return nullptr;
-    }
-    if (!fn->SignatureMatches(dart_args, dart_ret)) {
-      std::stringstream sig;
-      fn->Print(sig, name);
-      *error = String::NewFormatted("Function signature doesn't match: %s",
-                                    sig.str().c_str());
-      return nullptr;
-    }
-    return fn;
-  }
-
-  void PrintFunctions(std::ostream& o) const {
-    o << '{' << std::endl;
-    auto it = _functions.GetIterator();
-    for (auto* kv = it.Next(); kv; kv = it.Next()) {
-      kv->value->Print(o, kv->key);
-      o << std::endl;
-    }
-    o << '}' << std::endl;
-  }
-
-  wasmer_memory_t* memory() { return _memory; }
-
- private:
-  wasmer_instance_t* _instance;
-  wasmer_exports_t* _exports;
-  MallocDirectChainedHashMap<CStringKeyValueTrait<WasmFunction*>> _functions;
-  wasmer_memory_t* _memory;
-
-  static classid_t ToDartType(wasmer_value_tag wasm_type) {
-    switch (wasm_type) {
-      case wasmer_value_tag::WASM_I32:
-        return kWasmInt32Cid;
-      case wasmer_value_tag::WASM_I64:
-        return kWasmInt64Cid;
-      case wasmer_value_tag::WASM_F32:
-        return kWasmFloatCid;
-      case wasmer_value_tag::WASM_F64:
-        return kWasmDoubleCid;
-    }
-    FATAL("Unknown WASM type");
-    return 0;
-  }
-
-  bool AddFunction(wasmer_export_t* exp) {
-    const wasmer_export_func_t* fn = wasmer_export_to_func(exp);
-
-    uint32_t num_rets;
-    if (wasmer_export_func_returns_arity(fn, &num_rets) !=
-        wasmer_result_t::WASMER_OK) {
-      return false;
-    }
-    ASSERT(num_rets <= 1);
-    wasmer_value_tag wasm_ret;
-    if (wasmer_export_func_returns(fn, &wasm_ret, num_rets) !=
-        wasmer_result_t::WASMER_OK) {
-      return false;
-    }
-    classid_t ret = num_rets == 0 ? kWasmVoidCid : ToDartType(wasm_ret);
-
-    uint32_t num_args;
-    if (wasmer_export_func_params_arity(fn, &num_args) !=
-        wasmer_result_t::WASMER_OK) {
-      return false;
-    }
-    auto wasm_args =
-        std::unique_ptr<wasmer_value_tag[]>(new wasmer_value_tag[num_args]);
-    if (wasmer_export_func_params(fn, wasm_args.get(), num_args) !=
-        wasmer_result_t::WASMER_OK) {
-      return false;
-    }
-    MallocGrowableArray<classid_t> args;
-    for (intptr_t i = 0; i < num_args; ++i) {
-      args.Add(ToDartType(wasm_args[i]));
-    }
-
-    wasmer_byte_array name_bytes = wasmer_export_name(exp);
-    char* name = new char[name_bytes.bytes_len + 1];
-    for (size_t i = 0; i < name_bytes.bytes_len; ++i) {
-      name[i] = name_bytes.bytes[i];
-    }
-    name[name_bytes.bytes_len] = '\0';
-
-    _functions.Insert({name, new WasmFunction(std::move(args), ret, fn)});
-    return true;
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(WasmInstance);
-};
-
-DEFINE_NATIVE_ENTRY(Wasm_initModule, 0, 2) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, mod_wrap, arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(TypedDataBase, data, arguments->NativeArgAt(1));
-
-  ASSERT(mod_wrap.NumNativeFields() == 1);
-
-  std::unique_ptr<uint8_t[]> data_copy;
-  intptr_t len;
-  {
-    NoSafepointScope scope(thread);
-    len = data.LengthInBytes();
-    data_copy = std::unique_ptr<uint8_t[]>(new uint8_t[len]);
-    // The memory does not overlap.
-    memcpy(data_copy.get(), data.DataAddr(0), len);  // NOLINT
-  }
-
-  wasmer_module_t* module;
-  wasmer_result_t result;
-  {
-    TransitionVMToNative transition(thread);
-    result = wasmer_compile(&module, data_copy.get(), len);
-  }
-  if (result != wasmer_result_t::WASMER_OK) {
-    data_copy.reset();
-    ThrowWasmerError();
-    UNREACHABLE();
-  }
-
-  mod_wrap.SetNativeField(0, reinterpret_cast<intptr_t>(module));
-  FinalizablePersistentHandle::New(thread->isolate(), mod_wrap, module,
-                                   FinalizeWasmModule, len);
-
-  return Object::null();
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_describeModule, 0, 1) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, mod_wrap, arguments->NativeArgAt(0));
-
-  ASSERT(mod_wrap.NumNativeFields() == 1);
-
-  wasmer_module_t* module =
-      reinterpret_cast<wasmer_module_t*>(mod_wrap.GetNativeField(0));
-
-  return DescribeModule(module);
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_initImports, 0, 1) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, imp_wrap, arguments->NativeArgAt(0));
-
-  ASSERT(imp_wrap.NumNativeFields() == 1);
-
-  WasmImports* imports = new WasmImports();
-
-  imp_wrap.SetNativeField(0, reinterpret_cast<intptr_t>(imports));
-  imports->SetHandle(FinalizablePersistentHandle::New(
-      thread->isolate(), imp_wrap, imports, Finalize<WasmImports>,
-      sizeof(WasmImports)));
-
-  return Object::null();
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_addMemoryImport, 0, 4) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, imp_wrap, arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(String, module_name, arguments->NativeArgAt(1));
-  GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(2));
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, mem_wrap, arguments->NativeArgAt(3));
-
-  ASSERT(imp_wrap.NumNativeFields() == 1);
-  ASSERT(mem_wrap.NumNativeFields() == 1);
-
-  WasmImports* imports =
-      reinterpret_cast<WasmImports*>(imp_wrap.GetNativeField(0));
-  wasmer_memory_t* memory =
-      reinterpret_cast<wasmer_memory_t*>(mem_wrap.GetNativeField(0));
-
-  imports->AddMemory(ToUTF8(module_name), ToUTF8(name), memory);
-
-  return Object::null();
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_addGlobalImport, 0, 6) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, imp_wrap, arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(String, module_name, arguments->NativeArgAt(1));
-  GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(2));
-  GET_NON_NULL_NATIVE_ARGUMENT(Number, value, arguments->NativeArgAt(3));
-  GET_NON_NULL_NATIVE_ARGUMENT(Type, type, arguments->NativeArgAt(4));
-  GET_NON_NULL_NATIVE_ARGUMENT(Bool, mutable_, arguments->NativeArgAt(5));
-
-  ASSERT(imp_wrap.NumNativeFields() == 1);
-
-  WasmImports* imports =
-      reinterpret_cast<WasmImports*>(imp_wrap.GetNativeField(0));
-  wasmer_value_t wasm_value;
-  if (!ToWasmValue(value, type.type_class_id(), &wasm_value)) {
-    Exceptions::ThrowArgumentError(String::Handle(
-        zone, String::NewFormatted(
-                  "Can't convert dart value to WASM global variable")));
-    UNREACHABLE();
-  }
-
-  imports->AddGlobal(ToUTF8(module_name), ToUTF8(name), wasm_value,
-                     mutable_.value());
-
-  return Object::null();
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_addFunctionImport, 0, 5) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, imp_wrap, arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(String, module_name, arguments->NativeArgAt(1));
-  GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(2));
-  GET_NON_NULL_NATIVE_ARGUMENT(Integer, fn_id, arguments->NativeArgAt(3));
-  GET_NON_NULL_NATIVE_ARGUMENT(Type, fn_type, arguments->NativeArgAt(4));
-
-  ASSERT(imp_wrap.NumNativeFields() == 1);
-
-  Function& sig = Function::Handle(zone, fn_type.signature());
-
-  classid_t ret = AbstractType::Handle(zone, sig.result_type()).type_class_id();
-  intptr_t num_rets = ret == kWasmVoidCid ? 0 : 1;
-  wasmer_value_tag wasm_ret = wasmer_value_tag::WASM_I64;
-  if (num_rets != 0) {
-    if (!ToWasmValueTag(ret, &wasm_ret)) {
-      Exceptions::ThrowArgumentError(String::Handle(
-          zone, String::NewFormatted("Return type is not a valid WASM type")));
-      UNREACHABLE();
-    }
-  }
-
-  Array& args = Array::Handle(zone, sig.parameter_types());
-  AbstractType& arg_type = AbstractType::Handle(zone);
-  intptr_t first_arg_index = sig.NumImplicitParameters();
-  intptr_t num_args = args.Length() - first_arg_index;
-  auto wasm_args =
-      std::unique_ptr<wasmer_value_tag[]>(new wasmer_value_tag[num_args]);
-  for (intptr_t i = 0; i < num_args; ++i) {
-    arg_type ^= args.At(i + first_arg_index);
-    classid_t dart_arg = arg_type.type_class_id();
-    if (!ToWasmValueTag(dart_arg, &wasm_args[i])) {
-      wasm_args.reset();
-      Exceptions::ThrowArgumentError(String::Handle(
-          zone, String::NewFormatted(
-                    "Type of arg %" Pd " is not a valid WASM type", i)));
-      UNREACHABLE();
-    }
-  }
-
-  WasmImports* imports =
-      reinterpret_cast<WasmImports*>(imp_wrap.GetNativeField(0));
-  imports->AddFunction(ToUTF8(module_name), ToUTF8(name), fn_id.AsInt64Value(),
-                       std::move(wasm_args), num_args, wasm_ret, num_rets);
-
-  return Object::null();
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_initMemory, 0, 3) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, mem_wrap, arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(Integer, init, arguments->NativeArgAt(1));
-  GET_NATIVE_ARGUMENT(Integer, max, arguments->NativeArgAt(2));
-
-  ASSERT(mem_wrap.NumNativeFields() == 1);
-  const int64_t init_size = init.AsInt64Value();
-
-  wasmer_memory_t* memory;
-  wasmer_limits_t descriptor;
-  descriptor.min = init_size;
-  if (max.IsNull()) {
-    descriptor.max.has_some = false;
-  } else {
-    descriptor.max.has_some = true;
-    descriptor.max.some = max.AsInt64Value();
-  }
-  if (wasmer_memory_new(&memory, descriptor) != wasmer_result_t::WASMER_OK) {
-    ThrowWasmerError();
-    UNREACHABLE();
-  }
-  mem_wrap.SetNativeField(0, reinterpret_cast<intptr_t>(memory));
-  FinalizablePersistentHandle::New(thread->isolate(), mem_wrap, memory,
-                                   FinalizeWasmMemory, init_size);
-  return WasmMemoryToExternalTypedData(memory);
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_growMemory, 0, 2) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, mem_wrap, arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(Integer, delta, arguments->NativeArgAt(1));
-
-  ASSERT(mem_wrap.NumNativeFields() == 1);
-
-  wasmer_memory_t* memory =
-      reinterpret_cast<wasmer_memory_t*>(mem_wrap.GetNativeField(0));
-  if (wasmer_memory_grow(memory, delta.AsInt64Value()) !=
-      wasmer_result_t::WASMER_OK) {
-    ThrowWasmerError();
-    UNREACHABLE();
-  }
-  return WasmMemoryToExternalTypedData(memory);
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_initInstance, 0, 3) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, inst_wrap, arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, mod_wrap, arguments->NativeArgAt(1));
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, imp_wrap, arguments->NativeArgAt(2));
-
-  ASSERT(inst_wrap.NumNativeFields() == 1);
-  ASSERT(mod_wrap.NumNativeFields() == 1);
-  ASSERT(imp_wrap.NumNativeFields() == 1);
-
-  wasmer_module_t* module =
-      reinterpret_cast<wasmer_module_t*>(mod_wrap.GetNativeField(0));
-  WasmImports* imports =
-      reinterpret_cast<WasmImports*>(imp_wrap.GetNativeField(0));
-
-  WasmInstance* inst = nullptr;
-  {
-    TransitionVMToNative transition(thread);
-    inst = new WasmInstance();
-    if (!inst->Instantiate(module, imports)) {
-      delete inst;
-      inst = nullptr;
-    }
-  }
-  if (inst == nullptr) {
-    ThrowWasmerError();
-    UNREACHABLE();
-  }
-
-  inst_wrap.SetNativeField(0, reinterpret_cast<intptr_t>(inst));
-  FinalizablePersistentHandle::New(thread->isolate(), inst_wrap, inst,
-                                   Finalize<WasmInstance>,
-                                   sizeof(WasmInstance));
-
-  return Object::null();
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_initMemoryFromInstance, 0, 2) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, mem_wrap, arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, inst_wrap, arguments->NativeArgAt(1));
-
-  ASSERT(mem_wrap.NumNativeFields() == 1);
-  ASSERT(inst_wrap.NumNativeFields() == 1);
-
-  WasmInstance* inst =
-      reinterpret_cast<WasmInstance*>(inst_wrap.GetNativeField(0));
-
-  wasmer_memory_t* memory = inst->memory();
-
-  mem_wrap.SetNativeField(0, reinterpret_cast<intptr_t>(memory));
-  FinalizablePersistentHandle::New(thread->isolate(), mem_wrap, memory,
-                                   FinalizeWasmMemory,
-                                   wasmer_memory_length(memory));
-  return WasmMemoryToExternalTypedData(memory);
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_getMemoryPages, 0, 1) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, mem_wrap, arguments->NativeArgAt(0));
-
-  ASSERT(mem_wrap.NumNativeFields() == 1);
-
-  wasmer_memory_t* memory =
-      reinterpret_cast<wasmer_memory_t*>(mem_wrap.GetNativeField(0));
-
-  return Integer::New(wasmer_memory_length(memory));
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_initFunction, 0, 4) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, fn_wrap, arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, inst_wrap, arguments->NativeArgAt(1));
-  GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(2));
-  GET_NON_NULL_NATIVE_ARGUMENT(Type, fn_type, arguments->NativeArgAt(3));
-
-  ASSERT(fn_wrap.NumNativeFields() == 1);
-  ASSERT(inst_wrap.NumNativeFields() == 1);
-
-  WasmInstance* inst =
-      reinterpret_cast<WasmInstance*>(inst_wrap.GetNativeField(0));
-
-  WasmFunction* fn;
-  String& error = String::Handle(zone);
-
-  {
-    Function& sig = Function::Handle(zone, fn_type.signature());
-    Array& args = Array::Handle(zone, sig.parameter_types());
-    AbstractType& arg_type = AbstractType::Handle(zone);
-    MallocGrowableArray<classid_t> dart_args;
-    for (intptr_t i = sig.NumImplicitParameters(); i < args.Length(); ++i) {
-      arg_type ^= args.At(i);
-      dart_args.Add(arg_type.type_class_id());
-    }
-    classid_t dart_ret =
-        AbstractType::Handle(zone, sig.result_type()).type_class_id();
-
-    std::unique_ptr<char[]> name_raw = ToUTF8(name);
-    fn = inst->GetFunction(name_raw.get(), dart_args, dart_ret, &error);
-  }
-
-  if (fn == nullptr) {
-    Exceptions::ThrowArgumentError(error);
-    UNREACHABLE();
-  }
-
-  fn_wrap.SetNativeField(0, reinterpret_cast<intptr_t>(fn));
-  // Don't need a finalizer because WasmFunctions are owned their WasmInstance.
-
-  return Object::null();
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_callFunction, 0, 2) {
-  GET_NON_NULL_NATIVE_ARGUMENT(Instance, fn_wrap, arguments->NativeArgAt(0));
-  GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(1));
-
-  ASSERT(fn_wrap.NumNativeFields() == 1);
-  WasmFunction* fn = reinterpret_cast<WasmFunction*>(fn_wrap.GetNativeField(0));
-
-  if (args.Length() != fn->args().length()) {
-    Exceptions::ThrowArgumentError(String::Handle(
-        zone, String::NewFormatted("Wrong number of args. Expected %" Pu
-                                   " but found %" Pd ".",
-                                   fn->args().length(), args.Length())));
-    UNREACHABLE();
-  }
-  auto params = std::unique_ptr<wasmer_value_t[]>(
-      new wasmer_value_t[fn->args().length()]);
-  Number& arg_num = Number::Handle(zone);
-  for (intptr_t i = 0; i < args.Length(); ++i) {
-    arg_num ^= args.At(i);
-    if (!ToWasmValue(arg_num, fn->args()[i], &params[i])) {
-      params.reset();
-      Exceptions::ThrowArgumentError(String::Handle(
-          zone, String::NewFormatted("Arg %" Pd " is the wrong type.", i)));
-      UNREACHABLE();
-    }
-  }
-
-  wasmer_value_t ret;
-  wasmer_result_t result;
-  {
-    TransitionVMToNative transition(thread);
-    result = fn->Call(params.get(), &ret);
-  }
-  if (result != wasmer_result_t::WASMER_OK) {
-    params.reset();
-    ThrowWasmerError();
-    UNREACHABLE();
-  }
-  return fn->IsVoid() ? Object::null() : ToDartObject(ret);
-}
-
-}  // namespace dart
-
-#else  // DART_ENABLE_WASM
-
-#include "vm/bootstrap_natives.h"
-#include "vm/dart_entry.h"
-#include "vm/exceptions.h"
-
-namespace dart {
-
-DEFINE_NATIVE_ENTRY(Wasm_initModule, 0, 2) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_describeModule, 0, 1) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_initImports, 0, 1) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_addMemoryImport, 0, 4) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_addGlobalImport, 0, 6) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_addFunctionImport, 0, 5) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_initMemory, 0, 3) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_growMemory, 0, 3) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_initInstance, 0, 3) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_initMemoryFromInstance, 0, 2) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_getMemoryPages, 0, 1) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_initFunction, 0, 4) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-DEFINE_NATIVE_ENTRY(Wasm_callFunction, 0, 2) {
-  Exceptions::ThrowUnsupportedError("WASM is disabled");
-  return nullptr;
-}
-
-}  // namespace dart
-
-#endif  // DART_ENABLE_WASM
diff --git a/runtime/lib/wasm_sources.gni b/runtime/lib/wasm_sources.gni
deleted file mode 100644
index 2e7faff..0000000
--- a/runtime/lib/wasm_sources.gni
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright (c) 2019, the Dart project authors.  Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-wasm_runtime_cc_files = [ "wasm.cc" ]
diff --git a/runtime/platform/allocation.h b/runtime/platform/allocation.h
index 2e3b76b..e2d7ded 100644
--- a/runtime/platform/allocation.h
+++ b/runtime/platform/allocation.h
@@ -5,6 +5,7 @@
 #ifndef RUNTIME_PLATFORM_ALLOCATION_H_
 #define RUNTIME_PLATFORM_ALLOCATION_H_
 
+#include "platform/address_sanitizer.h"
 #include "platform/assert.h"
 
 namespace dart {
@@ -31,6 +32,36 @@
   DISALLOW_IMPLICIT_CONSTRUCTORS(AllStatic);
 };
 
+class MallocAllocated {
+ public:
+  MallocAllocated() {}
+
+  // Intercept operator new to produce clearer error messages when we run out
+  // of memory. Don't do this when running under ASAN so it can continue to
+  // check malloc/new/new[] are paired with free/delete/delete[] respectively.
+#if !defined(USING_ADDRESS_SANITIZER)
+  void* operator new(size_t size) {
+    void* result = ::malloc(size);
+    if (result == nullptr) {
+      OUT_OF_MEMORY();
+    }
+    return result;
+  }
+
+  void* operator new[](size_t size) {
+    void* result = ::malloc(size);
+    if (result == nullptr) {
+      OUT_OF_MEMORY();
+    }
+    return result;
+  }
+
+  void operator delete(void* pointer) { ::free(pointer); }
+
+  void operator delete[](void* pointer) { ::free(pointer); }
+#endif
+};
+
 }  // namespace dart
 
 #endif  // RUNTIME_PLATFORM_ALLOCATION_H_
diff --git a/runtime/platform/growable_array.h b/runtime/platform/growable_array.h
index b604ea4..20d5f1f 100644
--- a/runtime/platform/growable_array.h
+++ b/runtime/platform/growable_array.h
@@ -254,14 +254,13 @@
   }
 };
 
-class EmptyBase {};
-
 template <typename T>
-class MallocGrowableArray : public BaseGrowableArray<T, EmptyBase, Malloc> {
+class MallocGrowableArray
+    : public BaseGrowableArray<T, MallocAllocated, Malloc> {
  public:
   explicit MallocGrowableArray(intptr_t initial_capacity)
-      : BaseGrowableArray<T, EmptyBase, Malloc>(initial_capacity, NULL) {}
-  MallocGrowableArray() : BaseGrowableArray<T, EmptyBase, Malloc>(NULL) {}
+      : BaseGrowableArray<T, MallocAllocated, Malloc>(initial_capacity, NULL) {}
+  MallocGrowableArray() : BaseGrowableArray<T, MallocAllocated, Malloc>(NULL) {}
 };
 
 }  // namespace dart
diff --git a/runtime/platform/hashmap.cc b/runtime/platform/hashmap.cc
index 88c521e..730b94e 100644
--- a/runtime/platform/hashmap.cc
+++ b/runtime/platform/hashmap.cc
@@ -157,9 +157,6 @@
 void SimpleHashMap::Initialize(uint32_t capacity) {
   ASSERT(dart::Utils::IsPowerOfTwo(capacity));
   map_ = new Entry[capacity];
-  if (map_ == NULL) {
-    OUT_OF_MEMORY();
-  }
   capacity_ = capacity;
   occupancy_ = 0;
 }
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn
index 714de1b..1da3a20 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -15,7 +15,6 @@
 import("../../sdk/lib/mirrors/mirrors_sources.gni")
 import("../../sdk/lib/typed_data/typed_data_sources.gni")
 import("../../sdk/lib/vmservice/vmservice_sources.gni")
-import("../../sdk/lib/wasm/wasm_sources.gni")
 import("../../sdk_args.gni")
 import("../../utils/compile_platform.gni")
 import("../bin/cli_sources.gni")
@@ -34,7 +33,6 @@
 import("../lib/profiler_sources.gni")
 import("../lib/typed_data_sources.gni")
 import("../lib/vmservice_sources.gni")
-import("../lib/wasm_sources.gni")
 import("../runtime_args.gni")
 import("compiler/compiler_sources.gni")
 import("heap/heap_sources.gni")
@@ -154,7 +152,7 @@
                internal_runtime_cc_files + isolate_runtime_cc_files +
                math_runtime_cc_files + mirrors_runtime_cc_files +
                typed_data_runtime_cc_files + vmservice_runtime_cc_files +
-               ffi_runtime_cc_files + wasm_runtime_cc_files
+               ffi_runtime_cc_files
   sources = [ "bootstrap.cc" ] + rebase_path(allsources, ".", "../lib")
   snapshot_sources = []
 }
diff --git a/runtime/vm/allocation.h b/runtime/vm/allocation.h
index 834b28b..fc4be72 100644
--- a/runtime/vm/allocation.h
+++ b/runtime/vm/allocation.h
@@ -54,10 +54,10 @@
   ZoneAllocated() {}
 
   // Implicitly allocate the object in the current zone.
-  void* operator new(uword size);
+  void* operator new(size_t size);
 
   // Allocate the object in the given zone, which must be the current zone.
-  void* operator new(uword size, Zone* zone);
+  void* operator new(size_t size, Zone* zone);
 
   // Ideally, the delete operator should be protected instead of
   // public, but unfortunately the compiler sometimes synthesizes
diff --git a/runtime/vm/bootstrap_natives.cc b/runtime/vm/bootstrap_natives.cc
index a6b8a6b..5d9d84b 100644
--- a/runtime/vm/bootstrap_natives.cc
+++ b/runtime/vm/bootstrap_natives.cc
@@ -134,11 +134,6 @@
   ASSERT(!library.IsNull());
   library.set_native_entry_resolver(resolver);
   library.set_native_entry_symbol_resolver(symbol_resolver);
-
-  library = Library::WasmLibrary();
-  ASSERT(!library.IsNull());
-  library.set_native_entry_resolver(resolver);
-  library.set_native_entry_symbol_resolver(symbol_resolver);
 }
 
 bool Bootstrap::IsBootstrapResolver(Dart_NativeEntryResolver resolver) {
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index c8ac080..8d51e7a 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -421,20 +421,7 @@
   V(DartApiDLMinorVersion, 0)                                                  \
   V(DartNativeApiFunctionPointer, 1)                                           \
   V(TransferableTypedData_factory, 2)                                          \
-  V(TransferableTypedData_materialize, 1)                                      \
-  V(Wasm_initModule, 2)                                                        \
-  V(Wasm_describeModule, 1)                                                    \
-  V(Wasm_initImports, 1)                                                       \
-  V(Wasm_addMemoryImport, 4)                                                   \
-  V(Wasm_addGlobalImport, 6)                                                   \
-  V(Wasm_addFunctionImport, 5)                                                 \
-  V(Wasm_initMemory, 3)                                                        \
-  V(Wasm_growMemory, 2)                                                        \
-  V(Wasm_initInstance, 3)                                                      \
-  V(Wasm_initMemoryFromInstance, 2)                                            \
-  V(Wasm_getMemoryPages, 1)                                                    \
-  V(Wasm_initFunction, 4)                                                      \
-  V(Wasm_callFunction, 2)
+  V(TransferableTypedData_materialize, 1)
 
 // List of bootstrap native entry points used in the dart:mirror library.
 #define MIRRORS_BOOTSTRAP_NATIVE_LIST(V)                                       \
diff --git a/runtime/vm/class_id.h b/runtime/vm/class_id.h
index 92faca0..353cb01 100644
--- a/runtime/vm/class_id.h
+++ b/runtime/vm/class_id.h
@@ -144,13 +144,6 @@
   V(DynamicLibrary)                                                            \
   V(Struct)
 
-#define CLASS_LIST_WASM(V)                                                     \
-  V(WasmInt32)                                                                 \
-  V(WasmInt64)                                                                 \
-  V(WasmFloat)                                                                 \
-  V(WasmDouble)                                                                \
-  V(WasmVoid)
-
 #define DART_CLASS_LIST_TYPED_DATA(V)                                          \
   V(Int8)                                                                      \
   V(Uint8)                                                                     \
@@ -202,10 +195,6 @@
   CLASS_LIST_FFI(DEFINE_OBJECT_KIND)
 #undef DEFINE_OBJECT_KIND
 
-#define DEFINE_OBJECT_KIND(clazz) k##clazz##Cid,
-  CLASS_LIST_WASM(DEFINE_OBJECT_KIND)
-#undef DEFINE_OBJECT_KIND
-
 #define DEFINE_OBJECT_KIND(clazz)                                              \
   kTypedData##clazz##Cid,                                                      \
   kTypedData##clazz##ViewCid,                                                  \
diff --git a/runtime/vm/compiler/recognized_methods_list.h b/runtime/vm/compiler/recognized_methods_list.h
index d725d4e..e198f85 100644
--- a/runtime/vm/compiler/recognized_methods_list.h
+++ b/runtime/vm/compiler/recognized_methods_list.h
@@ -89,8 +89,8 @@
   V(_Double, _div, DoubleDiv, 0x813d6a94)                                      \
   V(::, min, MathMin, 0xe6a2f504)                                              \
   V(::, max, MathMax, 0x4cfa6f6b)                                              \
-  V(::, _doublePow, MathDoublePow, 0x973546e3)                                 \
-  V(::, _intPow, MathIntPow, 0x5449a6fb)                                       \
+  V(::, _doublePow, MathDoublePow, 0x9772a8c1)                                 \
+  V(::, _intPow, MathIntPow, 0x65762a89)                                       \
   V(Float32x4, _Float32x4FromDoubles, Float32x4FromDoubles, 0x4ddbf1d0)        \
   V(Float32x4, Float32x4.zero, Float32x4Zero, 0x730d827d)                      \
   V(Float32x4, _Float32x4Splat, Float32x4Splat, 0x36ae87e8)                    \
@@ -158,7 +158,7 @@
   V(_HashVMBase, set:_hashMask, LinkedHashMap_setHashMask, 0x5371ef57)         \
   V(_HashVMBase, get:_deletedKeys, LinkedHashMap_getDeletedKeys, 0xd55a64df)   \
   V(_HashVMBase, set:_deletedKeys, LinkedHashMap_setDeletedKeys, 0x5570ec5b)   \
-  V(::, _classRangeCheck, ClassRangeCheck, 0x44ba948a)                         \
+  V(::, _classRangeCheck, ClassRangeCheck, 0x5ee76871)                         \
   V(::, _asyncStackTraceHelper, AsyncStackTraceHelper, 0x92cea920)             \
   V(::, _abi, FfiAbi, 0x00a48dda)                                              \
   V(::, _asFunctionInternal, FfiAsFunctionInternal, 0x4ea3f661)                \
@@ -190,7 +190,7 @@
   V(::, _fromAddress, FfiFromAddress, 0xab4ae553)                              \
   V(Pointer, get:address, FfiGetAddress, 0x012b2b9f)                           \
   V(::, reachabilityFence, ReachabilityFence, 0xad39d0a6)                      \
-  V(_Utf8Decoder, _scan, Utf8DecoderScan, 0x78f44c3c)                          \
+  V(_Utf8Decoder, _scan, Utf8DecoderScan, 0x288d0078)                          \
   V(_Future, timeout, FutureTimeout, 0xdea67258)                               \
   V(Future, wait, FutureWait, 0x6c0c3295)                                      \
 
@@ -284,7 +284,7 @@
 
 #define MATH_LIB_INTRINSIC_LIST(V)                                             \
   V(::, sqrt, MathSqrt, 0x98d7cb39)                                            \
-  V(_Random, _nextState, Random_nextState, 0x3077323d)                         \
+  V(_Random, _nextState, Random_nextState, 0x2c1cf0e2)                         \
 
 #define GRAPH_MATH_LIB_INTRINSIC_LIST(V)                                       \
   V(::, sin, MathSin, 0x859e6680)                                              \
diff --git a/runtime/vm/deopt_instructions.h b/runtime/vm/deopt_instructions.h
index 0c40fa9..dd896cc 100644
--- a/runtime/vm/deopt_instructions.h
+++ b/runtime/vm/deopt_instructions.h
@@ -27,7 +27,7 @@
 
 // Holds all data relevant for execution of deoptimization instructions.
 // Structure is allocated in C-heap.
-class DeoptContext {
+class DeoptContext : public MallocAllocated {
  public:
   enum DestFrameOptions {
     kDestIsOriginalFrame,  // Replace the original frame with deopt frame.
diff --git a/runtime/vm/handles.h b/runtime/vm/handles.h
index 28ec9cc..ca6b5f4 100644
--- a/runtime/vm/handles.h
+++ b/runtime/vm/handles.h
@@ -116,7 +116,7 @@
   // is allocated from the chunk until we run out space in the chunk,
   // at this point another chunk is allocated. These chunks are chained
   // together.
-  class HandlesBlock {
+  class HandlesBlock : public MallocAllocated {
    public:
     explicit HandlesBlock(HandlesBlock* next)
         : next_handle_slot_(0), next_block_(next) {}
diff --git a/runtime/vm/handles_impl.h b/runtime/vm/handles_impl.h
index f4033dc..0697a13 100644
--- a/runtime/vm/handles_impl.h
+++ b/runtime/vm/handles_impl.h
@@ -157,9 +157,6 @@
   }
   if (scoped_blocks_->next_block() == NULL) {
     HandlesBlock* block = new HandlesBlock(NULL);
-    if (block == NULL) {
-      OUT_OF_MEMORY();
-    }
     scoped_blocks_->set_next_block(block);
   }
   scoped_blocks_ = scoped_blocks_->next_block();
@@ -207,9 +204,6 @@
                  CountScopedHandles());
   }
   zone_blocks_ = new HandlesBlock(zone_blocks_);
-  if (zone_blocks_ == NULL) {
-    OUT_OF_MEMORY();
-  }
 }
 
 #if defined(DEBUG)
diff --git a/runtime/vm/hash_map.h b/runtime/vm/hash_map.h
index 409ab89..88d58ba 100644
--- a/runtime/vm/hash_map.h
+++ b/runtime/vm/hash_map.h
@@ -423,15 +423,17 @@
 
 template <typename KeyValueTrait>
 class MallocDirectChainedHashMap
-    : public BaseDirectChainedHashMap<KeyValueTrait, EmptyBase, Malloc> {
+    : public BaseDirectChainedHashMap<KeyValueTrait, MallocAllocated, Malloc> {
  public:
   MallocDirectChainedHashMap()
-      : BaseDirectChainedHashMap<KeyValueTrait, EmptyBase, Malloc>(NULL) {}
+      : BaseDirectChainedHashMap<KeyValueTrait, MallocAllocated, Malloc>(NULL) {
+  }
 
   // The only use of the copy constructor seems to be in hash_map_test.cc.
   // Not disallowing it for now just in case there are other users.
   MallocDirectChainedHashMap(const MallocDirectChainedHashMap& other)
-      : BaseDirectChainedHashMap<KeyValueTrait, EmptyBase, Malloc>(other) {}
+      : BaseDirectChainedHashMap<KeyValueTrait, MallocAllocated, Malloc>(
+            other) {}
 
  private:
   void operator=(const MallocDirectChainedHashMap& other) = delete;
diff --git a/runtime/vm/heap/pointer_block.h b/runtime/vm/heap/pointer_block.h
index 4a40cd1..5e7dde8 100644
--- a/runtime/vm/heap/pointer_block.h
+++ b/runtime/vm/heap/pointer_block.h
@@ -18,7 +18,7 @@
 
 // A set of ObjectPtr. Must be emptied before destruction (using Pop/Reset).
 template <int Size>
-class PointerBlock {
+class PointerBlock : public MallocAllocated {
  public:
   enum { kSize = Size };
 
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index ea79c98..91ca10f 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -632,14 +632,6 @@
 
 #define INIT_VTABLE(clazz)                                                     \
   {                                                                            \
-    Instance fake_handle;                                                      \
-    builtin_vtables_[k##clazz##Cid] = fake_handle.vtable();                    \
-  }
-  CLASS_LIST_WASM(INIT_VTABLE)
-#undef INIT_VTABLE
-
-#define INIT_VTABLE(clazz)                                                     \
-  {                                                                            \
     TypedData fake_internal_handle;                                            \
     builtin_vtables_[kTypedData##clazz##Cid] = fake_internal_handle.vtable();  \
     TypedDataView fake_view_handle;                                            \
@@ -2299,23 +2291,6 @@
     pending_classes.Add(cls);
     RegisterClass(cls, Symbols::FfiDynamicLibrary(), lib);
 
-    lib = Library::LookupLibrary(thread, Symbols::DartWasm());
-    if (lib.IsNull()) {
-      lib = Library::NewLibraryHelper(Symbols::DartWasm(), true);
-      lib.SetLoadRequested();
-      lib.Register(thread);
-    }
-    object_store->set_bootstrap_library(ObjectStore::kWasm, lib);
-
-#define REGISTER_WASM_TYPE(clazz)                                              \
-  cls = Class::New<Instance, RTN::Instance>(k##clazz##Cid, isolate);           \
-  cls.set_num_type_arguments(0);                                               \
-  cls.set_is_prefinalized();                                                   \
-  pending_classes.Add(cls);                                                    \
-  RegisterClass(cls, Symbols::clazz(), lib);
-    CLASS_LIST_WASM(REGISTER_WASM_TYPE);
-#undef REGISTER_WASM_TYPE
-
     // Finish the initialization by compiling the bootstrap scripts containing
     // the base interfaces and the implementation of the internal classes.
     const Error& error = Error::Handle(
@@ -2410,11 +2385,6 @@
     CLASS_LIST_FFI_TYPE_MARKER(REGISTER_FFI_CLASS);
 #undef REGISTER_FFI_CLASS
 
-#define REGISTER_WASM_CLASS(clazz)                                             \
-  cls = Class::New<Instance, RTN::Instance>(k##clazz##Cid, isolate);
-    CLASS_LIST_WASM(REGISTER_WASM_CLASS);
-#undef REGISTER_WASM_CLASS
-
     cls = Class::New<Instance, RTN::Instance>(kFfiNativeFunctionCid, isolate);
 
     cls = Class::NewPointerClass(kFfiPointerCid, isolate);
@@ -13375,10 +13345,6 @@
   return Isolate::Current()->object_store()->_vmservice_library();
 }
 
-LibraryPtr Library::WasmLibrary() {
-  return Isolate::Current()->object_store()->wasm_library();
-}
-
 const char* Library::ToCString() const {
   NoSafepointScope no_safepoint;
   const String& name = String::Handle(url());
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 85add6f..988de23 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -4913,7 +4913,6 @@
   static LibraryPtr ProfilerLibrary();
   static LibraryPtr TypedDataLibrary();
   static LibraryPtr VMServiceLibrary();
-  static LibraryPtr WasmLibrary();
 
   // Eagerly compile all classes and functions in the library.
   static ErrorPtr CompileAll(bool ignore_error = false);
diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h
index ed3e69d..d4b3d4a 100644
--- a/runtime/vm/object_store.h
+++ b/runtime/vm/object_store.h
@@ -28,8 +28,7 @@
   M(Math, math)                                                                \
   M(Mirrors, mirrors)                                                          \
   M(TypedData, typed_data)                                                     \
-  M(VMService, _vmservice)                                                     \
-  M(Wasm, wasm)
+  M(VMService, _vmservice)
 
 // TODO(liama): Once NNBD is enabled, *_type will be deleted and all uses will
 // be replaced with *_type_non_nullable. Later, once we drop support for opted
@@ -151,7 +150,6 @@
   RW(Library, root_library)                                                    \
   RW(Library, typed_data_library)                                              \
   RW(Library, _vmservice_library)                                              \
-  RW(Library, wasm_library)                                                    \
   RW(GrowableObjectArray, libraries)                                           \
   RW(Array, libraries_map)                                                     \
   RW(Array, loading_units)                                                     \
diff --git a/runtime/vm/port_set.h b/runtime/vm/port_set.h
index 97a2c9a..a632f50 100644
--- a/runtime/vm/port_set.h
+++ b/runtime/vm/port_set.h
@@ -7,6 +7,7 @@
 
 #include "include/dart_api.h"
 
+#include "platform/allocation.h"
 #include "platform/globals.h"
 #include "platform/utils.h"
 
@@ -18,7 +19,7 @@
   static constexpr Dart_Port kFreePort = static_cast<Dart_Port>(0);
   static constexpr Dart_Port kDeletedPort = static_cast<Dart_Port>(3);
 
-  struct Entry {
+  struct Entry : public MallocAllocated {
     Entry() : port(kFreePort) {}
 
     // Free entries have set this to 0.
diff --git a/runtime/vm/raw_object.cc b/runtime/vm/raw_object.cc
index 1feb330..3f3bec6 100644
--- a/runtime/vm/raw_object.cc
+++ b/runtime/vm/raw_object.cc
@@ -337,13 +337,6 @@
         break;
       }
 #undef RAW_VISITPOINTERS
-#define RAW_VISITPOINTERS(clazz) case k##clazz##Cid:
-      CLASS_LIST_WASM(RAW_VISITPOINTERS) {
-        // These wasm types do not have any fields or type arguments.
-        size = HeapSize();
-        break;
-      }
-#undef RAW_VISITPOINTERS
     case kFreeListElement: {
       uword addr = ObjectLayout::ToAddr(this);
       FreeListElement* element = reinterpret_cast<FreeListElement*>(addr);
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index 7737d2a..bcb4057 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -76,9 +76,6 @@
   V(DartExtensionScheme, "dart-ext:")                                          \
   V(DartFfi, "dart:ffi")                                                       \
   V(DartFfiLibName, "ffi")                                                     \
-  V(DartWasm, "dart:wasm")                                                     \
-  V(DartWasmLibName, "wasm")                                                   \
-  V(DartLibraryWasm, "dart.library.wasm")                                      \
   V(DartIOLibName, "dart.io")                                                  \
   V(DartInternal, "dart:_internal")                                            \
   V(DartIsVM, "dart.isVM")                                                     \
@@ -302,11 +299,6 @@
   V(UnwindError, "UnwindError")                                                \
   V(Value, "value")                                                            \
   V(Values, "values")                                                          \
-  V(WasmInt32, "Int32")                                                        \
-  V(WasmInt64, "Int64")                                                        \
-  V(WasmFloat, "Float")                                                        \
-  V(WasmDouble, "Double")                                                      \
-  V(WasmVoid, "Void")                                                          \
   V(YieldKw, "yield")                                                          \
   V(_AsyncAwaitStart, "start")                                                 \
   V(_AsyncStarStreamController, "_AsyncStarStreamController")                  \
diff --git a/runtime/vm/timeline.h b/runtime/vm/timeline.h
index d5be399..38e739a 100644
--- a/runtime/vm/timeline.h
+++ b/runtime/vm/timeline.h
@@ -574,7 +574,7 @@
 };
 
 // A block of |TimelineEvent|s. Not thread safe.
-class TimelineEventBlock {
+class TimelineEventBlock : public MallocAllocated {
  public:
   static const intptr_t kBlockSize = 64;
 
@@ -707,7 +707,7 @@
 };
 
 // Recorder of |TimelineEvent|s.
-class TimelineEventRecorder {
+class TimelineEventRecorder : public MallocAllocated {
  public:
   TimelineEventRecorder();
   virtual ~TimelineEventRecorder() {}
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 392c905..39c0c0a 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -90,7 +90,6 @@
 # ......math/
 # ......mirrors/
 # ......typed_data/
-# ......wasm/
 # ......api_readme.md
 
 # Scripts that go under bin/
@@ -232,7 +231,6 @@
   "mirrors",
   "svg",
   "typed_data",
-  "wasm",
   "web_audio",
   "web_gl",
   "web_sql",
diff --git a/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart b/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart
index ab7da7e..eb87192 100644
--- a/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart
+++ b/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart
@@ -134,8 +134,6 @@
       categories: "Client",
       maturity: Maturity.WEB_STABLE,
       platforms: DART2JS_PLATFORM),
-  "wasm": const LibraryInfo("wasm/wasm.dart",
-      categories: "Server", maturity: Maturity.EXPERIMENTAL),
   "web_audio": const LibraryInfo("web_audio/dart2js/web_audio_dart2js.dart",
       categories: "Client",
       maturity: Maturity.WEB_STABLE,
diff --git a/sdk/lib/_internal/vm/lib/wasm_patch.dart b/sdk/lib/_internal/vm/lib/wasm_patch.dart
deleted file mode 100644
index f3a996d..0000000
--- a/sdk/lib/_internal/vm/lib/wasm_patch.dart
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright (c) 2019, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:_internal' show patch;
-import "dart:nativewrappers" show NativeFieldWrapperClass1;
-import 'dart:typed_data';
-
-@patch
-@pragma("vm:entry-point")
-class Int32 {}
-
-@patch
-@pragma("vm:entry-point")
-class Int64 {}
-
-@patch
-@pragma("vm:entry-point")
-class Float {}
-
-@patch
-@pragma("vm:entry-point")
-class Double {}
-
-@patch
-@pragma("vm:entry-point")
-class Void {}
-
-@patch
-class WasmModule {
-  @patch
-  factory WasmModule(Uint8List data) {
-    return _NativeWasmModule(data);
-  }
-}
-
-@patch
-class WasmMemory {
-  @patch
-  factory WasmMemory(int initialPages, [int? maxPages]) {
-    return _NativeWasmMemory(initialPages, maxPages);
-  }
-}
-
-@patch
-class WasmImports {
-  @patch
-  factory WasmImports() {
-    return _NativeWasmImports();
-  }
-}
-
-class _NativeWasmModule extends NativeFieldWrapperClass1 implements WasmModule {
-  _NativeWasmModule(Uint8List data) {
-    _init(data);
-  }
-
-  WasmInstance instantiate(covariant _NativeWasmImports imports) {
-    return _NativeWasmInstance(this, imports);
-  }
-
-  void _init(Uint8List data) native 'Wasm_initModule';
-  String describe() native 'Wasm_describeModule';
-}
-
-class _NativeWasmImports extends NativeFieldWrapperClass1
-    implements WasmImports {
-  List<WasmMemory> _memories;
-  List<Function> _fns;
-
-  _NativeWasmImports()
-      : _memories = [],
-        _fns = [] {
-    _init();
-  }
-
-  void addMemory(String moduleName, String name, WasmMemory memory) {
-    _memories.add(memory);
-    _addMemory(moduleName, name, memory);
-  }
-
-  void addGlobal<T>(String moduleName, String name, num value, bool mutable) {
-    _addGlobal(moduleName, name, value, T, mutable);
-  }
-
-  void addFunction<T extends Function>(
-      String moduleName, String name, Function fn) {
-    int id = _fns.length;
-    _fns.add(fn);
-    _addFunction(moduleName, name, id, T);
-  }
-
-  @pragma("vm:entry-point")
-  static Function getFunction(_NativeWasmImports imp, int id) {
-    return imp._fns[id];
-  }
-
-  void _init() native 'Wasm_initImports';
-  void _addMemory(String moduleName, String name, WasmMemory memory)
-      native 'Wasm_addMemoryImport';
-  void _addGlobal(String moduleName, String name, num value, Type type,
-      bool mutable) native 'Wasm_addGlobalImport';
-  void _addFunction(String moduleName, String name, int id, Type type)
-      native 'Wasm_addFunctionImport';
-}
-
-class _NativeWasmMemory extends NativeFieldWrapperClass1 implements WasmMemory {
-  late int _pages;
-  late Uint8List _buffer;
-
-  _NativeWasmMemory(int initialPages, int? maxPages) {
-    _buffer = _init(initialPages, maxPages);
-    _pages = initialPages;
-  }
-
-  _NativeWasmMemory.fromInstance(_NativeWasmInstance inst) {
-    _buffer = _initFromInstance(inst);
-    _pages = _getPages();
-  }
-
-  int get lengthInPages => _pages;
-  int get lengthInBytes => _buffer.lengthInBytes;
-  int operator [](int index) => _buffer[index];
-  void operator []=(int index, int value) {
-    _buffer[index] = value;
-  }
-
-  int grow(int deltaPages) {
-    int oldPages = _pages;
-    _buffer = _grow(deltaPages);
-    _pages += deltaPages;
-    return oldPages;
-  }
-
-  Uint8List _init(int initialPages, int? maxPages) native 'Wasm_initMemory';
-  Uint8List _grow(int deltaPages) native 'Wasm_growMemory';
-  Uint8List _initFromInstance(_NativeWasmInstance inst)
-      native 'Wasm_initMemoryFromInstance';
-  int _getPages() native 'Wasm_getMemoryPages';
-}
-
-class _NativeWasmInstance extends NativeFieldWrapperClass1
-    implements WasmInstance {
-  _NativeWasmModule _module;
-  _NativeWasmImports _imports;
-
-  _NativeWasmInstance(_NativeWasmModule module, _NativeWasmImports imports)
-      : _module = module,
-        _imports = imports {
-    _init(module, imports);
-  }
-
-  WasmFunction<T> lookupFunction<T extends Function>(String name) {
-    return _NativeWasmFunction<T>(this, name);
-  }
-
-  WasmMemory get memory {
-    return _NativeWasmMemory.fromInstance(this);
-  }
-
-  void _init(_NativeWasmModule module, _NativeWasmImports imports)
-      native 'Wasm_initInstance';
-}
-
-class _NativeWasmFunction<T extends Function> extends NativeFieldWrapperClass1
-    implements WasmFunction<T> {
-  _NativeWasmInstance _inst;
-
-  _NativeWasmFunction(_NativeWasmInstance inst, String name) : _inst = inst {
-    _init(inst, name, T);
-  }
-
-  num call(List<num> args) {
-    var arg_copy = List<num>.from(args, growable: false);
-    return _call(arg_copy);
-  }
-
-  void _init(_NativeWasmInstance inst, String name, Type fnType)
-      native 'Wasm_initFunction';
-  num _call(List<num> args) native 'Wasm_callFunction';
-}
diff --git a/sdk/lib/libraries.json b/sdk/lib/libraries.json
index 15b4cd3..0b9d207 100644
--- a/sdk/lib/libraries.json
+++ b/sdk/lib/libraries.json
@@ -91,12 +91,6 @@
           "_internal/vm/lib/ffi_struct_patch.dart"
         ]
       },
-      "wasm": {
-        "uri": "wasm/wasm.dart",
-        "patches": [
-          "_internal/vm/lib/wasm_patch.dart"
-        ]
-      },
       "_http": {
         "uri": "_http/http.dart"
       },
diff --git a/sdk/lib/libraries.yaml b/sdk/lib/libraries.yaml
index 50e350e..f6cb8c3 100644
--- a/sdk/lib/libraries.yaml
+++ b/sdk/lib/libraries.yaml
@@ -95,11 +95,6 @@
         - "_internal/vm/lib/ffi_native_type_patch.dart"
         - "_internal/vm/lib/ffi_struct_patch.dart"
 
-    wasm:
-      uri: "wasm/wasm.dart"
-      patches:
-        - "_internal/vm/lib/wasm_patch.dart"
-
     _http:
       uri: "_http/http.dart"
 
diff --git a/sdk/lib/wasm/wasm.dart b/sdk/lib/wasm/wasm.dart
deleted file mode 100644
index 768445e..0000000
--- a/sdk/lib/wasm/wasm.dart
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (c) 2019, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// {@category VM}
-/// {@nodoc}
-library dart.wasm;
-
-import 'dart:typed_data';
-
-// Represents the WASM 32-bit int type.
-class Int32 {}
-
-// Represents the WASM 64-bit int type.
-class Int64 {}
-
-// Represents the WASM 32-bit float type.
-class Float {}
-
-// Represents the WASM 64-bit float type.
-class Double {}
-
-// Represents the return type of a void function in WASM.
-class Void {}
-
-// WasmModule is a compiled module that can be instantiated.
-abstract class WasmModule {
-  // Compile a module.
-  external factory WasmModule(Uint8List data);
-
-  // Instantiate the module with the given imports.
-  WasmInstance instantiate(WasmImports imports);
-
-  // Describes the imports and exports that the module expects, for debugging.
-  String describe();
-}
-
-// WasmImports holds all the imports for a WasmInstance.
-abstract class WasmImports {
-  // Create an imports object.
-  external factory WasmImports();
-
-  // Add a global variable to the imports.
-  void addGlobal<T>(String moduleName, String name, num value, bool mutable);
-
-  // Add a memory to the imports.
-  void addMemory(String moduleName, String name, WasmMemory memory);
-
-  // Add a function to the imports.
-  void addFunction<T extends Function>(
-      String moduleName, String name, Function fn);
-}
-
-// WasmMemory is a sandbox for a WasmInstance to run in.
-abstract class WasmMemory {
-  // Create a new memory with the given number of initial pages, and optional
-  // maximum number of pages.
-  external factory WasmMemory(int initialPages, [int? maxPages]);
-
-  // The WASM spec defines the page size as 64KiB.
-  static const int kPageSizeInBytes = 64 * 1024;
-
-  // Returns the length of the memory in pages.
-  int get lengthInPages;
-
-  // Returns the length of the memory in bytes.
-  int get lengthInBytes;
-
-  // Returns the byte at the given index.
-  int operator [](int index);
-
-  // Sets the byte at the iven index to value.
-  void operator []=(int index, int value);
-
-  // Grow the memory by deltaPages. Returns the number of pages before resizing.
-  int grow(int deltaPages);
-}
-
-// WasmInstance is an instantiated WasmModule.
-abstract class WasmInstance {
-  // Find an exported function with the given signature.
-  WasmFunction<T> lookupFunction<T extends Function>(String name);
-
-  // Returns this instance's memory.
-  WasmMemory get memory;
-}
-
-// WasmFunction is a callable function in a WasmInstance.
-abstract class WasmFunction<T extends Function> {
-  num call(List<num> args);
-}
diff --git a/sdk/lib/wasm/wasm_sources.gni b/sdk/lib/wasm/wasm_sources.gni
deleted file mode 100644
index e63af2d..0000000
--- a/sdk/lib/wasm/wasm_sources.gni
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright (c) 2019, the Dart project authors.  Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-wasm_sdk_sources = [ "wasm.dart" ]
diff --git a/third_party/tcmalloc/include/config.h b/third_party/tcmalloc/include/config.h
index 3cd4982..ef33e13 100644
--- a/third_party/tcmalloc/include/config.h
+++ b/third_party/tcmalloc/include/config.h
@@ -6,6 +6,9 @@
 #define GPERFTOOLS_CONFIG_H_
 
 
+/* enable aggressive decommit by default */
+/* #undef ENABLE_AGGRESSIVE_DECOMMIT_BY_DEFAULT */
+
 /* Build new/delete operators for overaligned types */
 #define ENABLE_ALIGNED_NEW_DELETE 1
 
@@ -18,6 +21,9 @@
 /* Build sized deletion operators */
 #define ENABLE_SIZED_DELETE 1
 
+/* Define to 1 if you have the <asm/ptrace.h> header file. */
+/* #undef HAVE_ASM_PTRACE_H */
+
 /* Define to 1 if compiler supports __builtin_stack_pointer */
 /* #undef HAVE_BUILTIN_STACK_POINTER */
 
@@ -36,7 +42,7 @@
 
 /* Define to 1 if you have the declaration of `cfree', and to 0 if you don't.
    */
-#define HAVE_DECL_CFREE 1
+#define HAVE_DECL_CFREE 0
 
 /* Define to 1 if you have the declaration of `memalign', and to 0 if you
    don't. */
@@ -87,9 +93,6 @@
 /* Define to 1 if you have the `geteuid' function. */
 #define HAVE_GETEUID 1
 
-/* Define to 1 if you have the `getpagesize' function. */
-#define HAVE_GETPAGESIZE 1
-
 /* Define to 1 if you have the <glob.h> header file. */
 #define HAVE_GLOB_H 1
 
@@ -160,9 +163,6 @@
 /* Define to 1 if you have the <sys/cdefs.h> header file. */
 #define HAVE_SYS_CDEFS_H 1
 
-/* Define to 1 if you have the <sys/param.h> header file. */
-#define HAVE_SYS_PARAM_H 1
-
 /* Define to 1 if you have the <sys/prctl.h> header file. */
 #define HAVE_SYS_PRCTL_H 1
 
@@ -239,7 +239,7 @@
 #define PACKAGE_NAME "gperftools"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "gperftools 2.7"
+#define PACKAGE_STRING "gperftools 2.8"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "gperftools"
@@ -248,7 +248,7 @@
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "2.7"
+#define PACKAGE_VERSION "2.8"
 
 /* How to access the PC from a struct ucontext */
 /* #undef PC_FROM_UCONTEXT */
@@ -285,17 +285,14 @@
 /* the namespace where STL code like vector<> is defined */
 #define STL_NAMESPACE std
 
-/* Define 32K of internal pages size for tcmalloc */
-/* #undef TCMALLOC_32K_PAGES */
-
-/* Define 64K of internal pages size for tcmalloc */
-/* #undef TCMALLOC_64K_PAGES */
-
 /* Define 8 bytes of allocation alignment for tcmalloc */
 /* #undef TCMALLOC_ALIGN_8BYTES */
 
+/* Define internal page size for tcmalloc as number of left bitshift */
+/* #undef TCMALLOC_PAGE_SIZE_SHIFT */
+
 /* Version number of package */
-#define VERSION "2.7"
+#define VERSION "2.8"
 
 /* C99 says: define this to get the PRI... macros from stdint.h */
 #ifndef __STDC_FORMAT_MACROS
diff --git a/third_party/tcmalloc/include/gperftools/tcmalloc.h b/third_party/tcmalloc/include/gperftools/tcmalloc.h
index 7935081..2a5633f 100644
--- a/third_party/tcmalloc/include/gperftools/tcmalloc.h
+++ b/third_party/tcmalloc/include/gperftools/tcmalloc.h
@@ -43,9 +43,9 @@
 
 /* Define the version number so folks can check against it */
 #define TC_VERSION_MAJOR  2
-#define TC_VERSION_MINOR  7
+#define TC_VERSION_MINOR  8
 #define TC_VERSION_PATCH  ""
-#define TC_VERSION_STRING "gperftools 2.7"
+#define TC_VERSION_STRING "gperftools 2.8"
 
 /* For struct mallinfo, if it's defined. */
 #if 1
diff --git a/tools/VERSION b/tools/VERSION
index a76b3d2..6d004b9 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 12
 PATCH 0
-PRERELEASE 41
+PRERELEASE 42
 PRERELEASE_PATCH 0
\ No newline at end of file