Skip to content

Commit

Permalink
fix(core): compatible with v8 low version
Browse files Browse the repository at this point in the history
  • Loading branch information
churchill-zhang authored and zoomchan-cxj committed Mar 16, 2023
1 parent 9292a73 commit dd06697
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions android/sdk/src/main/jni/src/bridge/entry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,11 @@ jint CreateSnapshot(JNIEnv* j_env,
v8_ctx = nullptr;
scope = nullptr;
auto blob = creator->CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kKeep);
#if (V8_MAJOR_VERSION >= 9)
if (!blob.IsValid()) {
return static_cast<jint>(CreateSnapshotResult::kSnapshotBlobInvalid);
}
#endif
SnapshotData snapshot_data;
snapshot_data.WriteMetaData(blob);
auto time_end = std::chrono::time_point_cast<std::chrono::microseconds>(
Expand Down Expand Up @@ -607,7 +609,9 @@ jlong InitInstance(JNIEnv* j_env,
if (!is_valid) {
break;
}
#if (V8_MAJOR_VERSION >= 9)
is_valid = param->snapshot_data.startup_data.IsValid();
#endif
} while (false);
if (!is_valid) {
TDF_BASE_LOG(ERROR) << "snapshot invalid";
Expand Down

0 comments on commit dd06697

Please sign in to comment.