Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: src/background-parsing-task.cc

Issue 366153002: Add script streaming API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: cleanup Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/background-parsing-task.h"
6
7 #include "src/parser.h"
8
9 namespace v8 {
10 namespace internal {
11
12 static const int kBackgroundParserThreadStackSize = 64 * KB;
13
14
15 StreamingData::~StreamingData() {
16 delete info;
17 delete unicode_cache;
18 delete parser;
19 }
20
21
22 void BackgroundParsingTask::Run() {
23 DisallowHeapAllocation no_allocation;
24 DisallowHandleAllocation no_handles;
25 DisallowHandleDereference no_deref;
26
27 uintptr_t limit =
28 reinterpret_cast<uintptr_t>(&limit) - kBackgroundParserThreadStackSize;
29
30 Parser::ParseInfo parse_info = {limit, source_->streaming_data->hash_seed,
31 source_->streaming_data->unicode_cache};
32 StreamingData* streaming_data = source_->streaming_data;
33 // This is OK because Parser doesn't store the ParseInfo.
34 streaming_data->parser = new Parser(streaming_data->info, &parse_info);
35 streaming_data->parser->set_allow_lazy(streaming_data->allow_lazy);
36 streaming_data->parser->ParseOnBackground();
37
38 if (script_data_ != NULL) {
39 source_->cached_data = new ScriptCompiler::CachedData(
40 script_data_->data(), script_data_->length(),
41 ScriptCompiler::CachedData::BufferOwned);
42 script_data_->ReleaseDataOwnership();
43 delete script_data_;
44 script_data_ = NULL;
45 }
46 }
47 }
48 } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698