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