Commit 9819cfd2 authored by hpayer@chromium.org's avatar hpayer@chromium.org

Make sure tagged binary op instructions change new space promotion.

BUG=
R=jkummerow@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19790 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent dc14b164
......@@ -4049,7 +4049,6 @@ class HBitwiseBinaryOperation : public HBinaryOperation {
}
virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
if (to.IsTagged() &&
(left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
SetAllSideEffects();
......@@ -4058,6 +4057,7 @@ class HBitwiseBinaryOperation : public HBinaryOperation {
ClearAllSideEffects();
SetFlag(kUseGVN);
}
if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
}
virtual void UpdateRepresentation(Representation new_rep,
......@@ -4123,7 +4123,6 @@ class HArithmeticBinaryOperation : public HBinaryOperation {
}
virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
if (to.IsTagged() &&
(left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
SetAllSideEffects();
......@@ -4132,6 +4131,7 @@ class HArithmeticBinaryOperation : public HBinaryOperation {
ClearAllSideEffects();
SetFlag(kUseGVN);
}
if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
}
DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation)
......@@ -4716,10 +4716,6 @@ class HAdd V8_FINAL : public HArithmeticBinaryOperation {
}
virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
if (to.IsTagged()) {
SetChangesFlag(kNewSpacePromotion);
ClearFlag(kAllowUndefinedAsNaN);
}
if (to.IsTagged() &&
(left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() ||
left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) {
......@@ -4729,6 +4725,10 @@ class HAdd V8_FINAL : public HArithmeticBinaryOperation {
ClearAllSideEffects();
SetFlag(kUseGVN);
}
if (to.IsTagged()) {
SetChangesFlag(kNewSpacePromotion);
ClearFlag(kAllowUndefinedAsNaN);
}
}
virtual Representation RepresentationFromInputs() V8_OVERRIDE;
......
......@@ -3697,3 +3697,45 @@ TEST(ObjectsInOptimizedCodeAreWeak) {
ASSERT(code->marked_for_deoptimization());
}
TEST(AddInstructionChangesNewSpacePromotion) {
i::FLAG_allow_natives_syntax = true;
i::FLAG_expose_gc = true;
i::FLAG_stress_compaction = true;
i::FLAG_gc_interval = 1000;
CcTest::InitializeVM();
if (!i::FLAG_allocation_site_pretenuring) return;
v8::HandleScope scope(CcTest::isolate());
Isolate* isolate = CcTest::i_isolate();
Heap* heap = isolate->heap();
CompileRun(
"function add(a, b) {"
" return a + b;"
"}"
"add(1, 2);"
"add(\"a\", \"b\");"
"var oldSpaceObject;"
"gc();"
"function crash(x) {"
" var object = {a: null, b: null};"
" var result = add(1.5, x | 0);"
" object.a = result;"
" oldSpaceObject = object;"
" return object;"
"}"
"crash(1);"
"crash(1);"
"%OptimizeFunctionOnNextCall(crash);"
"crash(1);");
v8::Handle<v8::Object> global = CcTest::global();
v8::Handle<v8::Function> g =
v8::Handle<v8::Function>::Cast(global->Get(v8_str("crash")));
v8::Handle<v8::Value> args1[] = { v8_num(1) };
heap->DisableInlineAllocation();
heap->set_allocation_timeout(1);
g->Call(global, 1, args1);
heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
}
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