mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[dart2wasm] Fix memory definition.
Size is number of 64kb pages. Change-Id: I4c2876ebee553d0dc219e8dd8bb6b1169799a465 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257260 Commit-Queue: Joshua Litt <joshualitt@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com>
This commit is contained in:
parent
6484fa91ab
commit
f0ab6fb6ef
|
@ -175,8 +175,8 @@ class Constants {
|
|||
..add(oneByteStringsAsBytes))
|
||||
.toBytes();
|
||||
|
||||
w.Memory stringMemory =
|
||||
m.addMemory(false, stringsAsBytes.length, stringsAsBytes.length);
|
||||
double minSize = stringsAsBytes.length / w.Module.memoryBlockSize;
|
||||
w.Memory stringMemory = m.addMemory(false, minSize.ceil(), minSize.ceil());
|
||||
m.addDataSegment(stringsAsBytes, stringMemory, 0);
|
||||
makeStringFunctionBody(translator.oneByteStringClass, oneByteStringFunction,
|
||||
(b) {
|
||||
|
|
|
@ -35,6 +35,8 @@ class Module with SerializerMixin {
|
|||
|
||||
int functionNameCount = 0;
|
||||
|
||||
static const int memoryBlockSize = 0x10000;
|
||||
|
||||
/// Create a new, initially empty, module.
|
||||
///
|
||||
/// The [watchPoints] is a list of byte offsets within the final module of
|
||||
|
@ -170,7 +172,8 @@ class Module with SerializerMixin {
|
|||
initialContent ??= Uint8List(0);
|
||||
assert((memory != null) == (offset != null));
|
||||
assert(memory == null ||
|
||||
offset! >= 0 && offset + initialContent.length <= memory.minSize);
|
||||
offset! >= 0 &&
|
||||
offset + initialContent.length <= memory.minSize * memoryBlockSize);
|
||||
final DataSegment data =
|
||||
DataSegment(dataSegments.length, initialContent, memory, offset);
|
||||
dataSegments.add(data);
|
||||
|
|
Loading…
Reference in a new issue