| Index: src/background-parsing-task.cc
|
| diff --git a/src/background-parsing-task.cc b/src/background-parsing-task.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7097e9ec82bfd69a0f91c72f7d3a43c041420bf6
|
| --- /dev/null
|
| +++ b/src/background-parsing-task.cc
|
| @@ -0,0 +1,48 @@
|
| +// Copyright 2014 the V8 project authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "src/background-parsing-task.h"
|
| +
|
| +#include "src/parser.h"
|
| +
|
| +namespace v8 {
|
| +namespace internal {
|
| +
|
| +static const int kBackgroundParserThreadStackSize = 64 * KB;
|
| +
|
| +
|
| +StreamingData::~StreamingData() {
|
| + delete info;
|
| + delete unicode_cache;
|
| + delete parser;
|
| +}
|
| +
|
| +
|
| +void BackgroundParsingTask::Run() {
|
| + DisallowHeapAllocation no_allocation;
|
| + DisallowHandleAllocation no_handles;
|
| + DisallowHandleDereference no_deref;
|
| +
|
| + uintptr_t limit =
|
| + reinterpret_cast<uintptr_t>(&limit) - kBackgroundParserThreadStackSize;
|
| +
|
| + Parser::ParseInfo parse_info = {limit, source_->streaming_data->hash_seed,
|
| + source_->streaming_data->unicode_cache};
|
| + StreamingData* streaming_data = source_->streaming_data;
|
| + // This is OK because Parser doesn't store the ParseInfo.
|
| + streaming_data->parser = new Parser(streaming_data->info, &parse_info);
|
| + streaming_data->parser->set_allow_lazy(streaming_data->allow_lazy);
|
| + streaming_data->parser->ParseOnBackground();
|
| +
|
| + if (script_data_ != NULL) {
|
| + source_->cached_data = new ScriptCompiler::CachedData(
|
| + script_data_->data(), script_data_->length(),
|
| + ScriptCompiler::CachedData::BufferOwned);
|
| + script_data_->ReleaseDataOwnership();
|
| + delete script_data_;
|
| + script_data_ = NULL;
|
| + }
|
| +}
|
| +}
|
| +} // namespace v8::internal
|
|
|