30 #ifdef ENABLE_DEBUGGER_SUPPORT
32 #endif // ENABLE_DEBUGGER_SUPPORT
109 bool report_exceptions);
112 #ifdef ENABLE_DEBUGGER_SUPPORT
115 void DispatchDebugMessages() {
135 #endif // ENABLE_DEBUGGER_SUPPORT
145 int script_param_counter = 0;
147 #ifdef ENABLE_DEBUGGER_SUPPORT
148 int port_number = -1;
149 bool wait_for_connection =
false;
150 bool support_callback =
false;
151 #endif // ENABLE_DEBUGGER_SUPPORT
155 for (
int i = 1; i < argc; i++) {
156 const char* str = argv[i];
157 if (strcmp(str,
"-f") == 0) {
161 }
else if (strcmp(str,
"--main-cycle-in-cpp") == 0) {
163 }
else if (strcmp(str,
"--main-cycle-in-js") == 0) {
165 #ifdef ENABLE_DEBUGGER_SUPPORT
166 }
else if (strcmp(str,
"--callback") == 0) {
167 support_callback =
true;
168 }
else if (strcmp(str,
"--wait-for-connection") == 0) {
169 wait_for_connection =
true;
170 }
else if (strcmp(str,
"-p") == 0 && i + 1 < argc) {
171 port_number = atoi(argv[i + 1]);
173 #endif // ENABLE_DEBUGGER_SUPPORT
174 }
else if (strncmp(str,
"--", 2) == 0) {
175 printf(
"Warning: unknown flag %s.\nTry --help for options\n", str);
176 }
else if (strcmp(str,
"-e") == 0 && i + 1 < argc) {
180 script_param_counter++;
183 script_source =
ReadFile(isolate, str);
186 printf(
"Error reading '%s'\n", str);
189 script_param_counter++;
193 if (script_param_counter == 0) {
194 printf(
"Script is not specified\n");
197 if (script_param_counter != 1) {
198 printf(
"Only one script may be specified\n");
221 #ifdef ENABLE_DEBUGGER_SUPPORT
222 debug_message_context.
Reset(isolate, context);
226 if (support_callback) {
230 if (port_number != -1) {
233 #endif // ENABLE_DEBUGGER_SUPPORT
235 bool report_exceptions =
true;
245 if (report_exceptions)
256 if (report_exceptions)
276 bool report_exceptions) {
278 #ifdef ENABLE_DEBUGGER_SUPPORT
280 #endif // ENABLE_DEBUGGER_SUPPORT
289 printf(
"Error: Script does not declare 'ProcessLine' global function.\n");
298 while (!feof(stdin)) {
315 if (report_exceptions)
322 printf(
"%s\n", cstr);
329 int main(
int argc,
char* argv[]) {
331 int result =
RunMain(argc, argv);
339 return *value ? *value :
"<string conversion failed>";
345 FILE* file = fopen(name,
"rb");
348 fseek(file, 0, SEEK_END);
349 int size = ftell(file);
352 char* chars =
new char[size + 1];
354 for (
int i = 0; i <
size;) {
355 int read =
static_cast<int>(fread(&chars[i], 1, size - i, file));
369 const char* exception_string =
ToCString(exception);
374 printf(
"%s\n", exception_string);
378 const char* filename_string =
ToCString(filename);
380 printf(
"%s:%i: %s\n", filename_string, linenum, exception_string);
383 const char* sourceline_string =
ToCString(sourceline);
384 printf(
"%s\n", sourceline_string);
387 for (
int i = 0; i < start; i++) {
391 for (
int i = start; i < end; i++) {
404 for (
int i = 0; i < args.
Length(); i++) {
433 const int kBufferSize = 1024 + 1;
434 char buffer[kBufferSize];
438 #ifdef ENABLE_DEBUGGER_SUPPORT
440 #endif // ENABLE_DEBUGGER_SUPPORT
441 res = fgets(buffer, kBufferSize, stdin);
449 for (
char* pos = buffer; *pos !=
'\0'; pos++) {
static Isolate * GetCurrent()
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
static V8_INLINE Local< T > New(Isolate *isolate, Handle< T > that)
Local< Value > Call(Handle< Value > recv, int argc, Handle< Value > argv[])
const char * ToCString(const v8::String::Utf8Value &value)
Local< Value > Exception() const
V8_INLINE Isolate * GetIsolate() const
V8_INLINE ReturnValue< T > GetReturnValue() const
V8_INLINE int Length() const
Local< Context > GetCurrentContext()
v8::Handle< v8::String > ReadLine()
void Set(Handle< String > name, Handle< Data > value, PropertyAttribute attributes=None)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization 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 VFP3 instructions if available enable use of NEON instructions if 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 d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing 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 statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage message
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization 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 VFP3 instructions if available enable use of NEON instructions if 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 d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing 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 statistics of the maximum memory committed for the heap in name
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object size
Handle< Value > GetScriptResourceName() const
v8::Isolate * GetIsolate()
static Local< ObjectTemplate > New()
static Local< FunctionTemplate > New(Isolate *isolate, FunctionCallback callback=0, Handle< Value > data=Handle< Value >(), Handle< Signature > signature=Handle< Signature >(), int length=0)
static Local< Script > Compile(Handle< String > source, ScriptOrigin *origin=NULL, ScriptData *script_data=NULL)
static V8_INLINE Handle< T > Cast(Handle< S > that)
static bool EnableAgent(const char *name, int port, bool wait_for_connection=false)
int GetLineNumber() const
V8_INLINE Handle< Primitive > Undefined(Isolate *isolate)
static Local< Context > New(Isolate *isolate, ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
bool RunCppCycle(v8::Handle< v8::Script > script, v8::Local< v8::Context > context, bool report_exceptions)
static void SetDebugMessageDispatchHandler(DebugMessageDispatchHandler handler, bool provide_locker=false)
V8_INLINE bool IsEmpty() const
v8::Handle< v8::String > ReadFile(v8::Isolate *isolate, const char *name)
static bool InitializeICU(const char *icu_data_file=NULL)
int RunMain(int argc, char *argv[])
void Print(const v8::FunctionCallbackInfo< v8::Value > &args)
static void SetFlagsFromCommandLine(int *argc, char **argv, bool remove_flags)
void ReportException(v8::Isolate *isolate, v8::TryCatch *handler)
int GetStartColumn() const
int main(int argc, char *argv[])
static void ProcessDebugMessages()
Local< v8::Message > Message() const
Local< String > GetSourceLine() const
static Local< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=kNormalString, int length=-1)