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 |