diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2018-01-24 20:16:06 +0100 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-01-24 15:02:20 -0800 |
commit | 4c4af643e5042d615a60c6bbc05aee9d81b903e5 (patch) | |
tree | 3fb0a97988fe4439ae3ae06f26915d1dcf8cab92 /deps/v8/src/objects/arguments-inl.h | |
parent | fa9f31a4fda5a3782c652e56e394465805ebb50f (diff) | |
download | node-new-4c4af643e5042d615a60c6bbc05aee9d81b903e5.tar.gz |
deps: update V8 to 6.4.388.40
PR-URL: https://github.com/nodejs/node/pull/17489
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'deps/v8/src/objects/arguments-inl.h')
-rw-r--r-- | deps/v8/src/objects/arguments-inl.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/deps/v8/src/objects/arguments-inl.h b/deps/v8/src/objects/arguments-inl.h index 48ff8daec4..d759c7dab2 100644 --- a/deps/v8/src/objects/arguments-inl.h +++ b/deps/v8/src/objects/arguments-inl.h @@ -45,6 +45,33 @@ void SloppyArgumentsElements::set_mapped_entry(uint32_t entry, Object* object) { set(entry + kParameterMapStart, object); } +// TODO(danno): This shouldn't be inline here, but to defensively avoid +// regressions associated with the fix for the bug 778574, it's staying that way +// until the splice implementation in builtin-arrays.cc can be removed and this +// function can be moved into runtime-arrays.cc near its other usage. +bool JSSloppyArgumentsObject::GetSloppyArgumentsLength(Isolate* isolate, + Handle<JSObject> object, + int* out) { + Context* context = *isolate->native_context(); + Map* map = object->map(); + if (map != context->sloppy_arguments_map() && + map != context->strict_arguments_map() && + map != context->fast_aliased_arguments_map()) { + return false; + } + DCHECK(object->HasFastElements() || object->HasFastArgumentsElements()); + Object* len_obj = object->InObjectPropertyAt(JSArgumentsObject::kLengthIndex); + if (!len_obj->IsSmi()) return false; + *out = Max(0, Smi::ToInt(len_obj)); + + FixedArray* parameters = FixedArray::cast(object->elements()); + if (object->HasSloppyArgumentsElements()) { + FixedArray* arguments = FixedArray::cast(parameters->get(1)); + return *out <= arguments->length(); + } + return *out <= parameters->length(); +} + } // namespace internal } // namespace v8 |