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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 3003583002: [VM, Precompiler] PoC Obfuscator (Closed)
Patch Set: address comments and fix stuff Created 3 years, 4 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/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 9b83543416b0533da26a5c3cd31e2d014e90c0b1..202eb97364d4609c0f453e84abec89355c7d8ba4 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1204,6 +1204,10 @@ static Dart_Isolate CreateIsolate(const char* script_uri,
return reinterpret_cast<Dart_Isolate>(NULL);
}
+DART_EXPORT void Dart_IsolateFlagsInitialize(Dart_IsolateFlags* flags) {
+ Isolate::FlagsInitialize(flags);
+}
+
DART_EXPORT Dart_Isolate
Dart_CreateIsolate(const char* script_uri,
const char* main,
@@ -6733,6 +6737,37 @@ Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer,
#endif
}
+DART_EXPORT Dart_Handle Dart_GetObfuscationMap(uint8_t** buffer,
+ intptr_t* buffer_length) {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return Api::NewError("No obfuscation map to save on an AOT runtime.");
+#else
+ Thread* thread = Thread::Current();
+ DARTSCOPE(thread);
+ Isolate* isolate = thread->isolate();
+
+ if (buffer == NULL) {
+ RETURN_NULL_ERROR(buffer);
+ }
+ if (buffer_length == NULL) {
+ RETURN_NULL_ERROR(buffer_length);
+ }
+
+ JSONStream js_stream;
+ {
+ JSONArray js_map(&js_stream);
+ if (isolate->obfuscation_map() != NULL) {
+ for (intptr_t i = 0; isolate->obfuscation_map()[i] != NULL; i++) {
+ js_map.AddValue(isolate->obfuscation_map()[i]);
+ }
+ }
+ }
+
+ js_stream.Steal(reinterpret_cast<char**>(buffer), buffer_length);
+ return Api::Success();
+#endif
+}
+
DART_EXPORT bool Dart_IsPrecompiledRuntime() {
#if defined(DART_PRECOMPILED_RUNTIME)
return true;

Powered by Google App Engine
This is Rietveld 408576698