Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/runtime/runtime-scopes.cc

Issue 2504153002: [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: REBASE. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 DisallowHeapAllocation no_gc; 603 DisallowHeapAllocation no_gc;
604 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); 604 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
605 for (int index = 0; index < length; ++index) { 605 for (int index = 0; index < length; ++index) {
606 result->set(index, frame[offset - index], mode); 606 result->set(index, frame[offset - index], mode);
607 } 607 }
608 return *result; 608 return *result;
609 } 609 }
610 610
611 RUNTIME_FUNCTION(Runtime_NewClosure) { 611 RUNTIME_FUNCTION(Runtime_NewClosure) {
612 HandleScope scope(isolate); 612 HandleScope scope(isolate);
613 DCHECK_EQ(1, args.length()); 613 DCHECK_EQ(3, args.length());
614 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); 614 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0);
615 CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1);
616 CONVERT_SMI_ARG_CHECKED(index, 2);
615 Handle<Context> context(isolate->context(), isolate); 617 Handle<Context> context(isolate->context(), isolate);
616 return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, 618 FeedbackVectorSlot slot = TypeFeedbackVector::ToSlot(index);
617 NOT_TENURED); 619 Handle<LiteralsArray> literals(LiteralsArray::cast(vector->Get(slot)),
620 isolate);
621 Handle<JSFunction> function =
622 isolate->factory()->NewFunctionFromSharedFunctionInfo(
623 shared, context, literals, NOT_TENURED);
624 return *function;
618 } 625 }
619 626
620 627
621 RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) { 628 RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) {
622 HandleScope scope(isolate); 629 HandleScope scope(isolate);
623 DCHECK_EQ(1, args.length()); 630 DCHECK_EQ(3, args.length());
624 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); 631 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0);
632 CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1);
633 CONVERT_SMI_ARG_CHECKED(index, 2);
625 Handle<Context> context(isolate->context(), isolate); 634 Handle<Context> context(isolate->context(), isolate);
635 FeedbackVectorSlot slot = TypeFeedbackVector::ToSlot(index);
636 Handle<LiteralsArray> literals(LiteralsArray::cast(vector->Get(slot)),
637 isolate);
626 // The caller ensures that we pretenure closures that are assigned 638 // The caller ensures that we pretenure closures that are assigned
627 // directly to properties. 639 // directly to properties.
628 return *isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, 640 Handle<JSFunction> function =
629 TENURED); 641 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context,
642 literals, TENURED);
643 return *function;
630 } 644 }
631 645
632 static Object* FindNameClash(Handle<ScopeInfo> scope_info, 646 static Object* FindNameClash(Handle<ScopeInfo> scope_info,
633 Handle<JSGlobalObject> global_object, 647 Handle<JSGlobalObject> global_object,
634 Handle<ScriptContextTable> script_context) { 648 Handle<ScriptContextTable> script_context) {
635 Isolate* isolate = scope_info->GetIsolate(); 649 Isolate* isolate = scope_info->GetIsolate();
636 for (int var = 0; var < scope_info->ContextLocalCount(); var++) { 650 for (int var = 0; var < scope_info->ContextLocalCount(); var++) {
637 Handle<String> name(scope_info->ContextLocalName(var)); 651 Handle<String> name(scope_info->ContextLocalName(var));
638 VariableMode mode = scope_info->ContextLocalMode(var); 652 VariableMode mode = scope_info->ContextLocalMode(var);
639 ScriptContextTable::LookupResult lookup; 653 ScriptContextTable::LookupResult lookup;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { 988 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) {
975 HandleScope scope(isolate); 989 HandleScope scope(isolate);
976 DCHECK_EQ(2, args.length()); 990 DCHECK_EQ(2, args.length());
977 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); 991 CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
978 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); 992 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
979 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); 993 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT));
980 } 994 }
981 995
982 } // namespace internal 996 } // namespace internal
983 } // namespace v8 997 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698