OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 top->AllocateVariables(); | 58 top->AllocateVariables(); |
59 | 59 |
60 #ifdef DEBUG | 60 #ifdef DEBUG |
61 if (Bootstrapper::IsActive() ? | 61 if (Bootstrapper::IsActive() ? |
62 FLAG_print_builtin_scopes : | 62 FLAG_print_builtin_scopes : |
63 FLAG_print_scopes) { | 63 FLAG_print_scopes) { |
64 literal->scope()->Print(); | 64 literal->scope()->Print(); |
65 } | 65 } |
66 #endif | 66 #endif |
67 | 67 |
| 68 // Optimize the AST. |
| 69 Rewriter::Optimize(literal); |
| 70 |
68 // Generate code and return it. | 71 // Generate code and return it. |
69 Handle<Code> result = CodeGenerator::MakeCode(literal, script, is_eval); | 72 Handle<Code> result = CodeGenerator::MakeCode(literal, script, is_eval); |
70 return result; | 73 return result; |
71 } | 74 } |
72 | 75 |
73 | 76 |
74 static Handle<JSFunction> MakeFunction(bool is_global, | 77 static Handle<JSFunction> MakeFunction(bool is_global, |
75 bool is_eval, | 78 bool is_eval, |
76 Handle<Script> script, | 79 Handle<Script> script, |
77 v8::Extension* extension, | 80 v8::Extension* extension, |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // Set the expected number of properties for instances. | 288 // Set the expected number of properties for instances. |
286 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); | 289 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); |
287 | 290 |
288 // Check the function has compiled code. | 291 // Check the function has compiled code. |
289 ASSERT(shared->is_compiled()); | 292 ASSERT(shared->is_compiled()); |
290 return true; | 293 return true; |
291 } | 294 } |
292 | 295 |
293 | 296 |
294 } } // namespace v8::internal | 297 } } // namespace v8::internal |
OLD | NEW |