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

Side by Side Diff: src/compiler.h

Issue 3152016: Remove experimental fast-codegen. We are no longer working on this (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 23 matching lines...) Expand all
34 #include "register-allocator.h" 34 #include "register-allocator.h"
35 #include "zone.h" 35 #include "zone.h"
36 36
37 namespace v8 { 37 namespace v8 {
38 namespace internal { 38 namespace internal {
39 39
40 // CompilationInfo encapsulates some information known at compile time. It 40 // CompilationInfo encapsulates some information known at compile time. It
41 // is constructed based on the resources available at compile-time. 41 // is constructed based on the resources available at compile-time.
42 class CompilationInfo BASE_EMBEDDED { 42 class CompilationInfo BASE_EMBEDDED {
43 public: 43 public:
44 // Compilation mode. Either the compiler is used as the primary
45 // compiler and needs to setup everything or the compiler is used as
46 // the secondary compiler for split compilation and has to handle
47 // bailouts.
48 enum Mode {
49 PRIMARY,
50 SECONDARY
51 };
52
53 // A description of the compilation state at a bailout to the secondary
54 // code generator.
55 //
56 // The state is currently simple: there are no parameters or local
57 // variables to worry about ('this' can be found in the stack frame).
58 // There are at most two live values.
59 //
60 // There is a label that should be bound to the beginning of the bailout
61 // stub code.
62 class Bailout : public ZoneObject {
63 public:
64 Bailout(Register left, Register right) : left_(left), right_(right) {}
65
66 Label* label() { return &label_; }
67
68 private:
69 Register left_;
70 Register right_;
71 Label label_;
72 };
73
74
75 // Lazy compilation of a JSFunction. 44 // Lazy compilation of a JSFunction.
76 CompilationInfo(Handle<JSFunction> closure, 45 CompilationInfo(Handle<JSFunction> closure,
77 int loop_nesting, 46 int loop_nesting,
78 Handle<Object> receiver) 47 Handle<Object> receiver)
79 : closure_(closure), 48 : closure_(closure),
80 function_(NULL), 49 function_(NULL),
81 is_eval_(false), 50 is_eval_(false),
82 loop_nesting_(loop_nesting), 51 loop_nesting_(loop_nesting),
83 receiver_(receiver) { 52 receiver_(receiver) {
84 Initialize(); 53 Initialize();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // There should always be a function literal, but it may be set after 107 // There should always be a function literal, but it may be set after
139 // construction (for lazy compilation). 108 // construction (for lazy compilation).
140 FunctionLiteral* function() { return function_; } 109 FunctionLiteral* function() { return function_; }
141 void set_function(FunctionLiteral* literal) { function_ = literal; } 110 void set_function(FunctionLiteral* literal) { function_ = literal; }
142 111
143 // Simple accessors. 112 // Simple accessors.
144 bool is_eval() { return is_eval_; } 113 bool is_eval() { return is_eval_; }
145 int loop_nesting() { return loop_nesting_; } 114 int loop_nesting() { return loop_nesting_; }
146 bool has_receiver() { return !receiver_.is_null(); } 115 bool has_receiver() { return !receiver_.is_null(); }
147 Handle<Object> receiver() { return receiver_; } 116 Handle<Object> receiver() { return receiver_; }
148 List<Bailout*>* bailouts() { return &bailouts_; }
149
150 // Accessors for mutable fields (possibly set by analysis passes) with
151 // default values given by Initialize.
152 Mode mode() { return mode_; }
153 void set_mode(Mode mode) { mode_ = mode; }
154 117
155 bool has_this_properties() { return has_this_properties_; } 118 bool has_this_properties() { return has_this_properties_; }
156 void set_has_this_properties(bool flag) { has_this_properties_ = flag; } 119 void set_has_this_properties(bool flag) { has_this_properties_ = flag; }
157 120
158 bool has_global_object() { 121 bool has_global_object() {
159 return !closure().is_null() && (closure()->context()->global() != NULL); 122 return !closure().is_null() && (closure()->context()->global() != NULL);
160 } 123 }
161 124
162 GlobalObject* global_object() { 125 GlobalObject* global_object() {
163 return has_global_object() ? closure()->context()->global() : NULL; 126 return has_global_object() ? closure()->context()->global() : NULL;
164 } 127 }
165 128
166 bool has_globals() { return has_globals_; } 129 bool has_globals() { return has_globals_; }
167 void set_has_globals(bool flag) { has_globals_ = flag; } 130 void set_has_globals(bool flag) { has_globals_ = flag; }
168 131
169 // Derived accessors. 132 // Derived accessors.
170 Scope* scope() { return function()->scope(); } 133 Scope* scope() { return function()->scope(); }
171 134
172 // Add a bailout with two live values.
173 Label* AddBailout(Register left, Register right) {
174 Bailout* bailout = new Bailout(left, right);
175 bailouts_.Add(bailout);
176 return bailout->label();
177 }
178
179 // Add a bailout with no live values.
180 Label* AddBailout() { return AddBailout(no_reg, no_reg); }
181
182 private: 135 private:
183 void Initialize() { 136 void Initialize() {
184 mode_ = PRIMARY;
185 has_this_properties_ = false; 137 has_this_properties_ = false;
186 has_globals_ = false; 138 has_globals_ = false;
187 } 139 }
188 140
189 Handle<JSFunction> closure_; 141 Handle<JSFunction> closure_;
190 Handle<SharedFunctionInfo> shared_info_; 142 Handle<SharedFunctionInfo> shared_info_;
191 Handle<Script> script_; 143 Handle<Script> script_;
192 144
193 FunctionLiteral* function_; 145 FunctionLiteral* function_;
194 Mode mode_;
195 146
196 bool is_eval_; 147 bool is_eval_;
197 int loop_nesting_; 148 int loop_nesting_;
198 149
199 Handle<Object> receiver_; 150 Handle<Object> receiver_;
200 151
201 bool has_this_properties_; 152 bool has_this_properties_;
202 bool has_globals_; 153 bool has_globals_;
203 154
204 // An ordered list of bailout points encountered during fast-path
205 // compilation.
206 List<Bailout*> bailouts_;
207
208 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); 155 DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
209 }; 156 };
210 157
211 158
212 // The V8 compiler 159 // The V8 compiler
213 // 160 //
214 // General strategy: Source code is translated into an anonymous function w/o 161 // General strategy: Source code is translated into an anonymous function w/o
215 // parameters which then can be executed. If the source code contains other 162 // parameters which then can be executed. If the source code contains other
216 // functions, they will be compiled and allocated as part of the compilation 163 // functions, they will be compiled and allocated as part of the compilation
217 // of the source code. 164 // of the source code.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 FrameElement::ClearConstantList(); 237 FrameElement::ClearConstantList();
291 Result::ClearConstantList(); 238 Result::ClearConstantList();
292 } 239 }
293 } 240 }
294 }; 241 };
295 242
296 243
297 } } // namespace v8::internal 244 } } // namespace v8::internal
298 245
299 #endif // V8_COMPILER_H_ 246 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698