| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 | 195 |
| 196 | 196 |
| 197 void fail(v8::PreParserData* data, const char* message, ...) { | 197 void fail(v8::PreParserData* data, const char* message, ...) { |
| 198 va_list args; | 198 va_list args; |
| 199 va_start(args, message); | 199 va_start(args, message); |
| 200 vfprintf(stderr, message, args); | 200 vfprintf(stderr, message, args); |
| 201 va_end(args); | 201 va_end(args); |
| 202 fflush(stderr); | 202 fflush(stderr); |
| 203 // Print preparser data to stdout. | 203 if (data != NULL) { |
| 204 uint32_t size = data->size(); | 204 // Print preparser data to stdout. |
| 205 fprintf(stderr, "LOG: data size: %u\n", size); | 205 uint32_t size = data->size(); |
| 206 if (!WriteBuffer(stdout, data->data(), size)) { | 206 fprintf(stderr, "LOG: data size: %u\n", size); |
| 207 perror("ERROR: Writing data"); | 207 if (!WriteBuffer(stdout, data->data(), size)) { |
| 208 fflush(stderr); | 208 perror("ERROR: Writing data"); |
| 209 fflush(stderr); |
| 210 } |
| 209 } | 211 } |
| 210 exit(EXIT_FAILURE); | 212 exit(EXIT_FAILURE); |
| 211 } | 213 } |
| 212 | 214 |
| 213 | 215 |
| 214 bool IsFlag(const char* arg) { | 216 bool IsFlag(const char* arg) { |
| 215 // Anything starting with '-' is considered a flag. | 217 // Anything starting with '-' is considered a flag. |
| 216 // It's summarily ignored for now. | 218 // It's summarily ignored for now. |
| 217 return arg[0] == '-'; | 219 return arg[0] == '-'; |
| 218 } | 220 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 if (data.stack_overflow()) { | 361 if (data.stack_overflow()) { |
| 360 fail(&data, "ERROR: Stack overflow\n"); | 362 fail(&data, "ERROR: Stack overflow\n"); |
| 361 } | 363 } |
| 362 | 364 |
| 363 // Check that the expected exception is thrown, if an exception is | 365 // Check that the expected exception is thrown, if an exception is |
| 364 // expected. | 366 // expected. |
| 365 CheckException(&data, &expects); | 367 CheckException(&data, &expects); |
| 366 | 368 |
| 367 return EXIT_SUCCESS; | 369 return EXIT_SUCCESS; |
| 368 } | 370 } |
| OLD | NEW |