1 // Copyright 2017 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_OBJECTS_ARGUMENTS_H_ 6 #define V8_OBJECTS_ARGUMENTS_H_ 7 8 #include "src/objects/fixed-array.h" 9 #include "src/objects/js-objects.h" 10 #include "src/objects/struct.h" 11 #include "torque-generated/field-offsets.h" 12 13 // Has to be the last include (doesn't have include guards): 14 #include "src/objects/object-macros.h" 15 16 namespace v8 { 17 namespace internal { 18 19 #include "torque-generated/src/objects/arguments-tq.inc" 20 21 // Superclass for all objects with instance type {JS_ARGUMENTS_OBJECT_TYPE} 22 class JSArgumentsObject 23 : public TorqueGeneratedJSArgumentsObject<JSArgumentsObject, JSObject> { 24 public: 25 DECL_VERIFIER(JSArgumentsObject) 26 DECL_PRINTER(JSArgumentsObject) 27 TQ_OBJECT_CONSTRUCTORS(JSArgumentsObject) 28 }; 29 30 // JSSloppyArgumentsObject is just a JSArgumentsObject with specific initial 31 // map. This initial map adds in-object properties for "length" and "callee". 32 class JSSloppyArgumentsObject : public JSArgumentsObject { 33 public: 34 DEFINE_FIELD_OFFSET_CONSTANTS( 35 JSArgumentsObject::kHeaderSize, 36 TORQUE_GENERATED_JS_SLOPPY_ARGUMENTS_OBJECT_FIELDS) 37 38 // Indices of in-object properties. 39 static const int kLengthIndex = 0; 40 static const int kCalleeIndex = kLengthIndex + 1; 41 42 private: 43 DISALLOW_IMPLICIT_CONSTRUCTORS(JSSloppyArgumentsObject); 44 }; 45 46 // JSStrictArgumentsObject is just a JSArgumentsObject with specific initial 47 // map. This initial map adds an in-object property for "length". 48 class JSStrictArgumentsObject : public JSArgumentsObject { 49 public: 50 // Layout description. 51 DEFINE_FIELD_OFFSET_CONSTANTS( 52 JSArgumentsObject::kHeaderSize, 53 TORQUE_GENERATED_JS_STRICT_ARGUMENTS_OBJECT_FIELDS) 54 55 // Indices of in-object properties. 56 static const int kLengthIndex = 0; 57 STATIC_ASSERT(kLengthIndex == JSSloppyArgumentsObject::kLengthIndex); 58 59 private: 60 DISALLOW_IMPLICIT_CONSTRUCTORS(JSStrictArgumentsObject); 61 }; 62 63 // Representation of a slow alias as part of a sloppy arguments objects. 64 // For fast aliases (if HasSloppyArgumentsElements()): 65 // - the parameter map contains an index into the context 66 // - all attributes of the element have default values 67 // For slow aliases (if HasDictionaryArgumentsElements()): 68 // - the parameter map contains no fast alias mapping (i.e. the hole) 69 // - this struct (in the slow backing store) contains an index into the context 70 // - all attributes are available as part if the property details 71 class AliasedArgumentsEntry 72 : public TorqueGeneratedAliasedArgumentsEntry<AliasedArgumentsEntry, 73 Struct> { 74 public: 75 TQ_OBJECT_CONSTRUCTORS(AliasedArgumentsEntry) 76 }; 77 78 } // namespace internal 79 } // namespace v8 80 81 #include "src/objects/object-macros-undef.h" 82 83 #endif // V8_OBJECTS_ARGUMENTS_H_ 84