| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 for (int i = 0; i < num_elements; i++) { | 583 for (int i = 0; i < num_elements; i++) { |
| 584 elements->set(i, *arguments[i + start_index], mode); | 584 elements->set(i, *arguments[i + start_index], mode); |
| 585 } | 585 } |
| 586 } | 586 } |
| 587 return *result; | 587 return *result; |
| 588 } | 588 } |
| 589 | 589 |
| 590 | 590 |
| 591 RUNTIME_FUNCTION(Runtime_NewSloppyArguments) { | 591 RUNTIME_FUNCTION(Runtime_NewSloppyArguments) { |
| 592 HandleScope scope(isolate); | 592 HandleScope scope(isolate); |
| 593 DCHECK_EQ(3, args.length()); | 593 DCHECK_EQ(1, args.length()); |
| 594 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0); | 594 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0); |
| 595 Object** parameters = reinterpret_cast<Object**>(args[1]); | 595 StackFrameIterator iterator(isolate); |
| 596 CONVERT_SMI_ARG_CHECKED(argument_count, 2); | 596 |
| 597 // Stub/interpreter handler frame |
| 598 iterator.Advance(); |
| 599 DCHECK(iterator.frame()->type() == StackFrame::STUB); |
| 600 |
| 601 // Function frame |
| 602 iterator.Advance(); |
| 603 JavaScriptFrame* function_frame = JavaScriptFrame::cast(iterator.frame()); |
| 604 DCHECK(function_frame->is_java_script()); |
| 605 int argc = function_frame->GetArgumentsLength(); |
| 606 Address fp = function_frame->fp(); |
| 607 if (function_frame->has_adapted_arguments()) { |
| 608 iterator.Advance(); |
| 609 fp = iterator.frame()->fp(); |
| 610 } |
| 611 |
| 612 Object** parameters = reinterpret_cast<Object**>( |
| 613 fp + argc * kPointerSize + StandardFrameConstants::kCallerSPOffset); |
| 597 ParameterArguments argument_getter(parameters); | 614 ParameterArguments argument_getter(parameters); |
| 598 return *NewSloppyArguments(isolate, callee, argument_getter, argument_count); | 615 return *NewSloppyArguments(isolate, callee, argument_getter, argc); |
| 599 } | 616 } |
| 600 | 617 |
| 601 RUNTIME_FUNCTION(Runtime_NewArgumentsElements) { | 618 RUNTIME_FUNCTION(Runtime_NewArgumentsElements) { |
| 602 HandleScope scope(isolate); | 619 HandleScope scope(isolate); |
| 603 DCHECK_EQ(2, args.length()); | 620 DCHECK_EQ(2, args.length()); |
| 604 Object** frame = reinterpret_cast<Object**>(args[0]); | 621 Object** frame = reinterpret_cast<Object**>(args[0]); |
| 605 CONVERT_SMI_ARG_CHECKED(length, 1); | 622 CONVERT_SMI_ARG_CHECKED(length, 1); |
| 606 Handle<FixedArray> result = | 623 Handle<FixedArray> result = |
| 607 isolate->factory()->NewUninitializedFixedArray(length); | 624 isolate->factory()->NewUninitializedFixedArray(length); |
| 608 int const offset = length + 1; | 625 int const offset = length + 1; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { | 1009 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { |
| 993 HandleScope scope(isolate); | 1010 HandleScope scope(isolate); |
| 994 DCHECK_EQ(2, args.length()); | 1011 DCHECK_EQ(2, args.length()); |
| 995 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 1012 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 996 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 1013 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 997 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); | 1014 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); |
| 998 } | 1015 } |
| 999 | 1016 |
| 1000 } // namespace internal | 1017 } // namespace internal |
| 1001 } // namespace v8 | 1018 } // namespace v8 |
| OLD | NEW |