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

Unified Diff: src/objects-gen.h

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: src/objects-gen.h
diff --git a/src/objects-gen.h b/src/objects-gen.h
new file mode 100644
index 0000000000000000000000000000000000000000..179c5b76d466aa6abd6b59cfe19e776df703326d
--- /dev/null
+++ b/src/objects-gen.h
@@ -0,0 +1,366 @@
+// Copyright 2013 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// This file is automatically generated from 'objects.layout' and should
+// not be modified by hand. Run 'make objects' instead to update it.
+
+#ifndef V8_OBJECTS_GEN_H_
+#define V8_OBJECTS_GEN_H_
+
+
+// A simple one-element struct, useful where SMIs need to be boxed.
+class Box : public Struct {
+ public:
+ // [value]: the boxed contents.
+ DECL_ACCESSORS(value, Object)
+
+ // Casting.
+ static inline Box* cast(Object* object);
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(Box)
+ DECLARE_VERIFIER(Box)
+
+ // Layout description.
+ static const int kValueOffset = Struct::kHeaderSize;
+ static const int kSize = kValueOffset + kPointerSize;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(Box);
+};
+
+
+/*bool Object::IsBox() {
+ return Object::IsHeapObject() &&
+ HeapObject::cast(this)->map()->instance_type() == BOX_TYPE;
+}*/
+
+
+/*Box* Box::cast(Object* object) {
+ ASSERT(object->IsBox());
+ return reinterpret_cast<Box*>(object);
+}*/
+
+
+// Representation of a slow alias as part of a non-strict arguments objects.
+// For fast aliases (if HasNonStrictArgumentsElements()):
+// - the parameter map contains an index into the context
+// - all attributes of the element have default values
+// For slow aliases (if HasDictionaryArgumentsElements()):
+// - the parameter map contains no fast alias mapping (i.e. the hole)
+// - this struct (in the slow backing store) contains an index into the context
+// - all attributes are available as part if the property details
+class AliasedArgumentsEntry : public Struct {
+ public:
+ inline int aliased_context_slot();
+ inline void set_aliased_context_slot(int value);
+
+ // Casting.
+ static inline AliasedArgumentsEntry* cast(Object* object);
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(AliasedArgumentsEntry)
+ DECLARE_VERIFIER(AliasedArgumentsEntry)
+
+ // Layout description.
+ static const int kAliasedContextSlotOffset = Struct::kHeaderSize;
+ static const int kSize = kAliasedContextSlotOffset + kPointerSize;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(AliasedArgumentsEntry);
+};
+
+
+/*bool Object::IsAliasedArgumentsEntry() {
+ return Object::IsHeapObject() &&
+ HeapObject::cast(this)->map()->instance_type() == ALIASED_ARGUMENTS_ENTRY_TYPE;
+}*/
+
+
+/*AliasedArgumentsEntry* AliasedArgumentsEntry::cast(Object* object) {
+ ASSERT(object->IsAliasedArgumentsEntry());
+ return reinterpret_cast<AliasedArgumentsEntry*>(object);
+}*/
+
+
+// DeclaredAccessorInfo is a AccessorInfo.
+class DeclaredAccessorInfo : public AccessorInfo {
+ public:
+ DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor)
+
+ // Casting.
+ static inline DeclaredAccessorInfo* cast(Object* object);
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(DeclaredAccessorInfo)
+ DECLARE_VERIFIER(DeclaredAccessorInfo)
+
+ // Layout description.
+ static const int kDescriptorOffset = AccessorInfo::kHeaderSize;
+ static const int kSize = kDescriptorOffset + kPointerSize;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorInfo);
+};
+
+
+/*bool Object::IsDeclaredAccessorInfo() {
+ return Object::IsHeapObject() &&
+ HeapObject::cast(this)->map()->instance_type() == DECLARED_ACCESSOR_INFO_TYPE;
+}*/
+
+
+/*DeclaredAccessorInfo* DeclaredAccessorInfo::cast(Object* object) {
+ ASSERT(object->IsDeclaredAccessorInfo());
+ return reinterpret_cast<DeclaredAccessorInfo*>(object);
+}*/
+
+
+// An accessor must have a getter, but can have no setter.
+//
+// When setting a property, V8 searches accessors in prototypes.
+// If an accessor was found and it does not have a setter,
+// the request is ignored.
+//
+// If the accessor in the prototype has the READ_ONLY property attribute, then
+// a new value is added to the local object when the property is set.
+// This shadows the accessor in the prototype.
+class ExecutableAccessorInfo : public AccessorInfo {
+ public:
+ DECL_ACCESSORS(getter, Object)
+ DECL_ACCESSORS(setter, Object)
+ DECL_ACCESSORS(data, Object)
+
+ // Casting.
+ static inline ExecutableAccessorInfo* cast(Object* object);
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(ExecutableAccessorInfo)
+ DECLARE_VERIFIER(ExecutableAccessorInfo)
+
+ // Layout description.
+ static const int kGetterOffset = AccessorInfo::kHeaderSize;
+ static const int kSetterOffset = kGetterOffset + kPointerSize;
+ static const int kDataOffset = kSetterOffset + kPointerSize;
+ static const int kSize = kDataOffset + kPointerSize;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo);
+};
+
+
+/*bool Object::IsExecutableAccessorInfo() {
+ return Object::IsHeapObject() &&
+ HeapObject::cast(this)->map()->instance_type() == EXECUTABLE_ACCESSOR_INFO_TYPE;
+}*/
+
+
+/*ExecutableAccessorInfo* ExecutableAccessorInfo::cast(Object* object) {
+ ASSERT(object->IsExecutableAccessorInfo());
+ return reinterpret_cast<ExecutableAccessorInfo*>(object);
+}*/
+
+
+// FunctionTemplateInfo is a TemplateInfo.
+class FunctionTemplateInfo : public TemplateInfo {
+ public:
+ DECL_ACCESSORS(serial_number, Object)
+ DECL_ACCESSORS(call_code, Object)
+ DECL_ACCESSORS(property_accessors, Object)
+ DECL_ACCESSORS(prototype_template, Object)
+ DECL_ACCESSORS(parent_template, Object)
+ DECL_ACCESSORS(named_property_handler, Object)
+ DECL_ACCESSORS(indexed_property_handler, Object)
+ DECL_ACCESSORS(instance_template, Object)
+ DECL_ACCESSORS(class_name, Object)
+ DECL_ACCESSORS(signature, Object)
+ DECL_ACCESSORS(instance_call_handler, Object)
+ DECL_ACCESSORS(access_check_info, Object)
+ inline int flag();
+ inline void set_flag(int value);
+ inline int length();
+ inline void set_length(int value);
+
+ // Following fields are encoded within the 'flag' field.
+ DECL_BOOLEAN_ACCESSORS(hidden_prototype)
+ DECL_BOOLEAN_ACCESSORS(undetectable)
+ DECL_BOOLEAN_ACCESSORS(needs_access_check)
+ DECL_BOOLEAN_ACCESSORS(read_only_prototype)
+ DECL_BOOLEAN_ACCESSORS(remove_prototype)
+
+ // Casting.
+ static inline FunctionTemplateInfo* cast(Object* object);
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(FunctionTemplateInfo)
+ DECLARE_VERIFIER(FunctionTemplateInfo)
+
+ // Layout description.
+ static const int kSerialNumberOffset = TemplateInfo::kHeaderSize;
+ static const int kCallCodeOffset = kSerialNumberOffset + kPointerSize;
+ static const int kPropertyAccessorsOffset = kCallCodeOffset + kPointerSize;
+ static const int kPrototypeTemplateOffset = kPropertyAccessorsOffset + kPointerSize;
+ static const int kParentTemplateOffset = kPrototypeTemplateOffset + kPointerSize;
+ static const int kNamedPropertyHandlerOffset = kParentTemplateOffset + kPointerSize;
+ static const int kIndexedPropertyHandlerOffset = kNamedPropertyHandlerOffset + kPointerSize;
+ static const int kInstanceTemplateOffset = kIndexedPropertyHandlerOffset + kPointerSize;
+ static const int kClassNameOffset = kInstanceTemplateOffset + kPointerSize;
+ static const int kSignatureOffset = kClassNameOffset + kPointerSize;
+ static const int kInstanceCallHandlerOffset = kSignatureOffset + kPointerSize;
+ static const int kAccessCheckInfoOffset = kInstanceCallHandlerOffset + kPointerSize;
+ static const int kFlagOffset = kAccessCheckInfoOffset + kPointerSize;
+ static const int kLengthOffset = kFlagOffset + kPointerSize;
+ static const int kSize = kLengthOffset + kPointerSize;
+
+ private:
+ // Bit positions within the 'flag' field.
+ static const int kHiddenPrototypeBit = 0;
+ static const int kUndetectableBit = 1;
+ static const int kNeedsAccessCheckBit = 2;
+ static const int kReadOnlyPrototypeBit = 3;
+ static const int kRemovePrototypeBit = 4;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo);
+};
+
+
+/*bool Object::IsFunctionTemplateInfo() {
+ return Object::IsHeapObject() &&
+ HeapObject::cast(this)->map()->instance_type() == FUNCTION_TEMPLATE_INFO_TYPE;
+}*/
+
+
+/*FunctionTemplateInfo* FunctionTemplateInfo::cast(Object* object) {
+ ASSERT(object->IsFunctionTemplateInfo());
+ return reinterpret_cast<FunctionTemplateInfo*>(object);
+}*/
+
+
+// ObjectTemplateInfo is a TemplateInfo.
+class ObjectTemplateInfo : public TemplateInfo {
+ public:
+ DECL_ACCESSORS(constructor, Object)
+ DECL_ACCESSORS(internal_field_count, Object)
+
+ // Casting.
+ static inline ObjectTemplateInfo* cast(Object* object);
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(ObjectTemplateInfo)
+ DECLARE_VERIFIER(ObjectTemplateInfo)
+
+ // Layout description.
+ static const int kConstructorOffset = TemplateInfo::kHeaderSize;
+ static const int kInternalFieldCountOffset = kConstructorOffset + kPointerSize;
+ static const int kSize = kInternalFieldCountOffset + kPointerSize;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectTemplateInfo);
+};
+
+
+/*bool Object::IsObjectTemplateInfo() {
+ return Object::IsHeapObject() &&
+ HeapObject::cast(this)->map()->instance_type() == OBJECT_TEMPLATE_INFO_TYPE;
+}*/
+
+
+/*ObjectTemplateInfo* ObjectTemplateInfo::cast(Object* object) {
+ ASSERT(object->IsObjectTemplateInfo());
+ return reinterpret_cast<ObjectTemplateInfo*>(object);
+}*/
+
+
+// SignatureInfo is a Struct.
+class SignatureInfo : public Struct {
+ public:
+ DECL_ACCESSORS(receiver, Object)
+ DECL_ACCESSORS(args, Object)
+
+ // Casting.
+ static inline SignatureInfo* cast(Object* object);
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(SignatureInfo)
+ DECLARE_VERIFIER(SignatureInfo)
+
+ // Layout description.
+ static const int kReceiverOffset = Struct::kHeaderSize;
+ static const int kArgsOffset = kReceiverOffset + kPointerSize;
+ static const int kSize = kArgsOffset + kPointerSize;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(SignatureInfo);
+};
+
+
+/*bool Object::IsSignatureInfo() {
+ return Object::IsHeapObject() &&
+ HeapObject::cast(this)->map()->instance_type() == SIGNATURE_INFO_TYPE;
+}*/
+
+
+/*SignatureInfo* SignatureInfo::cast(Object* object) {
+ ASSERT(object->IsSignatureInfo());
+ return reinterpret_cast<SignatureInfo*>(object);
+}*/
+
+
+// TypeSwitchInfo is a Struct.
+class TypeSwitchInfo : public Struct {
+ public:
+ DECL_ACCESSORS(types, Object)
+
+ // Casting.
+ static inline TypeSwitchInfo* cast(Object* object);
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(TypeSwitchInfo)
+ DECLARE_VERIFIER(TypeSwitchInfo)
+
+ // Layout description.
+ static const int kTypesOffset = Struct::kHeaderSize;
+ static const int kSize = kTypesOffset + kPointerSize;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(TypeSwitchInfo);
+};
+
+
+/*bool Object::IsTypeSwitchInfo() {
+ return Object::IsHeapObject() &&
+ HeapObject::cast(this)->map()->instance_type() == TYPE_SWITCH_INFO_TYPE;
+}*/
+
+
+/*TypeSwitchInfo* TypeSwitchInfo::cast(Object* object) {
+ ASSERT(object->IsTypeSwitchInfo());
+ return reinterpret_cast<TypeSwitchInfo*>(object);
+}*/
+
+
+#endif // V8_OBJECTS_GEN_H_
« src/objects.layout ('K') | « src/objects-debug.cc ('k') | src/objects-gen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698