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

Unified Diff: preparser/preparser-process.cc

Issue 6580038: [Isolates] Merge from bleeding_edge, revisions 5934-6100. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 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
« no previous file with comments | « include/v8-profiler.h ('k') | samples/samples.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: preparser/preparser-process.cc
===================================================================
--- preparser/preparser-process.cc (revision 6904)
+++ preparser/preparser-process.cc (working copy)
@@ -127,7 +127,7 @@
bool ReadBuffer(FILE* source, void* buffer, size_t length) {
- size_t actually_read = fread(buffer, 1, length, stdin);
+ size_t actually_read = fread(buffer, 1, length, source);
return (actually_read == length);
}
@@ -150,22 +150,25 @@
};
-// Preparse stdin and output result on stdout.
-int PreParseIO() {
+// Preparse input and output result on stdout.
+int PreParseIO(FILE* input) {
fprintf(stderr, "LOG: Enter parsing loop\n");
bool ok = true;
- uint32_t length = ReadUInt32(stdin, &ok);
+ uint32_t length = ReadUInt32(input, &ok);
+ fprintf(stderr, "LOG: Input length: %d\n", length);
if (!ok) return kErrorReading;
ScopedPointer<uint8_t> buffer(new uint8_t[length]);
- if (!ReadBuffer(stdin, *buffer, length)) {
+ if (!ReadBuffer(input, *buffer, length)) {
return kErrorReading;
}
UTF8InputStream input_buffer(*buffer, static_cast<size_t>(length));
v8::PreParserData data =
- v8::Preparse(&input_buffer, 64 * sizeof(void*)); // NOLINT
+ v8::Preparse(&input_buffer, 64 * 1024 * sizeof(void*)); // NOLINT
if (data.stack_overflow()) {
+ fprintf(stderr, "LOG: Stack overflow\n");
+ fflush(stderr);
// Report stack overflow error/no-preparser-data.
WriteUInt32(stdout, 0, &ok);
if (!ok) return kErrorWriting;
@@ -173,6 +176,8 @@
}
uint32_t size = data.size();
+ fprintf(stderr, "LOG: Success, data size: %u\n", size);
+ fflush(stderr);
WriteUInt32(stdout, size, &ok);
if (!ok) return kErrorWriting;
if (!WriteBuffer(stdout, data.data(), size)) {
@@ -185,10 +190,17 @@
int main(int argc, char* argv[]) {
+ FILE* input = stdin;
+ if (argc > 1) {
+ char* arg = argv[1];
+ input = fopen(arg, "rb");
+ if (input == NULL) return EXIT_FAILURE;
+ }
int status = 0;
do {
- status = v8::internal::PreParseIO();
+ status = v8::internal::PreParseIO(input);
} while (status == 0);
fprintf(stderr, "EXIT: Failure %d\n", status);
+ fflush(stderr);
return EXIT_FAILURE;
}
« no previous file with comments | « include/v8-profiler.h ('k') | samples/samples.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698