| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 if (HasPointerMap()) { | 84 if (HasPointerMap()) { |
| 85 stream->Add(" "); | 85 stream->Add(" "); |
| 86 pointer_map()->PrintTo(stream); | 86 pointer_map()->PrintTo(stream); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 | 90 |
| 91 template<int R, int I, int T> | 91 template<int R, int I, int T> |
| 92 void LTemplateInstruction<R, I, T>::PrintDataTo(StringStream* stream) { | 92 void LTemplateInstruction<R, I, T>::PrintDataTo(StringStream* stream) { |
| 93 for (int i = 0; i < I; i++) { | 93 stream->Add("= "); |
| 94 stream->Add(i == 0 ? "= " : " "); | 94 inputs_.PrintOperandsTo(stream); |
| 95 inputs_.at(i)->PrintTo(stream); | |
| 96 } | |
| 97 } | 95 } |
| 98 | 96 |
| 99 | 97 |
| 100 template<int R, int I, int T> | 98 template<int R, int I, int T> |
| 101 void LTemplateInstruction<R, I, T>::PrintOutputOperandTo(StringStream* stream) { | 99 void LTemplateInstruction<R, I, T>::PrintOutputOperandTo(StringStream* stream) { |
| 102 if (this->HasResult()) { | 100 results_.PrintOperandsTo(stream); |
| 103 this->result()->PrintTo(stream); | 101 } |
| 104 stream->Add(" "); | 102 |
| 103 |
| 104 template<typename T, int N> |
| 105 void OperandContainer<T, N>::PrintOperandsTo(StringStream* stream) { |
| 106 for (int i = 0; i < N; i++) { |
| 107 if (i > 0) stream->Add(" "); |
| 108 elems_[i]->PrintTo(stream); |
| 105 } | 109 } |
| 106 } | 110 } |
| 107 | 111 |
| 108 | 112 |
| 109 void LLabel::PrintDataTo(StringStream* stream) { | 113 void LLabel::PrintDataTo(StringStream* stream) { |
| 110 LGap::PrintDataTo(stream); | 114 LGap::PrintDataTo(stream); |
| 111 LLabel* rep = replacement(); | 115 LLabel* rep = replacement(); |
| 112 if (rep != NULL) { | 116 if (rep != NULL) { |
| 113 stream->Add(" Dead block replaced with B%d", rep->block_id()); | 117 stream->Add(" Dead block replaced with B%d", rep->block_id()); |
| 114 } | 118 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 169 } |
| 166 | 170 |
| 167 | 171 |
| 168 void LGoto::PrintDataTo(StringStream* stream) { | 172 void LGoto::PrintDataTo(StringStream* stream) { |
| 169 stream->Add("B%d", block_id()); | 173 stream->Add("B%d", block_id()); |
| 170 } | 174 } |
| 171 | 175 |
| 172 | 176 |
| 173 void LBranch::PrintDataTo(StringStream* stream) { | 177 void LBranch::PrintDataTo(StringStream* stream) { |
| 174 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); | 178 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); |
| 175 input()->PrintTo(stream); | 179 InputAt(0)->PrintTo(stream); |
| 176 } | 180 } |
| 177 | 181 |
| 178 | 182 |
| 179 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) { | 183 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) { |
| 180 stream->Add("if "); | 184 stream->Add("if "); |
| 181 left()->PrintTo(stream); | 185 InputAt(0)->PrintTo(stream); |
| 182 stream->Add(" %s ", Token::String(op())); | 186 stream->Add(" %s ", Token::String(op())); |
| 183 right()->PrintTo(stream); | 187 InputAt(1)->PrintTo(stream); |
| 184 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); | 188 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); |
| 185 } | 189 } |
| 186 | 190 |
| 187 | 191 |
| 188 void LIsNullAndBranch::PrintDataTo(StringStream* stream) { | 192 void LIsNullAndBranch::PrintDataTo(StringStream* stream) { |
| 189 stream->Add("if "); | 193 stream->Add("if "); |
| 190 input()->PrintTo(stream); | 194 InputAt(0)->PrintTo(stream); |
| 191 stream->Add(is_strict() ? " === null" : " == null"); | 195 stream->Add(is_strict() ? " === null" : " == null"); |
| 192 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); | 196 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); |
| 193 } | 197 } |
| 194 | 198 |
| 195 | 199 |
| 196 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { | 200 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { |
| 197 stream->Add("if is_object("); | 201 stream->Add("if is_object("); |
| 198 input()->PrintTo(stream); | 202 InputAt(0)->PrintTo(stream); |
| 199 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 203 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 200 } | 204 } |
| 201 | 205 |
| 202 | 206 |
| 203 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { | 207 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { |
| 204 stream->Add("if is_smi("); | 208 stream->Add("if is_smi("); |
| 205 input()->PrintTo(stream); | 209 InputAt(0)->PrintTo(stream); |
| 206 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 210 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 207 } | 211 } |
| 208 | 212 |
| 209 | 213 |
| 210 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { | 214 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { |
| 211 stream->Add("if has_instance_type("); | 215 stream->Add("if has_instance_type("); |
| 212 input()->PrintTo(stream); | 216 InputAt(0)->PrintTo(stream); |
| 213 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 217 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 214 } | 218 } |
| 215 | 219 |
| 216 | 220 |
| 217 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { | 221 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { |
| 218 stream->Add("if has_cached_array_index("); | 222 stream->Add("if has_cached_array_index("); |
| 219 input()->PrintTo(stream); | 223 InputAt(0)->PrintTo(stream); |
| 220 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 224 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 221 } | 225 } |
| 222 | 226 |
| 223 | 227 |
| 224 void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) { | 228 void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) { |
| 225 stream->Add("if class_of_test("); | 229 stream->Add("if class_of_test("); |
| 226 input()->PrintTo(stream); | 230 InputAt(0)->PrintTo(stream); |
| 227 stream->Add(", \"%o\") then B%d else B%d", | 231 stream->Add(", \"%o\") then B%d else B%d", |
| 228 *hydrogen()->class_name(), | 232 *hydrogen()->class_name(), |
| 229 true_block_id(), | 233 true_block_id(), |
| 230 false_block_id()); | 234 false_block_id()); |
| 231 } | 235 } |
| 232 | 236 |
| 233 | 237 |
| 234 void LTypeofIs::PrintDataTo(StringStream* stream) { | 238 void LTypeofIs::PrintDataTo(StringStream* stream) { |
| 235 input()->PrintTo(stream); | 239 InputAt(0)->PrintTo(stream); |
| 236 stream->Add(" == \"%s\"", *hydrogen()->type_literal()->ToCString()); | 240 stream->Add(" == \"%s\"", *hydrogen()->type_literal()->ToCString()); |
| 237 } | 241 } |
| 238 | 242 |
| 239 | 243 |
| 240 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { | 244 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { |
| 241 stream->Add("if typeof "); | 245 stream->Add("if typeof "); |
| 242 input()->PrintTo(stream); | 246 InputAt(0)->PrintTo(stream); |
| 243 stream->Add(" == \"%s\" then B%d else B%d", | 247 stream->Add(" == \"%s\" then B%d else B%d", |
| 244 *hydrogen()->type_literal()->ToCString(), | 248 *hydrogen()->type_literal()->ToCString(), |
| 245 true_block_id(), false_block_id()); | 249 true_block_id(), false_block_id()); |
| 246 } | 250 } |
| 247 | 251 |
| 248 | 252 |
| 249 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 253 void LCallConstantFunction::PrintDataTo(StringStream* stream) { |
| 250 stream->Add("#%d / ", arity()); | 254 stream->Add("#%d / ", arity()); |
| 251 } | 255 } |
| 252 | 256 |
| 253 | 257 |
| 254 void LUnaryMathOperation::PrintDataTo(StringStream* stream) { | 258 void LUnaryMathOperation::PrintDataTo(StringStream* stream) { |
| 255 stream->Add("/%s ", hydrogen()->OpName()); | 259 stream->Add("/%s ", hydrogen()->OpName()); |
| 256 input()->PrintTo(stream); | 260 InputAt(0)->PrintTo(stream); |
| 257 } | 261 } |
| 258 | 262 |
| 259 | 263 |
| 260 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 264 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
| 261 stream->Add("(%d, %d)", context_chain_length(), slot_index()); | 265 stream->Add("(%d, %d)", context_chain_length(), slot_index()); |
| 262 } | 266 } |
| 263 | 267 |
| 264 | 268 |
| 265 void LCallKeyed::PrintDataTo(StringStream* stream) { | 269 void LCallKeyed::PrintDataTo(StringStream* stream) { |
| 266 stream->Add("[rcx] #%d / ", arity()); | 270 stream->Add("[ecx] #%d / ", arity()); |
| 267 } | 271 } |
| 268 | 272 |
| 269 | 273 |
| 270 void LCallNamed::PrintDataTo(StringStream* stream) { | 274 void LCallNamed::PrintDataTo(StringStream* stream) { |
| 271 SmartPointer<char> name_string = name()->ToCString(); | 275 SmartPointer<char> name_string = name()->ToCString(); |
| 272 stream->Add("%s #%d / ", *name_string, arity()); | 276 stream->Add("%s #%d / ", *name_string, arity()); |
| 273 } | 277 } |
| 274 | 278 |
| 275 | 279 |
| 276 void LCallGlobal::PrintDataTo(StringStream* stream) { | 280 void LCallGlobal::PrintDataTo(StringStream* stream) { |
| 277 SmartPointer<char> name_string = name()->ToCString(); | 281 SmartPointer<char> name_string = name()->ToCString(); |
| 278 stream->Add("%s #%d / ", *name_string, arity()); | 282 stream->Add("%s #%d / ", *name_string, arity()); |
| 279 } | 283 } |
| 280 | 284 |
| 281 | 285 |
| 282 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | 286 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { |
| 283 stream->Add("#%d / ", arity()); | 287 stream->Add("#%d / ", arity()); |
| 284 } | 288 } |
| 285 | 289 |
| 286 | 290 |
| 287 void LCallNew::PrintDataTo(StringStream* stream) { | 291 void LCallNew::PrintDataTo(StringStream* stream) { |
| 288 stream->Add("= "); | 292 stream->Add("= "); |
| 289 input()->PrintTo(stream); | 293 InputAt(0)->PrintTo(stream); |
| 290 stream->Add(" #%d / ", arity()); | 294 stream->Add(" #%d / ", arity()); |
| 291 } | 295 } |
| 292 | 296 |
| 293 | 297 |
| 294 void LClassOfTest::PrintDataTo(StringStream* stream) { | 298 void LClassOfTest::PrintDataTo(StringStream* stream) { |
| 295 stream->Add("= class_of_test("); | 299 stream->Add("= class_of_test("); |
| 296 input()->PrintTo(stream); | 300 InputAt(0)->PrintTo(stream); |
| 297 stream->Add(", \"%o\")", *hydrogen()->class_name()); | 301 stream->Add(", \"%o\")", *hydrogen()->class_name()); |
| 298 } | 302 } |
| 299 | 303 |
| 300 | 304 |
| 301 void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { | 305 void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { |
| 302 arguments()->PrintTo(stream); | 306 arguments()->PrintTo(stream); |
| 303 | 307 |
| 304 stream->Add(" length "); | 308 stream->Add(" length "); |
| 305 length()->PrintTo(stream); | 309 length()->PrintTo(stream); |
| 306 | 310 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 } | 568 } |
| 565 | 569 |
| 566 | 570 |
| 567 LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) { | 571 LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) { |
| 568 return value->IsConstant() | 572 return value->IsConstant() |
| 569 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | 573 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
| 570 : UseRegisterAtStart(value); | 574 : UseRegisterAtStart(value); |
| 571 } | 575 } |
| 572 | 576 |
| 573 | 577 |
| 578 LOperand* LChunkBuilder::UseAny(HValue* value) { |
| 579 return value->IsConstant() |
| 580 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
| 581 : Use(value, new LUnallocated(LUnallocated::ANY)); |
| 582 } |
| 583 |
| 584 |
| 574 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { | 585 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { |
| 575 if (value->EmitAtUses()) { | 586 if (value->EmitAtUses()) { |
| 576 HInstruction* instr = HInstruction::cast(value); | 587 HInstruction* instr = HInstruction::cast(value); |
| 577 VisitInstruction(instr); | 588 VisitInstruction(instr); |
| 578 } | 589 } |
| 579 allocator_->RecordUse(value, operand); | 590 allocator_->RecordUse(value, operand); |
| 580 return operand; | 591 return operand; |
| 581 } | 592 } |
| 582 | 593 |
| 583 | 594 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 | 747 |
| 737 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, | 748 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, |
| 738 HArithmeticBinaryOperation* instr) { | 749 HArithmeticBinaryOperation* instr) { |
| 739 Abort("Unimplemented: %s", "DoArithmeticD"); | 750 Abort("Unimplemented: %s", "DoArithmeticD"); |
| 740 return NULL; | 751 return NULL; |
| 741 } | 752 } |
| 742 | 753 |
| 743 | 754 |
| 744 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, | 755 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, |
| 745 HArithmeticBinaryOperation* instr) { | 756 HArithmeticBinaryOperation* instr) { |
| 746 Abort("Unimplemented: %s", "DoArithmeticT"); | 757 ASSERT(op == Token::ADD || |
| 747 return NULL; | 758 op == Token::DIV || |
| 759 op == Token::MOD || |
| 760 op == Token::MUL || |
| 761 op == Token::SUB); |
| 762 HValue* left = instr->left(); |
| 763 HValue* right = instr->right(); |
| 764 ASSERT(left->representation().IsTagged()); |
| 765 ASSERT(right->representation().IsTagged()); |
| 766 LOperand* left_operand = UseFixed(left, rdx); |
| 767 LOperand* right_operand = UseFixed(right, rax); |
| 768 LArithmeticT* result = new LArithmeticT(op, left_operand, right_operand); |
| 769 return MarkAsCall(DefineFixed(result, rax), instr); |
| 748 } | 770 } |
| 749 | 771 |
| 750 | 772 |
| 751 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { | 773 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { |
| 752 ASSERT(is_building()); | 774 ASSERT(is_building()); |
| 753 current_block_ = block; | 775 current_block_ = block; |
| 754 next_block_ = next_block; | 776 next_block_ = next_block; |
| 755 if (block->IsStartBlock()) { | 777 if (block->IsStartBlock()) { |
| 756 block->UpdateEnvironment(graph_->start_environment()); | 778 block->UpdateEnvironment(graph_->start_environment()); |
| 757 argument_count_ = 0; | 779 argument_count_ = 0; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 if (current->has_position()) position_ = current->position(); | 840 if (current->has_position()) position_ = current->position(); |
| 819 LInstruction* instr = current->CompileToLithium(this); | 841 LInstruction* instr = current->CompileToLithium(this); |
| 820 | 842 |
| 821 if (instr != NULL) { | 843 if (instr != NULL) { |
| 822 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 844 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 823 instr = AssignPointerMap(instr); | 845 instr = AssignPointerMap(instr); |
| 824 } | 846 } |
| 825 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 847 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 826 instr = AssignEnvironment(instr); | 848 instr = AssignEnvironment(instr); |
| 827 } | 849 } |
| 828 if (current->IsBranch()) { | 850 if (current->IsBranch() && !instr->IsGoto()) { |
| 829 instr->set_hydrogen_value(HBranch::cast(current)->value()); | 851 // TODO(fschneider): Handle branch instructions uniformly like |
| 852 // other instructions. This requires us to generate the right |
| 853 // branch instruction already at the HIR level. |
| 854 ASSERT(instr->IsControl()); |
| 855 HBranch* branch = HBranch::cast(current); |
| 856 instr->set_hydrogen_value(branch->value()); |
| 857 HBasicBlock* first = branch->FirstSuccessor(); |
| 858 HBasicBlock* second = branch->SecondSuccessor(); |
| 859 ASSERT(first != NULL && second != NULL); |
| 860 instr->SetBranchTargets(first->block_id(), second->block_id()); |
| 830 } else { | 861 } else { |
| 831 instr->set_hydrogen_value(current); | 862 instr->set_hydrogen_value(current); |
| 832 } | 863 } |
| 833 | 864 |
| 834 int index = chunk_->AddInstruction(instr, current_block_); | 865 int index = chunk_->AddInstruction(instr, current_block_); |
| 835 allocator_->SummarizeInstruction(index); | 866 allocator_->SummarizeInstruction(index); |
| 836 } else { | 867 } else { |
| 837 // This instruction should be omitted. | 868 // This instruction should be omitted. |
| 838 allocator_->OmitInstruction(); | 869 allocator_->OmitInstruction(); |
| 839 } | 870 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 856 outer); | 887 outer); |
| 857 int argument_index = 0; | 888 int argument_index = 0; |
| 858 for (int i = 0; i < value_count; ++i) { | 889 for (int i = 0; i < value_count; ++i) { |
| 859 HValue* value = hydrogen_env->values()->at(i); | 890 HValue* value = hydrogen_env->values()->at(i); |
| 860 LOperand* op = NULL; | 891 LOperand* op = NULL; |
| 861 if (value->IsArgumentsObject()) { | 892 if (value->IsArgumentsObject()) { |
| 862 op = NULL; | 893 op = NULL; |
| 863 } else if (value->IsPushArgument()) { | 894 } else if (value->IsPushArgument()) { |
| 864 op = new LArgument(argument_index++); | 895 op = new LArgument(argument_index++); |
| 865 } else { | 896 } else { |
| 866 op = UseOrConstant(value); | 897 op = UseAny(value); |
| 867 if (op->IsUnallocated()) { | |
| 868 LUnallocated* unalloc = LUnallocated::cast(op); | |
| 869 unalloc->set_policy(LUnallocated::ANY); | |
| 870 } | |
| 871 } | 898 } |
| 872 result->AddValue(op, value->representation()); | 899 result->AddValue(op, value->representation()); |
| 873 } | 900 } |
| 874 | 901 |
| 875 return result; | 902 return result; |
| 876 } | 903 } |
| 877 | 904 |
| 878 | 905 |
| 879 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 906 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 880 LGoto* result = new LGoto(instr->FirstSuccessor()->block_id(), | 907 LGoto* result = new LGoto(instr->FirstSuccessor()->block_id(), |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 } | 1089 } |
| 1063 | 1090 |
| 1064 | 1091 |
| 1065 LInstruction* LChunkBuilder::DoSub(HSub* instr) { | 1092 LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
| 1066 Abort("Unimplemented: %s", "DoSub"); | 1093 Abort("Unimplemented: %s", "DoSub"); |
| 1067 return NULL; | 1094 return NULL; |
| 1068 } | 1095 } |
| 1069 | 1096 |
| 1070 | 1097 |
| 1071 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { | 1098 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { |
| 1072 Abort("Unimplemented: %s", "DoAdd"); | 1099 if (instr->representation().IsInteger32()) { |
| 1100 ASSERT(instr->left()->representation().IsInteger32()); |
| 1101 ASSERT(instr->right()->representation().IsInteger32()); |
| 1102 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); |
| 1103 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); |
| 1104 LAddI* add = new LAddI(left, right); |
| 1105 LInstruction* result = DefineSameAsFirst(add); |
| 1106 if (instr->CheckFlag(HValue::kCanOverflow)) { |
| 1107 result = AssignEnvironment(result); |
| 1108 } |
| 1109 return result; |
| 1110 } else if (instr->representation().IsDouble()) { |
| 1111 Abort("Unimplemented: %s", "DoAdd on Doubles"); |
| 1112 } else { |
| 1113 ASSERT(instr->representation().IsTagged()); |
| 1114 return DoArithmeticT(Token::ADD, instr); |
| 1115 } |
| 1073 return NULL; | 1116 return NULL; |
| 1074 } | 1117 } |
| 1075 | 1118 |
| 1076 | 1119 |
| 1077 LInstruction* LChunkBuilder::DoPower(HPower* instr) { | 1120 LInstruction* LChunkBuilder::DoPower(HPower* instr) { |
| 1078 Abort("Unimplemented: %s", "DoPower"); | 1121 Abort("Unimplemented: %s", "DoPower"); |
| 1079 return NULL; | 1122 return NULL; |
| 1080 } | 1123 } |
| 1081 | 1124 |
| 1082 | 1125 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 } | 1250 } |
| 1208 | 1251 |
| 1209 | 1252 |
| 1210 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1253 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
| 1211 Representation r = instr->representation(); | 1254 Representation r = instr->representation(); |
| 1212 if (r.IsInteger32()) { | 1255 if (r.IsInteger32()) { |
| 1213 int32_t value = instr->Integer32Value(); | 1256 int32_t value = instr->Integer32Value(); |
| 1214 return DefineAsRegister(new LConstantI(value)); | 1257 return DefineAsRegister(new LConstantI(value)); |
| 1215 } else if (r.IsDouble()) { | 1258 } else if (r.IsDouble()) { |
| 1216 double value = instr->DoubleValue(); | 1259 double value = instr->DoubleValue(); |
| 1217 return DefineAsRegister(new LConstantD(value)); | 1260 LOperand* temp = TempRegister(); |
| 1261 return DefineAsRegister(new LConstantD(value, temp)); |
| 1218 } else if (r.IsTagged()) { | 1262 } else if (r.IsTagged()) { |
| 1219 return DefineAsRegister(new LConstantT(instr->handle())); | 1263 return DefineAsRegister(new LConstantT(instr->handle())); |
| 1220 } else { | 1264 } else { |
| 1221 UNREACHABLE(); | 1265 UNREACHABLE(); |
| 1222 return NULL; | 1266 return NULL; |
| 1223 } | 1267 } |
| 1224 } | 1268 } |
| 1225 | 1269 |
| 1226 | 1270 |
| 1227 LInstruction* LChunkBuilder::DoLoadGlobal(HLoadGlobal* instr) { | 1271 LInstruction* LChunkBuilder::DoLoadGlobal(HLoadGlobal* instr) { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 | 1470 |
| 1427 | 1471 |
| 1428 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 1472 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 1429 Abort("Unimplemented: %s", "DoLeaveInlined"); | 1473 Abort("Unimplemented: %s", "DoLeaveInlined"); |
| 1430 return NULL; | 1474 return NULL; |
| 1431 } | 1475 } |
| 1432 | 1476 |
| 1433 } } // namespace v8::internal | 1477 } } // namespace v8::internal |
| 1434 | 1478 |
| 1435 #endif // V8_TARGET_ARCH_X64 | 1479 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |