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

Unified Diff: src/preparse-data.cc

Issue 641283003: Support lazy parsing of inner functions (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@bleeding_edge
Patch Set: Actually track variable declarations in the preparser Created 6 years, 1 month 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
« no previous file with comments | « src/preparse-data.h ('k') | src/preparse-data-format.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparse-data.cc
diff --git a/src/preparse-data.cc b/src/preparse-data.cc
index c101493c9f924d22a934128db77c2fa5c8eaf4a0..b129ab833feeb054748b64b67548afd8b2809d7b 100644
--- a/src/preparse-data.cc
+++ b/src/preparse-data.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "src/ast-value-factory.h"
#include "src/base/logging.h"
#include "src/compiler.h"
#include "src/globals.h"
@@ -14,7 +15,7 @@ namespace internal {
CompleteParserRecorder::CompleteParserRecorder()
- : function_store_(0) {
+ : function_store_(0), next_function_calls_eval_(false) {
preamble_[PreparseDataConstants::kMagicOffset] =
PreparseDataConstants::kMagicNumber;
preamble_[PreparseDataConstants::kVersionOffset] =
@@ -59,6 +60,23 @@ void CompleteParserRecorder::WriteString(Vector<const char> str) {
}
+void CompleteParserRecorder::WriteString(const AstRawString* str) {
+ const bool is_one_byte = str->is_one_byte();
+ function_store_.Add(is_one_byte);
+ int byte_length = str->length();
+ if (!is_one_byte) {
+ byte_length *= 2;
+ }
+ function_store_.Add(byte_length);
+ DCHECK(byte_length > 0);
+ const int word_length =
+ 1 + (((byte_length * sizeof(unsigned char)) - 1) / sizeof(unsigned));
+ Vector<unsigned char> dest =
+ Vector<unsigned char>::cast(function_store_.AddBlock(word_length, 0));
+ MemCopy(dest.start(), str->raw_data(), byte_length);
+}
+
+
ScriptData* CompleteParserRecorder::GetScriptData() {
int function_size = function_store_.size();
int total_size = PreparseDataConstants::kHeaderSize + function_size;
« no previous file with comments | « src/preparse-data.h ('k') | src/preparse-data-format.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698