Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 // want it. | 211 // want it. |
| 212 if (!fresh.reg().is(backing_element.reg())) { | 212 if (!fresh.reg().is(backing_element.reg())) { |
| 213 __ mov(fresh.reg(), backing_element.reg()); | 213 __ mov(fresh.reg(), backing_element.reg()); |
| 214 } | 214 } |
| 215 } else { | 215 } else { |
| 216 ASSERT(backing_element.is_memory()); | 216 ASSERT(backing_element.is_memory()); |
| 217 __ mov(fresh.reg(), Operand(ebp, fp_relative(element.index()))); | 217 __ mov(fresh.reg(), Operand(ebp, fp_relative(element.index()))); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 // No need to set the copied flag---there are no copies. | 221 // No need to set the copied flag---there are no copies of |
| 222 | 222 // copies or constants so the original was not copied. |
|
Erik Corry
2009/06/24 11:46:35
Copies of copies?
Lasse Reichstein
2009/06/24 12:33:07
Bad merge. I'll restore the original.
| |
| 223 // Backwards jump targets can never know the type of a value. | |
| 224 elements_[i].set_static_type(StaticType::unknown()); | |
| 225 } else { | 223 } else { |
| 226 // Clear the copy flag of non-constant, non-copy elements. | 224 // Clear the copy flag of non-constant, non-copy elements. |
| 227 // They cannot be copied because copies are not allowed. | 225 // They cannot be copied because copies are not allowed. |
| 228 // The copy flag is not relied on before the end of this loop, | 226 // The copy flag is not relied on before the end of this loop, |
| 229 // including when registers are spilled. | 227 // including when registers are spilled. |
| 230 elements_[i].clear_copied(); | 228 elements_[i].clear_copied(); |
| 231 } | 229 } |
| 232 } | 230 } |
| 233 } | 231 } |
| 234 | 232 |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 992 FrameElement element = elements_.RemoveLast(); | 990 FrameElement element = elements_.RemoveLast(); |
| 993 int index = element_count(); | 991 int index = element_count(); |
| 994 ASSERT(element.is_valid()); | 992 ASSERT(element.is_valid()); |
| 995 | 993 |
| 996 bool pop_needed = (stack_pointer_ == index); | 994 bool pop_needed = (stack_pointer_ == index); |
| 997 if (pop_needed) { | 995 if (pop_needed) { |
| 998 stack_pointer_--; | 996 stack_pointer_--; |
| 999 if (element.is_memory()) { | 997 if (element.is_memory()) { |
| 1000 Result temp = cgen()->allocator()->Allocate(); | 998 Result temp = cgen()->allocator()->Allocate(); |
| 1001 ASSERT(temp.is_valid()); | 999 ASSERT(temp.is_valid()); |
| 1002 temp.set_static_type(element.static_type()); | |
| 1003 __ pop(temp.reg()); | 1000 __ pop(temp.reg()); |
| 1004 return temp; | 1001 return temp; |
| 1005 } | 1002 } |
| 1006 | 1003 |
| 1007 __ add(Operand(esp), Immediate(kPointerSize)); | 1004 __ add(Operand(esp), Immediate(kPointerSize)); |
| 1008 } | 1005 } |
| 1009 ASSERT(!element.is_memory()); | 1006 ASSERT(!element.is_memory()); |
| 1010 | 1007 |
| 1011 // The top element is a register, constant, or a copy. Unuse | 1008 // The top element is a register, constant, or a copy. Unuse |
| 1012 // registers and follow copies to their backing store. | 1009 // registers and follow copies to their backing store. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1024 // Memory elements could only be the backing store of a copy. | 1021 // Memory elements could only be the backing store of a copy. |
| 1025 // Allocate the original to a register. | 1022 // Allocate the original to a register. |
| 1026 ASSERT(index <= stack_pointer_); | 1023 ASSERT(index <= stack_pointer_); |
| 1027 Result temp = cgen()->allocator()->Allocate(); | 1024 Result temp = cgen()->allocator()->Allocate(); |
| 1028 ASSERT(temp.is_valid()); | 1025 ASSERT(temp.is_valid()); |
| 1029 Use(temp.reg(), index); | 1026 Use(temp.reg(), index); |
| 1030 FrameElement new_element = | 1027 FrameElement new_element = |
| 1031 FrameElement::RegisterElement(temp.reg(), FrameElement::SYNCED); | 1028 FrameElement::RegisterElement(temp.reg(), FrameElement::SYNCED); |
| 1032 // Preserve the copy flag on the element. | 1029 // Preserve the copy flag on the element. |
| 1033 if (element.is_copied()) new_element.set_copied(); | 1030 if (element.is_copied()) new_element.set_copied(); |
| 1034 new_element.set_static_type(element.static_type()); | |
| 1035 elements_[index] = new_element; | 1031 elements_[index] = new_element; |
| 1036 __ mov(temp.reg(), Operand(ebp, fp_relative(index))); | 1032 __ mov(temp.reg(), Operand(ebp, fp_relative(index))); |
| 1037 return Result(temp.reg(), element.static_type()); | 1033 return Result(temp.reg()); |
| 1038 } else if (element.is_register()) { | 1034 } else if (element.is_register()) { |
| 1039 return Result(element.reg(), element.static_type()); | 1035 return Result(element.reg()); |
| 1040 } else { | 1036 } else { |
| 1041 ASSERT(element.is_constant()); | 1037 ASSERT(element.is_constant()); |
| 1042 return Result(element.handle()); | 1038 return Result(element.handle()); |
| 1043 } | 1039 } |
| 1044 } | 1040 } |
| 1045 | 1041 |
| 1046 | 1042 |
| 1047 void VirtualFrame::EmitPop(Register reg) { | 1043 void VirtualFrame::EmitPop(Register reg) { |
| 1048 ASSERT(stack_pointer_ == element_count() - 1); | 1044 ASSERT(stack_pointer_ == element_count() - 1); |
| 1049 stack_pointer_--; | 1045 stack_pointer_--; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 1080 ASSERT(stack_pointer_ == element_count() - 1); | 1076 ASSERT(stack_pointer_ == element_count() - 1); |
| 1081 elements_.Add(FrameElement::MemoryElement()); | 1077 elements_.Add(FrameElement::MemoryElement()); |
| 1082 stack_pointer_++; | 1078 stack_pointer_++; |
| 1083 __ push(immediate); | 1079 __ push(immediate); |
| 1084 } | 1080 } |
| 1085 | 1081 |
| 1086 | 1082 |
| 1087 #undef __ | 1083 #undef __ |
| 1088 | 1084 |
| 1089 } } // namespace v8::internal | 1085 } } // namespace v8::internal |
| OLD | NEW |