| 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_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 __ Check(not_equal, kDeclarationInCatchContext); | 719 __ Check(not_equal, kDeclarationInCatchContext); |
| 720 } | 720 } |
| 721 } | 721 } |
| 722 | 722 |
| 723 | 723 |
| 724 void FullCodeGenerator::VisitVariableDeclaration( | 724 void FullCodeGenerator::VisitVariableDeclaration( |
| 725 VariableDeclaration* declaration) { | 725 VariableDeclaration* declaration) { |
| 726 VariableProxy* proxy = declaration->proxy(); | 726 VariableProxy* proxy = declaration->proxy(); |
| 727 Variable* variable = proxy->var(); | 727 Variable* variable = proxy->var(); |
| 728 switch (variable->location()) { | 728 switch (variable->location()) { |
| 729 case VariableLocation::GLOBAL: | |
| 730 case VariableLocation::UNALLOCATED: { | 729 case VariableLocation::UNALLOCATED: { |
| 731 DCHECK(!variable->binding_needs_init()); | 730 DCHECK(!variable->binding_needs_init()); |
| 732 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); | 731 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
| 733 DCHECK(!slot.IsInvalid()); | 732 DCHECK(!slot.IsInvalid()); |
| 734 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); | 733 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
| 735 globals_->Add(isolate()->factory()->undefined_value(), zone()); | 734 globals_->Add(isolate()->factory()->undefined_value(), zone()); |
| 736 break; | 735 break; |
| 737 } | 736 } |
| 738 case VariableLocation::PARAMETER: | 737 case VariableLocation::PARAMETER: |
| 739 case VariableLocation::LOCAL: | 738 case VariableLocation::LOCAL: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 769 UNREACHABLE(); | 768 UNREACHABLE(); |
| 770 } | 769 } |
| 771 } | 770 } |
| 772 | 771 |
| 773 | 772 |
| 774 void FullCodeGenerator::VisitFunctionDeclaration( | 773 void FullCodeGenerator::VisitFunctionDeclaration( |
| 775 FunctionDeclaration* declaration) { | 774 FunctionDeclaration* declaration) { |
| 776 VariableProxy* proxy = declaration->proxy(); | 775 VariableProxy* proxy = declaration->proxy(); |
| 777 Variable* variable = proxy->var(); | 776 Variable* variable = proxy->var(); |
| 778 switch (variable->location()) { | 777 switch (variable->location()) { |
| 779 case VariableLocation::GLOBAL: | |
| 780 case VariableLocation::UNALLOCATED: { | 778 case VariableLocation::UNALLOCATED: { |
| 781 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); | 779 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
| 782 DCHECK(!slot.IsInvalid()); | 780 DCHECK(!slot.IsInvalid()); |
| 783 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); | 781 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
| 784 Handle<SharedFunctionInfo> function = | 782 Handle<SharedFunctionInfo> function = |
| 785 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); | 783 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); |
| 786 // Check for stack-overflow exception. | 784 // Check for stack-overflow exception. |
| 787 if (function.is_null()) return SetStackOverflow(); | 785 if (function.is_null()) return SetStackOverflow(); |
| 788 globals_->Add(function, zone()); | 786 globals_->Add(function, zone()); |
| 789 break; | 787 break; |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, | 1229 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, |
| 1232 TypeofMode typeof_mode) { | 1230 TypeofMode typeof_mode) { |
| 1233 // Record position before possible IC call. | 1231 // Record position before possible IC call. |
| 1234 SetExpressionPosition(proxy); | 1232 SetExpressionPosition(proxy); |
| 1235 PrepareForBailoutForId(proxy->BeforeId(), BailoutState::NO_REGISTERS); | 1233 PrepareForBailoutForId(proxy->BeforeId(), BailoutState::NO_REGISTERS); |
| 1236 Variable* var = proxy->var(); | 1234 Variable* var = proxy->var(); |
| 1237 | 1235 |
| 1238 // Three cases: global variables, lookup variables, and all other types of | 1236 // Three cases: global variables, lookup variables, and all other types of |
| 1239 // variables. | 1237 // variables. |
| 1240 switch (var->location()) { | 1238 switch (var->location()) { |
| 1241 case VariableLocation::GLOBAL: | |
| 1242 case VariableLocation::UNALLOCATED: { | 1239 case VariableLocation::UNALLOCATED: { |
| 1243 Comment cmnt(masm_, "[ Global variable"); | 1240 Comment cmnt(masm_, "[ Global variable"); |
| 1244 EmitGlobalVariableLoad(proxy, typeof_mode); | 1241 EmitGlobalVariableLoad(proxy, typeof_mode); |
| 1245 context()->Plug(rax); | 1242 context()->Plug(rax); |
| 1246 break; | 1243 break; |
| 1247 } | 1244 } |
| 1248 | 1245 |
| 1249 case VariableLocation::PARAMETER: | 1246 case VariableLocation::PARAMETER: |
| 1250 case VariableLocation::LOCAL: | 1247 case VariableLocation::LOCAL: |
| 1251 case VariableLocation::CONTEXT: { | 1248 case VariableLocation::CONTEXT: { |
| (...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3632 DCHECK_EQ( | 3629 DCHECK_EQ( |
| 3633 isolate->builtins()->OnStackReplacement()->entry(), | 3630 isolate->builtins()->OnStackReplacement()->entry(), |
| 3634 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3631 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3635 return ON_STACK_REPLACEMENT; | 3632 return ON_STACK_REPLACEMENT; |
| 3636 } | 3633 } |
| 3637 | 3634 |
| 3638 } // namespace internal | 3635 } // namespace internal |
| 3639 } // namespace v8 | 3636 } // namespace v8 |
| 3640 | 3637 |
| 3641 #endif // V8_TARGET_ARCH_X64 | 3638 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |