05c28c6115
This reverts commit9198813a55. Reason for revert: Relanding with a fix Original change's description: > Revert "Scaffolding for dart:wasm" > > This reverts commitf39a3f188e. > > Reason for revert: https://golem.corp.goog/BuildInfo?target=flutter-profile&machine-type=android-armv7&revision=84750 > > Original change's description: > > Scaffolding for dart:wasm > > > > This CL doesn't have any tests because it's just boilerplate. I'll > > add a test in the follow up CLs where I add actual functionality. > > > > Bug: https://github.com/dart-lang/sdk/issues/37882 > > Change-Id: I47c81f5f1be724f8226e756ba5d01880a45f1ac7 > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112841 > > Reviewed-by: Siva Annamalai <asiva@google.com> > > Reviewed-by: Liam Appelbe <liama@google.com> > > Commit-Queue: Liam Appelbe <liama@google.com> > > TBR=asiva@google.com,liama@google.com > > Change-Id: I0fd0f29d66a07fc29e840ddaec2d4161c8d599cb > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: https://github.com/dart-lang/sdk/issues/37882 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114044 > Reviewed-by: Liam Appelbe <liama@google.com> > Commit-Queue: Liam Appelbe <liama@google.com> TBR=asiva@google.com,liama@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: https://github.com/dart-lang/sdk/issues/37882 Change-Id: Idb43cbd3a0521776ac420bfef91c8a9a4362f18e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114757 Reviewed-by: Liam Appelbe <liama@google.com> Commit-Queue: Liam Appelbe <liama@google.com>
29 lines
914 B
C++
29 lines
914 B
C++
// 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.
|
|
|
|
#include "platform/unicode.h"
|
|
#include "vm/bootstrap_natives.h"
|
|
#include "vm/dart_entry.h"
|
|
|
|
namespace dart {
|
|
|
|
int callWasm(const char* name, int n) {
|
|
return 100 * n;
|
|
}
|
|
|
|
// This is a temporary API for prototyping.
|
|
DEFINE_NATIVE_ENTRY(Wasm_callFunction, 0, 2) {
|
|
GET_NON_NULL_NATIVE_ARGUMENT(String, fn_name, arguments->NativeArgAt(0));
|
|
GET_NON_NULL_NATIVE_ARGUMENT(Integer, arg, arguments->NativeArgAt(1));
|
|
|
|
intptr_t len = Utf8::Length(fn_name);
|
|
std::unique_ptr<char> name = std::unique_ptr<char>(new char[len + 1]);
|
|
fn_name.ToUTF8(reinterpret_cast<uint8_t*>(name.get()), len);
|
|
name.get()[len] = 0;
|
|
|
|
return Smi::New(callWasm(name.get(), arg.AsInt64Value()));
|
|
}
|
|
|
|
} // namespace dart
|