| Index: src/ia32/lithium-codegen-ia32.h
|
| diff --git a/src/ia32/lithium-codegen-ia32.h b/src/ia32/lithium-codegen-ia32.h
|
| index 264f22b683e3d03b9864264f3aada07b0ae922ee..5a474b67f64723339607be28393f25ca7e768464 100644
|
| --- a/src/ia32/lithium-codegen-ia32.h
|
| +++ b/src/ia32/lithium-codegen-ia32.h
|
| @@ -45,7 +45,7 @@ class LDeferredCode;
|
| class LGapNode;
|
| class SafepointGenerator;
|
|
|
| -class LCodeGen BASE_EMBEDDED {
|
| +class LCodeGen V8_FINAL BASE_EMBEDDED {
|
| public:
|
| LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info)
|
| : zone_(info->zone()),
|
| @@ -68,7 +68,7 @@ class LCodeGen BASE_EMBEDDED {
|
| osr_pc_offset_(-1),
|
| last_lazy_deopt_pc_(0),
|
| frame_is_built_(false),
|
| - x87_stack_depth_(0),
|
| + x87_stack_(assembler),
|
| safepoints_(info->zone()),
|
| resolver_(this),
|
| expected_safepoint_kind_(Safepoint::kSimple),
|
| @@ -122,14 +122,23 @@ class LCodeGen BASE_EMBEDDED {
|
|
|
| void X87Mov(X87Register reg, Operand src,
|
| X87OperandType operand = kX87DoubleOperand);
|
| - void X87Mov(Operand src, X87Register reg);
|
| + void X87Mov(Operand src, X87Register reg,
|
| + X87OperandType operand = kX87DoubleOperand);
|
|
|
| void X87PrepareBinaryOp(
|
| X87Register left, X87Register right, X87Register result);
|
|
|
| void X87LoadForUsage(X87Register reg);
|
| - void X87PrepareToWrite(X87Register reg);
|
| - void X87CommitWrite(X87Register reg);
|
| + void X87PrepareToWrite(X87Register reg) { x87_stack_.PrepareToWrite(reg); }
|
| + void X87CommitWrite(X87Register reg) { x87_stack_.CommitWrite(reg); }
|
| +
|
| + void X87Fxch(X87Register reg, int other_slot = 0) {
|
| + x87_stack_.Fxch(reg, other_slot);
|
| + }
|
| +
|
| + bool X87StackEmpty() {
|
| + return x87_stack_.depth() == 0;
|
| + }
|
|
|
| Handle<Object> ToHandle(LConstantOperand* op) const;
|
|
|
| @@ -329,6 +338,8 @@ class LCodeGen BASE_EMBEDDED {
|
| void EmitGoto(int block);
|
| template<class InstrType>
|
| void EmitBranch(InstrType instr, Condition cc);
|
| + template<class InstrType>
|
| + void EmitFalseBranch(InstrType instr, Condition cc);
|
| void EmitNumberUntagD(
|
| Register input,
|
| Register temp,
|
| @@ -375,12 +386,6 @@ class LCodeGen BASE_EMBEDDED {
|
| // Caller should branch on equal condition.
|
| void EmitIsConstructCall(Register temp);
|
|
|
| - void EmitLoadFieldOrConstant(Register result,
|
| - Register object,
|
| - Handle<Map> type,
|
| - Handle<String> name,
|
| - LEnvironment* env);
|
| -
|
| // Emits optimized code to deep-copy the contents of statically known
|
| // object graphs (e.g. object literal boilerplate).
|
| void EmitDeepCopy(Handle<JSObject> object,
|
| @@ -403,15 +408,13 @@ class LCodeGen BASE_EMBEDDED {
|
| // register, or a stack slot operand.
|
| void EmitPushTaggedOperand(LOperand* operand);
|
|
|
| - void X87Fxch(X87Register reg, int other_slot = 0);
|
| void X87Fld(Operand src, X87OperandType opts);
|
| - void X87Free(X87Register reg);
|
|
|
| - void FlushX87StackIfNecessary(LInstruction* instr);
|
| void EmitFlushX87ForDeopt();
|
| - bool X87StackContains(X87Register reg);
|
| - int X87ArrayIndex(X87Register reg);
|
| - int x87_st2idx(int pos);
|
| + void FlushX87StackIfNecessary(LInstruction* instr) {
|
| + x87_stack_.FlushIfNecessary(instr, this);
|
| + }
|
| + friend class LGapResolver;
|
|
|
| #ifdef _MSC_VER
|
| // On windows, you may not access the stack more than one page below
|
| @@ -442,8 +445,48 @@ class LCodeGen BASE_EMBEDDED {
|
| int osr_pc_offset_;
|
| int last_lazy_deopt_pc_;
|
| bool frame_is_built_;
|
| - X87Register x87_stack_[X87Register::kNumAllocatableRegisters];
|
| - int x87_stack_depth_;
|
| +
|
| + class X87Stack {
|
| + public:
|
| + explicit X87Stack(MacroAssembler* masm) : stack_depth_(0), masm_(masm) { }
|
| + explicit X87Stack(const X87Stack& other)
|
| + : stack_depth_(0), masm_(other.masm_) {
|
| + stack_depth_ = other.stack_depth_;
|
| + for (int i = 0; i < stack_depth_; i++) {
|
| + stack_[i] = other.stack_[i];
|
| + }
|
| + }
|
| + bool operator==(const X87Stack& other) const {
|
| + if (stack_depth_ != other.stack_depth_) return false;
|
| + for (int i = 0; i < stack_depth_; i++) {
|
| + if (!stack_[i].is(other.stack_[i])) return false;
|
| + }
|
| + return true;
|
| + }
|
| + bool Contains(X87Register reg);
|
| + void Fxch(X87Register reg, int other_slot = 0);
|
| + void Free(X87Register reg);
|
| + void PrepareToWrite(X87Register reg);
|
| + void CommitWrite(X87Register reg);
|
| + void FlushIfNecessary(LInstruction* instr, LCodeGen* cgen);
|
| + int depth() const { return stack_depth_; }
|
| + void pop() { stack_depth_--; }
|
| + void push(X87Register reg) {
|
| + ASSERT(stack_depth_ < X87Register::kNumAllocatableRegisters);
|
| + stack_[stack_depth_] = reg;
|
| + stack_depth_++;
|
| + }
|
| +
|
| + MacroAssembler* masm() const { return masm_; }
|
| +
|
| + private:
|
| + int ArrayIndex(X87Register reg);
|
| + int st2idx(int pos);
|
| + X87Register stack_[X87Register::kNumAllocatableRegisters];
|
| + int stack_depth_;
|
| + MacroAssembler* const masm_;
|
| + };
|
| + X87Stack x87_stack_;
|
|
|
| // Builder that keeps track of safepoints in the code. The table
|
| // itself is emitted at the end of the generated code.
|
| @@ -456,7 +499,7 @@ class LCodeGen BASE_EMBEDDED {
|
|
|
| int old_position_;
|
|
|
| - class PushSafepointRegistersScope BASE_EMBEDDED {
|
| + class PushSafepointRegistersScope V8_FINAL BASE_EMBEDDED {
|
| public:
|
| explicit PushSafepointRegistersScope(LCodeGen* codegen)
|
| : codegen_(codegen) {
|
| @@ -483,7 +526,7 @@ class LCodeGen BASE_EMBEDDED {
|
| };
|
|
|
|
|
| -class LDeferredCode: public ZoneObject {
|
| +class LDeferredCode : public ZoneObject {
|
| public:
|
| explicit LDeferredCode(LCodeGen* codegen)
|
| : codegen_(codegen),
|
| @@ -492,7 +535,7 @@ class LDeferredCode: public ZoneObject {
|
| codegen->AddDeferredCode(this);
|
| }
|
|
|
| - virtual ~LDeferredCode() { }
|
| + virtual ~LDeferredCode() {}
|
| virtual void Generate() = 0;
|
| virtual LInstruction* instr() = 0;
|
|
|
|
|