| Index: src/deoptimizer.cc
|
| diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc
|
| index 89a06c2d353f95ddeacd527ce297d18e7a120884..4247e5535b0779c38f6a057c24c4e37564d358a1 100644
|
| --- a/src/deoptimizer.cc
|
| +++ b/src/deoptimizer.cc
|
| @@ -2407,6 +2407,11 @@ void Translation::ArgumentsElements(bool is_rest) {
|
| buffer_->Add(is_rest);
|
| }
|
|
|
| +void Translation::ArgumentsLength(bool is_rest) {
|
| + buffer_->Add(ARGUMENTS_LENGTH);
|
| + buffer_->Add(is_rest);
|
| +}
|
| +
|
| void Translation::BeginCapturedObject(int length) {
|
| buffer_->Add(CAPTURED_OBJECT);
|
| buffer_->Add(length);
|
| @@ -2540,6 +2545,7 @@ int Translation::NumberOfOperandsFor(Opcode opcode) {
|
| case CONSTRUCT_STUB_FRAME:
|
| return 3;
|
| case ARGUMENTS_ELEMENTS:
|
| + case ARGUMENTS_LENGTH:
|
| return 1;
|
| }
|
| FATAL("Unexpected translation type");
|
| @@ -3309,6 +3315,7 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
|
| case Translation::DUPLICATED_OBJECT:
|
| case Translation::ARGUMENTS_OBJECT:
|
| case Translation::ARGUMENTS_ELEMENTS:
|
| + case Translation::ARGUMENTS_LENGTH:
|
| case Translation::CAPTURED_OBJECT:
|
| case Translation::REGISTER:
|
| case Translation::INT32_REGISTER:
|
| @@ -3344,38 +3351,48 @@ void TranslatedFrame::AdvanceIterator(
|
| }
|
| }
|
|
|
| -// Creates translated values for an arguments backing store, or the backing
|
| -// store for the rest parameters if {is_rest} is true. The TranslatedValue
|
| -// objects for the fields are not read from the TranslationIterator, but instead
|
| -// created on-the-fly based on dynamic information in the optimized frame.
|
| -void TranslatedState::CreateArgumentsElementsTranslatedValues(
|
| - int frame_index, Address input_frame_pointer, bool is_rest) {
|
| - TranslatedFrame& frame = frames_[frame_index];
|
| -
|
| +Address TranslatedState::ComputeArgumentsPosition(Address input_frame_pointer,
|
| + bool is_rest, int* length) {
|
| Address parent_frame_pointer = *reinterpret_cast<Address*>(
|
| input_frame_pointer + StandardFrameConstants::kCallerFPOffset);
|
| intptr_t parent_frame_type = Memory::intptr_at(
|
| parent_frame_pointer + CommonFrameConstants::kContextOrFrameTypeOffset);
|
| - int length;
|
| +
|
| Address arguments_frame;
|
| if (parent_frame_type ==
|
| StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR)) {
|
| - length = Smi::cast(*reinterpret_cast<Object**>(
|
| - parent_frame_pointer +
|
| - ArgumentsAdaptorFrameConstants::kLengthOffset))
|
| - ->value();
|
| + if (length)
|
| + *length = Smi::cast(*reinterpret_cast<Object**>(
|
| + parent_frame_pointer +
|
| + ArgumentsAdaptorFrameConstants::kLengthOffset))
|
| + ->value();
|
| arguments_frame = parent_frame_pointer;
|
| } else {
|
| - length = formal_parameter_count_;
|
| + if (length) *length = formal_parameter_count_;
|
| arguments_frame = input_frame_pointer;
|
| }
|
|
|
| if (is_rest) {
|
| // If the actual number of arguments is less than the number of formal
|
| // parameters, we have zero rest parameters.
|
| - length = std::max(0, length - formal_parameter_count_);
|
| + if (length) *length = std::max(0, *length - formal_parameter_count_);
|
| }
|
|
|
| + return arguments_frame;
|
| +}
|
| +
|
| +// Creates translated values for an arguments backing store, or the backing
|
| +// store for the rest parameters if {is_rest} is true. The TranslatedValue
|
| +// objects for the fields are not read from the TranslationIterator, but instead
|
| +// created on-the-fly based on dynamic information in the optimized frame.
|
| +void TranslatedState::CreateArgumentsElementsTranslatedValues(
|
| + int frame_index, Address input_frame_pointer, bool is_rest) {
|
| + TranslatedFrame& frame = frames_[frame_index];
|
| +
|
| + int length;
|
| + Address arguments_frame =
|
| + ComputeArgumentsPosition(input_frame_pointer, is_rest, &length);
|
| +
|
| int object_index = static_cast<int>(object_positions_.size());
|
| int value_index = static_cast<int>(frame.values_.size());
|
| object_positions_.push_back({frame_index, value_index});
|
| @@ -3459,6 +3476,14 @@ int TranslatedState::CreateNextTranslatedValue(
|
| return 0;
|
| }
|
|
|
| + case Translation::ARGUMENTS_LENGTH: {
|
| + bool is_rest = iterator->Next();
|
| + int length;
|
| + ComputeArgumentsPosition(fp, is_rest, &length);
|
| + frame.Add(TranslatedValue::NewInt32(this, length));
|
| + return 0;
|
| + }
|
| +
|
| case Translation::CAPTURED_OBJECT: {
|
| int field_count = iterator->Next();
|
| int object_index = static_cast<int>(object_positions_.size());
|
|
|