| Index: src/codegen-ia32.h
|
| ===================================================================
|
| --- src/codegen-ia32.h (revision 483)
|
| +++ src/codegen-ia32.h (working copy)
|
| @@ -38,8 +38,65 @@
|
| // Mode to overwrite BinaryExpression values.
|
| enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT };
|
|
|
| +enum InitState { CONST_INIT, NOT_CONST_INIT };
|
| +enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
|
|
|
| -// -----------------------------------------------------------------------------
|
| +
|
| +// -------------------------------------------------------------------------
|
| +// Virtual frame
|
| +
|
| +class VirtualFrame BASE_EMBEDDED {
|
| + public:
|
| + explicit VirtualFrame(CodeGenerator* cgen);
|
| +
|
| + void Enter();
|
| + void Exit();
|
| +
|
| + void AllocateLocals();
|
| +
|
| + Operand Top() const { return Operand(esp, 0); }
|
| +
|
| + Operand Element(int index) const {
|
| + return Operand(esp, index * kPointerSize);
|
| + }
|
| +
|
| + Operand Local(int index) const {
|
| + ASSERT(0 <= index && index < frame_local_count_);
|
| + return Operand(ebp, kLocal0Offset - index * kPointerSize);
|
| + }
|
| +
|
| + Operand Function() const { return Operand(ebp, kFunctionOffset); }
|
| +
|
| + Operand Context() const { return Operand(ebp, kContextOffset); }
|
| +
|
| + Operand Parameter(int index) const {
|
| + ASSERT(-1 <= index && index < parameter_count_);
|
| + return Operand(ebp, (1 + parameter_count_ - index) * kPointerSize);
|
| + }
|
| +
|
| + Operand Receiver() const { return Parameter(-1); }
|
| +
|
| + inline void Drop(int count);
|
| +
|
| + inline void Pop(Register reg);
|
| + inline void Pop(Operand operand);
|
| +
|
| + inline void Push(Register reg);
|
| + inline void Push(Operand operand);
|
| + inline void Push(Immediate immediate);
|
| +
|
| + private:
|
| + static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset;
|
| + static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset;
|
| + static const int kContextOffset = StandardFrameConstants::kContextOffset;
|
| +
|
| + MacroAssembler* masm_;
|
| + int frame_local_count_;
|
| + int parameter_count_;
|
| +};
|
| +
|
| +
|
| +// -------------------------------------------------------------------------
|
| // Reference support
|
|
|
| // A reference is a C++ stack-allocated object that keeps an ECMA
|
| @@ -49,9 +106,6 @@
|
| // For properties, we keep either one (named) or two (indexed) values
|
| // on the execution stack to represent the reference.
|
|
|
| -enum InitState { CONST_INIT, NOT_CONST_INIT };
|
| -enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
|
| -
|
| class Reference BASE_EMBEDDED {
|
| public:
|
| // The values of the types is important, see size().
|
| @@ -135,10 +189,9 @@
|
|
|
|
|
|
|
| -// -----------------------------------------------------------------------------
|
| +// -------------------------------------------------------------------------
|
| // CodeGenerator
|
|
|
| -//
|
| class CodeGenerator: public Visitor {
|
| public:
|
| // Takes a function literal, generates code for it. This function should only
|
| @@ -159,6 +212,8 @@
|
| // Accessors
|
| MacroAssembler* masm() { return masm_; }
|
|
|
| + VirtualFrame* frame() const { return frame_; }
|
| +
|
| CodeGenState* state() { return state_; }
|
| void set_state(CodeGenState* state) { state_ = state; }
|
|
|
| @@ -196,19 +251,6 @@
|
| void LoadReference(Reference* ref);
|
| void UnloadReference(Reference* ref);
|
|
|
| - // Support functions for accessing parameters and other operands.
|
| - Operand ParameterOperand(int index) const {
|
| - int num_parameters = scope()->num_parameters();
|
| - ASSERT(-2 <= index && index < num_parameters);
|
| - return Operand(ebp, (1 + num_parameters - index) * kPointerSize);
|
| - }
|
| -
|
| - Operand ReceiverOperand() const { return ParameterOperand(-1); }
|
| -
|
| - Operand FunctionOperand() const {
|
| - return Operand(ebp, JavaScriptFrameConstants::kFunctionOffset);
|
| - }
|
| -
|
| Operand ContextOperand(Register context, int index) const {
|
| return Operand(context, Context::SlotOffset(index));
|
| }
|
| @@ -349,11 +391,6 @@
|
| // should be generated or not.
|
| void RecordStatementPosition(Node* node);
|
|
|
| - // Activation frames.
|
| - void EnterJSFrame();
|
| - void ExitJSFrame();
|
| -
|
| -
|
| bool is_eval_; // Tells whether code is generated for eval.
|
| Handle<Script> script_;
|
| List<DeferredCode*> deferred_;
|
| @@ -363,6 +400,7 @@
|
|
|
| // Code generation state
|
| Scope* scope_;
|
| + VirtualFrame* frame_;
|
| Condition cc_reg_;
|
| CodeGenState* state_;
|
| bool is_inside_try_;
|
| @@ -371,10 +409,8 @@
|
| // Labels
|
| Label function_return_;
|
|
|
| + friend class VirtualFrame;
|
| friend class Reference;
|
| - friend class Property;
|
| - friend class VariableProxy;
|
| - friend class Slot;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(CodeGenerator);
|
| };
|
|
|