#include <stdio.h>
#include <string.h>
+#include "../include/v8.h"
#include "../include/v8stdint.h"
#include "../include/v8-preparser.h"
namespace i = v8::internal;
-// This file is only used for testing the stand-alone preparser
-// library.
+// This file is only used for testing the preparser.
// The first argument must be the path of a JavaScript source file, or
// the flags "-e" and the next argument is then the source of a JavaScript
// program.
ExceptionExpectation expects =
ParseExpectation(argc - arg_index, argv + arg_index);
+ v8::V8::Initialize();
+
ScopedPointer<uint8_t> buffer;
size_t length;
{
'target_name': 'preparser',
'type': 'executable',
- 'dependencies': [
- '../tools/gyp/v8.gyp:preparser_lib',
+ 'conditions': [
+ # preparser can't link against a shared library, so link against
+ # the underlying static targets.
+ ['v8_use_snapshot=="true"', {
+ 'dependencies': ['../tools/gyp/v8.gyp:v8_snapshot'],
+ }, {
+ 'dependencies': ['../tools/gyp/v8.gyp:v8_nosnapshot'],
+ }],
+ ],
+ 'include_dirs+': [
+ '../src',
],
'sources': [
'preparser-process.cc',
+ '../include/v8-preparser.h',
+ '../src/preparser-api.cc',
],
},
],
unsigned pushback_buffer_backing_size_;
};
-
-// Functions declared by allocation.h and implemented in both api.cc (for v8)
-// or here (for a stand-alone preparser).
-
-void FatalProcessOutOfMemory(const char* reason) {
- V8_Fatal(__FILE__, __LINE__, reason);
-}
-
-bool EnableSlowAsserts() { return true; }
-
} // namespace internal.
}
} // namespace v8.
-
-
-// Used by ASSERT macros and other immediate exits.
-extern "C" void V8_Fatal(const char* file, int line, const char* format, ...) {
- exit(EXIT_FAILURE);
-}
}],
],
},
- {
- 'target_name': 'preparser_lib',
- 'type': 'static_library',
- 'include_dirs+': [
- '../../src',
- ],
- 'sources': [
- '../../include/v8-preparser.h',
- '../../include/v8stdint.h',
- '../../src/allocation.cc',
- '../../src/allocation.h',
- '../../src/atomicops.h',
- '../../src/atomicops_internals_x86_gcc.cc',
- '../../src/bignum.cc',
- '../../src/bignum.h',
- '../../src/bignum-dtoa.cc',
- '../../src/bignum-dtoa.h',
- '../../src/cached-powers.cc',
- '../../src/cached-powers.h',
- '../../src/char-predicates-inl.h',
- '../../src/char-predicates.h',
- '../../src/checks.h',
- '../../src/conversions-inl.h',
- '../../src/conversions.cc',
- '../../src/conversions.h',
- '../../src/diy-fp.cc',
- '../../src/diy-fp.h',
- '../../src/double.h',
- '../../src/dtoa.cc',
- '../../src/dtoa.h',
- '../../src/fast-dtoa.cc',
- '../../src/fast-dtoa.h',
- '../../src/fixed-dtoa.cc',
- '../../src/fixed-dtoa.h',
- '../../src/globals.h',
- '../../src/hashmap.h',
- '../../src/list-inl.h',
- '../../src/list.h',
- '../../src/once.cc',
- '../../src/once.h',
- '../../src/preparse-data-format.h',
- '../../src/preparse-data.cc',
- '../../src/preparse-data.h',
- '../../src/preparser.cc',
- '../../src/preparser.h',
- '../../src/preparser-api.cc',
- '../../src/scanner.cc',
- '../../src/scanner.h',
- '../../src/strtod.cc',
- '../../src/strtod.h',
- '../../src/token.cc',
- '../../src/token.h',
- '../../src/unicode-inl.h',
- '../../src/unicode.cc',
- '../../src/unicode.h',
- '../../src/utils-inl.h',
- '../../src/utils.cc',
- '../../src/utils.h',
- ],
- 'conditions': [
- ['OS=="win"', {
- 'sources': [
- '../../src/win32-math.cc',
- '../../src/win32-math.h',
- ]}],
- ],
- },
],
}, { # use_system_v8 != 0
'targets': [