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

Unified Diff: src/codegen-arm.h

Issue 10693: Merged bleeding_edge -r 685:746 into regexp2000. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: Created 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins-ia32.cc ('k') | src/codegen-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen-arm.h
===================================================================
--- src/codegen-arm.h (revision 746)
+++ src/codegen-arm.h (working copy)
@@ -38,8 +38,62 @@
// 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();
+
+ MemOperand Top() const { return MemOperand(sp, 0); }
+
+ MemOperand Element(int index) const {
+ return MemOperand(sp, index * kPointerSize);
+ }
+
+ MemOperand Local(int index) const {
+ ASSERT(0 <= index && index < frame_local_count_);
+ return MemOperand(fp, kLocal0Offset - index * kPointerSize);
+ }
+
+ MemOperand Function() const { return MemOperand(fp, kFunctionOffset); }
+
+ MemOperand Context() const { return MemOperand(fp, kContextOffset); }
+
+ MemOperand Parameter(int index) const {
+ // Index -1 corresponds to the receiver.
+ ASSERT(-1 <= index && index <= parameter_count_);
+ return MemOperand(fp, (1 + parameter_count_ - index) * kPointerSize);
+ }
+
+ inline void Drop(int count);
+
+ inline void Pop();
+ inline void Pop(Register reg);
+
+ inline void Push(Register reg);
+
+ 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 +103,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().
@@ -66,8 +117,8 @@
type_ = value;
}
- // The size of the reference or -1 if the reference is illegal.
- int size() const { return type_; }
+ // The size the reference takes up on the stack.
+ int size() const { return (type_ == ILLEGAL) ? 0 : type_; }
bool is_illegal() const { return type_ == ILLEGAL; }
bool is_slot() const { return type_ == SLOT; }
@@ -133,7 +184,7 @@
};
-// -----------------------------------------------------------------------------
+// -------------------------------------------------------------------------
// CodeGenerator
class CodeGenerator: public Visitor {
@@ -156,6 +207,8 @@
// Accessors
MacroAssembler* masm() { return masm_; }
+ VirtualFrame* frame() const { return frame_; }
+
CodeGenState* state() { return state_; }
void set_state(CodeGenState* state) { state_ = state; }
@@ -193,20 +246,6 @@
void LoadReference(Reference* ref);
void UnloadReference(Reference* ref);
- // Support functions for accessing parameters and other operands.
- MemOperand ParameterOperand(int index) const {
- int num_parameters = scope()->num_parameters();
- // index -2 corresponds to the activated closure, -1 corresponds
- // to the receiver
- ASSERT(-2 <= index && index < num_parameters);
- int offset = (1 + num_parameters - index) * kPointerSize;
- return MemOperand(fp, offset);
- }
-
- MemOperand FunctionOperand() const {
- return MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset);
- }
-
MemOperand ContextOperand(Register context, int index) const {
return MemOperand(context, Context::SlotOffset(index));
}
@@ -341,11 +380,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_;
@@ -355,6 +389,7 @@
// Code generation state
Scope* scope_;
+ VirtualFrame* frame_;
Condition cc_reg_;
CodeGenState* state_;
bool is_inside_try_;
@@ -363,10 +398,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);
};
« no previous file with comments | « src/builtins-ia32.cc ('k') | src/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698