OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 | 48 |
49 #define CHECK_BAILOUT \ | 49 #define CHECK_BAILOUT \ |
50 do { \ | 50 do { \ |
51 if (!has_supported_syntax_) return; \ | 51 if (!has_supported_syntax_) return; \ |
52 } while (false) | 52 } while (false) |
53 | 53 |
54 | 54 |
55 void FullCodeGenSyntaxChecker::Check(FunctionLiteral* fun) { | 55 void FullCodeGenSyntaxChecker::Check(FunctionLiteral* fun) { |
56 Scope* scope = fun->scope(); | 56 Scope* scope = fun->scope(); |
57 | |
58 if (scope->num_heap_slots() > 0) { | |
59 // We support functions with a local context if they do not have | |
60 // parameters that need to be copied into the context. | |
61 for (int i = 0, len = scope->num_parameters(); i < len; i++) { | |
62 Slot* slot = scope->parameter(i)->slot(); | |
63 if (slot != NULL && slot->type() == Slot::CONTEXT) { | |
64 BAILOUT("Function has context-allocated parameters."); | |
65 } | |
66 } | |
67 } | |
68 | |
69 VisitDeclarations(scope->declarations()); | 57 VisitDeclarations(scope->declarations()); |
70 CHECK_BAILOUT; | 58 CHECK_BAILOUT; |
71 | 59 |
72 VisitStatements(fun->body()); | 60 VisitStatements(fun->body()); |
73 } | 61 } |
74 | 62 |
75 | 63 |
76 void FullCodeGenSyntaxChecker::VisitDeclarations( | 64 void FullCodeGenSyntaxChecker::VisitDeclarations( |
77 ZoneList<Declaration*>* decls) { | 65 ZoneList<Declaration*>* decls) { |
78 for (int i = 0; i < decls->length(); i++) { | 66 for (int i = 0; i < decls->length(); i++) { |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 // The macros used here must preserve the result register. | 1146 // The macros used here must preserve the result register. |
1159 __ Drop(stack_depth); | 1147 __ Drop(stack_depth); |
1160 __ PopTryHandler(); | 1148 __ PopTryHandler(); |
1161 return 0; | 1149 return 0; |
1162 } | 1150 } |
1163 | 1151 |
1164 #undef __ | 1152 #undef __ |
1165 | 1153 |
1166 | 1154 |
1167 } } // namespace v8::internal | 1155 } } // namespace v8::internal |
OLD | NEW |