OLD | NEW |
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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 __ Check(not_equal, kDeclarationInCatchContext); | 706 __ Check(not_equal, kDeclarationInCatchContext); |
707 } | 707 } |
708 } | 708 } |
709 | 709 |
710 | 710 |
711 void FullCodeGenerator::VisitVariableDeclaration( | 711 void FullCodeGenerator::VisitVariableDeclaration( |
712 VariableDeclaration* declaration) { | 712 VariableDeclaration* declaration) { |
713 VariableProxy* proxy = declaration->proxy(); | 713 VariableProxy* proxy = declaration->proxy(); |
714 Variable* variable = proxy->var(); | 714 Variable* variable = proxy->var(); |
715 switch (variable->location()) { | 715 switch (variable->location()) { |
716 case VariableLocation::GLOBAL: | |
717 case VariableLocation::UNALLOCATED: { | 716 case VariableLocation::UNALLOCATED: { |
718 DCHECK(!variable->binding_needs_init()); | 717 DCHECK(!variable->binding_needs_init()); |
719 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); | 718 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
720 DCHECK(!slot.IsInvalid()); | 719 DCHECK(!slot.IsInvalid()); |
721 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); | 720 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
722 globals_->Add(isolate()->factory()->undefined_value(), zone()); | 721 globals_->Add(isolate()->factory()->undefined_value(), zone()); |
723 break; | 722 break; |
724 } | 723 } |
725 case VariableLocation::PARAMETER: | 724 case VariableLocation::PARAMETER: |
726 case VariableLocation::LOCAL: | 725 case VariableLocation::LOCAL: |
(...skipping 29 matching lines...) Expand all Loading... |
756 UNREACHABLE(); | 755 UNREACHABLE(); |
757 } | 756 } |
758 } | 757 } |
759 | 758 |
760 | 759 |
761 void FullCodeGenerator::VisitFunctionDeclaration( | 760 void FullCodeGenerator::VisitFunctionDeclaration( |
762 FunctionDeclaration* declaration) { | 761 FunctionDeclaration* declaration) { |
763 VariableProxy* proxy = declaration->proxy(); | 762 VariableProxy* proxy = declaration->proxy(); |
764 Variable* variable = proxy->var(); | 763 Variable* variable = proxy->var(); |
765 switch (variable->location()) { | 764 switch (variable->location()) { |
766 case VariableLocation::GLOBAL: | |
767 case VariableLocation::UNALLOCATED: { | 765 case VariableLocation::UNALLOCATED: { |
768 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); | 766 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
769 DCHECK(!slot.IsInvalid()); | 767 DCHECK(!slot.IsInvalid()); |
770 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); | 768 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
771 Handle<SharedFunctionInfo> function = | 769 Handle<SharedFunctionInfo> function = |
772 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); | 770 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); |
773 // Check for stack-overflow exception. | 771 // Check for stack-overflow exception. |
774 if (function.is_null()) return SetStackOverflow(); | 772 if (function.is_null()) return SetStackOverflow(); |
775 globals_->Add(function, zone()); | 773 globals_->Add(function, zone()); |
776 break; | 774 break; |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 | 1200 |
1203 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, | 1201 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, |
1204 TypeofMode typeof_mode) { | 1202 TypeofMode typeof_mode) { |
1205 SetExpressionPosition(proxy); | 1203 SetExpressionPosition(proxy); |
1206 PrepareForBailoutForId(proxy->BeforeId(), BailoutState::NO_REGISTERS); | 1204 PrepareForBailoutForId(proxy->BeforeId(), BailoutState::NO_REGISTERS); |
1207 Variable* var = proxy->var(); | 1205 Variable* var = proxy->var(); |
1208 | 1206 |
1209 // Three cases: global variables, lookup variables, and all other types of | 1207 // Three cases: global variables, lookup variables, and all other types of |
1210 // variables. | 1208 // variables. |
1211 switch (var->location()) { | 1209 switch (var->location()) { |
1212 case VariableLocation::GLOBAL: | |
1213 case VariableLocation::UNALLOCATED: { | 1210 case VariableLocation::UNALLOCATED: { |
1214 Comment cmnt(masm_, "[ Global variable"); | 1211 Comment cmnt(masm_, "[ Global variable"); |
1215 EmitGlobalVariableLoad(proxy, typeof_mode); | 1212 EmitGlobalVariableLoad(proxy, typeof_mode); |
1216 context()->Plug(eax); | 1213 context()->Plug(eax); |
1217 break; | 1214 break; |
1218 } | 1215 } |
1219 | 1216 |
1220 case VariableLocation::PARAMETER: | 1217 case VariableLocation::PARAMETER: |
1221 case VariableLocation::LOCAL: | 1218 case VariableLocation::LOCAL: |
1222 case VariableLocation::CONTEXT: { | 1219 case VariableLocation::CONTEXT: { |
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3642 isolate->builtins()->OnStackReplacement()->entry(), | 3639 isolate->builtins()->OnStackReplacement()->entry(), |
3643 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3640 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3644 return ON_STACK_REPLACEMENT; | 3641 return ON_STACK_REPLACEMENT; |
3645 } | 3642 } |
3646 | 3643 |
3647 | 3644 |
3648 } // namespace internal | 3645 } // namespace internal |
3649 } // namespace v8 | 3646 } // namespace v8 |
3650 | 3647 |
3651 #endif // V8_TARGET_ARCH_IA32 | 3648 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |