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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 for (int index = 0; index < length; ++index) { | 606 for (int index = 0; index < length; ++index) { |
607 result->set(index, frame[offset - index], mode); | 607 result->set(index, frame[offset - index], mode); |
608 } | 608 } |
609 return *result; | 609 return *result; |
610 } | 610 } |
611 | 611 |
612 RUNTIME_FUNCTION(Runtime_NewClosure) { | 612 RUNTIME_FUNCTION(Runtime_NewClosure) { |
613 HandleScope scope(isolate); | 613 HandleScope scope(isolate); |
614 DCHECK_EQ(3, args.length()); | 614 DCHECK_EQ(3, args.length()); |
615 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); | 615 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); |
| 616 CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1); |
| 617 CONVERT_SMI_ARG_CHECKED(index, 2); |
616 Handle<Context> context(isolate->context(), isolate); | 618 Handle<Context> context(isolate->context(), isolate); |
| 619 FeedbackVectorSlot slot = TypeFeedbackVector::ToSlot(index); |
| 620 Handle<LiteralsArray> literals(LiteralsArray::cast(vector->Get(slot)), |
| 621 isolate); |
617 Handle<JSFunction> function = | 622 Handle<JSFunction> function = |
618 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, | 623 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
619 NOT_TENURED); | 624 shared, context, literals, NOT_TENURED); |
620 return *function; | 625 return *function; |
621 } | 626 } |
622 | 627 |
623 | 628 |
624 RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) { | 629 RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) { |
625 HandleScope scope(isolate); | 630 HandleScope scope(isolate); |
626 DCHECK_EQ(3, args.length()); | 631 DCHECK_EQ(3, args.length()); |
627 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); | 632 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); |
| 633 CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1); |
| 634 CONVERT_SMI_ARG_CHECKED(index, 2); |
628 Handle<Context> context(isolate->context(), isolate); | 635 Handle<Context> context(isolate->context(), isolate); |
| 636 FeedbackVectorSlot slot = TypeFeedbackVector::ToSlot(index); |
| 637 Handle<LiteralsArray> literals(LiteralsArray::cast(vector->Get(slot)), |
| 638 isolate); |
629 // The caller ensures that we pretenure closures that are assigned | 639 // The caller ensures that we pretenure closures that are assigned |
630 // directly to properties. | 640 // directly to properties. |
631 Handle<JSFunction> function = | 641 Handle<JSFunction> function = |
632 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, | 642 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, |
633 TENURED); | 643 literals, TENURED); |
634 return *function; | 644 return *function; |
635 } | 645 } |
636 | 646 |
637 static Object* FindNameClash(Handle<ScopeInfo> scope_info, | 647 static Object* FindNameClash(Handle<ScopeInfo> scope_info, |
638 Handle<JSGlobalObject> global_object, | 648 Handle<JSGlobalObject> global_object, |
639 Handle<ScriptContextTable> script_context) { | 649 Handle<ScriptContextTable> script_context) { |
640 Isolate* isolate = scope_info->GetIsolate(); | 650 Isolate* isolate = scope_info->GetIsolate(); |
641 for (int var = 0; var < scope_info->ContextLocalCount(); var++) { | 651 for (int var = 0; var < scope_info->ContextLocalCount(); var++) { |
642 Handle<String> name(scope_info->ContextLocalName(var)); | 652 Handle<String> name(scope_info->ContextLocalName(var)); |
643 VariableMode mode = scope_info->ContextLocalMode(var); | 653 VariableMode mode = scope_info->ContextLocalMode(var); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { | 989 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { |
980 HandleScope scope(isolate); | 990 HandleScope scope(isolate); |
981 DCHECK_EQ(2, args.length()); | 991 DCHECK_EQ(2, args.length()); |
982 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 992 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
983 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 993 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
984 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); | 994 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); |
985 } | 995 } |
986 | 996 |
987 } // namespace internal | 997 } // namespace internal |
988 } // namespace v8 | 998 } // namespace v8 |
OLD | NEW |