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

Unified Diff: src/virtual-frame.h

Issue 48008: Simplify the construction of virtual frame elements in preparation for... (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 | « no previous file | src/virtual-frame-arm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/virtual-frame.h
===================================================================
--- src/virtual-frame.h (revision 1518)
+++ src/virtual-frame.h (working copy)
@@ -54,8 +54,7 @@
// The default constructor creates an invalid frame element.
FrameElement() {
- type_ = TypeField::encode(INVALID) | SyncField::encode(NOT_SYNCED);
- data_.reg_ = no_reg;
+ Initialize(INVALID, no_reg, NOT_SYNCED);
}
// Factory function to construct an invalid frame element.
@@ -66,18 +65,13 @@
// Factory function to construct an in-memory frame element.
static FrameElement MemoryElement() {
- FrameElement result;
- result.type_ = TypeField::encode(MEMORY) | SyncField::encode(SYNCED);
- // In-memory elements have no useful data.
- result.data_.reg_ = no_reg;
+ FrameElement result(MEMORY, no_reg, SYNCED);
return result;
}
// Factory function to construct an in-register frame element.
static FrameElement RegisterElement(Register reg, SyncFlag is_synced) {
- FrameElement result;
- result.type_ = TypeField::encode(REGISTER) | SyncField::encode(is_synced);
- result.data_.reg_ = reg;
+ FrameElement result(REGISTER, reg, is_synced);
return result;
}
@@ -85,9 +79,7 @@
// compile time.
static FrameElement ConstantElement(Handle<Object> value,
SyncFlag is_synced) {
- FrameElement result;
- result.type_ = TypeField::encode(CONSTANT) | SyncField::encode(is_synced);
- result.data_.handle_ = value.location();
+ FrameElement result(value, is_synced);
return result;
}
@@ -152,6 +144,21 @@
int index_;
} data_;
+ // The index of the next element in a list of copies, or the frame's
+ // illegal index if there is no next element.
+ int next_;
+
+ // Used to construct memory and register elements.
+ FrameElement(Type type, Register reg, SyncFlag is_synced) {
+ Initialize(type, reg, is_synced);
+ }
+
+ // Used to construct constant elements.
+ inline FrameElement(Handle<Object> value, SyncFlag is_synced);
+
+ // Used to initialize invalid, memory, and register elements.
+ inline void Initialize(Type type, Register reg, SyncFlag is_synced);
+
friend class VirtualFrame;
};
@@ -164,4 +171,23 @@
#include "virtual-frame-ia32.h"
#endif
+
+namespace v8 { namespace internal {
+
+FrameElement::FrameElement(Handle<Object> value, SyncFlag is_synced) {
+ type_ = TypeField::encode(CONSTANT) | SyncField::encode(is_synced);
+ data_.handle_ = value.location();
+ next_ = VirtualFrame::kIllegalIndex;
+}
+
+
+void FrameElement::Initialize(Type type, Register reg, SyncFlag is_synced) {
+ type_ = TypeField::encode(type) | SyncField::encode(is_synced);
+ data_.reg_ = reg;
+ next_ = VirtualFrame::kIllegalIndex;
+}
+
+
+} } // namespace v8::internal
+
#endif // V8_VIRTUAL_FRAME_H_
« no previous file with comments | « no previous file | src/virtual-frame-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698