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

Unified 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: added tests + fixed compilation flags (!) Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
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..7065f952dbd3b76b8e2313d584676ea8f6eca2e4
--- /dev/null
+++ b/src/background-parsing-task.cc
@@ -0,0 +1,31 @@
+// 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;
+
+void BackgroundParsingTask::Run() {
+ uintptr_t limit =
+ reinterpret_cast<uintptr_t>(&limit) - kBackgroundParserThreadStackSize;
+ Parser parser(source_->info, limit, hash_seed_);
+ parser.set_allow_lazy(allow_lazy_);
+ 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

Powered by Google App Engine
This is Rietveld 408576698