| 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 #include "src/debug/debug.h" | 7 #include "src/debug/debug.h" |
| 8 #include "src/parsing/parser.h" | 8 #include "src/parsing/parser.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 | 58 |
| 59 void BackgroundParsingTask::Run() { | 59 void BackgroundParsingTask::Run() { |
| 60 DisallowHeapAllocation no_allocation; | 60 DisallowHeapAllocation no_allocation; |
| 61 DisallowHandleAllocation no_handles; | 61 DisallowHandleAllocation no_handles; |
| 62 DisallowHandleDereference no_deref; | 62 DisallowHandleDereference no_deref; |
| 63 | 63 |
| 64 // Reset the stack limit of the parser to reflect correctly that we're on a | 64 // Reset the stack limit of the parser to reflect correctly that we're on a |
| 65 // background thread. | 65 // background thread. |
| 66 uintptr_t stack_limit = | 66 uintptr_t stack_limit = GetCurrentStackPosition() - stack_size_ * KB; |
| 67 reinterpret_cast<uintptr_t>(&stack_limit) - stack_size_ * KB; | |
| 68 source_->parser->set_stack_limit(stack_limit); | 67 source_->parser->set_stack_limit(stack_limit); |
| 69 | 68 |
| 70 // Nullify the Isolate temporarily so that the background parser doesn't | 69 // Nullify the Isolate temporarily so that the background parser doesn't |
| 71 // accidentally use it. | 70 // accidentally use it. |
| 72 Isolate* isolate = source_->info->isolate(); | 71 Isolate* isolate = source_->info->isolate(); |
| 73 source_->info->set_isolate(nullptr); | 72 source_->info->set_isolate(nullptr); |
| 74 | 73 |
| 75 source_->parser->ParseOnBackground(source_->info.get()); | 74 source_->parser->ParseOnBackground(source_->info.get()); |
| 76 | 75 |
| 77 if (script_data_ != nullptr) { | 76 if (script_data_ != nullptr) { |
| 78 source_->cached_data.reset(new ScriptCompiler::CachedData( | 77 source_->cached_data.reset(new ScriptCompiler::CachedData( |
| 79 script_data_->data(), script_data_->length(), | 78 script_data_->data(), script_data_->length(), |
| 80 ScriptCompiler::CachedData::BufferOwned)); | 79 ScriptCompiler::CachedData::BufferOwned)); |
| 81 script_data_->ReleaseDataOwnership(); | 80 script_data_->ReleaseDataOwnership(); |
| 82 delete script_data_; | 81 delete script_data_; |
| 83 script_data_ = nullptr; | 82 script_data_ = nullptr; |
| 84 } | 83 } |
| 85 source_->info->set_isolate(isolate); | 84 source_->info->set_isolate(isolate); |
| 86 } | 85 } |
| 87 } // namespace internal | 86 } // namespace internal |
| 88 } // namespace v8 | 87 } // namespace v8 |
| OLD | NEW |