Chromium Code Reviews| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 va_start(arguments, format); | 66 va_start(arguments, format); |
| 67 OS::VPrint(format, arguments); | 67 OS::VPrint(format, arguments); |
| 68 va_end(arguments); | 68 va_end(arguments); |
| 69 PrintF("\n"); | 69 PrintF("\n"); |
| 70 } | 70 } |
| 71 status_ = ABORTED; | 71 status_ = ABORTED; |
| 72 } | 72 } |
| 73 | 73 |
| 74 | 74 |
| 75 void LCodeGen::Comment(const char* format, ...) { | 75 void LCodeGen::Comment(const char* format, ...) { |
| 76 Abort("Unimplemented: %s", "Comment"); | 76 char buffer[4 * KB]; |
|
Kevin Millikin (Chromium)
2011/01/14 10:22:43
Something looks wrong with the indentation here.
Rico
2011/01/14 10:26:53
Done.
| |
| 77 StringBuilder builder(buffer, ARRAY_SIZE(buffer)); | |
| 78 va_list arguments; | |
| 79 va_start(arguments, format); | |
| 80 builder.AddFormattedList(format, arguments); | |
| 81 va_end(arguments); | |
| 82 | |
| 83 // Copy the string before recording it in the assembler to avoid | |
| 84 // issues when the stack allocated buffer goes out of scope. | |
| 85 size_t length = builder.position(); | |
| 86 Vector<char> copy = Vector<char>::New(length + 1); | |
| 87 memcpy(copy.start(), builder.Finalize(), copy.length()); | |
| 88 masm()->RecordComment(copy.start()); | |
| 77 } | 89 } |
| 78 | 90 |
| 79 | 91 |
| 80 bool LCodeGen::GeneratePrologue() { | 92 bool LCodeGen::GeneratePrologue() { |
| 81 Abort("Unimplemented: %s", "GeneratePrologue"); | 93 Abort("Unimplemented: %s", "GeneratePrologue"); |
| 82 return !is_aborted(); | 94 return false; |
| 83 } | 95 } |
| 84 | 96 |
| 85 | 97 |
| 86 bool LCodeGen::GenerateBody() { | 98 bool LCodeGen::GenerateBody() { |
| 87 ASSERT(is_generating()); | 99 ASSERT(is_generating()); |
| 88 bool emit_instructions = true; | 100 bool emit_instructions = true; |
| 89 for (current_instruction_ = 0; | 101 for (current_instruction_ = 0; |
| 90 !is_aborted() && current_instruction_ < instructions_->length(); | 102 !is_aborted() && current_instruction_ < instructions_->length(); |
| 91 current_instruction_++) { | 103 current_instruction_++) { |
| 92 LInstruction* instr = instructions_->at(current_instruction_); | 104 LInstruction* instr = instructions_->at(current_instruction_); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 | 136 |
| 125 // Deferred code is the last part of the instruction sequence. Mark | 137 // Deferred code is the last part of the instruction sequence. Mark |
| 126 // the generated code as done unless we bailed out. | 138 // the generated code as done unless we bailed out. |
| 127 if (!is_aborted()) status_ = DONE; | 139 if (!is_aborted()) status_ = DONE; |
| 128 return !is_aborted(); | 140 return !is_aborted(); |
| 129 } | 141 } |
| 130 | 142 |
| 131 | 143 |
| 132 bool LCodeGen::GenerateSafepointTable() { | 144 bool LCodeGen::GenerateSafepointTable() { |
| 133 Abort("Unimplemented: %s", "GeneratePrologue"); | 145 Abort("Unimplemented: %s", "GeneratePrologue"); |
| 134 return !is_aborted(); | 146 return false; |
| 135 } | 147 } |
| 136 | 148 |
| 137 | 149 |
| 138 Register LCodeGen::ToRegister(int index) const { | 150 Register LCodeGen::ToRegister(int index) const { |
| 139 return Register::FromAllocationIndex(index); | 151 return Register::FromAllocationIndex(index); |
| 140 } | 152 } |
| 141 | 153 |
| 142 | 154 |
| 143 XMMRegister LCodeGen::ToDoubleRegister(int index) const { | 155 XMMRegister LCodeGen::ToDoubleRegister(int index) const { |
| 144 return XMMRegister::FromAllocationIndex(index); | 156 return XMMRegister::FromAllocationIndex(index); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 480 Abort("Unimplemented: %s", "DoConstantI"); | 492 Abort("Unimplemented: %s", "DoConstantI"); |
| 481 } | 493 } |
| 482 | 494 |
| 483 | 495 |
| 484 void LCodeGen::DoConstantD(LConstantD* instr) { | 496 void LCodeGen::DoConstantD(LConstantD* instr) { |
| 485 Abort("Unimplemented: %s", "DoConstantI"); | 497 Abort("Unimplemented: %s", "DoConstantI"); |
| 486 } | 498 } |
| 487 | 499 |
| 488 | 500 |
| 489 void LCodeGen::DoConstantT(LConstantT* instr) { | 501 void LCodeGen::DoConstantT(LConstantT* instr) { |
| 490 Abort("Unimplemented: %s", "DoConstantT"); | 502 ASSERT(instr->result()->IsRegister()); |
| 503 __ Move(ToRegister(instr->result()), instr->value()); | |
| 491 } | 504 } |
| 492 | 505 |
| 493 | 506 |
| 494 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) { | 507 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) { |
| 495 Abort("Unimplemented: %s", "DoJSArrayLength"); | 508 Abort("Unimplemented: %s", "DoJSArrayLength"); |
| 496 } | 509 } |
| 497 | 510 |
| 498 | 511 |
| 499 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { | 512 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { |
| 500 Abort("Unimplemented: %s", "DoFixedArrayLength"); | 513 Abort("Unimplemented: %s", "DoFixedArrayLength"); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 Abort("Unimplemented: %s", "EmitGoto"); | 567 Abort("Unimplemented: %s", "EmitGoto"); |
| 555 } | 568 } |
| 556 | 569 |
| 557 | 570 |
| 558 void LCodeGen::DoDeferredStackCheck(LGoto* instr) { | 571 void LCodeGen::DoDeferredStackCheck(LGoto* instr) { |
| 559 Abort("Unimplemented: %s", "DoDeferredStackCheck"); | 572 Abort("Unimplemented: %s", "DoDeferredStackCheck"); |
| 560 } | 573 } |
| 561 | 574 |
| 562 | 575 |
| 563 void LCodeGen::DoGoto(LGoto* instr) { | 576 void LCodeGen::DoGoto(LGoto* instr) { |
| 564 Abort("Unimplemented: %s", "DoGoto"); | 577 class DeferredStackCheck: public LDeferredCode { |
| 578 public: | |
| 579 DeferredStackCheck(LCodeGen* codegen, LGoto* instr) | |
| 580 : LDeferredCode(codegen), instr_(instr) { } | |
| 581 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } | |
| 582 private: | |
| 583 LGoto* instr_; | |
| 584 }; | |
| 585 | |
| 586 DeferredStackCheck* deferred = NULL; | |
| 587 if (instr->include_stack_check()) { | |
| 588 deferred = new DeferredStackCheck(this, instr); | |
| 589 } | |
| 590 EmitGoto(instr->block_id(), deferred); | |
| 565 } | 591 } |
| 566 | 592 |
| 567 | 593 |
| 568 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { | 594 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { |
| 569 Condition cond = no_condition; | 595 Condition cond = no_condition; |
| 570 switch (op) { | 596 switch (op) { |
| 571 case Token::EQ: | 597 case Token::EQ: |
| 572 case Token::EQ_STRICT: | 598 case Token::EQ_STRICT: |
| 573 cond = equal; | 599 cond = equal; |
| 574 break; | 600 break; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 752 Abort("Unimplemented: %s", "DoCmpT"); | 778 Abort("Unimplemented: %s", "DoCmpT"); |
| 753 } | 779 } |
| 754 | 780 |
| 755 | 781 |
| 756 void LCodeGen::DoCmpTAndBranch(LCmpTAndBranch* instr) { | 782 void LCodeGen::DoCmpTAndBranch(LCmpTAndBranch* instr) { |
| 757 Abort("Unimplemented: %s", "DoCmpTAndBranch"); | 783 Abort("Unimplemented: %s", "DoCmpTAndBranch"); |
| 758 } | 784 } |
| 759 | 785 |
| 760 | 786 |
| 761 void LCodeGen::DoReturn(LReturn* instr) { | 787 void LCodeGen::DoReturn(LReturn* instr) { |
| 762 Abort("Unimplemented: %s", "DoReturn"); | 788 if (FLAG_trace) { |
| 789 // Preserve the return value on the stack and rely on the runtime | |
| 790 // call to return the value in the same register. | |
| 791 __ push(rax); | |
| 792 __ CallRuntime(Runtime::kTraceExit, 1); | |
| 793 } | |
| 794 __ movq(rsp, rbp); | |
| 795 __ pop(rbp); | |
| 796 __ ret((ParameterCount() + 1) * kPointerSize); | |
| 797 | |
| 763 } | 798 } |
| 764 | 799 |
| 765 | 800 |
| 766 void LCodeGen::DoLoadGlobal(LLoadGlobal* instr) { | 801 void LCodeGen::DoLoadGlobal(LLoadGlobal* instr) { |
| 767 Abort("Unimplemented: %s", "DoLoadGlobal"); | 802 Abort("Unimplemented: %s", "DoLoadGlobal"); |
| 768 } | 803 } |
| 769 | 804 |
| 770 | 805 |
| 771 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { | 806 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { |
| 772 Abort("Unimplemented: %s", "DoStoreGlobal"); | 807 Abort("Unimplemented: %s", "DoStoreGlobal"); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1124 | 1159 |
| 1125 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 1160 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
| 1126 Abort("Unimplemented: %s", "DoOsrEntry"); | 1161 Abort("Unimplemented: %s", "DoOsrEntry"); |
| 1127 } | 1162 } |
| 1128 | 1163 |
| 1129 #undef __ | 1164 #undef __ |
| 1130 | 1165 |
| 1131 } } // namespace v8::internal | 1166 } } // namespace v8::internal |
| 1132 | 1167 |
| 1133 #endif // V8_TARGET_ARCH_X64 | 1168 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |