| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 VariableDeclaration* declaration) { | 775 VariableDeclaration* declaration) { |
| 776 // If it was not possible to allocate the variable at compile time, we | 776 // If it was not possible to allocate the variable at compile time, we |
| 777 // need to "declare" it at runtime to make sure it actually exists in the | 777 // need to "declare" it at runtime to make sure it actually exists in the |
| 778 // local context. | 778 // local context. |
| 779 VariableProxy* proxy = declaration->proxy(); | 779 VariableProxy* proxy = declaration->proxy(); |
| 780 VariableMode mode = declaration->mode(); | 780 VariableMode mode = declaration->mode(); |
| 781 Variable* variable = proxy->var(); | 781 Variable* variable = proxy->var(); |
| 782 bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET; | 782 bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET; |
| 783 switch (variable->location()) { | 783 switch (variable->location()) { |
| 784 case Variable::UNALLOCATED: | 784 case Variable::UNALLOCATED: |
| 785 globals_->Add(variable->name()); | 785 globals_->Add(variable->name(), zone()); |
| 786 globals_->Add(variable->binding_needs_init() | 786 globals_->Add(variable->binding_needs_init() |
| 787 ? isolate()->factory()->the_hole_value() | 787 ? isolate()->factory()->the_hole_value() |
| 788 : isolate()->factory()->undefined_value()); | 788 : isolate()->factory()->undefined_value(), zone()); |
| 789 break; | 789 break; |
| 790 | 790 |
| 791 case Variable::PARAMETER: | 791 case Variable::PARAMETER: |
| 792 case Variable::LOCAL: | 792 case Variable::LOCAL: |
| 793 if (hole_init) { | 793 if (hole_init) { |
| 794 Comment cmnt(masm_, "[ VariableDeclaration"); | 794 Comment cmnt(masm_, "[ VariableDeclaration"); |
| 795 __ mov(StackOperand(variable), | 795 __ mov(StackOperand(variable), |
| 796 Immediate(isolate()->factory()->the_hole_value())); | 796 Immediate(isolate()->factory()->the_hole_value())); |
| 797 } | 797 } |
| 798 break; | 798 break; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 } | 833 } |
| 834 } | 834 } |
| 835 | 835 |
| 836 | 836 |
| 837 void FullCodeGenerator::VisitFunctionDeclaration( | 837 void FullCodeGenerator::VisitFunctionDeclaration( |
| 838 FunctionDeclaration* declaration) { | 838 FunctionDeclaration* declaration) { |
| 839 VariableProxy* proxy = declaration->proxy(); | 839 VariableProxy* proxy = declaration->proxy(); |
| 840 Variable* variable = proxy->var(); | 840 Variable* variable = proxy->var(); |
| 841 switch (variable->location()) { | 841 switch (variable->location()) { |
| 842 case Variable::UNALLOCATED: { | 842 case Variable::UNALLOCATED: { |
| 843 globals_->Add(variable->name()); | 843 globals_->Add(variable->name(), zone()); |
| 844 Handle<SharedFunctionInfo> function = | 844 Handle<SharedFunctionInfo> function = |
| 845 Compiler::BuildFunctionInfo(declaration->fun(), script()); | 845 Compiler::BuildFunctionInfo(declaration->fun(), script()); |
| 846 // Check for stack-overflow exception. | 846 // Check for stack-overflow exception. |
| 847 if (function.is_null()) return SetStackOverflow(); | 847 if (function.is_null()) return SetStackOverflow(); |
| 848 globals_->Add(function); | 848 globals_->Add(function, zone()); |
| 849 break; | 849 break; |
| 850 } | 850 } |
| 851 | 851 |
| 852 case Variable::PARAMETER: | 852 case Variable::PARAMETER: |
| 853 case Variable::LOCAL: { | 853 case Variable::LOCAL: { |
| 854 Comment cmnt(masm_, "[ FunctionDeclaration"); | 854 Comment cmnt(masm_, "[ FunctionDeclaration"); |
| 855 VisitForAccumulatorValue(declaration->fun()); | 855 VisitForAccumulatorValue(declaration->fun()); |
| 856 __ mov(StackOperand(variable), result_register()); | 856 __ mov(StackOperand(variable), result_register()); |
| 857 break; | 857 break; |
| 858 } | 858 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 889 | 889 |
| 890 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { | 890 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { |
| 891 VariableProxy* proxy = declaration->proxy(); | 891 VariableProxy* proxy = declaration->proxy(); |
| 892 Variable* variable = proxy->var(); | 892 Variable* variable = proxy->var(); |
| 893 Handle<JSModule> instance = declaration->module()->interface()->Instance(); | 893 Handle<JSModule> instance = declaration->module()->interface()->Instance(); |
| 894 ASSERT(!instance.is_null()); | 894 ASSERT(!instance.is_null()); |
| 895 | 895 |
| 896 switch (variable->location()) { | 896 switch (variable->location()) { |
| 897 case Variable::UNALLOCATED: { | 897 case Variable::UNALLOCATED: { |
| 898 Comment cmnt(masm_, "[ ModuleDeclaration"); | 898 Comment cmnt(masm_, "[ ModuleDeclaration"); |
| 899 globals_->Add(variable->name()); | 899 globals_->Add(variable->name(), zone()); |
| 900 globals_->Add(instance); | 900 globals_->Add(instance, zone()); |
| 901 Visit(declaration->module()); | 901 Visit(declaration->module()); |
| 902 break; | 902 break; |
| 903 } | 903 } |
| 904 | 904 |
| 905 case Variable::CONTEXT: { | 905 case Variable::CONTEXT: { |
| 906 Comment cmnt(masm_, "[ ModuleDeclaration"); | 906 Comment cmnt(masm_, "[ ModuleDeclaration"); |
| 907 EmitDebugCheckDeclarationContext(variable); | 907 EmitDebugCheckDeclarationContext(variable); |
| 908 __ mov(ContextOperand(esi, variable->index()), Immediate(instance)); | 908 __ mov(ContextOperand(esi, variable->index()), Immediate(instance)); |
| 909 Visit(declaration->module()); | 909 Visit(declaration->module()); |
| 910 break; | 910 break; |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 __ CallStub(&stub); | 1550 __ CallStub(&stub); |
| 1551 } | 1551 } |
| 1552 | 1552 |
| 1553 // If result_saved is true the result is on top of the stack. If | 1553 // If result_saved is true the result is on top of the stack. If |
| 1554 // result_saved is false the result is in eax. | 1554 // result_saved is false the result is in eax. |
| 1555 bool result_saved = false; | 1555 bool result_saved = false; |
| 1556 | 1556 |
| 1557 // Mark all computed expressions that are bound to a key that | 1557 // Mark all computed expressions that are bound to a key that |
| 1558 // is shadowed by a later occurrence of the same key. For the | 1558 // is shadowed by a later occurrence of the same key. For the |
| 1559 // marked expressions, no store code is emitted. | 1559 // marked expressions, no store code is emitted. |
| 1560 expr->CalculateEmitStore(); | 1560 expr->CalculateEmitStore(zone()); |
| 1561 | 1561 |
| 1562 AccessorTable accessor_table(isolate()->zone()); | 1562 AccessorTable accessor_table(isolate()->zone()); |
| 1563 for (int i = 0; i < expr->properties()->length(); i++) { | 1563 for (int i = 0; i < expr->properties()->length(); i++) { |
| 1564 ObjectLiteral::Property* property = expr->properties()->at(i); | 1564 ObjectLiteral::Property* property = expr->properties()->at(i); |
| 1565 if (property->IsCompileTimeValue()) continue; | 1565 if (property->IsCompileTimeValue()) continue; |
| 1566 | 1566 |
| 1567 Literal* key = property->key(); | 1567 Literal* key = property->key(); |
| 1568 Expression* value = property->value(); | 1568 Expression* value = property->value(); |
| 1569 if (!result_saved) { | 1569 if (!result_saved) { |
| 1570 __ push(eax); // Save result on the stack | 1570 __ push(eax); // Save result on the stack |
| (...skipping 2947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4518 *context_length = 0; | 4518 *context_length = 0; |
| 4519 return previous_; | 4519 return previous_; |
| 4520 } | 4520 } |
| 4521 | 4521 |
| 4522 | 4522 |
| 4523 #undef __ | 4523 #undef __ |
| 4524 | 4524 |
| 4525 } } // namespace v8::internal | 4525 } } // namespace v8::internal |
| 4526 | 4526 |
| 4527 #endif // V8_TARGET_ARCH_IA32 | 4527 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |