Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: src/mips/full-codegen-mips.cc

Issue 10041029: MIPS: Refactor code generation for global declarations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 ++global_count_; 820 globals_.Add(variable->name());
821 globals_.Add(variable->binding_needs_init()
822 ? isolate()->factory()->the_hole_value()
823 : isolate()->factory()->undefined_value());
821 break; 824 break;
822 825
823 case Variable::PARAMETER: 826 case Variable::PARAMETER:
824 case Variable::LOCAL: 827 case Variable::LOCAL:
825 if (hole_init) { 828 if (hole_init) {
826 Comment cmnt(masm_, "[ VariableDeclaration"); 829 Comment cmnt(masm_, "[ VariableDeclaration");
827 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 830 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
828 __ sw(t0, StackOperand(variable)); 831 __ sw(t0, StackOperand(variable));
829 } 832 }
830 break; 833 break;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 } 869 }
867 } 870 }
868 } 871 }
869 872
870 873
871 void FullCodeGenerator::VisitFunctionDeclaration( 874 void FullCodeGenerator::VisitFunctionDeclaration(
872 FunctionDeclaration* declaration) { 875 FunctionDeclaration* declaration) {
873 VariableProxy* proxy = declaration->proxy(); 876 VariableProxy* proxy = declaration->proxy();
874 Variable* variable = proxy->var(); 877 Variable* variable = proxy->var();
875 switch (variable->location()) { 878 switch (variable->location()) {
876 case Variable::UNALLOCATED: 879 case Variable::UNALLOCATED: {
877 ++global_count_; 880 globals_.Add(variable->name());
881 Handle<SharedFunctionInfo> function =
882 Compiler::BuildFunctionInfo(declaration->fun(), script());
883 // Check for stack-overflow exception.
884 if (function.is_null()) return SetStackOverflow();
885 globals_.Add(function);
878 break; 886 break;
887 }
879 888
880 case Variable::PARAMETER: 889 case Variable::PARAMETER:
881 case Variable::LOCAL: { 890 case Variable::LOCAL: {
882 Comment cmnt(masm_, "[ FunctionDeclaration"); 891 Comment cmnt(masm_, "[ FunctionDeclaration");
883 VisitForAccumulatorValue(declaration->fun()); 892 VisitForAccumulatorValue(declaration->fun());
884 __ sw(result_register(), StackOperand(variable)); 893 __ sw(result_register(), StackOperand(variable));
885 break; 894 break;
886 } 895 }
887 896
888 case Variable::CONTEXT: { 897 case Variable::CONTEXT: {
(...skipping 27 matching lines...) Expand all
916 } 925 }
917 } 926 }
918 } 927 }
919 928
920 929
921 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { 930 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
922 VariableProxy* proxy = declaration->proxy(); 931 VariableProxy* proxy = declaration->proxy();
923 Variable* variable = proxy->var(); 932 Variable* variable = proxy->var();
924 switch (variable->location()) { 933 switch (variable->location()) {
925 case Variable::UNALLOCATED: 934 case Variable::UNALLOCATED:
926 ++global_count_; 935 // TODO(rossberg): initialize module instance object
927 break; 936 break;
928 937
929 case Variable::CONTEXT: { 938 case Variable::CONTEXT: {
930 Comment cmnt(masm_, "[ ModuleDeclaration"); 939 Comment cmnt(masm_, "[ ModuleDeclaration");
931 EmitDebugCheckDeclarationContext(variable); 940 EmitDebugCheckDeclarationContext(variable);
932 // TODO(rossberg): initialize module instance object 941 // TODO(rossberg): initialize module instance object
933 break; 942 break;
934 } 943 }
935 944
936 case Variable::PARAMETER: 945 case Variable::PARAMETER:
937 case Variable::LOCAL: 946 case Variable::LOCAL:
938 case Variable::LOOKUP: 947 case Variable::LOOKUP:
939 UNREACHABLE(); 948 UNREACHABLE();
940 } 949 }
941 } 950 }
942 951
943 952
944 void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) { 953 void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) {
945 VariableProxy* proxy = declaration->proxy(); 954 VariableProxy* proxy = declaration->proxy();
946 Variable* variable = proxy->var(); 955 Variable* variable = proxy->var();
947 switch (variable->location()) { 956 switch (variable->location()) {
948 case Variable::UNALLOCATED: 957 case Variable::UNALLOCATED:
949 ++global_count_; 958 // TODO(rossberg)
950 break; 959 break;
951 960
952 case Variable::CONTEXT: { 961 case Variable::CONTEXT: {
953 Comment cmnt(masm_, "[ ImportDeclaration"); 962 Comment cmnt(masm_, "[ ImportDeclaration");
954 EmitDebugCheckDeclarationContext(variable); 963 EmitDebugCheckDeclarationContext(variable);
955 // TODO(rossberg) 964 // TODO(rossberg)
956 break; 965 break;
957 } 966 }
958 967
959 case Variable::PARAMETER: 968 case Variable::PARAMETER:
(...skipping 3680 matching lines...) Expand 10 before | Expand all | Expand 10 after
4640 *context_length = 0; 4649 *context_length = 0;
4641 return previous_; 4650 return previous_;
4642 } 4651 }
4643 4652
4644 4653
4645 #undef __ 4654 #undef __
4646 4655
4647 } } // namespace v8::internal 4656 } } // namespace v8::internal
4648 4657
4649 #endif // V8_TARGET_ARCH_MIPS 4658 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698