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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 RUNTIME_FUNCTION(Runtime_NewSloppyArguments) { | 585 RUNTIME_FUNCTION(Runtime_NewSloppyArguments) { |
586 HandleScope scope(isolate); | 586 HandleScope scope(isolate); |
587 DCHECK(args.length() == 3); | 587 DCHECK(args.length() == 3); |
588 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0); | 588 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0); |
589 Object** parameters = reinterpret_cast<Object**>(args[1]); | 589 Object** parameters = reinterpret_cast<Object**>(args[1]); |
590 CONVERT_SMI_ARG_CHECKED(argument_count, 2); | 590 CONVERT_SMI_ARG_CHECKED(argument_count, 2); |
591 ParameterArguments argument_getter(parameters); | 591 ParameterArguments argument_getter(parameters); |
592 return *NewSloppyArguments(isolate, callee, argument_getter, argument_count); | 592 return *NewSloppyArguments(isolate, callee, argument_getter, argument_count); |
593 } | 593 } |
594 | 594 |
| 595 RUNTIME_FUNCTION(Runtime_NewArgumentsElements) { |
| 596 HandleScope scope(isolate); |
| 597 DCHECK_EQ(2, args.length()); |
| 598 Object** frame = reinterpret_cast<Object**>(args[0]); |
| 599 CONVERT_SMI_ARG_CHECKED(length, 1); |
| 600 Handle<FixedArray> result = |
| 601 isolate->factory()->NewUninitializedFixedArray(length); |
| 602 int const offset = length + 1; |
| 603 DisallowHeapAllocation no_gc; |
| 604 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); |
| 605 for (int index = 0; index < length; ++index) { |
| 606 result->set(index, frame[offset - index], mode); |
| 607 } |
| 608 return *result; |
| 609 } |
595 | 610 |
596 RUNTIME_FUNCTION(Runtime_NewClosure) { | 611 RUNTIME_FUNCTION(Runtime_NewClosure) { |
597 HandleScope scope(isolate); | 612 HandleScope scope(isolate); |
598 DCHECK_EQ(1, args.length()); | 613 DCHECK_EQ(1, args.length()); |
599 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); | 614 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); |
600 Handle<Context> context(isolate->context(), isolate); | 615 Handle<Context> context(isolate->context(), isolate); |
601 return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, | 616 return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, |
602 NOT_TENURED); | 617 NOT_TENURED); |
603 } | 618 } |
604 | 619 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { | 974 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { |
960 HandleScope scope(isolate); | 975 HandleScope scope(isolate); |
961 DCHECK_EQ(2, args.length()); | 976 DCHECK_EQ(2, args.length()); |
962 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 977 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
963 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 978 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
964 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); | 979 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); |
965 } | 980 } |
966 | 981 |
967 } // namespace internal | 982 } // namespace internal |
968 } // namespace v8 | 983 } // namespace v8 |
OLD | NEW |