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

Side by Side Diff: src/fast-codegen.h

Issue 341081: Begin using the top-level code generator for code that is inside... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 25 matching lines...) Expand all
36 namespace internal { 36 namespace internal {
37 37
38 38
39 class FastCodeGenerator: public AstVisitor { 39 class FastCodeGenerator: public AstVisitor {
40 public: 40 public:
41 FastCodeGenerator(MacroAssembler* masm, Handle<Script> script, bool is_eval) 41 FastCodeGenerator(MacroAssembler* masm, Handle<Script> script, bool is_eval)
42 : masm_(masm), 42 : masm_(masm),
43 function_(NULL), 43 function_(NULL),
44 script_(script), 44 script_(script),
45 is_eval_(is_eval), 45 is_eval_(is_eval),
46 loop_depth_(0),
46 true_label_(NULL), 47 true_label_(NULL),
47 false_label_(NULL) { 48 false_label_(NULL) {
48 } 49 }
49 50
50 static Handle<Code> MakeCode(FunctionLiteral* fun, 51 static Handle<Code> MakeCode(FunctionLiteral* fun,
51 Handle<Script> script, 52 Handle<Script> script,
52 bool is_eval); 53 bool is_eval);
53 54
54 void Generate(FunctionLiteral* fun); 55 void Generate(FunctionLiteral* fun);
55 56
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 88
88 // Complete a keyed property assignment. The reciever, key, and 89 // Complete a keyed property assignment. The reciever, key, and
89 // right-hand-side value are expected on top of the stack. 90 // right-hand-side value are expected on top of the stack.
90 void EmitKeyedPropertyAssignment(Assignment* expr); 91 void EmitKeyedPropertyAssignment(Assignment* expr);
91 92
92 void SetFunctionPosition(FunctionLiteral* fun); 93 void SetFunctionPosition(FunctionLiteral* fun);
93 void SetReturnPosition(FunctionLiteral* fun); 94 void SetReturnPosition(FunctionLiteral* fun);
94 void SetStatementPosition(Statement* stmt); 95 void SetStatementPosition(Statement* stmt);
95 void SetSourcePosition(int pos); 96 void SetSourcePosition(int pos);
96 97
98 int loop_depth() { return loop_depth_; }
99 void increment_loop_depth() { loop_depth_++; }
100 void decrement_loop_depth() {
101 ASSERT(loop_depth_ > 0);
102 loop_depth_--;
103 }
104
97 // AST node visit functions. 105 // AST node visit functions.
98 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); 106 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
99 AST_NODE_LIST(DECLARE_VISIT) 107 AST_NODE_LIST(DECLARE_VISIT)
100 #undef DECLARE_VISIT 108 #undef DECLARE_VISIT
101 109
102 // Handles the shortcutted logical binary operations in VisitBinaryOperation. 110 // Handles the shortcutted logical binary operations in VisitBinaryOperation.
103 void EmitLogicalOperation(BinaryOperation* expr); 111 void EmitLogicalOperation(BinaryOperation* expr);
104 112
105 MacroAssembler* masm_; 113 MacroAssembler* masm_;
106 FunctionLiteral* function_; 114 FunctionLiteral* function_;
107 Handle<Script> script_; 115 Handle<Script> script_;
108 bool is_eval_; 116 bool is_eval_;
109 Label return_label_; 117 Label return_label_;
118 int loop_depth_;
110 119
111 Label* true_label_; 120 Label* true_label_;
112 Label* false_label_; 121 Label* false_label_;
113 122
114 DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator); 123 DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator);
115 }; 124 };
116 125
117 126
118 } } // namespace v8::internal 127 } } // namespace v8::internal
119 128
120 #endif // V8_FAST_CODEGEN_H_ 129 #endif // V8_FAST_CODEGEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698