OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/background-parsing-task.h" | 5 #include "src/background-parsing-task.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 | 9 |
10 BackgroundParsingTask::BackgroundParsingTask( | 10 BackgroundParsingTask::BackgroundParsingTask( |
(...skipping 13 matching lines...) Expand all Loading... |
24 ParseInfo* info = new ParseInfo(zone); | 24 ParseInfo* info = new ParseInfo(zone); |
25 source->zone.Reset(zone); | 25 source->zone.Reset(zone); |
26 source->info.Reset(info); | 26 source->info.Reset(info); |
27 info->set_isolate(isolate); | 27 info->set_isolate(isolate); |
28 info->set_source_stream(source->source_stream.get()); | 28 info->set_source_stream(source->source_stream.get()); |
29 info->set_source_stream_encoding(source->encoding); | 29 info->set_source_stream_encoding(source->encoding); |
30 info->set_hash_seed(isolate->heap()->HashSeed()); | 30 info->set_hash_seed(isolate->heap()->HashSeed()); |
31 info->set_global(); | 31 info->set_global(); |
32 info->set_unicode_cache(&source_->unicode_cache); | 32 info->set_unicode_cache(&source_->unicode_cache); |
33 | 33 |
34 bool disable_lazy = Compiler::DebuggerWantsEagerCompilation(isolate); | 34 info->set_compile_options(options); |
35 if (disable_lazy && options == ScriptCompiler::kProduceParserCache) { | |
36 // Producing cached data while parsing eagerly is not supported. | |
37 options = ScriptCompiler::kNoCompileOptions; | |
38 } | |
39 | 35 |
40 info->set_compile_options(options); | 36 // The background parsing task is not used for eval, where we may compile for |
41 info->set_allow_lazy_parsing(!disable_lazy); | 37 // debugging. Without compiling inner functions eagerly, we can parse lazily. |
| 38 info->set_allow_lazy_parsing(true); |
42 } | 39 } |
43 | 40 |
44 | 41 |
45 void BackgroundParsingTask::Run() { | 42 void BackgroundParsingTask::Run() { |
46 DisallowHeapAllocation no_allocation; | 43 DisallowHeapAllocation no_allocation; |
47 DisallowHandleAllocation no_handles; | 44 DisallowHandleAllocation no_handles; |
48 DisallowHandleDereference no_deref; | 45 DisallowHandleDereference no_deref; |
49 | 46 |
50 ScriptData* script_data = NULL; | 47 ScriptData* script_data = NULL; |
51 ScriptCompiler::CompileOptions options = source_->info->compile_options(); | 48 ScriptCompiler::CompileOptions options = source_->info->compile_options(); |
(...skipping 14 matching lines...) Expand all Loading... |
66 if (script_data != NULL) { | 63 if (script_data != NULL) { |
67 source_->cached_data.Reset(new ScriptCompiler::CachedData( | 64 source_->cached_data.Reset(new ScriptCompiler::CachedData( |
68 script_data->data(), script_data->length(), | 65 script_data->data(), script_data->length(), |
69 ScriptCompiler::CachedData::BufferOwned)); | 66 ScriptCompiler::CachedData::BufferOwned)); |
70 script_data->ReleaseDataOwnership(); | 67 script_data->ReleaseDataOwnership(); |
71 delete script_data; | 68 delete script_data; |
72 } | 69 } |
73 } | 70 } |
74 } // namespace internal | 71 } // namespace internal |
75 } // namespace v8 | 72 } // namespace v8 |
OLD | NEW |