Fix --cache=code option to work with interactive shell.
--cache=code produces and consume cache in different isolates. Earlier we created a new isolate for the run consuming the code cache. This cl changes to create a new isolate when producing the code cache so that RunShell works as expected. Change-Id: I1c73aab2bee429aafdcc52a68ddcf742edfcd652 Reviewed-on: https://chromium-review.googlesource.com/997694 Commit-Queue: Mythri Alle <mythria@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#52424}
This commit is contained in:
parent
fee762f9a9
commit
9cf5e47bfa
22
src/d8.cc
22
src/d8.cc
@ -2916,7 +2916,6 @@ bool Shell::SetOptions(int argc, char* argv[]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int Shell::RunMain(Isolate* isolate, int argc, char* argv[], bool last_run) {
|
||||
for (int i = 1; i < options.num_isolates; ++i) {
|
||||
options.isolate_sources[i].StartExecuteInThread();
|
||||
@ -3398,15 +3397,6 @@ int Shell::Main(int argc, char* argv[]) {
|
||||
ShellOptions::CodeCacheOptions::kNoProduceCache) {
|
||||
printf("============ Run: Produce code cache ============\n");
|
||||
// First run to produce the cache
|
||||
result = RunMain(isolate, argc, argv, false);
|
||||
|
||||
// Change the options to consume cache
|
||||
DCHECK(options.compile_options == v8::ScriptCompiler::kEagerCompile ||
|
||||
options.compile_options == v8::ScriptCompiler::kNoCompileOptions);
|
||||
options.compile_options = v8::ScriptCompiler::kConsumeCodeCache;
|
||||
|
||||
printf("============ Run: Consume code cache ============\n");
|
||||
// Second run to consume the cache in new isolate
|
||||
Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator = Shell::array_buffer_allocator;
|
||||
i::FLAG_hash_seed ^= 1337; // Use a different hash seed.
|
||||
@ -3422,9 +3412,19 @@ int Shell::Main(int argc, char* argv[]) {
|
||||
PerIsolateData data(isolate2);
|
||||
Isolate::Scope isolate_scope(isolate2);
|
||||
|
||||
result = RunMain(isolate2, argc, argv, true);
|
||||
result = RunMain(isolate2, argc, argv, false);
|
||||
}
|
||||
isolate2->Dispose();
|
||||
|
||||
// Change the options to consume cache
|
||||
DCHECK(options.compile_options == v8::ScriptCompiler::kEagerCompile ||
|
||||
options.compile_options == v8::ScriptCompiler::kNoCompileOptions);
|
||||
options.compile_options = v8::ScriptCompiler::kConsumeCodeCache;
|
||||
|
||||
printf("============ Run: Consume code cache ============\n");
|
||||
// Second run to consume the cache in current isolate
|
||||
result = RunMain(isolate, argc, argv, true);
|
||||
options.compile_options = v8::ScriptCompiler::kNoCompileOptions;
|
||||
} else {
|
||||
bool last_run = true;
|
||||
result = RunMain(isolate, argc, argv, last_run);
|
||||
|
Loading…
Reference in New Issue
Block a user