Commit 63372812 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Pass checked values to HLoadNamedField, removing the need for extra type-check field.

R=titzer@chromium.org

Review URL: https://chromiumcodereview.appspot.com/22831003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16260 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 34417e1d
......@@ -352,7 +352,7 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo();
HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access);
if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) {
HValue* elements = AddLoadElements(boilerplate, NULL);
HValue* elements = AddLoadElements(boilerplate);
IfBuilder if_fixed_cow(this);
if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map());
......@@ -513,7 +513,7 @@ HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() {
HObjectAccess access = casted_stub()->is_inobject() ?
HObjectAccess::ForJSObjectOffset(casted_stub()->offset(), rep) :
HObjectAccess::ForBackingStoreOffset(casted_stub()->offset(), rep);
return AddInstruction(BuildLoadNamedField(GetParameter(0), access, NULL));
return AddInstruction(BuildLoadNamedField(GetParameter(0), access));
}
......@@ -528,7 +528,7 @@ HValue* CodeStubGraphBuilder<KeyedLoadFieldStub>::BuildCodeStub() {
HObjectAccess access = casted_stub()->is_inobject() ?
HObjectAccess::ForJSObjectOffset(casted_stub()->offset(), rep) :
HObjectAccess::ForBackingStoreOffset(casted_stub()->offset(), rep);
return AddInstruction(BuildLoadNamedField(GetParameter(0), access, NULL));
return AddInstruction(BuildLoadNamedField(GetParameter(0), access));
}
......
......@@ -215,7 +215,6 @@ void HEscapeAnalysisPhase::AnalyzeDataFlow(HInstruction* allocate) {
for (HUseIterator it(mapcheck->uses()); !it.Done(); it.Advance()) {
if (!it.value()->IsLoadNamedField()) continue;
HLoadNamedField* load = HLoadNamedField::cast(it.value());
ASSERT(load->typecheck() == mapcheck);
load->ClearTypeCheck();
}
ASSERT(mapcheck->HasNoUses());
......
......@@ -2849,10 +2849,6 @@ void HParameter::PrintDataTo(StringStream* stream) {
void HLoadNamedField::PrintDataTo(StringStream* stream) {
object()->PrintNameTo(stream);
access_.PrintTo(stream);
if (HasTypeCheck()) {
stream->Add(" ");
typecheck()->PrintNameTo(stream);
}
}
......
......@@ -1371,6 +1371,9 @@ class HCompareMap V8_FINAL : public HUnaryControlInstruction {
DECLARE_CONCRETE_INSTRUCTION(CompareMap)
protected:
virtual int RedefinedOperandIndex() { return 0; }
private:
Handle<Map> map_;
};
......@@ -2575,6 +2578,8 @@ class HCheckMaps V8_FINAL : public HTemplateInstruction<2> {
return true;
}
virtual int RedefinedOperandIndex() { return 0; }
private:
void Add(Handle<Map> map, Zone* zone) {
map_set_.Add(map, zone);
......@@ -2699,6 +2704,8 @@ class HCheckInstanceType V8_FINAL : public HUnaryOperation {
return check_ == b->check_;
}
virtual int RedefinedOperandIndex() { return 0; }
private:
enum Check {
IS_SPEC_OBJECT,
......@@ -5585,20 +5592,13 @@ class HObjectAccess V8_FINAL {
};
class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> {
class HLoadNamedField V8_FINAL : public HTemplateInstruction<1> {
public:
DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess);
DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HObjectAccess,
HValue*);
HValue* object() { return OperandAt(0); }
HValue* typecheck() {
ASSERT(HasTypeCheck());
return OperandAt(1);
}
bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); }
void ClearTypeCheck() { SetOperandAt(1, object()); }
bool HasTypeCheck() { return object()->IsCheckMaps(); }
void ClearTypeCheck() { SetOperandAt(0, object()->ActualValue()); }
HObjectAccess access() const { return access_; }
Representation field_representation() const {
return access_.representation();
......@@ -5624,13 +5624,9 @@ class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> {
}
private:
HLoadNamedField(HValue* object,
HObjectAccess access,
HValue* typecheck = NULL)
: access_(access) {
HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) {
ASSERT(object != NULL);
SetOperandAt(0, object);
SetOperandAt(1, typecheck != NULL ? typecheck : object);
Representation representation = access.representation();
if (representation.IsSmi()) {
......
This diff is collapsed.
......@@ -1257,13 +1257,10 @@ class HGraphBuilder {
LoadKeyedHoleMode load_mode,
KeyedAccessStoreMode store_mode);
HLoadNamedField* BuildLoadNamedField(
HValue* object,
HObjectAccess access,
HValue* typecheck);
HInstruction* BuildLoadStringLength(HValue* object, HValue* typecheck);
HStoreNamedField* AddStoreMapConstant(HValue *object, Handle<Map>);
HLoadNamedField* AddLoadElements(HValue *object, HValue *typecheck);
HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access);
HInstruction* BuildLoadStringLength(HValue* object, HValue* checked_value);
HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map>);
HLoadNamedField* AddLoadElements(HValue* object);
HLoadNamedField* AddLoadFixedArrayLength(HValue *object);
HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin);
......@@ -1549,9 +1546,10 @@ class HGraphBuilder {
int previous_object_size,
HValue* payload);
void BuildConstantMapCheck(Handle<JSObject> constant, CompilationInfo* info);
void BuildCheckPrototypeMaps(Handle<JSObject> prototype,
Handle<JSObject> holder);
HInstruction* BuildConstantMapCheck(Handle<JSObject> constant,
CompilationInfo* info);
HInstruction* BuildCheckPrototypeMaps(Handle<JSObject> prototype,
Handle<JSObject> holder);
HInstruction* BuildGetNativeContext();
HInstruction* BuildGetArrayFunction();
......@@ -1604,22 +1602,6 @@ inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(
}
template<>
inline HInstruction* HGraphBuilder::NewUncasted<HLoadNamedField>(
HValue* object, HObjectAccess access) {
return NewUncasted<HLoadNamedField>(object, access,
static_cast<HValue*>(NULL));
}
template<>
inline HInstruction* HGraphBuilder::AddUncasted<HLoadNamedField>(
HValue* object, HObjectAccess access) {
return AddUncasted<HLoadNamedField>(object, access,
static_cast<HValue*>(NULL));
}
template<>
inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(BailoutId id) {
return AddUncasted<HSimulate>(id, FIXED_SIMULATE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment