Commit 7b1d13af authored by ulan@chromium.org's avatar ulan@chromium.org

Revert r12342 "Flush monomorphic ICs on context disposal instead of context...

Revert r12342 "Flush monomorphic ICs on context disposal instead of context exit." because of canary channel crashes.

BUG=144230
R=verwaest@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12388 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fcc1791a
...@@ -97,7 +97,6 @@ Heap::Heap() ...@@ -97,7 +97,6 @@ Heap::Heap()
linear_allocation_scope_depth_(0), linear_allocation_scope_depth_(0),
contexts_disposed_(0), contexts_disposed_(0),
global_ic_age_(0), global_ic_age_(0),
flush_monomorphic_ics_(false),
scan_on_scavenge_pages_(0), scan_on_scavenge_pages_(0),
new_space_(this), new_space_(this),
old_pointer_space_(NULL), old_pointer_space_(NULL),
...@@ -993,7 +992,7 @@ void Heap::MarkCompact(GCTracer* tracer) { ...@@ -993,7 +992,7 @@ void Heap::MarkCompact(GCTracer* tracer) {
contexts_disposed_ = 0; contexts_disposed_ = 0;
flush_monomorphic_ics_ = false; isolate_->set_context_exit_happened(false);
} }
......
...@@ -1079,10 +1079,7 @@ class Heap { ...@@ -1079,10 +1079,7 @@ class Heap {
void EnsureHeapIsIterable(); void EnsureHeapIsIterable();
// Notify the heap that a context has been disposed. // Notify the heap that a context has been disposed.
int NotifyContextDisposed() { int NotifyContextDisposed() { return ++contexts_disposed_; }
flush_monomorphic_ics_ = true;
return ++contexts_disposed_;
}
// Utility to invoke the scavenger. This is needed in test code to // Utility to invoke the scavenger. This is needed in test code to
// ensure correct callback for weak global handles. // ensure correct callback for weak global handles.
...@@ -1612,8 +1609,6 @@ class Heap { ...@@ -1612,8 +1609,6 @@ class Heap {
global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax; global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax;
} }
bool flush_monomorphic_ics() { return flush_monomorphic_ics_; }
intptr_t amount_of_external_allocated_memory() { intptr_t amount_of_external_allocated_memory() {
return amount_of_external_allocated_memory_; return amount_of_external_allocated_memory_;
} }
...@@ -1699,8 +1694,6 @@ class Heap { ...@@ -1699,8 +1694,6 @@ class Heap {
int global_ic_age_; int global_ic_age_;
bool flush_monomorphic_ics_;
int scan_on_scavenge_pages_; int scan_on_scavenge_pages_;
#if defined(V8_TARGET_ARCH_X64) #if defined(V8_TARGET_ARCH_X64)
......
...@@ -217,8 +217,9 @@ void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget( ...@@ -217,8 +217,9 @@ void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget(
// when they might be keeping a Context alive, or when the heap is about // when they might be keeping a Context alive, or when the heap is about
// to be serialized. // to be serialized.
if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub() if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub()
&& (target->ic_state() == MEGAMORPHIC || heap->flush_monomorphic_ics() || && (target->ic_state() == MEGAMORPHIC || Serializer::enabled() ||
Serializer::enabled() || target->ic_age() != heap->global_ic_age())) { heap->isolate()->context_exit_happened() ||
target->ic_age() != heap->global_ic_age())) {
IC::Clear(rinfo->pc()); IC::Clear(rinfo->pc());
target = Code::GetCodeFromTargetAddress(rinfo->target_address()); target = Code::GetCodeFromTargetAddress(rinfo->target_address());
} }
......
// Copyright 2012 the V8 project authors. All rights reserved. // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -10813,24 +10812,18 @@ TEST(DontLeakGlobalObjects) { ...@@ -10813,24 +10812,18 @@ TEST(DontLeakGlobalObjects) {
{ v8::HandleScope scope; { v8::HandleScope scope;
LocalContext context; LocalContext context;
} }
// Fire context disposed notification to force clearing monomorphic ICs.
v8::V8::ContextDisposedNotification();
CheckSurvivingGlobalObjectsCount(0); CheckSurvivingGlobalObjectsCount(0);
{ v8::HandleScope scope; { v8::HandleScope scope;
LocalContext context; LocalContext context;
v8_compile("Date")->Run(); v8_compile("Date")->Run();
} }
// Fire context disposed notification to force clearing monomorphic ICs.
v8::V8::ContextDisposedNotification();
CheckSurvivingGlobalObjectsCount(0); CheckSurvivingGlobalObjectsCount(0);
{ v8::HandleScope scope; { v8::HandleScope scope;
LocalContext context; LocalContext context;
v8_compile("/aaa/")->Run(); v8_compile("/aaa/")->Run();
} }
// Fire context disposed notification to force clearing monomorphic ICs.
v8::V8::ContextDisposedNotification();
CheckSurvivingGlobalObjectsCount(0); CheckSurvivingGlobalObjectsCount(0);
{ v8::HandleScope scope; { v8::HandleScope scope;
...@@ -10839,8 +10832,6 @@ TEST(DontLeakGlobalObjects) { ...@@ -10839,8 +10832,6 @@ TEST(DontLeakGlobalObjects) {
LocalContext context(&extensions); LocalContext context(&extensions);
v8_compile("gc();")->Run(); v8_compile("gc();")->Run();
} }
// Fire context disposed notification to force clearing monomorphic ICs.
v8::V8::ContextDisposedNotification();
CheckSurvivingGlobalObjectsCount(0); CheckSurvivingGlobalObjectsCount(0);
} }
} }
...@@ -14672,7 +14663,6 @@ TEST(Regress528) { ...@@ -14672,7 +14663,6 @@ TEST(Regress528) {
context->Exit(); context->Exit();
} }
context.Dispose(); context.Dispose();
v8::V8::ContextDisposedNotification();
for (gc_count = 1; gc_count < 10; gc_count++) { for (gc_count = 1; gc_count < 10; gc_count++) {
other_context->Enter(); other_context->Enter();
CompileRun(source_exception); CompileRun(source_exception);
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "v8.h" #include "v8.h"
#include "compilation-cache.h"
#include "execution.h" #include "execution.h"
#include "factory.h" #include "factory.h"
#include "macro-assembler.h" #include "macro-assembler.h"
...@@ -1066,7 +1065,6 @@ TEST(TestInternalWeakLists) { ...@@ -1066,7 +1065,6 @@ TEST(TestInternalWeakLists) {
} }
// Mark compact handles the weak references. // Mark compact handles the weak references.
ISOLATE->compilation_cache()->Clear();
HEAP->CollectAllGarbage(Heap::kNoGCFlags); HEAP->CollectAllGarbage(Heap::kNoGCFlags);
CHECK_EQ(opt ? 4 : 0, CountOptimizedUserFunctions(ctx[i])); CHECK_EQ(opt ? 4 : 0, CountOptimizedUserFunctions(ctx[i]));
...@@ -1397,7 +1395,6 @@ TEST(LeakNativeContextViaMap) { ...@@ -1397,7 +1395,6 @@ TEST(LeakNativeContextViaMap) {
ctx2->Exit(); ctx2->Exit();
ctx1->Exit(); ctx1->Exit();
ctx1.Dispose(); ctx1.Dispose();
v8::V8::ContextDisposedNotification();
} }
HEAP->CollectAllAvailableGarbage(); HEAP->CollectAllAvailableGarbage();
CHECK_EQ(2, NumberOfGlobalObjects()); CHECK_EQ(2, NumberOfGlobalObjects());
...@@ -1435,7 +1432,6 @@ TEST(LeakNativeContextViaFunction) { ...@@ -1435,7 +1432,6 @@ TEST(LeakNativeContextViaFunction) {
ctx2->Exit(); ctx2->Exit();
ctx1->Exit(); ctx1->Exit();
ctx1.Dispose(); ctx1.Dispose();
v8::V8::ContextDisposedNotification();
} }
HEAP->CollectAllAvailableGarbage(); HEAP->CollectAllAvailableGarbage();
CHECK_EQ(2, NumberOfGlobalObjects()); CHECK_EQ(2, NumberOfGlobalObjects());
...@@ -1471,7 +1467,6 @@ TEST(LeakNativeContextViaMapKeyed) { ...@@ -1471,7 +1467,6 @@ TEST(LeakNativeContextViaMapKeyed) {
ctx2->Exit(); ctx2->Exit();
ctx1->Exit(); ctx1->Exit();
ctx1.Dispose(); ctx1.Dispose();
v8::V8::ContextDisposedNotification();
} }
HEAP->CollectAllAvailableGarbage(); HEAP->CollectAllAvailableGarbage();
CHECK_EQ(2, NumberOfGlobalObjects()); CHECK_EQ(2, NumberOfGlobalObjects());
...@@ -1511,7 +1506,6 @@ TEST(LeakNativeContextViaMapProto) { ...@@ -1511,7 +1506,6 @@ TEST(LeakNativeContextViaMapProto) {
ctx2->Exit(); ctx2->Exit();
ctx1->Exit(); ctx1->Exit();
ctx1.Dispose(); ctx1.Dispose();
v8::V8::ContextDisposedNotification();
} }
HEAP->CollectAllAvailableGarbage(); HEAP->CollectAllAvailableGarbage();
CHECK_EQ(2, NumberOfGlobalObjects()); CHECK_EQ(2, NumberOfGlobalObjects());
...@@ -2106,6 +2100,8 @@ TEST(IncrementalMarkingPreservesMonomorhpicIC) { ...@@ -2106,6 +2100,8 @@ TEST(IncrementalMarkingPreservesMonomorhpicIC) {
Code* ic_before = FindFirstIC(f->shared()->code(), Code::LOAD_IC); Code* ic_before = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
CHECK(ic_before->ic_state() == MONOMORPHIC); CHECK(ic_before->ic_state() == MONOMORPHIC);
// Fire context dispose notification.
v8::V8::ContextDisposedNotification();
SimulateIncrementalMarking(); SimulateIncrementalMarking();
HEAP->CollectAllGarbage(Heap::kNoGCFlags); HEAP->CollectAllGarbage(Heap::kNoGCFlags);
......
...@@ -26,9 +26,8 @@ ...@@ -26,9 +26,8 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug --expose-gc --noparallel-recompilation // Flags: --expose-debug-as debug --expose-gc --noparallel-recompilation
// Flags: --send-idle-notification
// Get the Debug object exposed from the debug context global object. // Get the Debug object exposed from the debug context global object.
Debug = debug.Debug; Debug = debug.Debug
Date(); Date();
RegExp(); RegExp();
......
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --smi-only-arrays --noparallel-recompilation // Flags: --allow-natives-syntax --smi-only-arrays --expose-gc
// Flags: --noparallel-recompilation
// Ensure that ElementsKind transitions in various situations are hoisted (or // Ensure that ElementsKind transitions in various situations are hoisted (or
// not hoisted) correctly, don't change the semantics programs and don't trigger // not hoisted) correctly, don't change the semantics programs and don't trigger
...@@ -39,6 +40,11 @@ if (support_smi_only_arrays) { ...@@ -39,6 +40,11 @@ if (support_smi_only_arrays) {
print("Tests do NOT include smi-only arrays."); print("Tests do NOT include smi-only arrays.");
} }
// Force existing ICs from previous stress runs to be flushed, otherwise the
// assumptions in this test about when deoptimizations get triggered are not
// valid.
gc();
if (support_smi_only_arrays) { if (support_smi_only_arrays) {
// Make sure that a simple elements array transitions inside a loop before // Make sure that a simple elements array transitions inside a loop before
// stores to an array gets hoisted in a way that doesn't generate a deopt in // stores to an array gets hoisted in a way that doesn't generate a deopt in
...@@ -60,7 +66,6 @@ if (support_smi_only_arrays) { ...@@ -60,7 +66,6 @@ if (support_smi_only_arrays) {
testDoubleConversion4(new Array(5)); testDoubleConversion4(new Array(5));
testDoubleConversion4(new Array(5)); testDoubleConversion4(new Array(5));
assertTrue(2 != %GetOptimizationStatus(testDoubleConversion4)); assertTrue(2 != %GetOptimizationStatus(testDoubleConversion4));
%ClearFunctionTypeFeedback(testDoubleConversion4);
// Make sure that non-element related map checks that are not preceded by // Make sure that non-element related map checks that are not preceded by
// transitions in a loop still get hoisted in a way that doesn't generate a // transitions in a loop still get hoisted in a way that doesn't generate a
...@@ -86,7 +91,6 @@ if (support_smi_only_arrays) { ...@@ -86,7 +91,6 @@ if (support_smi_only_arrays) {
testExactMapHoisting(new Array(5)); testExactMapHoisting(new Array(5));
testExactMapHoisting(new Array(5)); testExactMapHoisting(new Array(5));
assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting)); assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting));
%ClearFunctionTypeFeedback(testExactMapHoisting);
// Make sure that non-element related map checks do NOT get hoisted if they // Make sure that non-element related map checks do NOT get hoisted if they
// depend on an elements transition before them and it's not possible to hoist // depend on an elements transition before them and it's not possible to hoist
...@@ -118,7 +122,6 @@ if (support_smi_only_arrays) { ...@@ -118,7 +122,6 @@ if (support_smi_only_arrays) {
testExactMapHoisting2(new Array(5)); testExactMapHoisting2(new Array(5));
// Temporarily disabled - see bug 2176. // Temporarily disabled - see bug 2176.
// assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting2)); // assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting2));
%ClearFunctionTypeFeedback(testExactMapHoisting2);
// Make sure that non-element related map checks do get hoisted if they use // Make sure that non-element related map checks do get hoisted if they use
// the transitioned map for the check and all transitions that they depend // the transitioned map for the check and all transitions that they depend
...@@ -147,7 +150,6 @@ if (support_smi_only_arrays) { ...@@ -147,7 +150,6 @@ if (support_smi_only_arrays) {
testExactMapHoisting3(new Array(5)); testExactMapHoisting3(new Array(5));
testExactMapHoisting3(new Array(5)); testExactMapHoisting3(new Array(5));
assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting3)); assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting3));
%ClearFunctionTypeFeedback(testExactMapHoisting3);
function testDominatingTransitionHoisting1(a) { function testDominatingTransitionHoisting1(a) {
var object = new Object(); var object = new Object();
...@@ -170,7 +172,6 @@ if (support_smi_only_arrays) { ...@@ -170,7 +172,6 @@ if (support_smi_only_arrays) {
testDominatingTransitionHoisting1(new Array(5)); testDominatingTransitionHoisting1(new Array(5));
testDominatingTransitionHoisting1(new Array(5)); testDominatingTransitionHoisting1(new Array(5));
assertTrue(2 != %GetOptimizationStatus(testDominatingTransitionHoisting1)); assertTrue(2 != %GetOptimizationStatus(testDominatingTransitionHoisting1));
%ClearFunctionTypeFeedback(testDominatingTransitionHoisting1);
function testHoistingWithSideEffect(a) { function testHoistingWithSideEffect(a) {
var object = new Object(); var object = new Object();
...@@ -190,9 +191,8 @@ if (support_smi_only_arrays) { ...@@ -190,9 +191,8 @@ if (support_smi_only_arrays) {
testHoistingWithSideEffect(new Array(5)); testHoistingWithSideEffect(new Array(5));
testHoistingWithSideEffect(new Array(5)); testHoistingWithSideEffect(new Array(5));
assertTrue(2 != %GetOptimizationStatus(testHoistingWithSideEffect)); assertTrue(2 != %GetOptimizationStatus(testHoistingWithSideEffect));
%ClearFunctionTypeFeedback(testHoistingWithSideEffect);
function testStraightLineDupeElimination(a,b,c,d,e,f) { function testStraightLineDupeElinination(a,b,c,d,e,f) {
var count = 3; var count = 3;
do { do {
assertTrue(true); assertTrue(true);
...@@ -205,29 +205,28 @@ if (support_smi_only_arrays) { ...@@ -205,29 +205,28 @@ if (support_smi_only_arrays) {
} while (--count > 3); } while (--count > 3);
} }
testStraightLineDupeElimination(new Array(0, 0, 0, 0, 0),0,0,0,0,.5); testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),0,0,0,0,.5);
testStraightLineDupeElimination(new Array(0, 0, 0, 0, 0),0,0,0,.5,0); testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),0,0,0,.5,0);
testStraightLineDupeElimination(new Array(0, 0, 0, 0, 0),0,0,.5,0,0); testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),0,0,.5,0,0);
testStraightLineDupeElimination(new Array(0, 0, 0, 0, 0),0,.5,0,0,0); testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),0,.5,0,0,0);
testStraightLineDupeElimination(new Array(0, 0, 0, 0, 0),.5,0,0,0,0); testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),.5,0,0,0,0);
testStraightLineDupeElimination(new Array(.1,.1,.1,.1,.1),0,0,0,0,.5); testStraightLineDupeElinination(new Array(.1,.1,.1,.1,.1),0,0,0,0,.5);
testStraightLineDupeElimination(new Array(.1,.1,.1,.1,.1),0,0,0,.5,0); testStraightLineDupeElinination(new Array(.1,.1,.1,.1,.1),0,0,0,.5,0);
testStraightLineDupeElimination(new Array(.1,.1,.1,.1,.1),0,0,.5,0,0); testStraightLineDupeElinination(new Array(.1,.1,.1,.1,.1),0,0,.5,0,0);
testStraightLineDupeElimination(new Array(.1,.1,.1,.1,.1),0,.5,0,0,0); testStraightLineDupeElinination(new Array(.1,.1,.1,.1,.1),0,.5,0,0,0);
testStraightLineDupeElimination(new Array(.1,.1,.1,.1,.1),.5,0,0,0,0); testStraightLineDupeElinination(new Array(.1,.1,.1,.1,.1),.5,0,0,0,0);
testStraightLineDupeElimination(new Array(5),.5,0,0,0,0); testStraightLineDupeElinination(new Array(5),.5,0,0,0,0);
testStraightLineDupeElimination(new Array(5),0,.5,0,0,0); testStraightLineDupeElinination(new Array(5),0,.5,0,0,0);
testStraightLineDupeElimination(new Array(5),0,0,.5,0,0); testStraightLineDupeElinination(new Array(5),0,0,.5,0,0);
testStraightLineDupeElimination(new Array(5),0,0,0,.5,0); testStraightLineDupeElinination(new Array(5),0,0,0,.5,0);
testStraightLineDupeElimination(new Array(5),0,0,0,0,.5); testStraightLineDupeElinination(new Array(5),0,0,0,0,.5);
testStraightLineDupeElimination(new Array(5),.5,0,0,0,0); testStraightLineDupeElinination(new Array(5),.5,0,0,0,0);
testStraightLineDupeElimination(new Array(5),0,.5,0,0,0); testStraightLineDupeElinination(new Array(5),0,.5,0,0,0);
testStraightLineDupeElimination(new Array(5),0,0,.5,0,0); testStraightLineDupeElinination(new Array(5),0,0,.5,0,0);
testStraightLineDupeElimination(new Array(5),0,0,0,.5,0); testStraightLineDupeElinination(new Array(5),0,0,0,.5,0);
testStraightLineDupeElimination(new Array(5),0,0,0,0,.5); testStraightLineDupeElinination(new Array(5),0,0,0,0,.5);
%OptimizeFunctionOnNextCall(testStraightLineDupeElimination); %OptimizeFunctionOnNextCall(testStraightLineDupeElinination);
testStraightLineDupeElimination(new Array(5)); testStraightLineDupeElinination(new Array(5));
testStraightLineDupeElimination(new Array(5)); testStraightLineDupeElinination(new Array(5));
assertTrue(2 != %GetOptimizationStatus(testStraightLineDupeElimination)); assertTrue(2 != %GetOptimizationStatus(testStraightLineDupeElinination));
%ClearFunctionTypeFeedback(testStraightLineDupeElimination);
} }
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