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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 if (current->has_position()) position_ = current->position(); | 887 if (current->has_position()) position_ = current->position(); |
888 LInstruction* instr = current->CompileToLithium(this); | 888 LInstruction* instr = current->CompileToLithium(this); |
889 | 889 |
890 if (instr != NULL) { | 890 if (instr != NULL) { |
891 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 891 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
892 instr = AssignPointerMap(instr); | 892 instr = AssignPointerMap(instr); |
893 } | 893 } |
894 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 894 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
895 instr = AssignEnvironment(instr); | 895 instr = AssignEnvironment(instr); |
896 } | 896 } |
897 if (current->IsBranch() && !instr->IsGoto()) { | 897 if (current->IsTest() && !instr->IsGoto()) { |
898 // TODO(fschneider): Handle branch instructions uniformly like | 898 // TODO(fschneider): Handle test instructions uniformly like |
899 // other instructions. This requires us to generate the right | 899 // other instructions. This requires us to generate the right |
900 // branch instruction already at the HIR level. | 900 // branch instruction already at the HIR level. |
901 ASSERT(instr->IsControl()); | 901 ASSERT(instr->IsControl()); |
902 HBranch* branch = HBranch::cast(current); | 902 HTest* test = HTest::cast(current); |
903 instr->set_hydrogen_value(branch->value()); | 903 instr->set_hydrogen_value(test->value()); |
904 HBasicBlock* first = branch->FirstSuccessor(); | 904 HBasicBlock* first = test->FirstSuccessor(); |
905 HBasicBlock* second = branch->SecondSuccessor(); | 905 HBasicBlock* second = test->SecondSuccessor(); |
906 ASSERT(first != NULL && second != NULL); | 906 ASSERT(first != NULL && second != NULL); |
907 instr->SetBranchTargets(first->block_id(), second->block_id()); | 907 instr->SetBranchTargets(first->block_id(), second->block_id()); |
908 } else { | 908 } else { |
909 instr->set_hydrogen_value(current); | 909 instr->set_hydrogen_value(current); |
910 } | 910 } |
911 | 911 |
912 int index = chunk_->AddInstruction(instr, current_block_); | 912 int index = chunk_->AddInstruction(instr, current_block_); |
913 allocator_->SummarizeInstruction(index); | 913 allocator_->SummarizeInstruction(index); |
914 } else { | 914 } else { |
915 // This instruction should be omitted. | 915 // This instruction should be omitted. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 | 952 |
953 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 953 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
954 LGoto* result = new LGoto(instr->FirstSuccessor()->block_id(), | 954 LGoto* result = new LGoto(instr->FirstSuccessor()->block_id(), |
955 instr->include_stack_check()); | 955 instr->include_stack_check()); |
956 return (instr->include_stack_check()) | 956 return (instr->include_stack_check()) |
957 ? AssignPointerMap(result) | 957 ? AssignPointerMap(result) |
958 : result; | 958 : result; |
959 } | 959 } |
960 | 960 |
961 | 961 |
962 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 962 LInstruction* LChunkBuilder::DoTest(HTest* instr) { |
963 HValue* v = instr->value(); | 963 HValue* v = instr->value(); |
964 if (v->EmitAtUses()) { | 964 if (v->EmitAtUses()) { |
965 if (v->IsClassOfTest()) { | 965 if (v->IsClassOfTest()) { |
966 HClassOfTest* compare = HClassOfTest::cast(v); | 966 HClassOfTest* compare = HClassOfTest::cast(v); |
967 ASSERT(compare->value()->representation().IsTagged()); | 967 ASSERT(compare->value()->representation().IsTagged()); |
968 | 968 |
969 return new LClassOfTestAndBranch(UseTempRegister(compare->value()), | 969 return new LClassOfTestAndBranch(UseTempRegister(compare->value()), |
970 TempRegister(), | 970 TempRegister(), |
971 TempRegister()); | 971 TempRegister()); |
972 } else if (v->IsCompare()) { | 972 } else if (v->IsCompare()) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 } | 1054 } |
1055 } | 1055 } |
1056 Abort("Undefined compare before branch"); | 1056 Abort("Undefined compare before branch"); |
1057 return NULL; | 1057 return NULL; |
1058 } | 1058 } |
1059 } | 1059 } |
1060 return new LBranch(UseRegisterAtStart(v)); | 1060 return new LBranch(UseRegisterAtStart(v)); |
1061 } | 1061 } |
1062 | 1062 |
1063 | 1063 |
1064 LInstruction* LChunkBuilder::DoCompareMapAndBranch( | 1064 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
1065 HCompareMapAndBranch* instr) { | |
1066 ASSERT(instr->value()->representation().IsTagged()); | 1065 ASSERT(instr->value()->representation().IsTagged()); |
1067 LOperand* value = UseRegisterAtStart(instr->value()); | 1066 LOperand* value = UseRegisterAtStart(instr->value()); |
1068 return new LCmpMapAndBranch(value); | 1067 return new LCmpMapAndBranch(value); |
1069 } | 1068 } |
1070 | 1069 |
1071 | 1070 |
1072 LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* length) { | 1071 LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* length) { |
1073 return DefineAsRegister(new LArgumentsLength(Use(length->value()))); | 1072 return DefineAsRegister(new LArgumentsLength(Use(length->value()))); |
1074 } | 1073 } |
1075 | 1074 |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 1885 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
1887 HEnvironment* outer = current_block_->last_environment()->outer(); | 1886 HEnvironment* outer = current_block_->last_environment()->outer(); |
1888 current_block_->UpdateEnvironment(outer); | 1887 current_block_->UpdateEnvironment(outer); |
1889 return NULL; | 1888 return NULL; |
1890 } | 1889 } |
1891 | 1890 |
1892 | 1891 |
1893 } } // namespace v8::internal | 1892 } } // namespace v8::internal |
1894 | 1893 |
1895 #endif // V8_TARGET_ARCH_IA32 | 1894 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |