summaryrefslogtreecommitdiffstats
path: root/preparser
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2012-04-11 18:30:58 +0100
committerBen Murdoch <benm@google.com>2012-04-11 18:39:07 +0100
commit85b71799222b55eb5dd74ea26efe0c64ab655c8c (patch)
tree0d0fa6be365df4b76fe2985458b3a9b9afd80988 /preparser
parent5d4cdbf7a67d3662fa0bee4efdb7edd8daec9b0b (diff)
downloadandroid_external_v8-85b71799222b55eb5dd74ea26efe0c64ab655c8c.tar.gz
android_external_v8-85b71799222b55eb5dd74ea26efe0c64ab655c8c.tar.bz2
android_external_v8-85b71799222b55eb5dd74ea26efe0c64ab655c8c.zip
Roll V8 back to 3.6
Roll back to V8 3.6 to fix x86 build, we don't have ucontext.h. This reverts commits: 5d4cdbf7a67d3662fa0bee4efdb7edd8daec9b0b c7cc028aaeedbbfa11c11d0b7b243b3d9e837ed9 592a9fc1d8ea420377a2e7efd0600e20b058be2b Bug: 5688872 Change-Id: Ic961bb5e65b778e98bbfb71cce71d99fa949e995
Diffstat (limited to 'preparser')
-rw-r--r--preparser/preparser-process.cc49
1 files changed, 29 insertions, 20 deletions
diff --git a/preparser/preparser-process.cc b/preparser/preparser-process.cc
index 368f63f6..e67851cb 100644
--- a/preparser/preparser-process.cc
+++ b/preparser/preparser-process.cc
@@ -200,14 +200,12 @@ void fail(v8::PreParserData* data, const char* message, ...) {
vfprintf(stderr, message, args);
va_end(args);
fflush(stderr);
- if (data != NULL) {
- // Print preparser data to stdout.
- uint32_t size = data->size();
- fprintf(stderr, "LOG: data size: %u\n", size);
- if (!WriteBuffer(stdout, data->data(), size)) {
- perror("ERROR: Writing data");
- fflush(stderr);
- }
+ // Print preparser data to stdout.
+ uint32_t size = data->size();
+ fprintf(stderr, "LOG: data size: %u\n", size);
+ if (!WriteBuffer(stdout, data->data(), size)) {
+ perror("ERROR: Writing data");
+ fflush(stderr);
}
exit(EXIT_FAILURE);
}
@@ -269,22 +267,34 @@ void CheckException(v8::PreParserData* data,
ExceptionExpectation ParseExpectation(int argc, const char* argv[]) {
- // Parse ["throws" [<exn-type> [<start> [<end>]]]].
ExceptionExpectation expects;
+
+ // Parse exception expectations from (the remainder of) the command line.
int arg_index = 0;
- while (argc > arg_index && strncmp("throws", argv[arg_index], 7)) {
- arg_index++;
- }
+ // Skip any flags.
+ while (argc > arg_index && IsFlag(argv[arg_index])) arg_index++;
if (argc > arg_index) {
+ if (strncmp("throws", argv[arg_index], 7)) {
+ // First argument after filename, if present, must be the verbatim
+ // "throws", marking that the preparsing should fail with an exception.
+ fail(NULL, "ERROR: Extra arguments not prefixed by \"throws\".\n");
+ }
expects.throws = true;
- arg_index++;
- if (argc > arg_index && !IsFlag(argv[arg_index])) {
- expects.type = argv[arg_index];
+ do {
arg_index++;
- if (argc > arg_index && !IsFlag(argv[arg_index])) {
- expects.beg_pos = atoi(argv[arg_index]); // NOLINT
+ } while (argc > arg_index && IsFlag(argv[arg_index]));
+ if (argc > arg_index) {
+ // Next argument is the exception type identifier.
+ expects.type = argv[arg_index];
+ do {
arg_index++;
- if (argc > arg_index && !IsFlag(argv[arg_index])) {
+ } while (argc > arg_index && IsFlag(argv[arg_index]));
+ if (argc > arg_index) {
+ expects.beg_pos = atoi(argv[arg_index]); // NOLINT
+ do {
+ arg_index++;
+ } while (argc > arg_index && IsFlag(argv[arg_index]));
+ if (argc > arg_index) {
expects.end_pos = atoi(argv[arg_index]); // NOLINT
}
}
@@ -298,8 +308,7 @@ int main(int argc, const char* argv[]) {
// Parse command line.
// Format: preparser (<scriptfile> | -e "<source>")
// ["throws" [<exn-type> [<start> [<end>]]]]
- // Any flags (except an initial -e) are ignored.
- // Flags must not separate "throws" and its arguments.
+ // Any flags (except an initial -s) are ignored.
// Check for mandatory filename argument.
int arg_index = 1;