| OLD | NEW | 
|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 60                                           LOperand* spill_operand) { | 60                                           LOperand* spill_operand) { | 
| 61   ASSERT(spill_operand->IsDoubleStackSlot()); | 61   ASSERT(spill_operand->IsDoubleStackSlot()); | 
| 62   ASSERT(double_register_spills_[allocation_index] == NULL); | 62   ASSERT(double_register_spills_[allocation_index] == NULL); | 
| 63   double_register_spills_[allocation_index] = spill_operand; | 63   double_register_spills_[allocation_index] = spill_operand; | 
| 64 } | 64 } | 
| 65 | 65 | 
| 66 | 66 | 
| 67 void LInstruction::PrintTo(StringStream* stream) { | 67 void LInstruction::PrintTo(StringStream* stream) { | 
| 68   stream->Add("%s ", this->Mnemonic()); | 68   stream->Add("%s ", this->Mnemonic()); | 
| 69   if (HasResult()) { | 69   if (HasResult()) { | 
| 70     LTemplateInstruction<1>::cast(this)->result()->PrintTo(stream); | 70     PrintOutputOperandTo(stream); | 
| 71     stream->Add(" "); |  | 
| 72   } | 71   } | 
|  | 72 | 
| 73   PrintDataTo(stream); | 73   PrintDataTo(stream); | 
| 74 | 74 | 
| 75   if (HasEnvironment()) { | 75   if (HasEnvironment()) { | 
| 76     stream->Add(" "); | 76     stream->Add(" "); | 
| 77     environment()->PrintTo(stream); | 77     environment()->PrintTo(stream); | 
| 78   } | 78   } | 
| 79 | 79 | 
| 80   if (HasPointerMap()) { | 80   if (HasPointerMap()) { | 
| 81     stream->Add(" "); | 81     stream->Add(" "); | 
| 82     pointer_map()->PrintTo(stream); | 82     pointer_map()->PrintTo(stream); | 
| 83   } | 83   } | 
| 84 } | 84 } | 
| 85 | 85 | 
| 86 | 86 | 
|  | 87 template<int R, int I, int T> | 
|  | 88 void LTemplateInstruction<R, I, T>::PrintDataTo(StringStream* stream) { | 
|  | 89   for (int i = 0; i < I; i++) { | 
|  | 90     stream->Add(i == 0 ? "= " : " "); | 
|  | 91     inputs_.at(i)->PrintTo(stream); | 
|  | 92   } | 
|  | 93 } | 
|  | 94 | 
|  | 95 | 
|  | 96 template<int R, int I, int T> | 
|  | 97 void LTemplateInstruction<R, I, T>::PrintOutputOperandTo(StringStream* stream) { | 
|  | 98   if (this->HasResult()) { | 
|  | 99     this->result()->PrintTo(stream); | 
|  | 100     stream->Add(" "); | 
|  | 101   } | 
|  | 102 } | 
|  | 103 | 
|  | 104 | 
| 87 void LLabel::PrintDataTo(StringStream* stream) { | 105 void LLabel::PrintDataTo(StringStream* stream) { | 
| 88   LGap::PrintDataTo(stream); | 106   LGap::PrintDataTo(stream); | 
| 89   LLabel* rep = replacement(); | 107   LLabel* rep = replacement(); | 
| 90   if (rep != NULL) { | 108   if (rep != NULL) { | 
| 91     stream->Add(" Dead block replaced with B%d", rep->block_id()); | 109     stream->Add(" Dead block replaced with B%d", rep->block_id()); | 
| 92   } | 110   } | 
| 93 } | 111 } | 
| 94 | 112 | 
| 95 | 113 | 
| 96 bool LGap::IsRedundant() const { | 114 bool LGap::IsRedundant() const { | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 136     case Token::MUL: return "mul-t"; | 154     case Token::MUL: return "mul-t"; | 
| 137     case Token::MOD: return "mod-t"; | 155     case Token::MOD: return "mod-t"; | 
| 138     case Token::DIV: return "div-t"; | 156     case Token::DIV: return "div-t"; | 
| 139     default: | 157     default: | 
| 140       UNREACHABLE(); | 158       UNREACHABLE(); | 
| 141       return NULL; | 159       return NULL; | 
| 142   } | 160   } | 
| 143 } | 161 } | 
| 144 | 162 | 
| 145 | 163 | 
| 146 |  | 
| 147 void LBinaryOperation::PrintDataTo(StringStream* stream) { |  | 
| 148   stream->Add("= "); |  | 
| 149   left()->PrintTo(stream); |  | 
| 150   stream->Add(" "); |  | 
| 151   right()->PrintTo(stream); |  | 
| 152 } |  | 
| 153 |  | 
| 154 |  | 
| 155 void LGoto::PrintDataTo(StringStream* stream) { | 164 void LGoto::PrintDataTo(StringStream* stream) { | 
| 156   stream->Add("B%d", block_id()); | 165   stream->Add("B%d", block_id()); | 
| 157 } | 166 } | 
| 158 | 167 | 
| 159 | 168 | 
| 160 void LBranch::PrintDataTo(StringStream* stream) { | 169 void LBranch::PrintDataTo(StringStream* stream) { | 
| 161   stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); | 170   stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); | 
| 162   input()->PrintTo(stream); | 171   input()->PrintTo(stream); | 
| 163 } | 172 } | 
| 164 | 173 | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 260   stream->Add("%s #%d / ", *name_string, arity()); | 269   stream->Add("%s #%d / ", *name_string, arity()); | 
| 261 } | 270 } | 
| 262 | 271 | 
| 263 | 272 | 
| 264 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | 273 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | 
| 265   stream->Add("#%d / ", arity()); | 274   stream->Add("#%d / ", arity()); | 
| 266 } | 275 } | 
| 267 | 276 | 
| 268 | 277 | 
| 269 void LCallNew::PrintDataTo(StringStream* stream) { | 278 void LCallNew::PrintDataTo(StringStream* stream) { | 
| 270   LUnaryOperation<1>::PrintDataTo(stream); | 279   stream->Add("= "); | 
|  | 280   input()->PrintTo(stream); | 
| 271   stream->Add(" #%d / ", arity()); | 281   stream->Add(" #%d / ", arity()); | 
| 272 } | 282 } | 
| 273 | 283 | 
| 274 | 284 | 
| 275 void LClassOfTest::PrintDataTo(StringStream* stream) { | 285 void LClassOfTest::PrintDataTo(StringStream* stream) { | 
| 276   stream->Add("= class_of_test("); | 286   stream->Add("= class_of_test("); | 
| 277   input()->PrintTo(stream); | 287   input()->PrintTo(stream); | 
| 278   stream->Add(", \"%o\")", *hydrogen()->class_name()); | 288   stream->Add(", \"%o\")", *hydrogen()->class_name()); | 
| 279 } | 289 } | 
| 280 | 290 | 
| 281 | 291 | 
| 282 template <int R> |  | 
| 283 void LUnaryOperation<R>::PrintDataTo(StringStream* stream) { |  | 
| 284   stream->Add("= "); |  | 
| 285   input()->PrintTo(stream); |  | 
| 286 } |  | 
| 287 |  | 
| 288 |  | 
| 289 void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { | 292 void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { | 
| 290   arguments()->PrintTo(stream); | 293   arguments()->PrintTo(stream); | 
| 291 | 294 | 
| 292   stream->Add(" length "); | 295   stream->Add(" length "); | 
| 293   length()->PrintTo(stream); | 296   length()->PrintTo(stream); | 
| 294 | 297 | 
| 295   stream->Add(" index "); | 298   stream->Add(" index "); | 
| 296   index()->PrintTo(stream); | 299   index()->PrintTo(stream); | 
| 297 } | 300 } | 
| 298 | 301 | 
| 299 | 302 | 
| 300 void LChunk::Verify() const { |  | 
| 301   // TODO(twuerthinger): Implement verification for chunk. |  | 
| 302 } |  | 
| 303 |  | 
| 304 |  | 
| 305 int LChunk::GetNextSpillIndex(bool is_double) { | 303 int LChunk::GetNextSpillIndex(bool is_double) { | 
| 306   // Skip a slot if for a double-width slot. | 304   // Skip a slot if for a double-width slot. | 
| 307   if (is_double) spill_slot_count_++; | 305   if (is_double) spill_slot_count_++; | 
| 308   return spill_slot_count_++; | 306   return spill_slot_count_++; | 
| 309 } | 307 } | 
| 310 | 308 | 
| 311 | 309 | 
| 312 LOperand* LChunk::GetNextSpillSlot(bool is_double)  { | 310 LOperand* LChunk::GetNextSpillSlot(bool is_double)  { | 
| 313   int index = GetNextSpillIndex(is_double); | 311   int index = GetNextSpillIndex(is_double); | 
| 314   if (is_double) { | 312   if (is_double) { | 
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 566 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { | 564 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { | 
| 567   if (value->EmitAtUses()) { | 565   if (value->EmitAtUses()) { | 
| 568     HInstruction* instr = HInstruction::cast(value); | 566     HInstruction* instr = HInstruction::cast(value); | 
| 569     VisitInstruction(instr); | 567     VisitInstruction(instr); | 
| 570   } | 568   } | 
| 571   allocator_->RecordUse(value, operand); | 569   allocator_->RecordUse(value, operand); | 
| 572   return operand; | 570   return operand; | 
| 573 } | 571 } | 
| 574 | 572 | 
| 575 | 573 | 
| 576 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1>* instr) { | 574 template<int I, int T> | 
|  | 575 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, | 
|  | 576                                     LUnallocated* result) { | 
|  | 577   allocator_->RecordDefinition(current_instruction_, result); | 
|  | 578   instr->set_result(result); | 
|  | 579   return instr; | 
|  | 580 } | 
|  | 581 | 
|  | 582 | 
|  | 583 template<int I, int T> | 
|  | 584 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr) { | 
| 577   return Define(instr, new LUnallocated(LUnallocated::NONE)); | 585   return Define(instr, new LUnallocated(LUnallocated::NONE)); | 
| 578 } | 586 } | 
| 579 | 587 | 
| 580 | 588 | 
| 581 LInstruction* LChunkBuilder::DefineAsRegister(LTemplateInstruction<1>* instr) { | 589 template<int I, int T> | 
|  | 590 LInstruction* LChunkBuilder::DefineAsRegister( | 
|  | 591     LTemplateInstruction<1, I, T>* instr) { | 
| 582   return Define(instr, new LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 592   return Define(instr, new LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 
| 583 } | 593 } | 
| 584 | 594 | 
| 585 | 595 | 
| 586 LInstruction* LChunkBuilder::DefineAsSpilled(LTemplateInstruction<1>* instr, | 596 template<int I, int T> | 
| 587                                              int index) { | 597 LInstruction* LChunkBuilder::DefineAsSpilled( | 
|  | 598     LTemplateInstruction<1, I, T>* instr, | 
|  | 599     int index) { | 
| 588   return Define(instr, new LUnallocated(LUnallocated::FIXED_SLOT, index)); | 600   return Define(instr, new LUnallocated(LUnallocated::FIXED_SLOT, index)); | 
| 589 } | 601 } | 
| 590 | 602 | 
| 591 | 603 | 
| 592 LInstruction* LChunkBuilder::DefineSameAsFirst(LTemplateInstruction<1>* instr) { | 604 template<int I, int T> | 
|  | 605 LInstruction* LChunkBuilder::DefineSameAsFirst( | 
|  | 606     LTemplateInstruction<1, I, T>* instr) { | 
| 593   return Define(instr, new LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); | 607   return Define(instr, new LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); | 
| 594 } | 608 } | 
| 595 | 609 | 
| 596 | 610 | 
| 597 LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1>* instr, | 611 template<int I, int T> | 
|  | 612 LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1, I, T>* instr, | 
| 598                                          Register reg) { | 613                                          Register reg) { | 
| 599   return Define(instr, ToUnallocated(reg)); | 614   return Define(instr, ToUnallocated(reg)); | 
| 600 } | 615 } | 
| 601 | 616 | 
| 602 | 617 | 
| 603 LInstruction* LChunkBuilder::DefineFixedDouble(LTemplateInstruction<1>* instr, | 618 template<int I, int T> | 
| 604                                                XMMRegister reg) { | 619 LInstruction* LChunkBuilder::DefineFixedDouble( | 
|  | 620     LTemplateInstruction<1, I, T>* instr, | 
|  | 621     XMMRegister reg) { | 
| 605   return Define(instr, ToUnallocated(reg)); | 622   return Define(instr, ToUnallocated(reg)); | 
| 606 } | 623 } | 
| 607 | 624 | 
| 608 | 625 | 
| 609 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 626 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 
| 610   HEnvironment* hydrogen_env = current_block_->last_environment(); | 627   HEnvironment* hydrogen_env = current_block_->last_environment(); | 
| 611   instr->set_environment(CreateEnvironment(hydrogen_env)); | 628   instr->set_environment(CreateEnvironment(hydrogen_env)); | 
| 612   return instr; | 629   return instr; | 
| 613 } | 630 } | 
| 614 | 631 | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 662 } | 679 } | 
| 663 | 680 | 
| 664 | 681 | 
| 665 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 682 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 
| 666   ASSERT(!instr->HasPointerMap()); | 683   ASSERT(!instr->HasPointerMap()); | 
| 667   instr->set_pointer_map(new LPointerMap(position_)); | 684   instr->set_pointer_map(new LPointerMap(position_)); | 
| 668   return instr; | 685   return instr; | 
| 669 } | 686 } | 
| 670 | 687 | 
| 671 | 688 | 
| 672 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1>* instr, |  | 
| 673                                     LUnallocated* result) { |  | 
| 674   allocator_->RecordDefinition(current_instruction_, result); |  | 
| 675   instr->set_result(result); |  | 
| 676   return instr; |  | 
| 677 } |  | 
| 678 |  | 
| 679 |  | 
| 680 LUnallocated* LChunkBuilder::TempRegister() { | 689 LUnallocated* LChunkBuilder::TempRegister() { | 
| 681   LUnallocated* operand = new LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 690   LUnallocated* operand = new LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 
| 682   allocator_->RecordTemporary(operand); | 691   allocator_->RecordTemporary(operand); | 
| 683   return operand; | 692   return operand; | 
| 684 } | 693 } | 
| 685 | 694 | 
| 686 | 695 | 
| 687 LOperand* LChunkBuilder::FixedTemp(Register reg) { | 696 LOperand* LChunkBuilder::FixedTemp(Register reg) { | 
| 688   LUnallocated* operand = ToUnallocated(reg); | 697   LUnallocated* operand = ToUnallocated(reg); | 
| 689   allocator_->RecordTemporary(operand); | 698   allocator_->RecordTemporary(operand); | 
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1272 | 1281 | 
| 1273 | 1282 | 
| 1274 LInstruction* LChunkBuilder::DoBitAnd(HBitAnd* instr) { | 1283 LInstruction* LChunkBuilder::DoBitAnd(HBitAnd* instr) { | 
| 1275   return DoBit(Token::BIT_AND, instr); | 1284   return DoBit(Token::BIT_AND, instr); | 
| 1276 } | 1285 } | 
| 1277 | 1286 | 
| 1278 | 1287 | 
| 1279 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { | 1288 LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) { | 
| 1280   ASSERT(instr->value()->representation().IsInteger32()); | 1289   ASSERT(instr->value()->representation().IsInteger32()); | 
| 1281   ASSERT(instr->representation().IsInteger32()); | 1290   ASSERT(instr->representation().IsInteger32()); | 
| 1282   return DefineSameAsFirst(new LBitNotI(UseRegisterAtStart(instr->value()))); | 1291   LOperand* input = UseRegisterAtStart(instr->value()); | 
|  | 1292   LBitNotI* result = new LBitNotI(input); | 
|  | 1293   return DefineSameAsFirst(result); | 
| 1283 } | 1294 } | 
| 1284 | 1295 | 
| 1285 | 1296 | 
| 1286 LInstruction* LChunkBuilder::DoBitOr(HBitOr* instr) { | 1297 LInstruction* LChunkBuilder::DoBitOr(HBitOr* instr) { | 
| 1287   return DoBit(Token::BIT_OR, instr); | 1298   return DoBit(Token::BIT_OR, instr); | 
| 1288 } | 1299 } | 
| 1289 | 1300 | 
| 1290 | 1301 | 
| 1291 LInstruction* LChunkBuilder::DoBitXor(HBitXor* instr) { | 1302 LInstruction* LChunkBuilder::DoBitXor(HBitXor* instr) { | 
| 1292   return DoBit(Token::BIT_XOR, instr); | 1303   return DoBit(Token::BIT_XOR, instr); | 
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1922 void LPointerMap::PrintTo(StringStream* stream) { | 1933 void LPointerMap::PrintTo(StringStream* stream) { | 
| 1923   stream->Add("{"); | 1934   stream->Add("{"); | 
| 1924   for (int i = 0; i < pointer_operands_.length(); ++i) { | 1935   for (int i = 0; i < pointer_operands_.length(); ++i) { | 
| 1925     if (i != 0) stream->Add(";"); | 1936     if (i != 0) stream->Add(";"); | 
| 1926     pointer_operands_[i]->PrintTo(stream); | 1937     pointer_operands_[i]->PrintTo(stream); | 
| 1927   } | 1938   } | 
| 1928   stream->Add("} @%d", position()); | 1939   stream->Add("} @%d", position()); | 
| 1929 } | 1940 } | 
| 1930 | 1941 | 
| 1931 } }  // namespace v8::internal | 1942 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|