| Index: src/virtual-frame.cc
|
| ===================================================================
|
| --- src/virtual-frame.cc (revision 3964)
|
| +++ src/virtual-frame.cc (working copy)
|
| @@ -29,6 +29,7 @@
|
|
|
| #include "codegen-inl.h"
|
| #include "register-allocator-inl.h"
|
| +#include "virtual-frame-inl.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
| @@ -36,25 +37,13 @@
|
| // -------------------------------------------------------------------------
|
| // VirtualFrame implementation.
|
|
|
| -// When cloned, a frame is a deep copy of the original.
|
| -VirtualFrame::VirtualFrame(VirtualFrame* original)
|
| - : elements_(original->element_count()),
|
| - stack_pointer_(original->stack_pointer_) {
|
| - elements_.AddAll(original->elements_);
|
| - // Copy register locations from original.
|
| - memcpy(®ister_locations_,
|
| - original->register_locations_,
|
| - sizeof(register_locations_));
|
| -}
|
| -
|
| -
|
| // Create a duplicate of an existing valid frame element.
|
| // We can pass an optional number type information that will override the
|
| // existing information about the backing element. The new information must
|
| // not conflict with the existing type information and must be equally or
|
| // more precise. The default parameter value kUninitialized means that there
|
| // is no additional information.
|
| -FrameElement VirtualFrame::CopyElementAt(int index, NumberInfo::Type info) {
|
| +FrameElement VirtualFrame::CopyElementAt(int index, NumberInfo info) {
|
| ASSERT(index >= 0);
|
| ASSERT(index < element_count());
|
|
|
| @@ -85,14 +74,14 @@
|
| result.set_index(index);
|
| elements_[index].set_copied();
|
| // Update backing element's number information.
|
| - NumberInfo::Type existing = elements_[index].number_info();
|
| - ASSERT(existing != NumberInfo::kUninitialized);
|
| + NumberInfo existing = elements_[index].number_info();
|
| + ASSERT(!existing.IsUninitialized());
|
| // Assert that the new type information (a) does not conflict with the
|
| // existing one and (b) is equally or more precise.
|
| - ASSERT((info == NumberInfo::kUninitialized) ||
|
| - (existing | info) != NumberInfo::kUninitialized);
|
| - ASSERT(existing <= info);
|
| - elements_[index].set_number_info(info != NumberInfo::kUninitialized
|
| + ASSERT((info.ToInt() & existing.ToInt()) == existing.ToInt());
|
| + ASSERT((info.ToInt() | existing.ToInt()) == info.ToInt());
|
| +
|
| + elements_[index].set_number_info(!info.IsUninitialized()
|
| ? info
|
| : existing);
|
| break;
|
| @@ -115,7 +104,7 @@
|
| ASSERT(stack_pointer_ == element_count() - 1);
|
|
|
| for (int i = 0; i < count; i++) {
|
| - elements_.Add(FrameElement::MemoryElement(NumberInfo::kUnknown));
|
| + elements_.Add(FrameElement::MemoryElement(NumberInfo::Unknown()));
|
| }
|
| stack_pointer_ += count;
|
| }
|
| @@ -163,7 +152,7 @@
|
| SyncElementAt(index);
|
| // Number type information is preserved.
|
| // Copies get their number information from their backing element.
|
| - NumberInfo::Type info;
|
| + NumberInfo info;
|
| if (!elements_[index].is_copy()) {
|
| info = elements_[index].number_info();
|
| } else {
|
| @@ -338,61 +327,6 @@
|
| }
|
|
|
|
|
| -void VirtualFrame::PushFrameSlotAt(int index) {
|
| - elements_.Add(CopyElementAt(index));
|
| -}
|
| -
|
| -
|
| -void VirtualFrame::Push(Register reg, NumberInfo::Type info) {
|
| - if (is_used(reg)) {
|
| - int index = register_location(reg);
|
| - FrameElement element = CopyElementAt(index, info);
|
| - elements_.Add(element);
|
| - } else {
|
| - Use(reg, element_count());
|
| - FrameElement element =
|
| - FrameElement::RegisterElement(reg, FrameElement::NOT_SYNCED, info);
|
| - elements_.Add(element);
|
| - }
|
| -}
|
| -
|
| -
|
| -void VirtualFrame::Push(Handle<Object> value) {
|
| - FrameElement element =
|
| - FrameElement::ConstantElement(value, FrameElement::NOT_SYNCED);
|
| - elements_.Add(element);
|
| -}
|
| -
|
| -
|
| -void VirtualFrame::Nip(int num_dropped) {
|
| - ASSERT(num_dropped >= 0);
|
| - if (num_dropped == 0) return;
|
| - Result tos = Pop();
|
| - if (num_dropped > 1) {
|
| - Drop(num_dropped - 1);
|
| - }
|
| - SetElementAt(0, &tos);
|
| -}
|
| -
|
| -
|
| -bool VirtualFrame::Equals(VirtualFrame* other) {
|
| -#ifdef DEBUG
|
| - for (int i = 0; i < RegisterAllocator::kNumRegisters; i++) {
|
| - if (register_location(i) != other->register_location(i)) {
|
| - return false;
|
| - }
|
| - }
|
| - if (element_count() != other->element_count()) return false;
|
| -#endif
|
| - if (stack_pointer_ != other->stack_pointer_) return false;
|
| - for (int i = 0; i < element_count(); i++) {
|
| - if (!elements_[i].Equals(other->elements_[i])) return false;
|
| - }
|
| -
|
| - return true;
|
| -}
|
| -
|
| -
|
| // Specialization of List::ResizeAdd to non-inlined version for FrameElements.
|
| // The function ResizeAdd becomes a real function, whose implementation is the
|
| // inlined ResizeAddInternal.
|
|
|