38 static const int kMentionedObjectCacheMaxSize = 256;
41 space_ = NewArray<char>(bytes);
54 if (full())
return false;
55 ASSERT(length_ < capacity_);
59 if (length_ == capacity_ - 2) {
60 unsigned new_capacity = capacity_;
61 char* new_buffer = allocator_->
grow(&new_capacity);
62 if (new_capacity > capacity_) {
63 capacity_ = new_capacity;
68 length_ = capacity_ - 1;
69 buffer_[length_ - 4] =
'.';
70 buffer_[length_ - 3] =
'.';
71 buffer_[length_ - 2] =
'.';
72 buffer_[length_ - 1] =
'\n';
73 buffer_[length_] =
'\0';
78 buffer_[length_ + 1] =
'\0';
86 static bool IsControlChar(
char c) {
88 case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
89 case '6':
case '7':
case '8':
case '9':
case '.':
case '-':
102 while (offset < format.
length()) {
103 if (format[offset] !=
'%' || elm == elms.
length()) {
110 int format_length = 0;
113 temp[format_length++] = format[offset++];
114 while (offset < format.
length() && IsControlChar(format[offset]))
115 temp[format_length++] = format[offset++];
116 if (offset >= format.
length())
118 char type = format[offset];
119 temp[format_length++] = type;
120 temp[format_length] =
'\0';
122 FmtElm current = elms[elm++];
126 const char* value = current.data_.
u_c_str_;
131 ASSERT_EQ(FmtElm::LC_STR, current.type_);
133 for (
int i = 0; i < value.
length(); i++)
134 Put(static_cast<char>(value[i]));
145 int value = current.data_.
u_int_;
146 if (0x20 <= value && value <= 0x7F) {
148 }
else if (value <= 0xff) {
149 Add(
"\\x%02x", value);
151 Add(
"\\u%04x", value);
155 case 'i':
case 'd':
case 'u':
case 'x':
case 'c':
case 'X': {
156 int value = current.data_.
u_int_;
162 case 'f':
case 'g':
case 'G':
case 'e':
case 'E': {
183 ASSERT(buffer_[length_] ==
'\0');
187 void StringStream::PrintObject(
Object* o) {
193 }
else if (o->IsNumber() || o->IsOddball()) {
196 if (o->IsHeapObject()) {
198 string_stream_debug_object_cache();
199 for (
int i = 0; i < debug_object_cache->length(); i++) {
200 if ((*debug_object_cache)[i] == o) {
205 if (debug_object_cache->length() < kMentionedObjectCacheMaxSize) {
206 Add(
"#%d#", debug_object_cache->length());
227 FmtElm argv[argc] = { arg0 };
234 FmtElm argv[argc] = { arg0, arg1 };
242 FmtElm argv[argc] = { arg0, arg1, arg2 };
250 FmtElm argv[argc] = { arg0, arg1, arg2, arg3 };
256 char* str = NewArray<char>(length_ + 1);
257 memcpy(str, buffer_, length_);
264 LOG(
ISOLATE, StringEvent(
"StackDump", buffer_));
273 unsigned position = 0;
274 for (
unsigned next; (next = position + 2048) < length_; position = next) {
275 char save = buffer_[next];
276 buffer_[next] =
'\0';
278 buffer_[next] = save;
290 Isolate* isolate = Isolate::Current();
291 isolate->set_string_stream_current_security_token(
NULL);
292 if (isolate->string_stream_debug_object_cache() ==
NULL) {
293 isolate->set_string_stream_debug_object_cache(
296 isolate->string_stream_debug_object_cache()->Clear();
301 bool StringStream::IsMentionedObjectCacheClear() {
303 Isolate::Current()->string_stream_debug_object_cache()->
length() == 0);
315 name_buffer.
Seek(start);
316 for (
int i = start; i < end && name_buffer.
has_more(); i++) {
318 if (c >= 127 || c < 32) {
330 if (name->IsString()) {
335 Add(
"/* anonymous */");
344 Map* map = js_object->
map();
345 if (!
HEAP->Contains(map) ||
346 !map->IsHeapObject() ||
348 Add(
"<Invalid map>\n");
354 PropertyDetails details = descs->
GetDetails(i);
355 if (details.descriptor_index() > real_size)
continue;
356 if (details.type() ==
FIELD) {
358 if (key->IsString() || key->IsNumber()) {
360 if (key->IsString()) {
363 for (; len < 18; len++)
365 if (key->IsString()) {
381 for (
unsigned int i = 0; i < 10 && i < limit; i++) {
383 if (element != heap->the_hole_value()) {
384 for (
int len = 1; len < 18; len++)
386 Add(
"%d: %o\n", i, array->
get(i));
396 unsigned int limit = byte_array->
length();
397 for (
unsigned int i = 0; i < 10 && i < limit; i++) {
399 Add(
" %d: %3d 0x%02x", i, b, b);
400 if (b >=
' ' && b <=
'~') {
402 }
else if (b ==
'\n') {
404 }
else if (b ==
'\r') {
406 }
else if (b >= 1 && b <= 26) {
407 Add(
" ^%c", b +
'A' - 1);
419 Isolate::Current()->string_stream_debug_object_cache();
420 Add(
"==== Key ============================================\n\n");
421 for (
int i = 0; i < debug_object_cache->length(); i++) {
422 HeapObject* printee = (*debug_object_cache)[i];
423 Add(
" #%d# %p: ", i, printee);
426 if (printee->IsJSObject()) {
427 if (printee->IsJSValue()) {
431 if (printee->IsJSArray()) {
437 if (length < limit) limit =
length;
441 }
else if (printee->IsByteArray()) {
443 }
else if (printee->IsFixedArray()) {
452 Isolate* isolate = Isolate::Current();
458 if (!map->IsHeapObject() ||
461 !f->IsJSFunction()) {
467 if (perhaps_context->IsHeapObject() &&
469 perhaps_context->IsContext()) {
472 Add(
"(Function context is outside heap)\n");
476 if (token != isolate->string_stream_current_security_token()) {
477 Add(
"Security context: %o\n", token);
478 isolate->set_string_stream_current_security_token(token);
481 Add(
"(Function context is corrupt)\n");
487 if (f->IsHeapObject() &&
491 if (f->IsJSFunction()) {
496 }
else if (f->IsSymbol()) {
500 Add(
"/* unresolved */ ");
506 Add(
"/* warning: no JSFunction object or function name found */ ");
512 if (!f->IsHeapObject()) {
513 Add(
"/* warning: 'function' was not a heap object */ ");
517 Add(
"/* warning: 'function' was not on the heap */ ");
521 Add(
"/* warning: function's map was not on the heap */ ");
525 Add(
"/* warning: function's map was not a valid map */ ");
528 Add(
"/* warning: Invalid JSFunction object found */ ");
534 Object* name = fun->shared()->name();
535 bool print_name =
false;
537 for (
Object* p = receiver; p != heap->null_value(); p = p->GetPrototype()) {
538 if (p->IsJSObject()) {
540 if (key != heap->undefined_value()) {
541 if (!name->IsString() ||
567 unsigned new_bytes = *bytes * 2;
569 if (new_bytes <= *bytes) {
572 char* new_space = NewArray<char>(new_bytes);
573 if (new_space ==
NULL) {
576 memcpy(new_space, space_, *bytes);
char * allocate(unsigned bytes)
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 memory(in Mbytes)") DEFINE_bool(gc_global
void PrintF(const char *format,...)
static String * cast(Object *obj)
#define LOG(isolate, Call)
int NumberOfOwnDescriptors()
static HeapObject * cast(Object *obj)
void PrintSecurityTokenIfChanged(Object *function)
static ByteArray * cast(Object *obj)
#define ASSERT(condition)
void PrintMentionedObjectCache()
Object * SlowReverseLookup(Object *value)
void PrintPrototype(JSFunction *fun, Object *receiver)
void PrintUsingMap(JSObject *js_object)
char * grow(unsigned *bytes)
List< HeapObject *, PreallocatedStorageAllocationPolicy > DebugObjectCache
Handle< String > ToString()
bool Equals(String *other)
void Add(Vector< const char > format, Vector< FmtElm > elms)
void PrintFixedArray(FixedArray *array, unsigned int limit)
String * GetKey(int descriptor_number)
char * grow(unsigned *bytes)
NoAllocationStringAllocator(char *memory, unsigned size)
Context * native_context()
int GetFieldIndex(int descriptor_number)
Object * FastPropertyAt(int index)
Object * unchecked_context()
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 PrintName(Object *o)
bool Contains(Address addr)
const Vector< const uc16 > * u_lc_str_
static JSValue * cast(Object *obj)
int number_of_descriptors()
#define ASSERT_EQ(v1, v2)
bool HasFastObjectElements()
void PrintFunction(Object *function, Object *receiver, Code **code)
static FixedArray * cast(Object *obj)
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
virtual char * grow(unsigned *bytes)=0
void OutputToFile(FILE *out)
static void ClearMentionedObjectCache()
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 code(assertions) for debugging") DEFINE_bool(code_comments
SmartArrayPointer< const char > ToCString() const
void DeleteArray(T *array)
static JSObject * cast(Object *obj)
static JSFunction * cast(Object *obj)