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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 for (int i = 0; i < num_elements; i++) { | 578 for (int i = 0; i < num_elements; i++) { |
579 elements->set(i, *arguments[i + start_index], mode); | 579 elements->set(i, *arguments[i + start_index], mode); |
580 } | 580 } |
581 } | 581 } |
582 return *result; | 582 return *result; |
583 } | 583 } |
584 | 584 |
585 | 585 |
586 RUNTIME_FUNCTION(Runtime_NewSloppyArguments) { | 586 RUNTIME_FUNCTION(Runtime_NewSloppyArguments) { |
587 HandleScope scope(isolate); | 587 HandleScope scope(isolate); |
588 DCHECK_EQ(3, args.length()); | 588 DCHECK_EQ(1, args.length()); |
589 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0); | 589 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0); |
590 Object** parameters = reinterpret_cast<Object**>(args[1]); | 590 StackFrameIterator iterator(isolate); |
591 CONVERT_SMI_ARG_CHECKED(argument_count, 2); | 591 |
| 592 // Stub/interpreter handler frame |
| 593 iterator.Advance(); |
| 594 DCHECK(iterator.frame()->type() == StackFrame::STUB); |
| 595 |
| 596 // Function frame |
| 597 iterator.Advance(); |
| 598 JavaScriptFrame* function_frame = JavaScriptFrame::cast(iterator.frame()); |
| 599 DCHECK(function_frame->is_java_script()); |
| 600 int argc = function_frame->GetArgumentsLength(); |
| 601 Address fp = function_frame->fp(); |
| 602 if (function_frame->has_adapted_arguments()) { |
| 603 iterator.Advance(); |
| 604 fp = iterator.frame()->fp(); |
| 605 } |
| 606 |
| 607 Object** parameters = reinterpret_cast<Object**>( |
| 608 fp + argc * kPointerSize + StandardFrameConstants::kCallerSPOffset); |
592 ParameterArguments argument_getter(parameters); | 609 ParameterArguments argument_getter(parameters); |
593 return *NewSloppyArguments(isolate, callee, argument_getter, argument_count); | 610 return *NewSloppyArguments(isolate, callee, argument_getter, argc); |
594 } | 611 } |
595 | 612 |
596 RUNTIME_FUNCTION(Runtime_NewArgumentsElements) { | 613 RUNTIME_FUNCTION(Runtime_NewArgumentsElements) { |
597 HandleScope scope(isolate); | 614 HandleScope scope(isolate); |
598 DCHECK_EQ(2, args.length()); | 615 DCHECK_EQ(2, args.length()); |
599 Object** frame = reinterpret_cast<Object**>(args[0]); | 616 Object** frame = reinterpret_cast<Object**>(args[0]); |
600 CONVERT_SMI_ARG_CHECKED(length, 1); | 617 CONVERT_SMI_ARG_CHECKED(length, 1); |
601 Handle<FixedArray> result = | 618 Handle<FixedArray> result = |
602 isolate->factory()->NewUninitializedFixedArray(length); | 619 isolate->factory()->NewUninitializedFixedArray(length); |
603 int const offset = length + 1; | 620 int const offset = length + 1; |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { | 996 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { |
980 HandleScope scope(isolate); | 997 HandleScope scope(isolate); |
981 DCHECK_EQ(2, args.length()); | 998 DCHECK_EQ(2, args.length()); |
982 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 999 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
983 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 1000 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
984 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); | 1001 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); |
985 } | 1002 } |
986 | 1003 |
987 } // namespace internal | 1004 } // namespace internal |
988 } // namespace v8 | 1005 } // namespace v8 |
OLD | NEW |