| Index: src/compiler.h
|
| ===================================================================
|
| --- src/compiler.h (revision 3935)
|
| +++ src/compiler.h (working copy)
|
| @@ -28,8 +28,10 @@
|
| #ifndef V8_COMPILER_H_
|
| #define V8_COMPILER_H_
|
|
|
| +#include "ast.h"
|
| #include "frame-element.h"
|
| #include "parser.h"
|
| +#include "register-allocator.h"
|
| #include "zone.h"
|
|
|
| namespace v8 {
|
| @@ -39,6 +41,37 @@
|
| // 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) {}
|
| +
|
| + Label* label() { return &label_; }
|
| +
|
| + private:
|
| + Register left_;
|
| + Register right_;
|
| + Label label_;
|
| + };
|
| +
|
| +
|
| // Lazy compilation of a JSFunction.
|
| CompilationInfo(Handle<JSFunction> closure,
|
| int loop_nesting,
|
| @@ -115,9 +148,13 @@
|
| 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; }
|
|
|
| @@ -135,8 +172,19 @@
|
| // 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;
|
| }
|
| @@ -146,6 +194,7 @@
|
| Handle<Script> script_;
|
|
|
| FunctionLiteral* function_;
|
| + Mode mode_;
|
|
|
| bool is_eval_;
|
| int loop_nesting_;
|
| @@ -155,6 +204,10 @@
|
| 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);
|
| };
|
|
|
| @@ -183,7 +236,8 @@
|
| Handle<Object> script_name,
|
| int line_offset, int column_offset,
|
| v8::Extension* extension,
|
| - ScriptDataImpl* script_Data,
|
| + ScriptDataImpl* pre_data,
|
| + Handle<Object> script_data,
|
| NativesFlag is_natives_code);
|
|
|
| // Compile a String source within a context for Eval.
|
|
|