36 static const int kMentionedObjectCacheMaxSize = 256;
39 space_ = NewArray<char>(bytes);
52 if (full())
return false;
53 ASSERT(length_ < capacity_);
57 if (length_ == capacity_ - 2) {
58 unsigned new_capacity = capacity_;
59 char* new_buffer = allocator_->
grow(&new_capacity);
60 if (new_capacity > capacity_) {
61 capacity_ = new_capacity;
66 length_ = capacity_ - 1;
67 buffer_[length_ - 4] =
'.';
68 buffer_[length_ - 3] =
'.';
69 buffer_[length_ - 2] =
'.';
70 buffer_[length_ - 1] =
'\n';
71 buffer_[length_] =
'\0';
76 buffer_[length_ + 1] =
'\0';
84 static bool IsControlChar(
char c) {
86 case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
87 case '6':
case '7':
case '8':
case '9':
case '.':
case '-':
100 while (offset < format.
length()) {
101 if (format[offset] !=
'%' || elm == elms.
length()) {
108 int format_length = 0;
111 temp[format_length++] = format[offset++];
112 while (offset < format.
length() && IsControlChar(format[offset]))
113 temp[format_length++] = format[offset++];
114 if (offset >= format.
length())
116 char type = format[offset];
117 temp[format_length++] = type;
118 temp[format_length] =
'\0';
120 FmtElm current = elms[elm++];
124 const char* value = current.data_.
u_c_str_;
129 ASSERT_EQ(FmtElm::LC_STR, current.type_);
131 for (
int i = 0; i < value.
length(); i++)
132 Put(static_cast<char>(value[i]));
143 int value = current.data_.
u_int_;
144 if (0x20 <= value && value <= 0x7F) {
146 }
else if (value <= 0xff) {
147 Add(
"\\x%02x", value);
149 Add(
"\\u%04x", value);
153 case 'i':
case 'd':
case 'u':
case 'x':
case 'c':
case 'X': {
154 int value = current.data_.
u_int_;
160 case 'f':
case 'g':
case 'G':
case 'e':
case 'E': {
181 ASSERT(buffer_[length_] ==
'\0');
185 void StringStream::PrintObject(
Object* o) {
191 }
else if (o->IsNumber() || o->IsOddball()) {
194 if (o->IsHeapObject()) {
197 string_stream_debug_object_cache();
198 for (
int i = 0; i < debug_object_cache->length(); i++) {
199 if ((*debug_object_cache)[i] == o) {
204 if (debug_object_cache->length() < kMentionedObjectCacheMaxSize) {
205 Add(
"#%d#", debug_object_cache->length());
226 FmtElm argv[argc] = { arg0 };
233 FmtElm argv[argc] = { arg0, arg1 };
241 FmtElm argv[argc] = { arg0, arg1, arg2 };
249 FmtElm argv[argc] = { arg0, arg1, arg2, arg3 };
257 FmtElm argv[argc] = { arg0, arg1, arg2, arg3, arg4 };
263 char* str = NewArray<char>(length_ + 1);
271 LOG(isolate, StringEvent(
"StackDump", buffer_));
280 unsigned position = 0;
281 for (
unsigned next; (next = position + 2048) < length_; position = next) {
282 char save = buffer_[next];
283 buffer_[next] =
'\0';
285 buffer_[next] = save;
298 isolate->set_string_stream_current_security_token(
NULL);
299 if (isolate->string_stream_debug_object_cache() ==
NULL) {
302 isolate->string_stream_debug_object_cache()->Clear();
307 bool StringStream::IsMentionedObjectCacheClear(
Isolate* isolate) {
308 return isolate->string_stream_debug_object_cache()->length() == 0;
321 for (
int i = start; i < end && stream.
HasMore(); i++) {
323 if (c >= 127 || c < 32) {
326 if (!
Put(static_cast<char>(c))) {
335 if (name->IsString()) {
340 Add(
"/* anonymous */");
351 !map->IsHeapObject() ||
353 Add(
"<Invalid map>\n");
358 for (
int i = 0; i < real_size; i++) {
359 PropertyDetails details = descs->
GetDetails(i);
360 if (details.type() ==
FIELD) {
362 if (key->IsString() || key->IsNumber()) {
364 if (key->IsString()) {
367 for (; len < 18; len++)
369 if (key->IsString()) {
385 for (
unsigned int i = 0; i < 10 && i < limit; i++) {
387 if (element != heap->the_hole_value()) {
388 for (
int len = 1; len < 18; len++)
390 Add(
"%d: %o\n", i, array->
get(i));
400 unsigned int limit = byte_array->
length();
401 for (
unsigned int i = 0; i < 10 && i < limit; i++) {
403 Add(
" %d: %3d 0x%02x", i, b, b);
404 if (b >=
' ' && b <=
'~') {
406 }
else if (b ==
'\n') {
408 }
else if (b ==
'\r') {
410 }
else if (b >= 1 && b <= 26) {
411 Add(
" ^%c", b +
'A' - 1);
423 isolate->string_stream_debug_object_cache();
424 Add(
"==== Key ============================================\n\n");
425 for (
int i = 0; i < debug_object_cache->length(); i++) {
426 HeapObject* printee = (*debug_object_cache)[i];
427 Add(
" #%d# %p: ", i, printee);
430 if (printee->IsJSObject()) {
431 if (printee->IsJSValue()) {
435 if (printee->IsJSArray()) {
441 if (length < limit) limit =
length;
445 }
else if (printee->IsByteArray()) {
447 }
else if (printee->IsFixedArray()) {
456 if (!f->IsHeapObject())
return;
462 if (!map->IsHeapObject() ||
465 !f->IsJSFunction()) {
471 if (perhaps_context->IsHeapObject() &&
473 perhaps_context->IsContext()) {
476 Add(
"(Function context is outside heap)\n");
480 if (token != isolate->string_stream_current_security_token()) {
481 Add(
"Security context: %o\n", token);
482 isolate->set_string_stream_current_security_token(token);
485 Add(
"(Function context is corrupt)\n");
491 if (!f->IsHeapObject()) {
492 Add(
"/* warning: 'function' was not a heap object */ ");
497 Add(
"/* warning: 'function' was not on the heap */ ");
501 Add(
"/* warning: function's map was not on the heap */ ");
505 Add(
"/* warning: function's map was not a valid map */ ");
508 if (f->IsJSFunction()) {
513 }
else if (f->IsInternalizedString()) {
517 Add(
"/* unresolved */ ");
523 Add(
"/* warning: no JSFunction object or function name found */ ");
530 bool print_name =
false;
532 for (
Object* p = receiver;
533 p != isolate->
heap()->null_value();
534 p = p->GetPrototype(isolate)) {
535 if (p->IsJSObject()) {
537 if (key != isolate->
heap()->undefined_value()) {
538 if (!name->IsString() ||
564 unsigned new_bytes = *bytes * 2;
566 if (new_bytes <= *bytes) {
569 char* new_space = NewArray<char>(new_bytes);
570 if (new_space ==
NULL) {
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
char * allocate(unsigned bytes)
void PrintF(const char *format,...)
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 map
static String * cast(Object *obj)
#define LOG(isolate, Call)
int NumberOfOwnDescriptors()
static HeapObject * cast(Object *obj)
void Log(Isolate *isolate)
void PrintSecurityTokenIfChanged(Object *function)
static ByteArray * cast(Object *obj)
#define ASSERT(condition)
Object * SlowReverseLookup(Object *value)
void PrintPrototype(JSFunction *fun, Object *receiver)
void PrintUsingMap(JSObject *js_object)
char * grow(unsigned *bytes)
bool Equals(String *other)
void Add(Vector< const char > format, Vector< FmtElm > elms)
Handle< String > NewStringFromUtf8(Vector< const char > str, PretenureFlag pretenure=NOT_TENURED)
void PrintFixedArray(FixedArray *array, unsigned int limit)
char * grow(unsigned *bytes)
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
NoAllocationStringAllocator(char *memory, unsigned size)
static void MemCopy(void *dest, const void *src, size_t size)
Context * native_context()
int GetFieldIndex(int descriptor_number)
Object * RawFastPropertyAt(int index)
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 code(assertions) for debugging") DEFINE_bool(code_comments
PropertyDetails GetDetails(int descriptor_number)
void PrintByteArray(ByteArray *ba)
Vector< const char > CStrVector(const char *data)
static JSArray * cast(Object *obj)
static const int kMaxShortPrintLength
static int SNPrintF(Vector< char > str, const char *format,...)
void PrintMentionedObjectCache(Isolate *isolate)
void PrintName(Object *o)
bool Contains(Address addr)
const Vector< const uc16 > * u_lc_str_
Handle< String > ToString(Isolate *isolate)
static JSValue * cast(Object *obj)
void ShortPrint(FILE *out=stdout)
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 memory(in Mbytes)") DEFINE_bool(gc_global
static void ClearMentionedObjectCache(Isolate *isolate)
#define ASSERT_EQ(v1, v2)
bool HasFastObjectElements()
void PrintFunction(Object *function, Object *receiver, Code **code)
static FixedArray * cast(Object *obj)
virtual char * grow(unsigned *bytes)=0
void OutputToFile(FILE *out)
SmartArrayPointer< const char > ToCString() const
void DeleteArray(T *array)
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
List< HeapObject * > DebugObjectCache
static JSObject * cast(Object *obj)
Name * GetKey(int descriptor_number)
static JSFunction * cast(Object *obj)