OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 23 matching lines...) Expand all Loading... |
35 | 35 |
36 class Rewriter { | 36 class Rewriter { |
37 public: | 37 public: |
38 // Rewrite top-level code (ECMA 262 "programs") so as to conservatively | 38 // Rewrite top-level code (ECMA 262 "programs") so as to conservatively |
39 // include an assignment of the value of the last statement in the code to | 39 // include an assignment of the value of the last statement in the code to |
40 // a compiler-generated temporary variable wherever needed. | 40 // a compiler-generated temporary variable wherever needed. |
41 // | 41 // |
42 // Assumes code has been parsed and scopes have been analyzed. Mutates the | 42 // Assumes code has been parsed and scopes have been analyzed. Mutates the |
43 // AST, so the AST should not continue to be used in the case of failure. | 43 // AST, so the AST should not continue to be used in the case of failure. |
44 static bool Rewrite(CompilationInfo* info); | 44 static bool Rewrite(CompilationInfo* info); |
45 | |
46 // Perform a suite of simple non-iterative analyses of the AST. Mark | |
47 // expressions that are likely smis, expressions without side effects, | |
48 // expressions whose value will be converted to Int32, and expressions in a | |
49 // context where +0 and -0 are treated the same. | |
50 // | |
51 // Assumes code has been parsed and scopes have been analyzed. Mutates the | |
52 // AST, so the AST should not continue to be used in the case of failure. | |
53 static bool Analyze(CompilationInfo* info); | |
54 }; | 45 }; |
55 | 46 |
56 | 47 |
57 } } // namespace v8::internal | 48 } } // namespace v8::internal |
58 | 49 |
59 #endif // V8_REWRITER_H_ | 50 #endif // V8_REWRITER_H_ |
OLD | NEW |