On Tue, Jul 17, 2018 at 11:55 AM, <[email protected]> wrote: > Thanks for your kindly reply. > > What do you mean "Js natives"? Are they some c++ native functions written > in c++ on which v8's build-in js source codes depend? >
JS natives are builtin code shipped with V8 that are still implemented in JavaScript, see e.g.: https://cs.chromium.org/chromium/src/v8/src/js/array.js?l=1&rcl=f1b3e80faad6c84deabec8043bae524d1480293b > > I noticed that "v8_use_external_startup_data" is only used when " > v8_use_snapshot=true". So I thought "v8_use_external_startup_data" just > controls whether snapshot data is compiled into the binary. But actually it > controls both snapshot data and natives_blob data. > > Given "v8_use_snapshot=true v8_use_external_startup_data=false", I can > find the equivalent of snapshot_blob.bin that is snapshot.cc generated by > mksnapshot, but I can't find the equivalent of native_blob.bin. > The equivalent for natives_blob.bin is libraries.cc <https://cs.chromium.org/chromium/src/out/Debug/gen/v8/libraries.cc>. > > Also I thought "v8_use_snapshot" is used to control the disable/enable of > snapshot functionality, but actually it controls the generation of default > snapshot data. Even if given "v8_use_snapshot=false", I can still feed v8 > with my custom snapshot data. > Right. Look for V8_USE_SNAPSHOT in the V8 source code to see what changes (spoiler: not much). It's mostly the build process <https://cs.chromium.org/chromium/src/BUILD.gn?rcl=1de71b638f99c15a3f97ec7b25b0c6dc920fbee0> that differs. > > 在 2018年7月17日星期二 UTC+8下午3:31:11,Jakob Gruber写道: >> >> natives_blob.bin contains the minified source code of JS natives shipped >> with V8, while snapshot_blob.bin contains the startup and context >> snapshots. We are working on removing natives_blob.bin, hopefully this will >> happen sometime this year. >> >> Given "v8_use_snapshot=true v8_use_external_startup_data=false", the >> serialized data is compiled into the binary. >> Given "v8_use_snapshot=true v8_use_external_startup_data=true", >> serialized data is shipped as the external .bin files you mentioned. >> >> I hope that helps a bit. I'm not sure I understand your remaining >> questions, could you clarify if things are still unclear? >> >> On Thu, Jul 12, 2018 at 10:52 AM, <[email protected]> wrote: >> >>> when v8 is compiled with options "v8_use_snapshot=true >>> v8_use_external_startup_data=true", two files which are >>> natives_blob.bin and snapshot_blob.bin will be generated. when we use v8 >>> in our embedder progroam, *V8::InitializeExternalStartupData *need be >>> called to load the two files. After that, we need to new a isolate by >>> calling *Isolate::New* that will call >>> *isolate->set_snapshot_blob(i::Snapshot::DefaultSnapshotBlob());* if we >>> don't supply a custom snapshot data by specifing *CreateParams*'s snaps >>> hot_blob. >>> >>> But if v8 is complied with options "v8_use_snapshot=true >>> v8_use_external_startup_data=false", natives_blob.bin and >>> snapshot_blob.bin will not be generated. *V8::InitializeExternalStartupData >>> *need not be called. Can I call *Isolate::New *with a custom snapshot >>> data that was generated by *SnapshotCreator *Api. Notice in this case >>> no natives_blob.bin is supplied. So is natives_blob.bin necessary ? Is >>> natives_blob.bin complied into v8 binary? >>> >>> we can still supply a custom snapshot to *CreateParams even i*f v8 is >>> complied with options "v8_use_snapshot=false", is that right? >>> >>> what is the relationship between natives_blob.bin and snapshot_blob.bin? >>> why not just generate one snapshot file? >>> >>> -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
