mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
Simplify c api
This commit is contained in:
parent
7c71785981
commit
aa857984b0
3 changed files with 12 additions and 10 deletions
|
@ -295,8 +295,12 @@ void deno_add_isolate(Deno* d, v8::Isolate* isolate) {
|
|||
d->isolate->SetData(0, d);
|
||||
}
|
||||
|
||||
v8::StartupData deno_make_snapshot(const char* js_filename,
|
||||
const char* js_source) {
|
||||
v8::StartupData make_snapshot(v8::StartupData* prev_natives_blob,
|
||||
v8::StartupData* prev_snapshot_blob,
|
||||
const char* js_filename, const char* js_source) {
|
||||
v8::V8::SetNativesDataBlob(prev_natives_blob);
|
||||
v8::V8::SetSnapshotDataBlob(prev_snapshot_blob);
|
||||
|
||||
auto creator = new v8::SnapshotCreator(external_references);
|
||||
auto* isolate = creator->GetIsolate();
|
||||
|
||||
|
|
|
@ -28,8 +28,9 @@ void v8_set_flags(int* argc, char** argv);
|
|||
// Constructors:
|
||||
Deno* deno_from_snapshot(v8::StartupData* blob, void* data, RecvCallback cb);
|
||||
|
||||
v8::StartupData deno_make_snapshot(const char* js_filename,
|
||||
const char* js_source);
|
||||
v8::StartupData make_snapshot(v8::StartupData* prev_natives_blob,
|
||||
v8::StartupData* prev_snapshot_blob,
|
||||
const char* js_filename, const char* js_source);
|
||||
|
||||
void* deno_get_data();
|
||||
|
||||
|
|
|
@ -125,16 +125,13 @@ int main(int argc, char** argv) {
|
|||
const char* natives_out_cc = argv[4];
|
||||
const char* snapshot_out_cc = argv[5];
|
||||
|
||||
deno::v8_init();
|
||||
|
||||
auto js_data = ReadFile(js_fn);
|
||||
auto natives_blob = ReadFile(natives_in_bin);
|
||||
auto snapshot_in_blob = ReadFile(snapshot_in_bin);
|
||||
|
||||
v8::V8::SetNativesDataBlob(&natives_blob);
|
||||
v8::V8::SetSnapshotDataBlob(&snapshot_in_blob);
|
||||
|
||||
auto snapshot_blob = deno::deno_make_snapshot(js_fn, js_data.data);
|
||||
deno::v8_init();
|
||||
auto snapshot_blob = deno::make_snapshot(&natives_blob, &snapshot_in_blob,
|
||||
js_fn, js_data.data);
|
||||
|
||||
StartupDataCppWriter nativesWriter("natives", natives_out_cc, natives_blob);
|
||||
nativesWriter.Write();
|
||||
|
|
Loading…
Reference in a new issue