Commit 5fd24b0a authored by hpayer@chromium.org's avatar hpayer@chromium.org

Added non observable side effects scope and removed unnecessary calls to AddSimulate.

BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14232 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 06c26f57
...@@ -147,6 +147,8 @@ bool CodeStubGraphBuilderBase::BuildGraph() { ...@@ -147,6 +147,8 @@ bool CodeStubGraphBuilderBase::BuildGraph() {
AddSimulate(BailoutId::StubEntry()); AddSimulate(BailoutId::StubEntry());
NoObservableSideEffectsScope no_effects(this);
HValue* return_value = BuildCodeStub(); HValue* return_value = BuildCodeStub();
// We might have extra expressions to pop from the stack in addition to the // We might have extra expressions to pop from the stack in addition to the
...@@ -298,7 +300,6 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { ...@@ -298,7 +300,6 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
factory->empty_string(), factory->empty_string(),
value, value,
true, i)); true, i));
AddSimulate(BailoutId::StubEntry());
} }
builder.End(); builder.End();
...@@ -332,7 +333,6 @@ HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() { ...@@ -332,7 +333,6 @@ HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() {
GetParameter(0), GetParameter(1), GetParameter(2), NULL, GetParameter(0), GetParameter(1), GetParameter(2), NULL,
casted_stub()->is_js_array(), casted_stub()->elements_kind(), casted_stub()->is_js_array(), casted_stub()->elements_kind(),
true, casted_stub()->store_mode(), Representation::Tagged()); true, casted_stub()->store_mode(), Representation::Tagged());
AddSimulate(BailoutId::StubEntry(), REMOVABLE_SIMULATE);
return GetParameter(2); return GetParameter(2);
} }
...@@ -388,13 +388,11 @@ HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { ...@@ -388,13 +388,11 @@ HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() {
factory->elements_field_string(), factory->elements_field_string(),
new_elements, true, new_elements, true,
JSArray::kElementsOffset)); JSArray::kElementsOffset));
AddSimulate(BailoutId::StubEntry());
if_builder.End(); if_builder.End();
AddInstruction(new(zone) HStoreNamedField(js_array, factory->length_string(), AddInstruction(new(zone) HStoreNamedField(js_array, factory->length_string(),
map, true, JSArray::kMapOffset)); map, true, JSArray::kMapOffset));
AddSimulate(BailoutId::StubEntry());
return js_array; return js_array;
} }
......
...@@ -802,6 +802,9 @@ void HValue::ComputeInitialRange(Zone* zone) { ...@@ -802,6 +802,9 @@ void HValue::ComputeInitialRange(Zone* zone) {
void HInstruction::PrintTo(StringStream* stream) { void HInstruction::PrintTo(StringStream* stream) {
PrintMnemonicTo(stream); PrintMnemonicTo(stream);
const char* side_effects =
CheckFlag(HValue::kHasNoObservableSideEffects) ? "-" : "+";
stream->Add("ose%s ", side_effects);
PrintDataTo(stream); PrintDataTo(stream);
PrintRangeTo(stream); PrintRangeTo(stream);
PrintChangesTo(stream); PrintChangesTo(stream);
......
...@@ -828,6 +828,7 @@ class HValue: public ZoneObject { ...@@ -828,6 +828,7 @@ class HValue: public ZoneObject {
// This flag is set to true after the SetupInformativeDefinitions() pass // This flag is set to true after the SetupInformativeDefinitions() pass
// has processed this instruction. // has processed this instruction.
kIDefsProcessingDone, kIDefsProcessingDone,
kHasNoObservableSideEffects,
kLastFlag = kIDefsProcessingDone kLastFlag = kIDefsProcessingDone
}; };
...@@ -1005,7 +1006,8 @@ class HValue: public ZoneObject { ...@@ -1005,7 +1006,8 @@ class HValue: public ZoneObject {
return gvn_flags_.ContainsAnyOf(AllSideEffectsFlagSet()); return gvn_flags_.ContainsAnyOf(AllSideEffectsFlagSet());
} }
bool HasObservableSideEffects() const { bool HasObservableSideEffects() const {
return gvn_flags_.ContainsAnyOf(AllObservableSideEffectsFlagSet()); return !CheckFlag(kHasNoObservableSideEffects) &&
gvn_flags_.ContainsAnyOf(AllObservableSideEffectsFlagSet());
} }
GVNFlagSet DependsOnFlags() const { GVNFlagSet DependsOnFlags() const {
......
This diff is collapsed.
...@@ -865,7 +865,10 @@ class FunctionState { ...@@ -865,7 +865,10 @@ class FunctionState {
class HGraphBuilder { class HGraphBuilder {
public: public:
explicit HGraphBuilder(CompilationInfo* info) explicit HGraphBuilder(CompilationInfo* info)
: info_(info), graph_(NULL), current_block_(NULL) {} : info_(info),
graph_(NULL),
current_block_(NULL),
no_side_effects_scope_count_(0) {}
virtual ~HGraphBuilder() {} virtual ~HGraphBuilder() {}
HBasicBlock* current_block() const { return current_block_; } HBasicBlock* current_block() const { return current_block_; }
...@@ -891,6 +894,14 @@ class HGraphBuilder { ...@@ -891,6 +894,14 @@ class HGraphBuilder {
HReturn* AddReturn(HValue* value); HReturn* AddReturn(HValue* value);
void IncrementInNoSideEffectsScope() {
no_side_effects_scope_count_++;
}
void DecrementInNoSideEffectsScope() {
no_side_effects_scope_count_--;
}
protected: protected:
virtual bool BuildGraph() = 0; virtual bool BuildGraph() = 0;
...@@ -1032,6 +1043,20 @@ class HGraphBuilder { ...@@ -1032,6 +1043,20 @@ class HGraphBuilder {
bool finished_; bool finished_;
}; };
class NoObservableSideEffectsScope {
public:
explicit NoObservableSideEffectsScope(HGraphBuilder* builder) :
builder_(builder) {
builder_->IncrementInNoSideEffectsScope();
}
~NoObservableSideEffectsScope() {
builder_->DecrementInNoSideEffectsScope();
}
private:
HGraphBuilder* builder_;
};
HValue* BuildNewElementsCapacity(HValue* context, HValue* BuildNewElementsCapacity(HValue* context,
HValue* old_capacity); HValue* old_capacity);
...@@ -1082,6 +1107,7 @@ class HGraphBuilder { ...@@ -1082,6 +1107,7 @@ class HGraphBuilder {
CompilationInfo* info_; CompilationInfo* info_;
HGraph* graph_; HGraph* graph_;
HBasicBlock* current_block_; HBasicBlock* current_block_;
int no_side_effects_scope_count_;
}; };
......
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