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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 Visit(node->try_block()); | 214 Visit(node->try_block()); |
215 { WeightScaler ws(this, 0.25); | 215 { WeightScaler ws(this, 0.25); |
216 Write(node->catch_var()); | 216 Write(node->catch_var()); |
217 Visit(node->catch_block()); | 217 Visit(node->catch_block()); |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 | 221 |
222 void UsageComputer::VisitTryFinally(TryFinally* node) { | 222 void UsageComputer::VisitTryFinally(TryFinally* node) { |
223 Visit(node->try_block()); | 223 Visit(node->try_block()); |
224 Expression* var = node->finally_var(); | |
225 if (var != NULL) { | |
226 Write(var); | |
227 Read(var); | |
228 } | |
229 Visit(node->finally_block()); | 224 Visit(node->finally_block()); |
230 } | 225 } |
231 | 226 |
232 | 227 |
233 void UsageComputer::VisitDebuggerStatement(DebuggerStatement* node) { | 228 void UsageComputer::VisitDebuggerStatement(DebuggerStatement* node) { |
234 } | 229 } |
235 | 230 |
236 | 231 |
237 void UsageComputer::VisitFunctionLiteral(FunctionLiteral* node) { | 232 void UsageComputer::VisitFunctionLiteral(FunctionLiteral* node) { |
238 ZoneList<Declaration*>* decls = node->scope()->declarations(); | 233 ZoneList<Declaration*>* decls = node->scope()->declarations(); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 429 |
435 // ---------------------------------------------------------------------------- | 430 // ---------------------------------------------------------------------------- |
436 // Interface to variable usage analysis | 431 // Interface to variable usage analysis |
437 | 432 |
438 bool AnalyzeVariableUsage(FunctionLiteral* lit) { | 433 bool AnalyzeVariableUsage(FunctionLiteral* lit) { |
439 if (!FLAG_usage_computation) return true; | 434 if (!FLAG_usage_computation) return true; |
440 return UsageComputer::Traverse(lit); | 435 return UsageComputer::Traverse(lit); |
441 } | 436 } |
442 | 437 |
443 } } // namespace v8::internal | 438 } } // namespace v8::internal |
OLD | NEW |