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

Side by Side Diff: src/full-codegen/x87/full-codegen-x87.cc

Issue 2107193002: [ic] Initialize feedback slots for LoadGlobalIC in Runtime::kDeclareGlobals when possible to ... (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing on top of Issue 2127583002 Patch 120001 Created 4 years, 5 months 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
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #if V8_TARGET_ARCH_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 VariableDeclaration* declaration) { 710 VariableDeclaration* declaration) {
711 // If it was not possible to allocate the variable at compile time, we 711 // If it was not possible to allocate the variable at compile time, we
712 // need to "declare" it at runtime to make sure it actually exists in the 712 // need to "declare" it at runtime to make sure it actually exists in the
713 // local context. 713 // local context.
714 VariableProxy* proxy = declaration->proxy(); 714 VariableProxy* proxy = declaration->proxy();
715 VariableMode mode = declaration->mode(); 715 VariableMode mode = declaration->mode();
716 Variable* variable = proxy->var(); 716 Variable* variable = proxy->var();
717 bool hole_init = mode == LET || mode == CONST; 717 bool hole_init = mode == LET || mode == CONST;
718 switch (variable->location()) { 718 switch (variable->location()) {
719 case VariableLocation::GLOBAL: 719 case VariableLocation::GLOBAL:
720 case VariableLocation::UNALLOCATED: 720 case VariableLocation::UNALLOCATED: {
721 DCHECK(!variable->binding_needs_init()); 721 DCHECK(!variable->binding_needs_init());
722 globals_->Add(variable->name(), zone()); 722 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot();
723 DCHECK(!slot.IsInvalid());
724 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone());
723 globals_->Add(isolate()->factory()->undefined_value(), zone()); 725 globals_->Add(isolate()->factory()->undefined_value(), zone());
724 break; 726 break;
725 727 }
726 case VariableLocation::PARAMETER: 728 case VariableLocation::PARAMETER:
727 case VariableLocation::LOCAL: 729 case VariableLocation::LOCAL:
728 if (hole_init) { 730 if (hole_init) {
729 Comment cmnt(masm_, "[ VariableDeclaration"); 731 Comment cmnt(masm_, "[ VariableDeclaration");
730 __ mov(StackOperand(variable), 732 __ mov(StackOperand(variable),
731 Immediate(isolate()->factory()->the_hole_value())); 733 Immediate(isolate()->factory()->the_hole_value()));
732 } 734 }
733 break; 735 break;
734 736
735 case VariableLocation::CONTEXT: 737 case VariableLocation::CONTEXT:
(...skipping 19 matching lines...) Expand all
755 } 757 }
756 } 758 }
757 759
758 void FullCodeGenerator::VisitFunctionDeclaration( 760 void FullCodeGenerator::VisitFunctionDeclaration(
759 FunctionDeclaration* declaration) { 761 FunctionDeclaration* declaration) {
760 VariableProxy* proxy = declaration->proxy(); 762 VariableProxy* proxy = declaration->proxy();
761 Variable* variable = proxy->var(); 763 Variable* variable = proxy->var();
762 switch (variable->location()) { 764 switch (variable->location()) {
763 case VariableLocation::GLOBAL: 765 case VariableLocation::GLOBAL:
764 case VariableLocation::UNALLOCATED: { 766 case VariableLocation::UNALLOCATED: {
765 globals_->Add(variable->name(), zone()); 767 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot();
768 DCHECK(!slot.IsInvalid());
769 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone());
766 Handle<SharedFunctionInfo> function = 770 Handle<SharedFunctionInfo> function =
767 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); 771 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_);
768 // Check for stack-overflow exception. 772 // Check for stack-overflow exception.
769 if (function.is_null()) return SetStackOverflow(); 773 if (function.is_null()) return SetStackOverflow();
770 globals_->Add(function, zone()); 774 globals_->Add(function, zone());
771 break; 775 break;
772 } 776 }
773 777
774 case VariableLocation::PARAMETER: 778 case VariableLocation::PARAMETER:
775 case VariableLocation::LOCAL: { 779 case VariableLocation::LOCAL: {
(...skipping 25 matching lines...) Expand all
801 break; 805 break;
802 } 806 }
803 } 807 }
804 } 808 }
805 809
806 810
807 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { 811 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
808 // Call the runtime to declare the globals. 812 // Call the runtime to declare the globals.
809 __ Push(pairs); 813 __ Push(pairs);
810 __ Push(Smi::FromInt(DeclareGlobalsFlags())); 814 __ Push(Smi::FromInt(DeclareGlobalsFlags()));
815 __ EmitLoadTypeFeedbackVector(eax);
816 __ Push(eax);
811 __ CallRuntime(Runtime::kDeclareGlobals); 817 __ CallRuntime(Runtime::kDeclareGlobals);
812 // Return value is ignored. 818 // Return value is ignored.
813 } 819 }
814 820
815 821
816 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { 822 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
817 Comment cmnt(masm_, "[ SwitchStatement"); 823 Comment cmnt(masm_, "[ SwitchStatement");
818 Breakable nested_statement(this, stmt); 824 Breakable nested_statement(this, stmt);
819 SetStatementPosition(stmt); 825 SetStatementPosition(stmt);
820 826
(...skipping 2856 matching lines...) Expand 10 before | Expand all | Expand 10 after
3677 isolate->builtins()->OnStackReplacement()->entry(), 3683 isolate->builtins()->OnStackReplacement()->entry(),
3678 Assembler::target_address_at(call_target_address, unoptimized_code)); 3684 Assembler::target_address_at(call_target_address, unoptimized_code));
3679 return ON_STACK_REPLACEMENT; 3685 return ON_STACK_REPLACEMENT;
3680 } 3686 }
3681 3687
3682 3688
3683 } // namespace internal 3689 } // namespace internal
3684 } // namespace v8 3690 } // namespace v8
3685 3691
3686 #endif // V8_TARGET_ARCH_X87 3692 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698