Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Unified Diff: runtime/vm/os_fuchsia.cc

Issue 2189973003: Fuchsia: Make some more VM tests pass (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/os_fuchsia.cc
diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc
index b6343522633a5c30e7b7f50ee7db207ab7d731d2..09aa389890f11d102216d5fcd060e8a4c28b0016 100644
--- a/runtime/vm/os_fuchsia.cc
+++ b/runtime/vm/os_fuchsia.cc
@@ -10,6 +10,7 @@
#include <errno.h>
#include <magenta/syscalls.h>
#include <magenta/types.h>
+#include <runtime/sysinfo.h>
#include "platform/assert.h"
#include "vm/zone.h"
@@ -86,13 +87,19 @@ int64_t OS::GetCurrentThreadCPUMicros() {
void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) {
- UNIMPLEMENTED();
- return NULL;
+ const int kMinimumAlignment = 16;
+ ASSERT(Utils::IsPowerOfTwo(alignment));
+ ASSERT(alignment >= kMinimumAlignment);
+ void* p = memalign(alignment, size);
+ if (p == NULL) {
+ UNREACHABLE();
+ }
+ return p;
}
void OS::AlignedFree(void* ptr) {
- UNIMPLEMENTED();
+ free(ptr);
}
@@ -146,18 +153,19 @@ bool OS::AllowStackFrameIteratorFromAnotherThread() {
int OS::NumberOfAvailableProcessors() {
- UNIMPLEMENTED();
- return 0;
+ return mxr_get_nprocs_conf();
}
void OS::Sleep(int64_t millis) {
- UNIMPLEMENTED();
+ mx_nanosleep(
+ millis * kMicrosecondsPerMillisecond * kNanosecondsPerMicrosecond);
}
void OS::SleepMicros(int64_t micros) {
- UNIMPLEMENTED();
+ mx_nanosleep(
+ micros * kNanosecondsPerMicrosecond);
}

Powered by Google App Engine
This is Rietveld 408576698