Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: src/virtual-frame-ia32.cc

Issue 49029: Inline part of RawSyncElementAt, improve PrepareForCall (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/virtual-frame-ia32.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/virtual-frame-ia32.cc
===================================================================
--- src/virtual-frame-ia32.cc (revision 1617)
+++ src/virtual-frame-ia32.cc (working copy)
@@ -57,101 +57,101 @@
}
-// Clear the dirty bit for the element at a given index if it is a
-// valid element. The stack address corresponding to the element must
-// be allocated on the physical stack, or the first element above the
-// stack pointer so it can be allocated by a single push instruction.
-void VirtualFrame::RawSyncElementAt(int index) {
+void VirtualFrame::SyncElementBelowStackPointer(int index) {
+ // Emit code to write elements below the stack pointer to their
+ // (already allocated) stack address.
+ ASSERT(index <= stack_pointer_);
FrameElement element = elements_[index];
+ ASSERT(!element.is_synced());
+ switch (element.type()) {
+ case FrameElement::INVALID:
+ break;
- if (!element.is_valid() || element.is_synced()) return;
+ case FrameElement::MEMORY:
+ // This function should not be called with synced elements.
+ // (memory elements are always synced).
+ UNREACHABLE();
+ break;
- if (index <= stack_pointer_) {
- // Emit code to write elements below the stack pointer to their
- // (already allocated) stack address.
- switch (element.type()) {
- case FrameElement::INVALID: // Fall through.
- case FrameElement::MEMORY:
- // There was an early bailout for invalid and synced elements
- // (memory elements are always synced).
- UNREACHABLE();
- break;
+ case FrameElement::REGISTER:
+ __ mov(Operand(ebp, fp_relative(index)), element.reg());
+ break;
- case FrameElement::REGISTER:
- __ mov(Operand(ebp, fp_relative(index)), element.reg());
- break;
+ case FrameElement::CONSTANT:
+ if (cgen_->IsUnsafeSmi(element.handle())) {
+ Result temp = cgen_->allocator()->Allocate();
+ ASSERT(temp.is_valid());
+ cgen_->LoadUnsafeSmi(temp.reg(), element.handle());
+ __ mov(Operand(ebp, fp_relative(index)), temp.reg());
+ } else {
+ __ Set(Operand(ebp, fp_relative(index)),
+ Immediate(element.handle()));
+ }
+ break;
- case FrameElement::CONSTANT:
- if (cgen_->IsUnsafeSmi(element.handle())) {
- Result temp = cgen_->allocator()->Allocate();
- ASSERT(temp.is_valid());
- cgen_->LoadUnsafeSmi(temp.reg(), element.handle());
- __ mov(Operand(ebp, fp_relative(index)), temp.reg());
- } else {
- __ Set(Operand(ebp, fp_relative(index)),
- Immediate(element.handle()));
- }
- break;
-
- case FrameElement::COPY: {
- int backing_index = element.index();
- FrameElement backing_element = elements_[backing_index];
- if (backing_element.is_memory()) {
- Result temp = cgen_->allocator()->Allocate();
- ASSERT(temp.is_valid());
- __ mov(temp.reg(), Operand(ebp, fp_relative(backing_index)));
- __ mov(Operand(ebp, fp_relative(index)), temp.reg());
- } else {
- ASSERT(backing_element.is_register());
- __ mov(Operand(ebp, fp_relative(index)), backing_element.reg());
- }
- break;
+ case FrameElement::COPY: {
+ int backing_index = element.index();
+ FrameElement backing_element = elements_[backing_index];
+ if (backing_element.is_memory()) {
+ Result temp = cgen_->allocator()->Allocate();
+ ASSERT(temp.is_valid());
+ __ mov(temp.reg(), Operand(ebp, fp_relative(backing_index)));
+ __ mov(Operand(ebp, fp_relative(index)), temp.reg());
+ } else {
+ ASSERT(backing_element.is_register());
+ __ mov(Operand(ebp, fp_relative(index)), backing_element.reg());
}
+ break;
}
+ }
+ elements_[index].set_sync();
+}
- } else {
- // Push elements above the stack pointer to allocate space and
- // sync them. Space should have already been allocated in the
- // actual frame for all the elements below this one.
- ASSERT(index == stack_pointer_ + 1);
- stack_pointer_++;
- switch (element.type()) {
- case FrameElement::INVALID: // Fall through.
- case FrameElement::MEMORY:
- // There was an early bailout for invalid and synced elements
- // (memory elements are always synced).
- UNREACHABLE();
- break;
- case FrameElement::REGISTER:
- __ push(element.reg());
- break;
+void VirtualFrame::SyncElementByPushing(int index) {
+ // Sync an element of the frame that is just above the stack pointer
+ // by pushing it.
+ ASSERT(index == stack_pointer_ + 1);
+ stack_pointer_++;
+ FrameElement element = elements_[index];
- case FrameElement::CONSTANT:
- if (cgen_->IsUnsafeSmi(element.handle())) {
- Result temp = cgen_->allocator()->Allocate();
- ASSERT(temp.is_valid());
- cgen_->LoadUnsafeSmi(temp.reg(), element.handle());
- __ push(temp.reg());
- } else {
- __ push(Immediate(element.handle()));
- }
- break;
+ switch (element.type()) {
+ case FrameElement::INVALID:
+ __ push(Immediate(Smi::FromInt(0)));
+ break;
- case FrameElement::COPY: {
- int backing_index = element.index();
- FrameElement backing = elements_[backing_index];
- ASSERT(backing.is_memory() || backing.is_register());
- if (backing.is_memory()) {
- __ push(Operand(ebp, fp_relative(backing_index)));
- } else {
- __ push(backing.reg());
- }
- break;
+ case FrameElement::MEMORY:
+ // No memory elements exist above the stack pointer.
+ UNREACHABLE();
+ break;
+
+ case FrameElement::REGISTER:
+ __ push(element.reg());
+ break;
+
+ case FrameElement::CONSTANT:
+ if (cgen_->IsUnsafeSmi(element.handle())) {
+ Result temp = cgen_->allocator()->Allocate();
+ ASSERT(temp.is_valid());
+ cgen_->LoadUnsafeSmi(temp.reg(), element.handle());
+ __ push(temp.reg());
+ } else {
+ __ push(Immediate(element.handle()));
}
+ break;
+
+ case FrameElement::COPY: {
+ int backing_index = element.index();
+ FrameElement backing = elements_[backing_index];
+ ASSERT(backing.is_memory() || backing.is_register());
+ if (backing.is_memory()) {
+ __ push(Operand(ebp, fp_relative(backing_index)));
+ } else {
+ __ push(backing.reg());
+ }
+ break;
}
}
-
elements_[index].set_sync();
}
« no previous file with comments | « src/virtual-frame-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698