30 #ifdef ENABLE_DEBUGGER_SUPPORT
32 #endif // ENABLE_DEBUGGER_SUPPORT
108 bool report_exceptions);
111 #ifdef ENABLE_DEBUGGER_SUPPORT
114 void DispatchDebugMessages() {
130 #endif // ENABLE_DEBUGGER_SUPPORT
139 int script_param_counter = 0;
141 #ifdef ENABLE_DEBUGGER_SUPPORT
142 int port_number = -1;
143 bool wait_for_connection =
false;
144 bool support_callback =
false;
145 #endif // ENABLE_DEBUGGER_SUPPORT
149 for (
int i = 1; i < argc; i++) {
150 const char* str = argv[i];
151 if (strcmp(str,
"-f") == 0) {
155 }
else if (strcmp(str,
"--main-cycle-in-cpp") == 0) {
157 }
else if (strcmp(str,
"--main-cycle-in-js") == 0) {
159 #ifdef ENABLE_DEBUGGER_SUPPORT
160 }
else if (strcmp(str,
"--callback") == 0) {
161 support_callback =
true;
162 }
else if (strcmp(str,
"--wait-for-connection") == 0) {
163 wait_for_connection =
true;
164 }
else if (strcmp(str,
"-p") == 0 && i + 1 < argc) {
165 port_number = atoi(argv[i + 1]);
167 #endif // ENABLE_DEBUGGER_SUPPORT
168 }
else if (strncmp(str,
"--", 2) == 0) {
169 printf(
"Warning: unknown flag %s.\nTry --help for options\n", str);
170 }
else if (strcmp(str,
"-e") == 0 && i + 1 < argc) {
174 script_param_counter++;
180 printf(
"Error reading '%s'\n", str);
183 script_param_counter++;
187 if (script_param_counter == 0) {
188 printf(
"Script is not specified\n");
191 if (script_param_counter != 1) {
192 printf(
"Only one script may be specified\n");
214 #ifdef ENABLE_DEBUGGER_SUPPORT
219 if (support_callback) {
223 if (port_number != -1) {
226 #endif // ENABLE_DEBUGGER_SUPPORT
228 bool report_exceptions =
true;
237 if (report_exceptions)
248 if (report_exceptions)
266 bool report_exceptions) {
267 #ifdef ENABLE_DEBUGGER_SUPPORT
269 #endif // ENABLE_DEBUGGER_SUPPORT
278 printf(
"Error: Script does not declare 'ProcessLine' global function.\n");
287 while (!feof(stdin)) {
304 if (report_exceptions)
311 printf(
"%s\n", cstr);
317 int main(
int argc,
char* argv[]) {
318 int result =
RunMain(argc, argv);
326 return *value ? *value :
"<string conversion failed>";
332 FILE* file = fopen(name,
"rb");
335 fseek(file, 0, SEEK_END);
336 int size = ftell(file);
339 char* chars =
new char[size + 1];
341 for (
int i = 0; i < size;) {
342 int read =
static_cast<int>(fread(&chars[i], 1, size - i, file));
355 const char* exception_string =
ToCString(exception);
360 printf(
"%s\n", exception_string);
364 const char* filename_string =
ToCString(filename);
366 printf(
"%s:%i: %s\n", filename_string, linenum, exception_string);
369 const char* sourceline_string =
ToCString(sourceline);
370 printf(
"%s\n", sourceline_string);
373 for (
int i = 0; i < start; i++) {
377 for (
int i = start; i < end; i++) {
390 for (
int i = 0; i < args.
Length(); i++) {
417 const int kBufferSize = 1024 + 1;
418 char buffer[kBufferSize];
422 #ifdef ENABLE_DEBUGGER_SUPPORT
424 #endif // ENABLE_DEBUGGER_SUPPORT
425 res = fgets(buffer, kBufferSize, stdin);
432 for (
char* pos = buffer; *pos !=
'\0'; pos++) {
static Local< Context > GetCurrent()
v8::Handle< v8::String > ReadFile(const char *name)
static Local< Script > Compile(Handle< String > source, ScriptOrigin *origin=NULL, ScriptData *pre_data=NULL, Handle< String > script_data=Handle< String >())
static Local< FunctionTemplate > New(InvocationCallback callback=0, Handle< Value > data=Handle< Value >(), Handle< Signature > signature=Handle< Signature >())
const char * ToCString(const v8::String::Utf8Value &value)
Local< Value > Exception() const
static V8EXPORT Local< String > New(const char *data, int length=-1)
static Handle< T > Cast(Handle< S > that)
V8EXPORT Local< Value > Call(Handle< Object > recv, int argc, Handle< Value > argv[])
v8::Handle< v8::Value > Print(const v8::Arguments &args)
v8::Handle< v8::String > ReadLine()
void Set(Handle< String > name, Handle< Data > value, PropertyAttribute attributes=None)
Handle< Value > GetScriptResourceName() const
static Local< ObjectTemplate > New()
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if expose natives in global object expose gc extension number of stack frames to capture disable builtin natives files print a stack trace if an assertion failure occurs use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations prepare for turning on always opt minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions automatically set the debug break flag when debugger commands are in the queue always cause a debug break before aborting maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print more details following each garbage collection print amount of external allocated memory after each time it is adjusted flush code that we expect not to use again before full gc do incremental marking steps track object counts and memory usage use caching Perform compaction on every full GC Never perform compaction on full GC testing only Compact code space on full incremental collections Default seed for initializing random allows verbose printing trace parsing and preparsing Check icache flushes in ARM and MIPS simulator Stack alingment in bytes in print stack trace when throwing exceptions randomize hashes to avoid predictable hash Fixed seed to use to hash property activate a timer that switches between V8 threads testing_bool_flag float flag Seed used for threading test randomness A filename with extra code to be included in the Print usage message
static Persistent< T > New(Handle< T > that)
static String * Cast(v8::Value *obj)
static bool EnableAgent(const char *name, int port, bool wait_for_connection=false)
int GetLineNumber() const
V8EXPORT bool IsFunction() const
bool RunCppCycle(v8::Handle< v8::Script > script, v8::Local< v8::Context > context, bool report_exceptions)
static void SetDebugMessageDispatchHandler(DebugMessageDispatchHandler handler, bool provide_locker=false)
void ReportException(v8::TryCatch *handler)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL
int RunMain(int argc, char *argv[])
Handle< Primitive > V8EXPORT Undefined()
static Persistent< Context > New(ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
static void SetFlagsFromCommandLine(int *argc, char **argv, bool remove_flags)
int GetStartColumn() const
int main(int argc, char *argv[])
Handle< Value > V8EXPORT ThrowException(Handle< Value > exception)
static void ProcessDebugMessages()
Local< v8::Message > Message() const
Local< String > GetSourceLine() const