FunctionEntryHook: require no-snapshot build

When a FunctionEntryHook parameter was passed to isolate creation,
we ignored any existing snapshots anyway. Since the ability to
bootstrap from scratch will be removed from snapshot builds, the
FunctionEntryHook feature must depend on a no-snapshot build.

BUG=v8:6055

Review-Url: https://codereview.chromium.org/2733203002
Cr-Commit-Position: refs/heads/master@{#43779}
This commit is contained in:
jkummerow 2017-03-14 05:31:03 -07:00 committed by Commit bot
parent 822aef290f
commit d0e604bf26
4 changed files with 16 additions and 2 deletions

View File

@ -258,6 +258,9 @@ config("features") {
if (v8_enable_handle_zapping) {
defines += [ "ENABLE_HANDLE_ZAPPING" ]
}
if (v8_use_snapshot) {
defines += [ "V8_USE_SNAPSHOT" ]
}
if (v8_use_external_startup_data) {
defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
}

View File

@ -6342,8 +6342,9 @@ class V8_EXPORT Isolate {
* The optional entry_hook allows the host application to provide the
* address of a function that's invoked on entry to every V8-generated
* function. Note that entry_hook is invoked at the very start of each
* generated function. Furthermore, if an entry_hook is given, V8 will
* not use a snapshot, including custom snapshots.
* generated function.
* An entry_hook can only be provided in no-snapshot builds; in snapshot
* builds it must be nullptr.
*/
FunctionEntryHook entry_hook;

View File

@ -8143,6 +8143,12 @@ Isolate* Isolate::New(const Isolate::CreateParams& params) {
isolate->set_snapshot_blob(i::Snapshot::DefaultSnapshotBlob());
}
if (params.entry_hook) {
#ifdef V8_USE_SNAPSHOT
// Setting a FunctionEntryHook is only supported in no-snapshot builds.
Utils::ApiCheck(
false, "v8::Isolate::New",
"Setting a FunctionEntryHook is only supported in no-snapshot builds.");
#endif
isolate->set_function_entry_hook(params.entry_hook);
}
auto code_event_handler = params.code_event_handler;

View File

@ -185,6 +185,10 @@
'test-api/FastReturnValues*': [PASS, SLOW],
'test-decls/CrossScriptReferences_Simple2': [PASS, SLOW],
}], # 'no_snap == True'
['no_snap == False', {
# FunctionEntryHooks require bootstrapping from scratch.
'test-api/SetFunctionEntryHook': [SKIP],
}], # 'no_snap == False'
##############################################################################
# TODO(machenbach): Fix application of '*'. Nosnap windows needs a separate