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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 #endif | 73 #endif |
74 | 74 |
75 // Optimize the AST. | 75 // Optimize the AST. |
76 if (!Rewriter::Optimize(literal)) { | 76 if (!Rewriter::Optimize(literal)) { |
77 // Signal a stack overflow by returning a null handle. The stack | 77 // Signal a stack overflow by returning a null handle. The stack |
78 // overflow exception will be thrown by the caller. | 78 // overflow exception will be thrown by the caller. |
79 return Handle<Code>::null(); | 79 return Handle<Code>::null(); |
80 } | 80 } |
81 | 81 |
82 if (FLAG_multipass) { | 82 if (FLAG_multipass) { |
83 Cfg* cfg = Cfg::Build(literal); | 83 CfgGlobals scope(literal); |
| 84 Cfg* cfg = Cfg::Build(); |
84 #ifdef DEBUG | 85 #ifdef DEBUG |
85 if (FLAG_print_cfg && cfg != NULL) { | 86 if (FLAG_print_cfg && cfg != NULL) { |
86 SmartPointer<char> name = literal->name()->ToCString(); | 87 SmartPointer<char> name = literal->name()->ToCString(); |
87 PrintF("Function \"%s\":\n", *name); | 88 PrintF("Function \"%s\":\n", *name); |
88 cfg->Print(); | 89 cfg->Print(); |
89 PrintF("\n"); | 90 PrintF("\n"); |
90 } | 91 } |
91 #endif | 92 #endif |
92 if (cfg != NULL) { | 93 if (cfg != NULL) { |
93 return cfg->Compile(literal, script); | 94 return cfg->Compile(script); |
94 } | 95 } |
95 } | 96 } |
96 | 97 |
97 // Generate code and return it. | 98 // Generate code and return it. |
98 Handle<Code> result = CodeGenerator::MakeCode(literal, script, is_eval); | 99 Handle<Code> result = CodeGenerator::MakeCode(literal, script, is_eval); |
99 return result; | 100 return result; |
100 } | 101 } |
101 | 102 |
102 | 103 |
103 static bool IsValidJSON(FunctionLiteral* lit) { | 104 static bool IsValidJSON(FunctionLiteral* lit) { |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 // Set the expected number of properties for instances. | 417 // Set the expected number of properties for instances. |
417 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); | 418 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); |
418 | 419 |
419 // Check the function has compiled code. | 420 // Check the function has compiled code. |
420 ASSERT(shared->is_compiled()); | 421 ASSERT(shared->is_compiled()); |
421 return true; | 422 return true; |
422 } | 423 } |
423 | 424 |
424 | 425 |
425 } } // namespace v8::internal | 426 } } // namespace v8::internal |
OLD | NEW |