| 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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 VariableDeclaration* declaration) { | 801 VariableDeclaration* declaration) { |
| 802 // If it was not possible to allocate the variable at compile time, we | 802 // If it was not possible to allocate the variable at compile time, we |
| 803 // need to "declare" it at runtime to make sure it actually exists in the | 803 // need to "declare" it at runtime to make sure it actually exists in the |
| 804 // local context. | 804 // local context. |
| 805 VariableProxy* proxy = declaration->proxy(); | 805 VariableProxy* proxy = declaration->proxy(); |
| 806 VariableMode mode = declaration->mode(); | 806 VariableMode mode = declaration->mode(); |
| 807 Variable* variable = proxy->var(); | 807 Variable* variable = proxy->var(); |
| 808 bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET; | 808 bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET; |
| 809 switch (variable->location()) { | 809 switch (variable->location()) { |
| 810 case Variable::UNALLOCATED: | 810 case Variable::UNALLOCATED: |
| 811 globals_->Add(variable->name()); | 811 globals_->Add(variable->name(), zone()); |
| 812 globals_->Add(variable->binding_needs_init() | 812 globals_->Add(variable->binding_needs_init() |
| 813 ? isolate()->factory()->the_hole_value() | 813 ? isolate()->factory()->the_hole_value() |
| 814 : isolate()->factory()->undefined_value()); | 814 : isolate()->factory()->undefined_value(), |
| 815 zone()); |
| 815 break; | 816 break; |
| 816 | 817 |
| 817 case Variable::PARAMETER: | 818 case Variable::PARAMETER: |
| 818 case Variable::LOCAL: | 819 case Variable::LOCAL: |
| 819 if (hole_init) { | 820 if (hole_init) { |
| 820 Comment cmnt(masm_, "[ VariableDeclaration"); | 821 Comment cmnt(masm_, "[ VariableDeclaration"); |
| 821 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 822 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 822 __ str(ip, StackOperand(variable)); | 823 __ str(ip, StackOperand(variable)); |
| 823 } | 824 } |
| 824 break; | 825 break; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 } | 861 } |
| 861 } | 862 } |
| 862 | 863 |
| 863 | 864 |
| 864 void FullCodeGenerator::VisitFunctionDeclaration( | 865 void FullCodeGenerator::VisitFunctionDeclaration( |
| 865 FunctionDeclaration* declaration) { | 866 FunctionDeclaration* declaration) { |
| 866 VariableProxy* proxy = declaration->proxy(); | 867 VariableProxy* proxy = declaration->proxy(); |
| 867 Variable* variable = proxy->var(); | 868 Variable* variable = proxy->var(); |
| 868 switch (variable->location()) { | 869 switch (variable->location()) { |
| 869 case Variable::UNALLOCATED: { | 870 case Variable::UNALLOCATED: { |
| 870 globals_->Add(variable->name()); | 871 globals_->Add(variable->name(), zone()); |
| 871 Handle<SharedFunctionInfo> function = | 872 Handle<SharedFunctionInfo> function = |
| 872 Compiler::BuildFunctionInfo(declaration->fun(), script()); | 873 Compiler::BuildFunctionInfo(declaration->fun(), script()); |
| 873 // Check for stack-overflow exception. | 874 // Check for stack-overflow exception. |
| 874 if (function.is_null()) return SetStackOverflow(); | 875 if (function.is_null()) return SetStackOverflow(); |
| 875 globals_->Add(function); | 876 globals_->Add(function, zone()); |
| 876 break; | 877 break; |
| 877 } | 878 } |
| 878 | 879 |
| 879 case Variable::PARAMETER: | 880 case Variable::PARAMETER: |
| 880 case Variable::LOCAL: { | 881 case Variable::LOCAL: { |
| 881 Comment cmnt(masm_, "[ FunctionDeclaration"); | 882 Comment cmnt(masm_, "[ FunctionDeclaration"); |
| 882 VisitForAccumulatorValue(declaration->fun()); | 883 VisitForAccumulatorValue(declaration->fun()); |
| 883 __ str(result_register(), StackOperand(variable)); | 884 __ str(result_register(), StackOperand(variable)); |
| 884 break; | 885 break; |
| 885 } | 886 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 | 920 |
| 920 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { | 921 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { |
| 921 VariableProxy* proxy = declaration->proxy(); | 922 VariableProxy* proxy = declaration->proxy(); |
| 922 Variable* variable = proxy->var(); | 923 Variable* variable = proxy->var(); |
| 923 Handle<JSModule> instance = declaration->module()->interface()->Instance(); | 924 Handle<JSModule> instance = declaration->module()->interface()->Instance(); |
| 924 ASSERT(!instance.is_null()); | 925 ASSERT(!instance.is_null()); |
| 925 | 926 |
| 926 switch (variable->location()) { | 927 switch (variable->location()) { |
| 927 case Variable::UNALLOCATED: { | 928 case Variable::UNALLOCATED: { |
| 928 Comment cmnt(masm_, "[ ModuleDeclaration"); | 929 Comment cmnt(masm_, "[ ModuleDeclaration"); |
| 929 globals_->Add(variable->name()); | 930 globals_->Add(variable->name(), zone()); |
| 930 globals_->Add(instance); | 931 globals_->Add(instance, zone()); |
| 931 Visit(declaration->module()); | 932 Visit(declaration->module()); |
| 932 break; | 933 break; |
| 933 } | 934 } |
| 934 | 935 |
| 935 case Variable::CONTEXT: { | 936 case Variable::CONTEXT: { |
| 936 Comment cmnt(masm_, "[ ModuleDeclaration"); | 937 Comment cmnt(masm_, "[ ModuleDeclaration"); |
| 937 EmitDebugCheckDeclarationContext(variable); | 938 EmitDebugCheckDeclarationContext(variable); |
| 938 __ mov(r1, Operand(instance)); | 939 __ mov(r1, Operand(instance)); |
| 939 __ str(r1, ContextOperand(cp, variable->index())); | 940 __ str(r1, ContextOperand(cp, variable->index())); |
| 940 Visit(declaration->module()); | 941 Visit(declaration->module()); |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 __ CallStub(&stub); | 1597 __ CallStub(&stub); |
| 1597 } | 1598 } |
| 1598 | 1599 |
| 1599 // If result_saved is true the result is on top of the stack. If | 1600 // If result_saved is true the result is on top of the stack. If |
| 1600 // result_saved is false the result is in r0. | 1601 // result_saved is false the result is in r0. |
| 1601 bool result_saved = false; | 1602 bool result_saved = false; |
| 1602 | 1603 |
| 1603 // Mark all computed expressions that are bound to a key that | 1604 // Mark all computed expressions that are bound to a key that |
| 1604 // is shadowed by a later occurrence of the same key. For the | 1605 // is shadowed by a later occurrence of the same key. For the |
| 1605 // marked expressions, no store code is emitted. | 1606 // marked expressions, no store code is emitted. |
| 1606 expr->CalculateEmitStore(); | 1607 expr->CalculateEmitStore(zone()); |
| 1607 | 1608 |
| 1608 AccessorTable accessor_table(isolate()->zone()); | 1609 AccessorTable accessor_table(isolate()->zone()); |
| 1609 for (int i = 0; i < expr->properties()->length(); i++) { | 1610 for (int i = 0; i < expr->properties()->length(); i++) { |
| 1610 ObjectLiteral::Property* property = expr->properties()->at(i); | 1611 ObjectLiteral::Property* property = expr->properties()->at(i); |
| 1611 if (property->IsCompileTimeValue()) continue; | 1612 if (property->IsCompileTimeValue()) continue; |
| 1612 | 1613 |
| 1613 Literal* key = property->key(); | 1614 Literal* key = property->key(); |
| 1614 Expression* value = property->value(); | 1615 Expression* value = property->value(); |
| 1615 if (!result_saved) { | 1616 if (!result_saved) { |
| 1616 __ push(r0); // Save result on stack | 1617 __ push(r0); // Save result on stack |
| (...skipping 2917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4534 *context_length = 0; | 4535 *context_length = 0; |
| 4535 return previous_; | 4536 return previous_; |
| 4536 } | 4537 } |
| 4537 | 4538 |
| 4538 | 4539 |
| 4539 #undef __ | 4540 #undef __ |
| 4540 | 4541 |
| 4541 } } // namespace v8::internal | 4542 } } // namespace v8::internal |
| 4542 | 4543 |
| 4543 #endif // V8_TARGET_ARCH_ARM | 4544 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |