• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
12 // Has to be the last include (doesn't have include guards):
13 #include "src/objects/object-macros.h"
14 
15 namespace v8 {
16 namespace internal {
17 
18 class StructBodyDescriptor;
19 
20 #include "torque-generated/src/objects/arguments-tq.inc"
21 
22 // Superclass for all objects with instance type {JS_ARGUMENTS_OBJECT_TYPE}
23 class JSArgumentsObject
24     : public TorqueGeneratedJSArgumentsObject<JSArgumentsObject, JSObject> {
25  public:
26   DECL_VERIFIER(JSArgumentsObject)
27   DECL_PRINTER(JSArgumentsObject)
28   TQ_OBJECT_CONSTRUCTORS(JSArgumentsObject)
29 };
30 
31 // JSSloppyArgumentsObject is just a JSArgumentsObject with specific initial
32 // map. This initial map adds in-object properties for "length" and "callee".
33 class JSSloppyArgumentsObject
34     : public TorqueGeneratedJSSloppyArgumentsObject<JSSloppyArgumentsObject,
35                                                     JSArgumentsObject> {
36  public:
37   // Indices of in-object properties.
38   static const int kLengthIndex = 0;
39   static const int kCalleeIndex = kLengthIndex + 1;
40 
41  private:
42   DISALLOW_IMPLICIT_CONSTRUCTORS(JSSloppyArgumentsObject);
43 };
44 
45 // JSStrictArgumentsObject is just a JSArgumentsObject with specific initial
46 // map. This initial map adds an in-object property for "length".
47 class JSStrictArgumentsObject
48     : public TorqueGeneratedJSStrictArgumentsObject<JSStrictArgumentsObject,
49                                                     JSArgumentsObject> {
50  public:
51   // Indices of in-object properties.
52   static const int kLengthIndex = 0;
53   STATIC_ASSERT(kLengthIndex == JSSloppyArgumentsObject::kLengthIndex);
54 
55  private:
56   DISALLOW_IMPLICIT_CONSTRUCTORS(JSStrictArgumentsObject);
57 };
58 
59 // Representation of a slow alias as part of a sloppy arguments objects.
60 // For fast aliases (if HasSloppyArgumentsElements()):
61 // - the parameter map contains an index into the context
62 // - all attributes of the element have default values
63 // For slow aliases (if HasDictionaryArgumentsElements()):
64 // - the parameter map contains no fast alias mapping (i.e. the hole)
65 // - this struct (in the slow backing store) contains an index into the context
66 // - all attributes are available as part if the property details
67 class AliasedArgumentsEntry
68     : public TorqueGeneratedAliasedArgumentsEntry<AliasedArgumentsEntry,
69                                                   Struct> {
70  public:
71   using BodyDescriptor = StructBodyDescriptor;
72 
73   TQ_OBJECT_CONSTRUCTORS(AliasedArgumentsEntry)
74 };
75 
76 }  // namespace internal
77 }  // namespace v8
78 
79 #include "src/objects/object-macros-undef.h"
80 
81 #endif  // V8_OBJECTS_ARGUMENTS_H_
82