| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 FrameElement target = expected->elements_[i]; | 184 FrameElement target = expected->elements_[i]; |
| 185 if (source.is_synced() && !target.is_synced()) { | 185 if (source.is_synced() && !target.is_synced()) { |
| 186 elements_[i].clear_sync(); | 186 elements_[i].clear_sync(); |
| 187 } else if (!source.is_synced() && target.is_synced()) { | 187 } else if (!source.is_synced() && target.is_synced()) { |
| 188 SyncElementAt(i); | 188 SyncElementAt(i); |
| 189 } | 189 } |
| 190 elements_[i].clear_copied(); | 190 elements_[i].clear_copied(); |
| 191 if (elements_[i].is_copy()) { | 191 if (elements_[i].is_copy()) { |
| 192 elements_[elements_[i].index()].set_copied(); | 192 elements_[elements_[i].index()].set_copied(); |
| 193 } | 193 } |
| 194 elements_[i].set_static_type(target.static_type()); |
| 194 } | 195 } |
| 195 | 196 |
| 196 // Adjust the stack point downard if necessary. | 197 // Adjust the stack pointer downward if necessary. |
| 197 if (stack_pointer_ > expected->stack_pointer_) { | 198 if (stack_pointer_ > expected->stack_pointer_) { |
| 198 int difference = stack_pointer_ - expected->stack_pointer_; | 199 int difference = stack_pointer_ - expected->stack_pointer_; |
| 199 stack_pointer_ = expected->stack_pointer_; | 200 stack_pointer_ = expected->stack_pointer_; |
| 200 __ add(Operand(esp), Immediate(difference * kPointerSize)); | 201 __ add(Operand(esp), Immediate(difference * kPointerSize)); |
| 201 } | 202 } |
| 202 | 203 |
| 203 // At this point, the frames should be identical. | 204 // At this point, the frames should be identical. |
| 204 ASSERT(Equals(expected)); | 205 ASSERT(Equals(expected)); |
| 205 } | 206 } |
| 206 | 207 |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 FrameElement element = elements_.RemoveLast(); | 944 FrameElement element = elements_.RemoveLast(); |
| 944 int index = elements_.length(); | 945 int index = elements_.length(); |
| 945 ASSERT(element.is_valid()); | 946 ASSERT(element.is_valid()); |
| 946 | 947 |
| 947 bool pop_needed = (stack_pointer_ == index); | 948 bool pop_needed = (stack_pointer_ == index); |
| 948 if (pop_needed) { | 949 if (pop_needed) { |
| 949 stack_pointer_--; | 950 stack_pointer_--; |
| 950 if (element.is_memory()) { | 951 if (element.is_memory()) { |
| 951 Result temp = cgen_->allocator()->Allocate(); | 952 Result temp = cgen_->allocator()->Allocate(); |
| 952 ASSERT(temp.is_valid()); | 953 ASSERT(temp.is_valid()); |
| 954 temp.set_static_type(element.static_type()); |
| 953 __ pop(temp.reg()); | 955 __ pop(temp.reg()); |
| 954 return temp; | 956 return temp; |
| 955 } | 957 } |
| 956 | 958 |
| 957 __ add(Operand(esp), Immediate(kPointerSize)); | 959 __ add(Operand(esp), Immediate(kPointerSize)); |
| 958 } | 960 } |
| 959 ASSERT(!element.is_memory()); | 961 ASSERT(!element.is_memory()); |
| 960 | 962 |
| 961 // The top element is a register, constant, or a copy. Unuse | 963 // The top element is a register, constant, or a copy. Unuse |
| 962 // registers and follow copies to their backing store. | 964 // registers and follow copies to their backing store. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 974 // Memory elements could only be the backing store of a copy. | 976 // Memory elements could only be the backing store of a copy. |
| 975 // Allocate the original to a register. | 977 // Allocate the original to a register. |
| 976 ASSERT(index <= stack_pointer_); | 978 ASSERT(index <= stack_pointer_); |
| 977 Result temp = cgen_->allocator()->Allocate(); | 979 Result temp = cgen_->allocator()->Allocate(); |
| 978 ASSERT(temp.is_valid()); | 980 ASSERT(temp.is_valid()); |
| 979 Use(temp.reg(), index); | 981 Use(temp.reg(), index); |
| 980 FrameElement new_element = | 982 FrameElement new_element = |
| 981 FrameElement::RegisterElement(temp.reg(), FrameElement::SYNCED); | 983 FrameElement::RegisterElement(temp.reg(), FrameElement::SYNCED); |
| 982 // Preserve the copy flag on the element. | 984 // Preserve the copy flag on the element. |
| 983 if (element.is_copied()) new_element.set_copied(); | 985 if (element.is_copied()) new_element.set_copied(); |
| 986 new_element.set_static_type(element.static_type()); |
| 984 elements_[index] = new_element; | 987 elements_[index] = new_element; |
| 985 __ mov(temp.reg(), Operand(ebp, fp_relative(index))); | 988 __ mov(temp.reg(), Operand(ebp, fp_relative(index))); |
| 986 return Result(temp.reg(), cgen_); | 989 return Result(temp.reg(), cgen_, element.static_type()); |
| 987 } else if (element.is_register()) { | 990 } else if (element.is_register()) { |
| 988 return Result(element.reg(), cgen_); | 991 return Result(element.reg(), cgen_, element.static_type()); |
| 989 } else { | 992 } else { |
| 990 ASSERT(element.is_constant()); | 993 ASSERT(element.is_constant()); |
| 991 return Result(element.handle(), cgen_); | 994 return Result(element.handle(), cgen_); |
| 992 } | 995 } |
| 993 } | 996 } |
| 994 | 997 |
| 995 | 998 |
| 996 void VirtualFrame::EmitPop(Register reg) { | 999 void VirtualFrame::EmitPop(Register reg) { |
| 997 ASSERT(stack_pointer_ == elements_.length() - 1); | 1000 ASSERT(stack_pointer_ == elements_.length() - 1); |
| 998 stack_pointer_--; | 1001 stack_pointer_--; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1029 ASSERT(stack_pointer_ == elements_.length() - 1); | 1032 ASSERT(stack_pointer_ == elements_.length() - 1); |
| 1030 elements_.Add(FrameElement::MemoryElement()); | 1033 elements_.Add(FrameElement::MemoryElement()); |
| 1031 stack_pointer_++; | 1034 stack_pointer_++; |
| 1032 __ push(immediate); | 1035 __ push(immediate); |
| 1033 } | 1036 } |
| 1034 | 1037 |
| 1035 | 1038 |
| 1036 #undef __ | 1039 #undef __ |
| 1037 | 1040 |
| 1038 } } // namespace v8::internal | 1041 } } // namespace v8::internal |
| OLD | NEW |