Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: src/rewriter.h

Issue 3561012: More refactoring of class Compiler's interface. (Closed)
Patch Set: Reindent some code, change some copyright dates. Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 12 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_REWRITER_H_ 28 #ifndef V8_REWRITER_H_
29 #define V8_REWRITER_H_ 29 #define V8_REWRITER_H_
30 30
31 namespace v8 { 31 namespace v8 {
32 namespace internal { 32 namespace internal {
33 33
34 34 class CompilationInfo;
35 // Currently, the rewriter takes function literals (only top-level)
36 // and rewrites them to return the value of the last expression in
37 // them.
38 //
39 // The rewriter adds a (hidden) variable, called .result, to the
40 // activation, and tries to figure out where it needs to store into
41 // this variable. If the variable is ever used, we conclude by adding
42 // a return statement that returns the variable to the body of the
43 // given function.
44 35
45 class Rewriter { 36 class Rewriter {
46 public: 37 public:
47 static bool Process(FunctionLiteral* function); 38 // Rewrite top-level code (ECMA 262 "programs") so as to conservatively
48 static bool Optimize(FunctionLiteral* function); 39 // include an assignment of the value of the last statement in the code to
40 // a compiler-generated temporary variable wherever needed.
41 //
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.
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);
49 }; 54 };
50 55
51 56
52 } } // namespace v8::internal 57 } } // namespace v8::internal
53 58
54 #endif // V8_REWRITER_H_ 59 #endif // V8_REWRITER_H_
OLDNEW
« src/compiler.h ('K') | « src/objects.cc ('k') | src/rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698