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

Unified Diff: src/compiler.h

Issue 651031: Begin using a list of bailouts instead of a singleton in the fast code generator. (Closed)
Patch Set: Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index 6ee2246b298d5ed60227348cbba461fee52897a0..f01889d0a13856dfa7a35d445ded0f7158c855a3 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -41,6 +41,37 @@ namespace internal {
// is constructed based on the resources available at compile-time.
class CompilationInfo BASE_EMBEDDED {
public:
+ // Compilation mode. Either the compiler is used as the primary
+ // compiler and needs to setup everything or the compiler is used as
+ // the secondary compiler for split compilation and has to handle
+ // bailouts.
+ enum Mode {
+ PRIMARY,
+ SECONDARY
+ };
+
+ // A description of the compilation state at a bailout to the secondary
+ // code generator.
+ //
+ // The state is currently simple: there are no parameters or local
+ // variables to worry about ('this' can be found in the stack frame).
+ // There are at most two live values.
+ //
+ // There is a label that should be bound to the beginning of the bailout
+ // stub code.
+ class Bailout : public ZoneObject {
+ public:
+ Bailout(Register left, Register right) : left_(left), right_(right) {}
fschneider 2010/02/19 14:47:14 label_ needs to be initialized here.
+
+ Label* label() { return &label_; }
+
+ private:
+ Register left_;
+ Register right_;
+ Label label_;
+ };
+
+
// Lazy compilation of a JSFunction.
CompilationInfo(Handle<JSFunction> closure,
int loop_nesting,
@@ -117,9 +148,13 @@ class CompilationInfo BASE_EMBEDDED {
int loop_nesting() { return loop_nesting_; }
bool has_receiver() { return !receiver_.is_null(); }
Handle<Object> receiver() { return receiver_; }
+ List<Bailout*>* bailouts() { return &bailouts_; }
- // Accessors for mutable fields, possibly set by analysis passes with
+ // Accessors for mutable fields (possibly set by analysis passes) with
// default values given by Initialize.
+ Mode mode() { return mode_; }
+ void set_mode(Mode mode) { mode_ = mode; }
+
bool has_this_properties() { return has_this_properties_; }
void set_has_this_properties(bool flag) { has_this_properties_ = flag; }
@@ -137,8 +172,19 @@ class CompilationInfo BASE_EMBEDDED {
// Derived accessors.
Scope* scope() { return function()->scope(); }
+ // Add a bailout with two live values.
+ Label* AddBailout(Register left, Register right) {
+ Bailout* bailout = new Bailout(left, right);
+ bailouts_.Add(bailout);
+ return bailout->label();
+ }
+
+ // Add a bailout with no live values.
+ Label* AddBailout() { return AddBailout(no_reg, no_reg); }
+
private:
void Initialize() {
+ mode_ = PRIMARY;
has_this_properties_ = false;
has_globals_ = false;
}
@@ -148,6 +194,7 @@ class CompilationInfo BASE_EMBEDDED {
Handle<Script> script_;
FunctionLiteral* function_;
+ Mode mode_;
bool is_eval_;
int loop_nesting_;
@@ -157,6 +204,10 @@ class CompilationInfo BASE_EMBEDDED {
bool has_this_properties_;
bool has_globals_;
+ // An ordered list of bailout points encountered during fast-path
+ // compilation.
+ List<Bailout*> bailouts_;
+
DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
};
« no previous file with comments | « src/codegen.cc ('k') | src/fast-codegen.h » ('j') | src/ia32/fast-codegen-ia32.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698