Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: src/objects.cc

Issue 5998001: 1. Added support for object printing for release mode using the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 if (IsNumber()) return context->number_function()->instance_prototype(); 546 if (IsNumber()) return context->number_function()->instance_prototype();
547 if (IsString()) return context->string_function()->instance_prototype(); 547 if (IsString()) return context->string_function()->instance_prototype();
548 if (IsBoolean()) { 548 if (IsBoolean()) {
549 return context->boolean_function()->instance_prototype(); 549 return context->boolean_function()->instance_prototype();
550 } else { 550 } else {
551 return Heap::null_value(); 551 return Heap::null_value();
552 } 552 }
553 } 553 }
554 554
555 555
556 void Object::ShortPrint() { 556 void Object::ShortPrint(FILE* out) {
557 HeapStringAllocator allocator; 557 HeapStringAllocator allocator;
558 StringStream accumulator(&allocator); 558 StringStream accumulator(&allocator);
559 ShortPrint(&accumulator); 559 ShortPrint(&accumulator);
560 accumulator.OutputToStdOut(); 560 accumulator.OutputToFile(out);
561 } 561 }
562 562
563 563
564 void Object::ShortPrint(StringStream* accumulator) { 564 void Object::ShortPrint(StringStream* accumulator) {
565 if (IsSmi()) { 565 if (IsSmi()) {
566 Smi::cast(this)->SmiPrint(accumulator); 566 Smi::cast(this)->SmiPrint(accumulator);
567 } else if (IsFailure()) { 567 } else if (IsFailure()) {
568 Failure::cast(this)->FailurePrint(accumulator); 568 Failure::cast(this)->FailurePrint(accumulator);
569 } else { 569 } else {
570 HeapObject::cast(this)->HeapObjectShortPrint(accumulator); 570 HeapObject::cast(this)->HeapObjectShortPrint(accumulator);
571 } 571 }
572 } 572 }
573 573
574 574
575 void Smi::SmiPrint() { 575 void Smi::SmiPrint(FILE* out) {
576 PrintF("%d", value()); 576 PrintF(out, "%d", value());
577 } 577 }
578 578
579 579
580 void Smi::SmiPrint(StringStream* accumulator) { 580 void Smi::SmiPrint(StringStream* accumulator) {
581 accumulator->Add("%d", value()); 581 accumulator->Add("%d", value());
582 } 582 }
583 583
584 584
585 void Failure::FailurePrint(StringStream* accumulator) { 585 void Failure::FailurePrint(StringStream* accumulator) {
586 accumulator->Add("Failure(%p)", reinterpret_cast<void*>(value())); 586 accumulator->Add("Failure(%p)", reinterpret_cast<void*>(value()));
587 } 587 }
588 588
589 589
590 void Failure::FailurePrint() { 590 void Failure::FailurePrint(FILE* out) {
591 PrintF("Failure(%p)", reinterpret_cast<void*>(value())); 591 PrintF(out, "Failure(%p)", reinterpret_cast<void*>(value()));
592 } 592 }
593 593
594 594
595 // Should a word be prefixed by 'a' or 'an' in order to read naturally in 595 // Should a word be prefixed by 'a' or 'an' in order to read naturally in
596 // English? Returns false for non-ASCII or words that don't start with 596 // English? Returns false for non-ASCII or words that don't start with
597 // a capital letter. The a/an rule follows pronunciation in English. 597 // a capital letter. The a/an rule follows pronunciation in English.
598 // We don't use the BBC's overcorrect "an historic occasion" though if 598 // We don't use the BBC's overcorrect "an historic occasion" though if
599 // you speak a dialect you may well say "an 'istoric occasion". 599 // you speak a dialect you may well say "an 'istoric occasion".
600 static bool AnWord(String* str) { 600 static bool AnWord(String* str) {
601 if (str->length() == 0) return false; // A nothing. 601 if (str->length() == 0) return false; // A nothing.
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 } 1134 }
1135 if (u.bits.exp == 0) { 1135 if (u.bits.exp == 0) {
1136 // Detect +0, and -0 for IEEE double precision floating point. 1136 // Detect +0, and -0 for IEEE double precision floating point.
1137 if ((u.bits.man_low | u.bits.man_high) == 0) 1137 if ((u.bits.man_low | u.bits.man_high) == 0)
1138 return Heap::false_value(); 1138 return Heap::false_value();
1139 } 1139 }
1140 return Heap::true_value(); 1140 return Heap::true_value();
1141 } 1141 }
1142 1142
1143 1143
1144 void HeapNumber::HeapNumberPrint() { 1144 void HeapNumber::HeapNumberPrint(FILE* out) {
1145 PrintF("%.16g", Number()); 1145 PrintF(out, "%.16g", Number());
1146 } 1146 }
1147 1147
1148 1148
1149 void HeapNumber::HeapNumberPrint(StringStream* accumulator) { 1149 void HeapNumber::HeapNumberPrint(StringStream* accumulator) {
1150 // The Windows version of vsnprintf can allocate when printing a %g string 1150 // The Windows version of vsnprintf can allocate when printing a %g string
1151 // into a buffer that may not be big enough. We don't want random memory 1151 // into a buffer that may not be big enough. We don't want random memory
1152 // allocation when producing post-crash stack traces, so we print into a 1152 // allocation when producing post-crash stack traces, so we print into a
1153 // buffer that is plenty big enough for any floating point number, then 1153 // buffer that is plenty big enough for any floating point number, then
1154 // print that using vsnprintf (which may truncate but never allocate if 1154 // print that using vsnprintf (which may truncate but never allocate if
1155 // there is no more space in the buffer). 1155 // there is no more space in the buffer).
(...skipping 4304 matching lines...) Expand 10 before | Expand all | Expand 10 after
5460 return this; 5460 return this;
5461 } 5461 }
5462 5462
5463 5463
5464 Object* JSFunction::SetInstanceClassName(String* name) { 5464 Object* JSFunction::SetInstanceClassName(String* name) {
5465 shared()->set_instance_class_name(name); 5465 shared()->set_instance_class_name(name);
5466 return this; 5466 return this;
5467 } 5467 }
5468 5468
5469 5469
5470 void JSFunction::PrintName() { 5470 void JSFunction::PrintName(FILE* out) {
5471 SmartPointer<char> name = shared()->DebugName()->ToCString(); 5471 SmartPointer<char> name = shared()->DebugName()->ToCString();
5472 PrintF("%s", *name); 5472 PrintF(out, "%s", *name);
5473 } 5473 }
5474 5474
5475 5475
5476 Context* JSFunction::GlobalContextFromLiterals(FixedArray* literals) { 5476 Context* JSFunction::GlobalContextFromLiterals(FixedArray* literals) {
5477 return Context::cast(literals->get(JSFunction::kLiteralGlobalContextIndex)); 5477 return Context::cast(literals->get(JSFunction::kLiteralGlobalContextIndex));
5478 } 5478 }
5479 5479
5480 5480
5481 MaybeObject* Oddball::Initialize(const char* to_string, Object* to_number) { 5481 MaybeObject* Oddball::Initialize(const char* to_string, Object* to_number) {
5482 Object* symbol; 5482 Object* symbol;
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
5992 RelocInfo* info = it.rinfo(); 5992 RelocInfo* info = it.rinfo();
5993 Object* object = info->target_object(); 5993 Object* object = info->target_object();
5994 if (object->IsMap()) return Map::cast(object); 5994 if (object->IsMap()) return Map::cast(object);
5995 } 5995 }
5996 return NULL; 5996 return NULL;
5997 } 5997 }
5998 5998
5999 5999
6000 #ifdef ENABLE_DISASSEMBLER 6000 #ifdef ENABLE_DISASSEMBLER
6001 6001
6002 #ifdef DEBUG 6002 #ifdef OBJECT_PRINT
6003 6003
6004 void DeoptimizationInputData::DeoptimizationInputDataPrint() { 6004 void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) {
6005 disasm::NameConverter converter; 6005 disasm::NameConverter converter;
6006 int deopt_count = DeoptCount(); 6006 int deopt_count = DeoptCount();
6007 PrintF("Deoptimization Input Data (deopt points = %d)\n", deopt_count); 6007 PrintF(out, "Deoptimization Input Data (deopt points = %d)\n", deopt_count);
6008 if (0 == deopt_count) return; 6008 if (0 == deopt_count) return;
6009 6009
6010 PrintF("%6s %6s %6s %12s\n", "index", "ast id", "argc", "commands"); 6010 PrintF(out, "%6s %6s %6s %12s\n", "index", "ast id", "argc", "commands");
6011 for (int i = 0; i < deopt_count; i++) { 6011 for (int i = 0; i < deopt_count; i++) {
6012 int command_count = 0; 6012 int command_count = 0;
6013 PrintF("%6d %6d %6d", 6013 PrintF(out, "%6d %6d %6d",
6014 i, AstId(i)->value(), ArgumentsStackHeight(i)->value()); 6014 i, AstId(i)->value(), ArgumentsStackHeight(i)->value());
6015 int translation_index = TranslationIndex(i)->value(); 6015 int translation_index = TranslationIndex(i)->value();
6016 TranslationIterator iterator(TranslationByteArray(), translation_index); 6016 TranslationIterator iterator(TranslationByteArray(), translation_index);
6017 Translation::Opcode opcode = 6017 Translation::Opcode opcode =
6018 static_cast<Translation::Opcode>(iterator.Next()); 6018 static_cast<Translation::Opcode>(iterator.Next());
6019 ASSERT(Translation::BEGIN == opcode); 6019 ASSERT(Translation::BEGIN == opcode);
6020 int frame_count = iterator.Next(); 6020 int frame_count = iterator.Next();
6021 if (FLAG_print_code_verbose) { 6021 if (FLAG_print_code_verbose) {
6022 PrintF(" %s {count=%d}\n", Translation::StringFor(opcode), frame_count); 6022 PrintF(out, " %s {count=%d}\n", Translation::StringFor(opcode),
6023 frame_count);
6023 } 6024 }
6024 6025
6025 for (int i = 0; i < frame_count; ++i) { 6026 for (int i = 0; i < frame_count; ++i) {
6026 opcode = static_cast<Translation::Opcode>(iterator.Next()); 6027 opcode = static_cast<Translation::Opcode>(iterator.Next());
6027 ASSERT(Translation::FRAME == opcode); 6028 ASSERT(Translation::FRAME == opcode);
6028 int ast_id = iterator.Next(); 6029 int ast_id = iterator.Next();
6029 int function_id = iterator.Next(); 6030 int function_id = iterator.Next();
6030 JSFunction* function = 6031 JSFunction* function =
6031 JSFunction::cast(LiteralArray()->get(function_id)); 6032 JSFunction::cast(LiteralArray()->get(function_id));
6032 unsigned height = iterator.Next(); 6033 unsigned height = iterator.Next();
6033 if (FLAG_print_code_verbose) { 6034 if (FLAG_print_code_verbose) {
6034 PrintF("%24s %s {ast_id=%d, function=", 6035 PrintF(out, "%24s %s {ast_id=%d, function=",
6035 "", Translation::StringFor(opcode), ast_id); 6036 "", Translation::StringFor(opcode), ast_id);
6036 function->PrintName(); 6037 function->PrintName(out);
6037 PrintF(", height=%u}\n", height); 6038 PrintF(out, ", height=%u}\n", height);
6038 } 6039 }
6039 6040
6040 // Size of translation is height plus all incoming arguments including 6041 // Size of translation is height plus all incoming arguments including
6041 // receiver. 6042 // receiver.
6042 int size = height + function->shared()->formal_parameter_count() + 1; 6043 int size = height + function->shared()->formal_parameter_count() + 1;
6043 command_count += size; 6044 command_count += size;
6044 for (int j = 0; j < size; ++j) { 6045 for (int j = 0; j < size; ++j) {
6045 opcode = static_cast<Translation::Opcode>(iterator.Next()); 6046 opcode = static_cast<Translation::Opcode>(iterator.Next());
6046 if (FLAG_print_code_verbose) { 6047 if (FLAG_print_code_verbose) {
6047 PrintF("%24s %s ", "", Translation::StringFor(opcode)); 6048 PrintF(out, "%24s %s ", "", Translation::StringFor(opcode));
6048 } 6049 }
6049 6050
6050 if (opcode == Translation::DUPLICATE) { 6051 if (opcode == Translation::DUPLICATE) {
6051 opcode = static_cast<Translation::Opcode>(iterator.Next()); 6052 opcode = static_cast<Translation::Opcode>(iterator.Next());
6052 if (FLAG_print_code_verbose) { 6053 if (FLAG_print_code_verbose) {
6053 PrintF("%s ", Translation::StringFor(opcode)); 6054 PrintF(out, "%s ", Translation::StringFor(opcode));
6054 } 6055 }
6055 --j; // Two commands share the same frame index. 6056 --j; // Two commands share the same frame index.
6056 } 6057 }
6057 6058
6058 switch (opcode) { 6059 switch (opcode) {
6059 case Translation::BEGIN: 6060 case Translation::BEGIN:
6060 case Translation::FRAME: 6061 case Translation::FRAME:
6061 case Translation::DUPLICATE: 6062 case Translation::DUPLICATE:
6062 UNREACHABLE(); 6063 UNREACHABLE();
6063 break; 6064 break;
6064 6065
6065 case Translation::REGISTER: { 6066 case Translation::REGISTER: {
6066 int reg_code = iterator.Next(); 6067 int reg_code = iterator.Next();
6067 if (FLAG_print_code_verbose) { 6068 if (FLAG_print_code_verbose) {
6068 PrintF("{input=%s}", converter.NameOfCPURegister(reg_code)); 6069 PrintF(out, "{input=%s}", converter.NameOfCPURegister(reg_code));
6069 } 6070 }
6070 break; 6071 break;
6071 } 6072 }
6072 6073
6073 case Translation::INT32_REGISTER: { 6074 case Translation::INT32_REGISTER: {
6074 int reg_code = iterator.Next(); 6075 int reg_code = iterator.Next();
6075 if (FLAG_print_code_verbose) { 6076 if (FLAG_print_code_verbose) {
6076 PrintF("{input=%s}", converter.NameOfCPURegister(reg_code)); 6077 PrintF(out, "{input=%s}", converter.NameOfCPURegister(reg_code));
6077 } 6078 }
6078 break; 6079 break;
6079 } 6080 }
6080 6081
6081 case Translation::DOUBLE_REGISTER: { 6082 case Translation::DOUBLE_REGISTER: {
6082 int reg_code = iterator.Next(); 6083 int reg_code = iterator.Next();
6083 if (FLAG_print_code_verbose) { 6084 if (FLAG_print_code_verbose) {
6084 PrintF("{input=%s}", 6085 PrintF(out, "{input=%s}",
6085 DoubleRegister::AllocationIndexToString(reg_code)); 6086 DoubleRegister::AllocationIndexToString(reg_code));
6086 } 6087 }
6087 break; 6088 break;
6088 } 6089 }
6089 6090
6090 case Translation::STACK_SLOT: { 6091 case Translation::STACK_SLOT: {
6091 int input_slot_index = iterator.Next(); 6092 int input_slot_index = iterator.Next();
6092 if (FLAG_print_code_verbose) { 6093 if (FLAG_print_code_verbose) {
6093 PrintF("{input=%d}", input_slot_index); 6094 PrintF(out, "{input=%d}", input_slot_index);
6094 } 6095 }
6095 break; 6096 break;
6096 } 6097 }
6097 6098
6098 case Translation::INT32_STACK_SLOT: { 6099 case Translation::INT32_STACK_SLOT: {
6099 int input_slot_index = iterator.Next(); 6100 int input_slot_index = iterator.Next();
6100 if (FLAG_print_code_verbose) { 6101 if (FLAG_print_code_verbose) {
6101 PrintF("{input=%d}", input_slot_index); 6102 PrintF(out, "{input=%d}", input_slot_index);
6102 } 6103 }
6103 break; 6104 break;
6104 } 6105 }
6105 6106
6106 case Translation::DOUBLE_STACK_SLOT: { 6107 case Translation::DOUBLE_STACK_SLOT: {
6107 int input_slot_index = iterator.Next(); 6108 int input_slot_index = iterator.Next();
6108 if (FLAG_print_code_verbose) { 6109 if (FLAG_print_code_verbose) {
6109 PrintF("{input=%d}", input_slot_index); 6110 PrintF(out, "{input=%d}", input_slot_index);
6110 } 6111 }
6111 break; 6112 break;
6112 } 6113 }
6113 6114
6114 case Translation::LITERAL: { 6115 case Translation::LITERAL: {
6115 unsigned literal_index = iterator.Next(); 6116 unsigned literal_index = iterator.Next();
6116 if (FLAG_print_code_verbose) { 6117 if (FLAG_print_code_verbose) {
6117 PrintF("{literal_id=%u}", literal_index); 6118 PrintF(out, "{literal_id=%u}", literal_index);
6118 } 6119 }
6119 break; 6120 break;
6120 } 6121 }
6121 6122
6122 case Translation::ARGUMENTS_OBJECT: 6123 case Translation::ARGUMENTS_OBJECT:
6123 break; 6124 break;
6124 } 6125 }
6125 if (FLAG_print_code_verbose) PrintF("\n"); 6126 if (FLAG_print_code_verbose) PrintF(out, "\n");
6126 } 6127 }
6127 } 6128 }
6128 if (!FLAG_print_code_verbose) PrintF(" %12d\n", command_count); 6129 if (!FLAG_print_code_verbose) PrintF(out, " %12d\n", command_count);
6129 } 6130 }
6130 } 6131 }
6131 6132
6132 6133
6133 void DeoptimizationOutputData::DeoptimizationOutputDataPrint() { 6134 void DeoptimizationOutputData::DeoptimizationOutputDataPrint(FILE* out) {
6134 PrintF("Deoptimization Output Data (deopt points = %d)\n", 6135 PrintF(out, "Deoptimization Output Data (deopt points = %d)\n",
6135 this->DeoptPoints()); 6136 this->DeoptPoints());
6136 if (this->DeoptPoints() == 0) return; 6137 if (this->DeoptPoints() == 0) return;
6137 6138
6138 PrintF("%6s %8s %s\n", "ast id", "pc", "state"); 6139 PrintF("%6s %8s %s\n", "ast id", "pc", "state");
6139 for (int i = 0; i < this->DeoptPoints(); i++) { 6140 for (int i = 0; i < this->DeoptPoints(); i++) {
6140 int pc_and_state = this->PcAndState(i)->value(); 6141 int pc_and_state = this->PcAndState(i)->value();
6141 PrintF("%6d %8d %s\n", 6142 PrintF("%6d %8d %s\n",
6142 this->AstId(i)->value(), 6143 this->AstId(i)->value(),
6143 FullCodeGenerator::PcField::decode(pc_and_state), 6144 FullCodeGenerator::PcField::decode(pc_and_state),
6144 FullCodeGenerator::State2String( 6145 FullCodeGenerator::State2String(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
6195 case INTERCEPTOR: return "INTERCEPTOR"; 6196 case INTERCEPTOR: return "INTERCEPTOR";
6196 case MAP_TRANSITION: return "MAP_TRANSITION"; 6197 case MAP_TRANSITION: return "MAP_TRANSITION";
6197 case CONSTANT_TRANSITION: return "CONSTANT_TRANSITION"; 6198 case CONSTANT_TRANSITION: return "CONSTANT_TRANSITION";
6198 case NULL_DESCRIPTOR: return "NULL_DESCRIPTOR"; 6199 case NULL_DESCRIPTOR: return "NULL_DESCRIPTOR";
6199 } 6200 }
6200 UNREACHABLE(); 6201 UNREACHABLE();
6201 return NULL; 6202 return NULL;
6202 } 6203 }
6203 6204
6204 6205
6205 void Code::Disassemble(const char* name) { 6206 void Code::Disassemble(const char* name, FILE* out) {
6206 PrintF("kind = %s\n", Kind2String(kind())); 6207 PrintF(out, "kind = %s\n", Kind2String(kind()));
6207 if (is_inline_cache_stub()) { 6208 if (is_inline_cache_stub()) {
6208 PrintF("ic_state = %s\n", ICState2String(ic_state())); 6209 PrintF(out, "ic_state = %s\n", ICState2String(ic_state()));
6209 PrintF("ic_in_loop = %d\n", ic_in_loop() == IN_LOOP); 6210 PrintF(out, "ic_in_loop = %d\n", ic_in_loop() == IN_LOOP);
6210 if (ic_state() == MONOMORPHIC) { 6211 if (ic_state() == MONOMORPHIC) {
6211 PrintF("type = %s\n", PropertyType2String(type())); 6212 PrintF(out, "type = %s\n", PropertyType2String(type()));
6212 } 6213 }
6213 } 6214 }
6214 if ((name != NULL) && (name[0] != '\0')) { 6215 if ((name != NULL) && (name[0] != '\0')) {
6215 PrintF("name = %s\n", name); 6216 PrintF(out, "name = %s\n", name);
6216 } 6217 }
6217 if (kind() == OPTIMIZED_FUNCTION) { 6218 if (kind() == OPTIMIZED_FUNCTION) {
6218 PrintF("stack_slots = %d\n", stack_slots()); 6219 PrintF(out, "stack_slots = %d\n", stack_slots());
6219 } 6220 }
6220 6221
6221 PrintF("Instructions (size = %d)\n", instruction_size()); 6222 PrintF(out, "Instructions (size = %d)\n", instruction_size());
6222 Disassembler::Decode(NULL, this); 6223 Disassembler::Decode(out, this);
6223 PrintF("\n"); 6224 PrintF(out, "\n");
6224 6225
6225 #ifdef DEBUG 6226 #ifdef DEBUG
6226 if (kind() == FUNCTION) { 6227 if (kind() == FUNCTION) {
6227 DeoptimizationOutputData* data = 6228 DeoptimizationOutputData* data =
6228 DeoptimizationOutputData::cast(this->deoptimization_data()); 6229 DeoptimizationOutputData::cast(this->deoptimization_data());
6229 data->DeoptimizationOutputDataPrint(); 6230 data->DeoptimizationOutputDataPrint(out);
6230 } else if (kind() == OPTIMIZED_FUNCTION) { 6231 } else if (kind() == OPTIMIZED_FUNCTION) {
6231 DeoptimizationInputData* data = 6232 DeoptimizationInputData* data =
6232 DeoptimizationInputData::cast(this->deoptimization_data()); 6233 DeoptimizationInputData::cast(this->deoptimization_data());
6233 data->DeoptimizationInputDataPrint(); 6234 data->DeoptimizationInputDataPrint(out);
6234 } 6235 }
6235 PrintF("\n"); 6236 PrintF("\n");
6236 #endif 6237 #endif
6237 6238
6238 if (kind() == OPTIMIZED_FUNCTION) { 6239 if (kind() == OPTIMIZED_FUNCTION) {
6239 SafepointTable table(this); 6240 SafepointTable table(this);
6240 PrintF("Safepoints (size = %u)\n", table.size()); 6241 PrintF(out, "Safepoints (size = %u)\n", table.size());
6241 for (unsigned i = 0; i < table.length(); i++) { 6242 for (unsigned i = 0; i < table.length(); i++) {
6242 unsigned pc_offset = table.GetPcOffset(i); 6243 unsigned pc_offset = table.GetPcOffset(i);
6243 PrintF("%p %4d ", (instruction_start() + pc_offset), pc_offset); 6244 PrintF(out, "%p %4d ", (instruction_start() + pc_offset), pc_offset);
6244 table.PrintEntry(i); 6245 table.PrintEntry(i);
6245 PrintF(" (sp -> fp)"); 6246 PrintF(out, " (sp -> fp)");
6246 int deoptimization_index = table.GetDeoptimizationIndex(i); 6247 int deoptimization_index = table.GetDeoptimizationIndex(i);
6247 if (deoptimization_index != Safepoint::kNoDeoptimizationIndex) { 6248 if (deoptimization_index != Safepoint::kNoDeoptimizationIndex) {
6248 PrintF(" %6d", deoptimization_index); 6249 PrintF(out, " %6d", deoptimization_index);
6249 } else { 6250 } else {
6250 PrintF(" <none>"); 6251 PrintF(out, " <none>");
6251 } 6252 }
6252 PrintF("\n"); 6253 PrintF(out, "\n");
6253 } 6254 }
6254 PrintF("\n"); 6255 PrintF(out, "\n");
6255 } else if (kind() == FUNCTION) { 6256 } else if (kind() == FUNCTION) {
6256 unsigned offset = stack_check_table_start(); 6257 unsigned offset = stack_check_table_start();
6257 // If there is no stack check table, the "table start" will at or after 6258 // If there is no stack check table, the "table start" will at or after
6258 // (due to alignment) the end of the instruction stream. 6259 // (due to alignment) the end of the instruction stream.
6259 if (static_cast<int>(offset) < instruction_size()) { 6260 if (static_cast<int>(offset) < instruction_size()) {
6260 unsigned* address = 6261 unsigned* address =
6261 reinterpret_cast<unsigned*>(instruction_start() + offset); 6262 reinterpret_cast<unsigned*>(instruction_start() + offset);
6262 unsigned length = address[0]; 6263 unsigned length = address[0];
6263 PrintF("Stack checks (size = %u)\n", length); 6264 PrintF(out, "Stack checks (size = %u)\n", length);
6264 PrintF("ast_id pc_offset\n"); 6265 PrintF(out, "ast_id pc_offset\n");
6265 for (unsigned i = 0; i < length; ++i) { 6266 for (unsigned i = 0; i < length; ++i) {
6266 unsigned index = (2 * i) + 1; 6267 unsigned index = (2 * i) + 1;
6267 PrintF("%6u %9u\n", address[index], address[index + 1]); 6268 PrintF(out, "%6u %9u\n", address[index], address[index + 1]);
6268 } 6269 }
6269 PrintF("\n"); 6270 PrintF(out, "\n");
6270 } 6271 }
6271 } 6272 }
6272 6273
6273 PrintF("RelocInfo (size = %d)\n", relocation_size()); 6274 PrintF("RelocInfo (size = %d)\n", relocation_size());
6274 for (RelocIterator it(this); !it.done(); it.next()) it.rinfo()->Print(); 6275 for (RelocIterator it(this); !it.done(); it.next()) it.rinfo()->Print(out);
6275 PrintF("\n"); 6276 PrintF(out, "\n");
6276 } 6277 }
6277 #endif // ENABLE_DISASSEMBLER 6278 #endif // ENABLE_DISASSEMBLER
6278 6279
6279 6280
6280 MaybeObject* JSObject::SetFastElementsCapacityAndLength(int capacity, 6281 MaybeObject* JSObject::SetFastElementsCapacityAndLength(int capacity,
6281 int length) { 6282 int length) {
6282 // We should never end in here with a pixel or external array. 6283 // We should never end in here with a pixel or external array.
6283 ASSERT(!HasPixelElements() && !HasExternalArrayElements()); 6284 ASSERT(!HasPixelElements() && !HasExternalArrayElements());
6284 6285
6285 Object* obj; 6286 Object* obj;
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
7414 return static_cast<uint32_t>(dictionary->Capacity()) >= 7415 return static_cast<uint32_t>(dictionary->Capacity()) >=
7415 (length / (2 * NumberDictionary::kEntrySize)); 7416 (length / (2 * NumberDictionary::kEntrySize));
7416 } 7417 }
7417 7418
7418 7419
7419 // Certain compilers request function template instantiation when they 7420 // Certain compilers request function template instantiation when they
7420 // see the definition of the other template functions in the 7421 // see the definition of the other template functions in the
7421 // class. This requires us to have the template functions put 7422 // class. This requires us to have the template functions put
7422 // together, so even though this function belongs in objects-debug.cc, 7423 // together, so even though this function belongs in objects-debug.cc,
7423 // we keep it here instead to satisfy certain compilers. 7424 // we keep it here instead to satisfy certain compilers.
7424 #ifdef DEBUG 7425 #ifdef OBJECT_PRINT
7425 template<typename Shape, typename Key> 7426 template<typename Shape, typename Key>
7426 void Dictionary<Shape, Key>::Print() { 7427 void Dictionary<Shape, Key>::Print(FILE* out) {
7427 int capacity = HashTable<Shape, Key>::Capacity(); 7428 int capacity = HashTable<Shape, Key>::Capacity();
7428 for (int i = 0; i < capacity; i++) { 7429 for (int i = 0; i < capacity; i++) {
7429 Object* k = HashTable<Shape, Key>::KeyAt(i); 7430 Object* k = HashTable<Shape, Key>::KeyAt(i);
7430 if (HashTable<Shape, Key>::IsKey(k)) { 7431 if (HashTable<Shape, Key>::IsKey(k)) {
7431 PrintF(" "); 7432 PrintF(out, " ");
7432 if (k->IsString()) { 7433 if (k->IsString()) {
7433 String::cast(k)->StringPrint(); 7434 String::cast(k)->StringPrint(out);
7434 } else { 7435 } else {
7435 k->ShortPrint(); 7436 k->ShortPrint(out);
7436 } 7437 }
7437 PrintF(": "); 7438 PrintF(out, ": ");
7438 ValueAt(i)->ShortPrint(); 7439 ValueAt(i)->ShortPrint(out);
7439 PrintF("\n"); 7440 PrintF(out, "\n");
7440 } 7441 }
7441 } 7442 }
7442 } 7443 }
7443 #endif 7444 #endif
7444 7445
7445 7446
7446 template<typename Shape, typename Key> 7447 template<typename Shape, typename Key>
7447 void Dictionary<Shape, Key>::CopyValuesTo(FixedArray* elements) { 7448 void Dictionary<Shape, Key>::CopyValuesTo(FixedArray* elements) {
7448 int pos = 0; 7449 int pos = 0;
7449 int capacity = HashTable<Shape, Key>::Capacity(); 7450 int capacity = HashTable<Shape, Key>::Capacity();
(...skipping 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after
9746 if (break_point_objects()->IsUndefined()) return 0; 9747 if (break_point_objects()->IsUndefined()) return 0;
9747 // Single beak point. 9748 // Single beak point.
9748 if (!break_point_objects()->IsFixedArray()) return 1; 9749 if (!break_point_objects()->IsFixedArray()) return 1;
9749 // Multiple break points. 9750 // Multiple break points.
9750 return FixedArray::cast(break_point_objects())->length(); 9751 return FixedArray::cast(break_point_objects())->length();
9751 } 9752 }
9752 #endif 9753 #endif
9753 9754
9754 9755
9755 } } // namespace v8::internal 9756 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698