| 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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 VariableDeclaration* declaration) { | 810 VariableDeclaration* declaration) { |
| 811 // If it was not possible to allocate the variable at compile time, we | 811 // If it was not possible to allocate the variable at compile time, we |
| 812 // need to "declare" it at runtime to make sure it actually exists in the | 812 // need to "declare" it at runtime to make sure it actually exists in the |
| 813 // local context. | 813 // local context. |
| 814 VariableProxy* proxy = declaration->proxy(); | 814 VariableProxy* proxy = declaration->proxy(); |
| 815 VariableMode mode = declaration->mode(); | 815 VariableMode mode = declaration->mode(); |
| 816 Variable* variable = proxy->var(); | 816 Variable* variable = proxy->var(); |
| 817 bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET; | 817 bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET; |
| 818 switch (variable->location()) { | 818 switch (variable->location()) { |
| 819 case Variable::UNALLOCATED: | 819 case Variable::UNALLOCATED: |
| 820 globals_->Add(variable->name()); | 820 globals_->Add(variable->name(), zone()); |
| 821 globals_->Add(variable->binding_needs_init() | 821 globals_->Add(variable->binding_needs_init() |
| 822 ? isolate()->factory()->the_hole_value() | 822 ? isolate()->factory()->the_hole_value() |
| 823 : isolate()->factory()->undefined_value()); | 823 : isolate()->factory()->undefined_value(), |
| 824 zone()); |
| 824 break; | 825 break; |
| 825 | 826 |
| 826 case Variable::PARAMETER: | 827 case Variable::PARAMETER: |
| 827 case Variable::LOCAL: | 828 case Variable::LOCAL: |
| 828 if (hole_init) { | 829 if (hole_init) { |
| 829 Comment cmnt(masm_, "[ VariableDeclaration"); | 830 Comment cmnt(masm_, "[ VariableDeclaration"); |
| 830 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); | 831 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); |
| 831 __ sw(t0, StackOperand(variable)); | 832 __ sw(t0, StackOperand(variable)); |
| 832 } | 833 } |
| 833 break; | 834 break; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 } | 871 } |
| 871 } | 872 } |
| 872 | 873 |
| 873 | 874 |
| 874 void FullCodeGenerator::VisitFunctionDeclaration( | 875 void FullCodeGenerator::VisitFunctionDeclaration( |
| 875 FunctionDeclaration* declaration) { | 876 FunctionDeclaration* declaration) { |
| 876 VariableProxy* proxy = declaration->proxy(); | 877 VariableProxy* proxy = declaration->proxy(); |
| 877 Variable* variable = proxy->var(); | 878 Variable* variable = proxy->var(); |
| 878 switch (variable->location()) { | 879 switch (variable->location()) { |
| 879 case Variable::UNALLOCATED: { | 880 case Variable::UNALLOCATED: { |
| 880 globals_->Add(variable->name()); | 881 globals_->Add(variable->name(), zone()); |
| 881 Handle<SharedFunctionInfo> function = | 882 Handle<SharedFunctionInfo> function = |
| 882 Compiler::BuildFunctionInfo(declaration->fun(), script()); | 883 Compiler::BuildFunctionInfo(declaration->fun(), script()); |
| 883 // Check for stack-overflow exception. | 884 // Check for stack-overflow exception. |
| 884 if (function.is_null()) return SetStackOverflow(); | 885 if (function.is_null()) return SetStackOverflow(); |
| 885 globals_->Add(function); | 886 globals_->Add(function, zone()); |
| 886 break; | 887 break; |
| 887 } | 888 } |
| 888 | 889 |
| 889 case Variable::PARAMETER: | 890 case Variable::PARAMETER: |
| 890 case Variable::LOCAL: { | 891 case Variable::LOCAL: { |
| 891 Comment cmnt(masm_, "[ FunctionDeclaration"); | 892 Comment cmnt(masm_, "[ FunctionDeclaration"); |
| 892 VisitForAccumulatorValue(declaration->fun()); | 893 VisitForAccumulatorValue(declaration->fun()); |
| 893 __ sw(result_register(), StackOperand(variable)); | 894 __ sw(result_register(), StackOperand(variable)); |
| 894 break; | 895 break; |
| 895 } | 896 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 | 930 |
| 930 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { | 931 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { |
| 931 VariableProxy* proxy = declaration->proxy(); | 932 VariableProxy* proxy = declaration->proxy(); |
| 932 Variable* variable = proxy->var(); | 933 Variable* variable = proxy->var(); |
| 933 Handle<JSModule> instance = declaration->module()->interface()->Instance(); | 934 Handle<JSModule> instance = declaration->module()->interface()->Instance(); |
| 934 ASSERT(!instance.is_null()); | 935 ASSERT(!instance.is_null()); |
| 935 | 936 |
| 936 switch (variable->location()) { | 937 switch (variable->location()) { |
| 937 case Variable::UNALLOCATED: { | 938 case Variable::UNALLOCATED: { |
| 938 Comment cmnt(masm_, "[ ModuleDeclaration"); | 939 Comment cmnt(masm_, "[ ModuleDeclaration"); |
| 939 globals_->Add(variable->name()); | 940 globals_->Add(variable->name(), zone()); |
| 940 globals_->Add(instance); | 941 globals_->Add(instance, zone()); |
| 941 Visit(declaration->module()); | 942 Visit(declaration->module()); |
| 942 break; | 943 break; |
| 943 } | 944 } |
| 944 | 945 |
| 945 case Variable::CONTEXT: { | 946 case Variable::CONTEXT: { |
| 946 Comment cmnt(masm_, "[ ModuleDeclaration"); | 947 Comment cmnt(masm_, "[ ModuleDeclaration"); |
| 947 EmitDebugCheckDeclarationContext(variable); | 948 EmitDebugCheckDeclarationContext(variable); |
| 948 __ li(a1, Operand(instance)); | 949 __ li(a1, Operand(instance)); |
| 949 __ sw(a1, ContextOperand(cp, variable->index())); | 950 __ sw(a1, ContextOperand(cp, variable->index())); |
| 950 Visit(declaration->module()); | 951 Visit(declaration->module()); |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 __ CallStub(&stub); | 1605 __ CallStub(&stub); |
| 1605 } | 1606 } |
| 1606 | 1607 |
| 1607 // If result_saved is true the result is on top of the stack. If | 1608 // If result_saved is true the result is on top of the stack. If |
| 1608 // result_saved is false the result is in v0. | 1609 // result_saved is false the result is in v0. |
| 1609 bool result_saved = false; | 1610 bool result_saved = false; |
| 1610 | 1611 |
| 1611 // Mark all computed expressions that are bound to a key that | 1612 // Mark all computed expressions that are bound to a key that |
| 1612 // is shadowed by a later occurrence of the same key. For the | 1613 // is shadowed by a later occurrence of the same key. For the |
| 1613 // marked expressions, no store code is emitted. | 1614 // marked expressions, no store code is emitted. |
| 1614 expr->CalculateEmitStore(); | 1615 expr->CalculateEmitStore(zone()); |
| 1615 | 1616 |
| 1616 AccessorTable accessor_table(isolate()->zone()); | 1617 AccessorTable accessor_table(isolate()->zone()); |
| 1617 for (int i = 0; i < expr->properties()->length(); i++) { | 1618 for (int i = 0; i < expr->properties()->length(); i++) { |
| 1618 ObjectLiteral::Property* property = expr->properties()->at(i); | 1619 ObjectLiteral::Property* property = expr->properties()->at(i); |
| 1619 if (property->IsCompileTimeValue()) continue; | 1620 if (property->IsCompileTimeValue()) continue; |
| 1620 | 1621 |
| 1621 Literal* key = property->key(); | 1622 Literal* key = property->key(); |
| 1622 Expression* value = property->value(); | 1623 Expression* value = property->value(); |
| 1623 if (!result_saved) { | 1624 if (!result_saved) { |
| 1624 __ push(v0); // Save result on stack. | 1625 __ push(v0); // Save result on stack. |
| (...skipping 2947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4572 *context_length = 0; | 4573 *context_length = 0; |
| 4573 return previous_; | 4574 return previous_; |
| 4574 } | 4575 } |
| 4575 | 4576 |
| 4576 | 4577 |
| 4577 #undef __ | 4578 #undef __ |
| 4578 | 4579 |
| 4579 } } // namespace v8::internal | 4580 } } // namespace v8::internal |
| 4580 | 4581 |
| 4581 #endif // V8_TARGET_ARCH_MIPS | 4582 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |