Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/jni/Constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

std::string Constants::APP_ROOT_FOLDER_PATH = "";
bool Constants::V8_CACHE_COMPILED_CODE = false;
bool Constants::V8_HEAP_SNAPSHOT = false;
std::string Constants::V8_STARTUP_FLAGS = "";
std::string Constants::V8_HEAP_SNAPSHOT_SCRIPT = "";
std::string Constants::V8_HEAP_SNAPSHOT_BLOB = "";
1 change: 0 additions & 1 deletion src/jni/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Constants
static std::string V8_HEAP_SNAPSHOT_SCRIPT;
static std::string V8_HEAP_SNAPSHOT_BLOB;
static bool V8_CACHE_COMPILED_CODE;
static bool V8_HEAP_SNAPSHOT;

private:
Constants()
Expand Down
10 changes: 4 additions & 6 deletions src/jni/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,11 @@ void Runtime::Init(jstring filesPath, bool verboseLoggingEnabled, jstring packag
Constants::V8_STARTUP_FLAGS = ArgConverter::jstringToString(v8Flags);
JniLocalRef cacheCode(m_env.GetObjectArrayElement(args, 1));
Constants::V8_CACHE_COMPILED_CODE = (bool) cacheCode;
JniLocalRef snapshot(m_env.GetObjectArrayElement(args, 2));
Constants::V8_HEAP_SNAPSHOT = (bool)snapshot;
JniLocalRef snapshotScript(m_env.GetObjectArrayElement(args, 3));
JniLocalRef snapshotScript(m_env.GetObjectArrayElement(args, 2));
Constants::V8_HEAP_SNAPSHOT_SCRIPT = ArgConverter::jstringToString(snapshotScript);
JniLocalRef snapshotBlob(m_env.GetObjectArrayElement(args, 4));
JniLocalRef snapshotBlob(m_env.GetObjectArrayElement(args, 3));
Constants::V8_HEAP_SNAPSHOT_BLOB = ArgConverter::jstringToString(snapshotBlob);
JniLocalRef profilerOutputDir(m_env.GetObjectArrayElement(args, 5));
JniLocalRef profilerOutputDir(m_env.GetObjectArrayElement(args, 4));

DEBUG_WRITE("Initializing Telerik NativeScript");

Expand Down Expand Up @@ -355,7 +353,7 @@ Isolate* Runtime::PrepareV8Runtime(const string& filesPath, jstring packageName,

create_params.array_buffer_allocator = &g_allocator;
// prepare the snapshot blob
if (Constants::V8_HEAP_SNAPSHOT)
if (!Constants::V8_HEAP_SNAPSHOT_BLOB.empty() || !Constants::V8_HEAP_SNAPSHOT_SCRIPT.empty())
{
DEBUG_WRITE_FORCE("Snapshot enabled.");

Expand Down
13 changes: 3 additions & 10 deletions src/src/com/tns/V8Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class V8Config
private static final String AndroidKey = "android";
private static final String V8FlagsKey = "v8Flags";
private static final String CodeCacheKey = "codeCache";
private static final String HeapSnapshotKey = "heapSnapshot";
private static final String HeapSnapshotScriptKey = "heapSnapshotScript";
private static final String HeapSnapshotBlobKey = "heapSnapshotBlob";
private static final String SnapshotFile = "snapshot.blob";
Expand Down Expand Up @@ -41,14 +40,10 @@ public static Object[] fromPackageJSON(File appDir)
{
result[1] = androidObject.getBoolean(CodeCacheKey);
}
if (androidObject.has(HeapSnapshotKey))
{
result[2] = androidObject.getBoolean(HeapSnapshotKey);
}
if(androidObject.has(HeapSnapshotScriptKey))
{
String value = androidObject.getString(HeapSnapshotScriptKey);
result[3] = FileSystem.resolveRelativePath(appDir.getPath(), value, appDir + "/app/");
result[2] = FileSystem.resolveRelativePath(appDir.getPath(), value, appDir + "/app/");
}
if(androidObject.has(HeapSnapshotBlobKey))
{
Expand All @@ -59,12 +54,12 @@ public static Object[] fromPackageJSON(File appDir)
{
// this path is expected to be a directory, containing three sub-directories: armeabi-v7a, x86 and arm64-v8a
path = path + "/" + Build.CPU_ABI + "/" + SnapshotFile;
result[4] = path;
result[3] = path;
}
}
if(androidObject.has(ProfilerOutputDirKey))
{
result[5] = androidObject.getString(ProfilerOutputDirKey);
result[4] = androidObject.getString(ProfilerOutputDirKey);
}
}
}
Expand All @@ -83,8 +78,6 @@ private static Object[] makeDefaultOptions()
"--expose_gc",
// enable v8 code caching, false by default
false,
// enable v8 heap snapshot, false by default
false,
// arbitrary script to be included in the snapshot
"",
// a binary file containing an already saved snapshot
Expand Down