| 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 #include "src/debug.h" | 6 #include "src/debug.h" |
| 7 | 7 |
| 8 namespace v8 { | 8 namespace v8 { |
| 9 namespace internal { | 9 namespace internal { |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 Zone* zone = new Zone(); | 24 Zone* zone = new Zone(); |
| 25 ParseInfo* info = new ParseInfo(zone); | 25 ParseInfo* info = new ParseInfo(zone); |
| 26 source->zone.Reset(zone); | 26 source->zone.Reset(zone); |
| 27 source->info.Reset(info); | 27 source->info.Reset(info); |
| 28 info->set_isolate(isolate); | 28 info->set_isolate(isolate); |
| 29 info->set_source_stream(source->source_stream.get()); | 29 info->set_source_stream(source->source_stream.get()); |
| 30 info->set_source_stream_encoding(source->encoding); | 30 info->set_source_stream_encoding(source->encoding); |
| 31 info->set_hash_seed(isolate->heap()->HashSeed()); | 31 info->set_hash_seed(isolate->heap()->HashSeed()); |
| 32 info->set_global(); | 32 info->set_global(); |
| 33 info->set_unicode_cache(&source_->unicode_cache); | 33 info->set_unicode_cache(&source_->unicode_cache); |
| 34 | |
| 35 bool disable_lazy = isolate->debug()->RequiresEagerCompilation(); | |
| 36 if (disable_lazy && options == ScriptCompiler::kProduceParserCache) { | |
| 37 // Producing cached data while parsing eagerly is not supported. | |
| 38 options = ScriptCompiler::kNoCompileOptions; | |
| 39 } | |
| 40 | |
| 41 info->set_compile_options(options); | 34 info->set_compile_options(options); |
| 42 info->set_allow_lazy_parsing(!disable_lazy); | 35 info->set_allow_lazy_parsing(true); |
| 43 } | 36 } |
| 44 | 37 |
| 45 | 38 |
| 46 void BackgroundParsingTask::Run() { | 39 void BackgroundParsingTask::Run() { |
| 47 DisallowHeapAllocation no_allocation; | 40 DisallowHeapAllocation no_allocation; |
| 48 DisallowHandleAllocation no_handles; | 41 DisallowHandleAllocation no_handles; |
| 49 DisallowHandleDereference no_deref; | 42 DisallowHandleDereference no_deref; |
| 50 | 43 |
| 51 ScriptData* script_data = NULL; | 44 ScriptData* script_data = NULL; |
| 52 ScriptCompiler::CompileOptions options = source_->info->compile_options(); | 45 ScriptCompiler::CompileOptions options = source_->info->compile_options(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 67 if (script_data != NULL) { | 60 if (script_data != NULL) { |
| 68 source_->cached_data.Reset(new ScriptCompiler::CachedData( | 61 source_->cached_data.Reset(new ScriptCompiler::CachedData( |
| 69 script_data->data(), script_data->length(), | 62 script_data->data(), script_data->length(), |
| 70 ScriptCompiler::CachedData::BufferOwned)); | 63 ScriptCompiler::CachedData::BufferOwned)); |
| 71 script_data->ReleaseDataOwnership(); | 64 script_data->ReleaseDataOwnership(); |
| 72 delete script_data; | 65 delete script_data; |
| 73 } | 66 } |
| 74 } | 67 } |
| 75 } // namespace internal | 68 } // namespace internal |
| 76 } // namespace v8 | 69 } // namespace v8 |
| OLD | NEW |