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

Unified Diff: tools/objects-gen.h.mustache

Issue 23604020: Initial prototype of object layout generation. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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
Index: tools/objects-gen.h.mustache
diff --git a/src/hydrogen-bce.h b/tools/objects-gen.h.mustache
similarity index 50%
copy from src/hydrogen-bce.h
copy to tools/objects-gen.h.mustache
index d91997bda011775d92a66eb9c2c9acbf581d4491..b4a4db83b1fd4864f260847d9da6ee90db2b8383 100644
--- a/src/hydrogen-bce.h
+++ b/tools/objects-gen.h.mustache
@@ -25,48 +25,73 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef V8_HYDROGEN_BCE_H_
-#define V8_HYDROGEN_BCE_H_
+// This file is automatically generated from 'objects.layout' and should
+// not be modified by hand. Run 'make objects' instead to update it.
-#include "hydrogen.h"
+#ifndef V8_OBJECTS_GEN_H_
+#define V8_OBJECTS_GEN_H_
-namespace v8 {
-namespace internal {
+{{#types}}
-
-class BoundsCheckBbData;
-class BoundsCheckKey;
-class BoundsCheckTable : private ZoneHashMap {
+{{comment}}
+class {{name}} : public {{base}} {
public:
- explicit BoundsCheckTable(Zone* zone);
-
- INLINE(BoundsCheckBbData** LookupOrInsert(BoundsCheckKey* key, Zone* zone));
- INLINE(void Insert(BoundsCheckKey* key, BoundsCheckBbData* data, Zone* zone));
- INLINE(void Delete(BoundsCheckKey* key));
+{{#fields}}
+{{#field_comment}}
+ // [{{field_name_lower}}]: {{field_comment}}
+{{/field_comment}}
+{{#is_smi}}
+ inline int {{field_name_lower}}();
+ inline void set_{{field_name_lower}}(int value);
+{{/is_smi}}
+{{^is_primitive}}
+ DECL_ACCESSORS({{field_name_lower}}, {{type}})
+{{/is_primitive}}
+{{/fields}}
+{{#bitfields}}
+
+ // Following fields are encoded within the '{{field_name_lower}}' field.
+{{#bitfield}}
+ DECL_BOOLEAN_ACCESSORS({{name}})
+{{/bitfield}}
+{{/bitfields}}
+
+ // Casting.
+ static inline {{name}}* cast(Object* object);
+
+ // Dispatched behavior.
+ DECLARE_PRINTER({{name}})
+ DECLARE_VERIFIER({{name}})
+
+ // Layout description.
+{{#fields}}
+ static const int k{{field_name_pascal}}Offset = {{field_offset}};
+{{/fields}}
+ static const int kSize = {{type_size}};
private:
- DISALLOW_COPY_AND_ASSIGN(BoundsCheckTable);
+{{#bitfields}}
+ // Bit positions within the '{{field_name_lower}}' field.
+{{#bitfield}}
+ static const int k{{bitfield_name_pascal}}Bit = {{bitfield_start}};
+{{/bitfield}}
+
+{{/bitfields}}
+ DISALLOW_IMPLICIT_CONSTRUCTORS({{name}});
};
-class HBoundsCheckEliminationPhase : public HPhase {
- public:
- explicit HBoundsCheckEliminationPhase(HGraph* graph)
- : HPhase("H_Bounds checks elimination", graph), table_(zone()) { }
-
- void Run() {
- EliminateRedundantBoundsChecks(graph()->entry_block());
- }
-
- private:
- void EliminateRedundantBoundsChecks(HBasicBlock* bb);
-
- BoundsCheckTable table_;
+/*bool Object::Is{{name}}() {
+ return Object::IsHeapObject() &&
+ HeapObject::cast(this)->map()->instance_type() == {{type_name_upper}}_TYPE;
+}*/
- DISALLOW_COPY_AND_ASSIGN(HBoundsCheckEliminationPhase);
-};
+/*{{name}}* {{name}}::cast(Object* object) {
+ ASSERT(object->Is{{name}}());
+ return reinterpret_cast<{{name}}*>(object);
+}*/
-} } // namespace v8::internal
+{{/types}}
-#endif // V8_HYDROGEN_BCE_H_
+#endif // V8_OBJECTS_GEN_H_

Powered by Google App Engine
This is Rietveld 408576698