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_INL_H_
6 #define V8_OBJECTS_ARGUMENTS_INL_H_
7 
8 #include "src/objects/arguments.h"
9 
10 #include "src/execution/isolate-inl.h"
11 #include "src/objects/contexts-inl.h"
12 #include "src/objects/fixed-array-inl.h"
13 #include "src/objects/objects-inl.h"
14 
15 // Has to be the last include (doesn't have include guards):
16 #include "src/objects/object-macros.h"
17 
18 namespace v8 {
19 namespace internal {
20 
OBJECT_CONSTRUCTORS_IMPL(SloppyArgumentsElements,FixedArray)21 OBJECT_CONSTRUCTORS_IMPL(SloppyArgumentsElements, FixedArray)
22 TQ_OBJECT_CONSTRUCTORS_IMPL(JSArgumentsObject)
23 TQ_OBJECT_CONSTRUCTORS_IMPL(AliasedArgumentsEntry)
24 
25 CAST_ACCESSOR(SloppyArgumentsElements)
26 
27 DEF_GETTER(SloppyArgumentsElements, context, Context) {
28   return TaggedField<Context>::load(isolate, *this,
29                                     OffsetOfElementAt(kContextIndex));
30 }
31 
DEF_GETTER(SloppyArgumentsElements,arguments,FixedArray)32 DEF_GETTER(SloppyArgumentsElements, arguments, FixedArray) {
33   return TaggedField<FixedArray>::load(isolate, *this,
34                                        OffsetOfElementAt(kArgumentsIndex));
35 }
36 
set_arguments(FixedArray arguments)37 void SloppyArgumentsElements::set_arguments(FixedArray arguments) {
38   set(kArgumentsIndex, arguments);
39 }
40 
parameter_map_length()41 uint32_t SloppyArgumentsElements::parameter_map_length() {
42   return length() - kParameterMapStart;
43 }
44 
get_mapped_entry(uint32_t entry)45 Object SloppyArgumentsElements::get_mapped_entry(uint32_t entry) {
46   return get(entry + kParameterMapStart);
47 }
48 
set_mapped_entry(uint32_t entry,Object object)49 void SloppyArgumentsElements::set_mapped_entry(uint32_t entry, Object object) {
50   set(entry + kParameterMapStart, object);
51 }
52 
53 }  // namespace internal
54 }  // namespace v8
55 
56 #include "src/objects/object-macros-undef.h"
57 
58 #endif  // V8_OBJECTS_ARGUMENTS_INL_H_
59