5 #ifndef V8_OBJECTS_ARGUMENTS_INL_H_ 6 #define V8_OBJECTS_ARGUMENTS_INL_H_ 8 #include "src/objects/arguments.h" 10 #include "src/contexts-inl.h" 11 #include "src/isolate-inl.h" 12 #include "src/objects-inl.h" 13 #include "src/objects/fixed-array-inl.h" 16 #include "src/objects/object-macros.h" 21 OBJECT_CONSTRUCTORS_IMPL(SloppyArgumentsElements, FixedArray)
23 CAST_ACCESSOR(AliasedArgumentsEntry)
24 CAST_ACCESSOR(JSArgumentsObject)
25 CAST_ACCESSOR2(SloppyArgumentsElements)
27 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot)
29 Context SloppyArgumentsElements::context() {
30 return Context::cast(
get(kContextIndex));
33 FixedArray SloppyArgumentsElements::arguments() {
34 return FixedArray::cast(
get(kArgumentsIndex));
37 void SloppyArgumentsElements::set_arguments(FixedArray arguments) {
38 set(kArgumentsIndex, arguments);
41 uint32_t SloppyArgumentsElements::parameter_map_length() {
42 return length() - kParameterMapStart;
45 Object* SloppyArgumentsElements::get_mapped_entry(
uint32_t entry) {
46 return get(entry + kParameterMapStart);
49 void SloppyArgumentsElements::set_mapped_entry(
uint32_t entry, Object*
object) {
50 set(entry + kParameterMapStart, object);
57 bool JSSloppyArgumentsObject::GetSloppyArgumentsLength(Isolate* isolate,
58 Handle<JSObject>
object,
60 Context context = *isolate->native_context();
61 Map map =
object->map();
62 if (map != context->sloppy_arguments_map() &&
63 map != context->strict_arguments_map() &&
64 map != context->fast_aliased_arguments_map()) {
67 DCHECK(object->HasFastElements() ||
object->HasFastArgumentsElements());
69 object->InObjectPropertyAt(JSArgumentsObjectWithLength::kLengthIndex);
70 if (!len_obj->IsSmi())
return false;
71 *out = Max(0, Smi::ToInt(len_obj));
73 FixedArray parameters = FixedArray::cast(object->elements());
74 if (object->HasSloppyArgumentsElements()) {
75 FixedArray arguments = FixedArray::cast(parameters->get(1));
76 return *out <= arguments->length();
78 return *out <= parameters->length();
84 #include "src/objects/object-macros-undef.h" 86 #endif // V8_OBJECTS_ARGUMENTS_INL_H_