37 #include "../include/v8.h"
70 static const unsigned kMaxCounters = 512;
71 uint32_t magic_number_;
72 uint32_t max_counters_;
73 uint32_t max_name_size_;
74 uint32_t counters_in_use_;
75 Counter counters_[kMaxCounters];
83 i::HashMap::Entry* answer = hash_map_.
Lookup(
84 const_cast<char*>(name),
87 if (!answer)
return NULL;
88 return reinterpret_cast<Counter*
>(answer->value);
91 i::HashMap::Entry* answer = hash_map_.
Lookup(
92 const_cast<char*>(name),
96 answer->value = value;
101 : map_(&map->hash_map_), entry_(map_->Start()) { }
104 const char*
CurrentKey() {
return static_cast<const char*
>(entry_->key); }
108 i::HashMap::Entry* entry_;
112 static int Hash(
const char* name);
113 static bool Match(
void* key1,
void* key2);
126 virtual bool Open() {
return true; }
127 virtual bool Close() {
return true; }
130 const char*
name() {
return name_; }
144 next_semaphore_(v8::internal::OS::CreateSemaphore(0)),
145 done_semaphore_(v8::internal::OS::CreateSemaphore(0)),
154 void Begin(
char** argv,
int offset) {
155 argv_ =
const_cast<const char**
>(argv);
156 begin_offset_ = offset;
159 void End(
int offset) { end_offset_ = offset; }
171 : i::Thread(GetThreadOptions()), group_(group) {}
174 group_->ExecuteInThread();
181 static i::Thread::Options GetThreadOptions();
182 void ExecuteInThread();
189 void ExitShell(
int exit_code);
190 Handle<String> ReadFile(
const char* name);
210 virtual const char*
data()
const {
return data_; }
211 virtual size_t length()
const {
return length_; }
272 bool report_exceptions);
277 static int RunMain(
int argc,
char* argv[]);
278 static int Main(
int argc,
char* argv[]);
279 static void Exit(
int exit_code);
293 #ifdef ENABLE_DEBUGGER_SUPPORT
296 static void DispatchDebugMessages();
297 #endif // ENABLE_DEBUGGER_SUPPORT
381 static i::OS::MemoryMappedFile* counters_file_;
384 static Counter* GetCounter(
const char* name,
bool is_histogram);
385 static void InstallUtilityScript();
387 static void Initialize();
389 static bool SetOptions(
int argc,
char* argv[]);
static void Exit(int exit_code)
static Handle< Array > GetCompletions(Handle< String > text, Handle< String > full)
void Set(const char *name, Counter *value)
static Handle< Value > ArrayBufferSlice(const Arguments &args)
static Handle< Value > Version(const Arguments &args)
static int Main(int argc, char *argv[])
static void AddHistogramSample(void *histogram, int sample)
void AddSample(int32_t sample)
static Handle< Value > Int32Array(const Arguments &args)
static Handle< Value > Float32Array(const Arguments &args)
static Handle< Value > OSObject(const Arguments &args)
virtual size_t length() const
static Handle< Value > SetUMask(const Arguments &args)
static Handle< Value > ReadLine(const Arguments &args)
static void AddOSMethods(Handle< ObjectTemplate > os_template)
static LineEditor * Get()
Counter * GetNextCounter()
int32_t * Bind(const char *name, bool histogram)
#define ASSERT(condition)
static Handle< Value > Int16Array(const Arguments &args)
static const int kMaxNameSize
v8::Handle< v8::ObjectTemplate > CreateGlobalTemplate(v8::InvocationCallback terminate, v8::InvocationCallback doloop)
Iterator(CounterMap *map)
static Handle< Value > Uint16Array(const Arguments &args)
static LineEditor * console
static Handle< Value > SetEnvironment(const Arguments &args)
static ShellOptions options
virtual const char * data() const
LineEditor(Type type, const char *name)
Handle< Value >(* InvocationCallback)(const Arguments &args)
static Handle< Value > ArrayBuffer(const Arguments &args)
static Handle< Value > EnableProfiler(const Arguments &args)
static const char * ToCString(const v8::String::Utf8Value &value)
static Handle< Value > DisableProfiler(const Arguments &args)
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 Handle< Value > Read(const Arguments &args)
SourceGroup * isolate_sources
Entry * Lookup(void *key, uint32_t hash, bool insert, AllocationPolicy allocator=AllocationPolicy())
static const char * kPrompt
static Handle< Value > ArraySet(const Arguments &args)
activate correct semantics for inheriting readonliness false
static void * CreateHistogram(const char *name, int min, int max, size_t buckets)
static Handle< Value > RemoveDirectory(const Arguments &args)
static Handle< Value > Int8Array(const Arguments &args)
static Handle< Value > Write(const Arguments &args)
static Handle< Value > Load(const Arguments &args)
Counter * Lookup(const char *name)
BinaryResource(const char *string, int length)
virtual Handle< String > Prompt(const char *prompt)=0
static Handle< Value > ReadBuffer(const Arguments &args)
static Handle< Value > UnsetEnvironment(const Arguments &args)
static Handle< Value > Print(const Arguments &args)
static bool ExecuteString(Handle< String > source, Handle< Value > name, bool print_result, bool report_exceptions)
static Handle< Value > Float64Array(const Arguments &args)
static Persistent< Context > CreateEvaluationContext()
static Handle< String > ReadFile(const char *name)
void Begin(char **argv, int offset)
static void MapCounters(const char *name)
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
static void ReportException(TryCatch *try_catch)
static Handle< Value > Uint8Array(const Arguments &args)
static Handle< String > ReadFromStdin()
static Handle< Value > Uint8ClampedArray(const Arguments &args)
static Handle< Value > Quit(const Arguments &args)
static Handle< Value > ArraySubArray(const Arguments &args)
static Handle< Value > Uint32Array(const Arguments &args)
static Handle< Value > MakeDirectory(const Arguments &args)
const char * CurrentKey()
virtual void AddHistory(const char *str)
static int * LookupCounter(const char *name)
static Handle< Value > Yield(const Arguments &args)
bool send_idle_notification
static Handle< Value > System(const Arguments &args)
void RunShell(v8::Handle< v8::Context > context)
static Handle< Value > ChangeDirectory(const Arguments &args)
void StartExecuteInThread()
static int RunMain(int argc, char *argv[])
Entry * Next(Entry *p) const