| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 if (needs_environment && !instr->HasEnvironment()) { | 649 if (needs_environment && !instr->HasEnvironment()) { |
| 650 instr = AssignEnvironment(instr); | 650 instr = AssignEnvironment(instr); |
| 651 } | 651 } |
| 652 | 652 |
| 653 return instr; | 653 return instr; |
| 654 } | 654 } |
| 655 | 655 |
| 656 | 656 |
| 657 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 657 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { |
| 658 ASSERT(!instr->HasPointerMap()); | 658 ASSERT(!instr->HasPointerMap()); |
| 659 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); | 659 instr->set_pointer_map(new(zone()) LPointerMap(zone())); |
| 660 return instr; | 660 return instr; |
| 661 } | 661 } |
| 662 | 662 |
| 663 | 663 |
| 664 LUnallocated* LChunkBuilder::TempRegister() { | 664 LUnallocated* LChunkBuilder::TempRegister() { |
| 665 LUnallocated* operand = | 665 LUnallocated* operand = |
| 666 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 666 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
| 667 int vreg = allocator_->GetVirtualRegister(); | 667 int vreg = allocator_->GetVirtualRegister(); |
| 668 if (!allocator_->AllocationOk()) { | 668 if (!allocator_->AllocationOk()) { |
| 669 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); | 669 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; | 907 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; |
| 908 } | 908 } |
| 909 for (TempIterator it(instr); !it.Done(); it.Advance()) { | 909 for (TempIterator it(instr); !it.Done(); it.Advance()) { |
| 910 LUnallocated* operand = LUnallocated::cast(it.Current()); | 910 LUnallocated* operand = LUnallocated::cast(it.Current()); |
| 911 if (operand->HasFixedPolicy()) ++fixed; | 911 if (operand->HasFixedPolicy()) ++fixed; |
| 912 } | 912 } |
| 913 ASSERT(fixed == 0 || used_at_start == 0); | 913 ASSERT(fixed == 0 || used_at_start == 0); |
| 914 } | 914 } |
| 915 #endif | 915 #endif |
| 916 | 916 |
| 917 instr->set_position(position_); | |
| 918 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 917 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 919 instr = AssignPointerMap(instr); | 918 instr = AssignPointerMap(instr); |
| 920 } | 919 } |
| 921 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 920 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 922 instr = AssignEnvironment(instr); | 921 instr = AssignEnvironment(instr); |
| 923 } | 922 } |
| 924 chunk_->AddInstruction(instr, current_block_); | 923 chunk_->AddInstruction(instr, current_block_); |
| 925 } | 924 } |
| 926 current_instruction_ = old_current; | 925 current_instruction_ = old_current; |
| 927 } | 926 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 HInstanceOfKnownGlobal* instr) { | 1074 HInstanceOfKnownGlobal* instr) { |
| 1076 LInstanceOfKnownGlobal* result = | 1075 LInstanceOfKnownGlobal* result = |
| 1077 new(zone()) LInstanceOfKnownGlobal( | 1076 new(zone()) LInstanceOfKnownGlobal( |
| 1078 UseFixed(instr->context(), cp), | 1077 UseFixed(instr->context(), cp), |
| 1079 UseFixed(instr->left(), r0), | 1078 UseFixed(instr->left(), r0), |
| 1080 FixedTemp(r4)); | 1079 FixedTemp(r4)); |
| 1081 return MarkAsCall(DefineFixed(result, r0), instr); | 1080 return MarkAsCall(DefineFixed(result, r0), instr); |
| 1082 } | 1081 } |
| 1083 | 1082 |
| 1084 | 1083 |
| 1085 LInstruction* LChunkBuilder::DoInstanceSize(HInstanceSize* instr) { | |
| 1086 LOperand* object = UseRegisterAtStart(instr->object()); | |
| 1087 return DefineAsRegister(new(zone()) LInstanceSize(object)); | |
| 1088 } | |
| 1089 | |
| 1090 | |
| 1091 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 1084 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 1092 LOperand* receiver = UseRegisterAtStart(instr->receiver()); | 1085 LOperand* receiver = UseRegisterAtStart(instr->receiver()); |
| 1093 LOperand* function = UseRegisterAtStart(instr->function()); | 1086 LOperand* function = UseRegisterAtStart(instr->function()); |
| 1094 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 1087 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
| 1095 return AssignEnvironment(DefineSameAsFirst(result)); | 1088 return AssignEnvironment(DefineSameAsFirst(result)); |
| 1096 } | 1089 } |
| 1097 | 1090 |
| 1098 | 1091 |
| 1099 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { | 1092 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { |
| 1100 LOperand* function = UseFixed(instr->function(), r1); | 1093 LOperand* function = UseFixed(instr->function(), r1); |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1945 Representation to = instr->to(); | 1938 Representation to = instr->to(); |
| 1946 if (from.IsSmi()) { | 1939 if (from.IsSmi()) { |
| 1947 if (to.IsTagged()) { | 1940 if (to.IsTagged()) { |
| 1948 LOperand* value = UseRegister(instr->value()); | 1941 LOperand* value = UseRegister(instr->value()); |
| 1949 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1942 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
| 1950 } | 1943 } |
| 1951 from = Representation::Tagged(); | 1944 from = Representation::Tagged(); |
| 1952 } | 1945 } |
| 1953 if (from.IsTagged()) { | 1946 if (from.IsTagged()) { |
| 1954 if (to.IsDouble()) { | 1947 if (to.IsDouble()) { |
| 1955 info()->MarkAsDeferredCalling(); | |
| 1956 LOperand* value = UseRegister(instr->value()); | 1948 LOperand* value = UseRegister(instr->value()); |
| 1957 LNumberUntagD* res = new(zone()) LNumberUntagD(value); | 1949 LNumberUntagD* res = new(zone()) LNumberUntagD(value); |
| 1958 return AssignEnvironment(DefineAsRegister(res)); | 1950 return AssignEnvironment(DefineAsRegister(res)); |
| 1959 } else if (to.IsSmi()) { | 1951 } else if (to.IsSmi()) { |
| 1960 HValue* val = instr->value(); | 1952 HValue* val = instr->value(); |
| 1961 LOperand* value = UseRegister(val); | 1953 LOperand* value = UseRegister(val); |
| 1962 if (val->type().IsSmi()) { | 1954 if (val->type().IsSmi()) { |
| 1963 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1955 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
| 1964 } | 1956 } |
| 1965 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 1957 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2015 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 2007 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
| 2016 } else if (val->HasRange() && val->range()->IsInSmiRange()) { | 2008 } else if (val->HasRange() && val->range()->IsInSmiRange()) { |
| 2017 return DefineAsRegister(new(zone()) LSmiTag(value)); | 2009 return DefineAsRegister(new(zone()) LSmiTag(value)); |
| 2018 } else { | 2010 } else { |
| 2019 LNumberTagI* result = new(zone()) LNumberTagI(value); | 2011 LNumberTagI* result = new(zone()) LNumberTagI(value); |
| 2020 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2012 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 2021 } | 2013 } |
| 2022 } else if (to.IsSmi()) { | 2014 } else if (to.IsSmi()) { |
| 2023 HValue* val = instr->value(); | 2015 HValue* val = instr->value(); |
| 2024 LOperand* value = UseRegister(val); | 2016 LOperand* value = UseRegister(val); |
| 2025 LInstruction* result = | 2017 LInstruction* result = val->CheckFlag(HInstruction::kUint32) |
| 2026 DefineSameAsFirst(new(zone()) LInteger32ToSmi(value)); | 2018 ? DefineSameAsFirst(new(zone()) LUint32ToSmi(value)) |
| 2019 : DefineSameAsFirst(new(zone()) LInteger32ToSmi(value)); |
| 2027 if (val->HasRange() && val->range()->IsInSmiRange()) { | 2020 if (val->HasRange() && val->range()->IsInSmiRange()) { |
| 2028 return result; | 2021 return result; |
| 2029 } | 2022 } |
| 2030 return AssignEnvironment(result); | 2023 return AssignEnvironment(result); |
| 2031 } else { | 2024 } else { |
| 2032 ASSERT(to.IsDouble()); | 2025 ASSERT(to.IsDouble()); |
| 2033 if (instr->value()->CheckFlag(HInstruction::kUint32)) { | 2026 if (instr->value()->CheckFlag(HInstruction::kUint32)) { |
| 2034 return DefineAsRegister( | 2027 return DefineAsRegister( |
| 2035 new(zone()) LUint32ToDouble(UseRegister(instr->value()))); | 2028 new(zone()) LUint32ToDouble(UseRegister(instr->value()))); |
| 2036 } else { | 2029 } else { |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2666 | 2659 |
| 2667 | 2660 |
| 2668 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2661 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2669 LOperand* object = UseRegister(instr->object()); | 2662 LOperand* object = UseRegister(instr->object()); |
| 2670 LOperand* index = UseRegister(instr->index()); | 2663 LOperand* index = UseRegister(instr->index()); |
| 2671 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2664 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2672 } | 2665 } |
| 2673 | 2666 |
| 2674 | 2667 |
| 2675 } } // namespace v8::internal | 2668 } } // namespace v8::internal |
| OLD | NEW |