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