This commit removes the set_flags_from_command_line_with_usage and puts
it in an example code section instead.
The motivation for doing this is that the test output currently contains
the usage string and all the V8 options which creates a lot of output
when the tests is run regardless if --nocapture is used or not.
This should allow people to build without explicitly setting GN and
NINJA env vars.
If the tool(s) are detected, the build will continue without trying to
download the binaries.
This commit adds calls to v8::V8::dispose and v8::V8::shutdown_platform
to the hello_world.rs example.
The motivation for adding this is that it was not obvious to me that I
needed to have the Isolate in a separate scope. If there is not, the
platform will have been shutdown before the Isolate's Drop function
is called at the end of the function where the scope ends. Drop will in
turn call Dispose on the V8 Isolate, which calls Isolate::Deinit, and
Deinit calls tracing_cpu_profilers.reset() which will call
~TracingCpuProfilerImpl which has a call to V8::GetCurrentPlatform()
which will produce the following error:
Fatal error in ../../../v8/src/init/v8.cc, line 144
Debug check failed: platform.
FailureMessage Object: 0x7fff45b03700Illegal instruction (core dumped)
Having an example might safe others some time if they run into the same
issue.
The blanket `std:#️⃣:Hash` impl for instances of `v8::Data` invokes
`v8::internal::Object::GetHash()` but that crashes for `v8::Module`
objects. Use a custom impl that calls `v8::Module::get_identity_hash()`.
Fixes the following runtime assertion:
# Fatal error in ../../../v8/src/objects/objects-inl.h, line 1043
# Debug check failed: object.IsJSReceiver().
Refs: https://github.com/denoland/deno/pull/8354#discussion_r522157813
This commit removes mut from the script variable to avoid the following
warning if used:
25 | let mut script = v8::Script::compile(scope, code, None).unwrap();
| ----^^^^^^
| |
| help: remove this `mut`
|
= note: `#[warn(unused_mut)]` on by default
warning: 1 warning emitted