Add HLoadRoot hydrogen instruction.

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/23601038

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16807 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
bmeurer@chromium.org 2013-09-19 06:08:13 +00:00
parent 45bd2f50cd
commit bf192205ce
10 changed files with 98 additions and 0 deletions

View File

@ -2169,6 +2169,11 @@ LInstruction* LChunkBuilder::DoLoadFunctionPrototype(
} }
LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
return DefineAsRegister(new(zone()) LLoadRoot);
}
LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( LInstruction* LChunkBuilder::DoLoadExternalArrayPointer(
HLoadExternalArrayPointer* instr) { HLoadExternalArrayPointer* instr) {
LOperand* input = UseRegisterAtStart(instr->value()); LOperand* input = UseRegisterAtStart(instr->value());

View File

@ -119,6 +119,7 @@ class LCodeGen;
V(LazyBailout) \ V(LazyBailout) \
V(LoadContextSlot) \ V(LoadContextSlot) \
V(LoadExternalArrayPointer) \ V(LoadExternalArrayPointer) \
V(LoadRoot) \
V(LoadFieldByIndex) \ V(LoadFieldByIndex) \
V(LoadFunctionPrototype) \ V(LoadFunctionPrototype) \
V(LoadGlobalCell) \ V(LoadGlobalCell) \
@ -1579,6 +1580,15 @@ class LLoadFunctionPrototype V8_FINAL : public LTemplateInstruction<1, 1, 0> {
}; };
class LLoadRoot V8_FINAL : public LTemplateInstruction<1, 0, 0> {
public:
DECLARE_CONCRETE_INSTRUCTION(LoadRoot, "load-root")
DECLARE_HYDROGEN_ACCESSOR(LoadRoot)
Heap::RootListIndex index() const { return hydrogen()->index(); }
};
class LLoadExternalArrayPointer V8_FINAL class LLoadExternalArrayPointer V8_FINAL
: public LTemplateInstruction<1, 1, 0> { : public LTemplateInstruction<1, 1, 0> {
public: public:

View File

@ -3149,6 +3149,12 @@ void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
} }
void LCodeGen::DoLoadRoot(LLoadRoot* instr) {
Register result = ToRegister(instr->result());
__ LoadRoot(result, instr->index());
}
void LCodeGen::DoLoadExternalArrayPointer( void LCodeGen::DoLoadExternalArrayPointer(
LLoadExternalArrayPointer* instr) { LLoadExternalArrayPointer* instr) {
Register to_reg = ToRegister(instr->result()); Register to_reg = ToRegister(instr->result());

View File

@ -142,6 +142,7 @@ class LChunkBuilder;
V(LoadKeyedGeneric) \ V(LoadKeyedGeneric) \
V(LoadNamedField) \ V(LoadNamedField) \
V(LoadNamedGeneric) \ V(LoadNamedGeneric) \
V(LoadRoot) \
V(MapEnumLength) \ V(MapEnumLength) \
V(MathFloorOfDiv) \ V(MathFloorOfDiv) \
V(MathMinMax) \ V(MathMinMax) \
@ -2514,6 +2515,40 @@ class HUnaryMathOperation V8_FINAL : public HTemplateInstruction<2> {
}; };
class HLoadRoot V8_FINAL : public HTemplateInstruction<0> {
public:
DECLARE_INSTRUCTION_FACTORY_P1(HLoadRoot, Heap::RootListIndex);
DECLARE_INSTRUCTION_FACTORY_P2(HLoadRoot, Heap::RootListIndex, HType);
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
return Representation::None();
}
Heap::RootListIndex index() const { return index_; }
DECLARE_CONCRETE_INSTRUCTION(LoadRoot)
protected:
virtual bool DataEquals(HValue* other) V8_OVERRIDE {
HLoadRoot* b = HLoadRoot::cast(other);
return index_ == b->index_;
}
private:
HLoadRoot(Heap::RootListIndex index, HType type = HType::Tagged())
: HTemplateInstruction<0>(type), index_(index) {
SetFlag(kUseGVN);
// TODO(bmeurer): We'll need kDependsOnRoots once we add the
// corresponding HStoreRoot instruction.
SetGVNFlag(kDependsOnCalls);
}
virtual bool IsDeletable() const V8_OVERRIDE { return true; }
const Heap::RootListIndex index_;
};
class HLoadExternalArrayPointer V8_FINAL : public HUnaryOperation { class HLoadExternalArrayPointer V8_FINAL : public HUnaryOperation {
public: public:
DECLARE_INSTRUCTION_FACTORY_P1(HLoadExternalArrayPointer, HValue*); DECLARE_INSTRUCTION_FACTORY_P1(HLoadExternalArrayPointer, HValue*);

View File

@ -3365,6 +3365,12 @@ void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
} }
void LCodeGen::DoLoadRoot(LLoadRoot* instr) {
Register result = ToRegister(instr->result());
__ LoadRoot(result, instr->index());
}
void LCodeGen::DoLoadExternalArrayPointer( void LCodeGen::DoLoadExternalArrayPointer(
LLoadExternalArrayPointer* instr) { LLoadExternalArrayPointer* instr) {
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());

View File

@ -2202,6 +2202,11 @@ LInstruction* LChunkBuilder::DoLoadFunctionPrototype(
} }
LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
return DefineAsRegister(new(zone()) LLoadRoot);
}
LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( LInstruction* LChunkBuilder::DoLoadExternalArrayPointer(
HLoadExternalArrayPointer* instr) { HLoadExternalArrayPointer* instr) {
LOperand* input = UseRegisterAtStart(instr->value()); LOperand* input = UseRegisterAtStart(instr->value());

View File

@ -129,6 +129,7 @@ class LCodeGen;
V(LoadKeyedGeneric) \ V(LoadKeyedGeneric) \
V(LoadNamedField) \ V(LoadNamedField) \
V(LoadNamedGeneric) \ V(LoadNamedGeneric) \
V(LoadRoot) \
V(MapEnumLength) \ V(MapEnumLength) \
V(MathAbs) \ V(MathAbs) \
V(MathCos) \ V(MathCos) \
@ -1591,6 +1592,15 @@ class LLoadFunctionPrototype V8_FINAL : public LTemplateInstruction<1, 1, 1> {
}; };
class LLoadRoot V8_FINAL : public LTemplateInstruction<1, 0, 0> {
public:
DECLARE_CONCRETE_INSTRUCTION(LoadRoot, "load-root")
DECLARE_HYDROGEN_ACCESSOR(LoadRoot)
Heap::RootListIndex index() const { return hydrogen()->index(); }
};
class LLoadExternalArrayPointer V8_FINAL class LLoadExternalArrayPointer V8_FINAL
: public LTemplateInstruction<1, 1, 0> { : public LTemplateInstruction<1, 1, 0> {
public: public:

View File

@ -2869,6 +2869,12 @@ void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
} }
void LCodeGen::DoLoadRoot(LLoadRoot* instr) {
Register result = ToRegister(instr->result());
__ LoadRoot(result, instr->index());
}
void LCodeGen::DoLoadExternalArrayPointer( void LCodeGen::DoLoadExternalArrayPointer(
LLoadExternalArrayPointer* instr) { LLoadExternalArrayPointer* instr) {
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());

View File

@ -2069,6 +2069,11 @@ LInstruction* LChunkBuilder::DoLoadFunctionPrototype(
} }
LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
return DefineAsRegister(new(zone()) LLoadRoot);
}
LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( LInstruction* LChunkBuilder::DoLoadExternalArrayPointer(
HLoadExternalArrayPointer* instr) { HLoadExternalArrayPointer* instr) {
LOperand* input = UseRegisterAtStart(instr->value()); LOperand* input = UseRegisterAtStart(instr->value());

View File

@ -119,6 +119,7 @@ class LCodeGen;
V(LazyBailout) \ V(LazyBailout) \
V(LoadContextSlot) \ V(LoadContextSlot) \
V(LoadExternalArrayPointer) \ V(LoadExternalArrayPointer) \
V(LoadRoot) \
V(LoadFieldByIndex) \ V(LoadFieldByIndex) \
V(LoadFunctionPrototype) \ V(LoadFunctionPrototype) \
V(LoadGlobalCell) \ V(LoadGlobalCell) \
@ -1521,6 +1522,15 @@ class LLoadFunctionPrototype V8_FINAL : public LTemplateInstruction<1, 1, 0> {
}; };
class LLoadRoot V8_FINAL : public LTemplateInstruction<1, 0, 0> {
public:
DECLARE_CONCRETE_INSTRUCTION(LoadRoot, "load-root")
DECLARE_HYDROGEN_ACCESSOR(LoadRoot)
Heap::RootListIndex index() const { return hydrogen()->index(); }
};
class LLoadExternalArrayPointer V8_FINAL class LLoadExternalArrayPointer V8_FINAL
: public LTemplateInstruction<1, 1, 0> { : public LTemplateInstruction<1, 1, 0> {
public: public: