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

Side by Side Diff: preparser/preparser-process.cc

Issue 13880018: Remove preparser library; link preparser executable against full V8 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « preparser/preparser.gyp ('k') | src/preparser-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include <stdlib.h> 28 #include <stdlib.h>
29 #include <stdarg.h> 29 #include <stdarg.h>
30 #include <stdio.h> 30 #include <stdio.h>
31 #include <string.h> 31 #include <string.h>
32 32
33 #include "../include/v8.h"
33 #include "../include/v8stdint.h" 34 #include "../include/v8stdint.h"
34 #include "../include/v8-preparser.h" 35 #include "../include/v8-preparser.h"
35 36
36 #include "../src/preparse-data-format.h" 37 #include "../src/preparse-data-format.h"
37 38
38 namespace i = v8::internal; 39 namespace i = v8::internal;
39 40
40 // This file is only used for testing the stand-alone preparser 41 // This file is only used for testing the preparser.
41 // library.
42 // The first argument must be the path of a JavaScript source file, or 42 // The first argument must be the path of a JavaScript source file, or
43 // the flags "-e" and the next argument is then the source of a JavaScript 43 // the flags "-e" and the next argument is then the source of a JavaScript
44 // program. 44 // program.
45 // Optionally this can be followed by the word "throws" (case sensitive), 45 // Optionally this can be followed by the word "throws" (case sensitive),
46 // which signals that the parsing is expected to throw - the default is 46 // which signals that the parsing is expected to throw - the default is
47 // to expect the parsing to not throw. 47 // to expect the parsing to not throw.
48 // The command line can further be followed by a message text (the 48 // The command line can further be followed by a message text (the
49 // *type* of the exception to throw), and even more optionally, the 49 // *type* of the exception to throw), and even more optionally, the
50 // start and end position reported with the exception. 50 // start and end position reported with the exception.
51 // 51 //
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 if (argc <= arg_index) { 313 if (argc <= arg_index) {
314 fail(NULL, "ERROR: No source after -e on command line.\n"); 314 fail(NULL, "ERROR: No source after -e on command line.\n");
315 } 315 }
316 source = reinterpret_cast<const uint8_t*>(argv[arg_index]); 316 source = reinterpret_cast<const uint8_t*>(argv[arg_index]);
317 } 317 }
318 // Check remainder of command line for exception expectations. 318 // Check remainder of command line for exception expectations.
319 arg_index++; 319 arg_index++;
320 ExceptionExpectation expects = 320 ExceptionExpectation expects =
321 ParseExpectation(argc - arg_index, argv + arg_index); 321 ParseExpectation(argc - arg_index, argv + arg_index);
322 322
323 v8::V8::Initialize();
324
323 ScopedPointer<uint8_t> buffer; 325 ScopedPointer<uint8_t> buffer;
324 size_t length; 326 size_t length;
325 327
326 if (source == NULL) { 328 if (source == NULL) {
327 // Open JS file. 329 // Open JS file.
328 FILE* input = fopen(filename, "rb"); 330 FILE* input = fopen(filename, "rb");
329 if (input == NULL) { 331 if (input == NULL) {
330 perror("ERROR: Error opening file"); 332 perror("ERROR: Error opening file");
331 fflush(stderr); 333 fflush(stderr);
332 return EXIT_FAILURE; 334 return EXIT_FAILURE;
(...skipping 28 matching lines...) Expand all
361 if (data.stack_overflow()) { 363 if (data.stack_overflow()) {
362 fail(&data, "ERROR: Stack overflow\n"); 364 fail(&data, "ERROR: Stack overflow\n");
363 } 365 }
364 366
365 // Check that the expected exception is thrown, if an exception is 367 // Check that the expected exception is thrown, if an exception is
366 // expected. 368 // expected.
367 CheckException(&data, &expects); 369 CheckException(&data, &expects);
368 370
369 return EXIT_SUCCESS; 371 return EXIT_SUCCESS;
370 } 372 }
OLDNEW
« no previous file with comments | « preparser/preparser.gyp ('k') | src/preparser-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698