Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: test/cctest/heap/test-heap.cc

Issue 1642613002: Reland of Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: %SetCode failed to install literals in cache. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/compiler/test-run-jscalls.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/heap/test-heap.cc
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc
index 6df355d289d30ad8168c3030b5812cb234126808..603216a07bfb7381f7dedf90ef374b6771c32c3e 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -3627,7 +3627,7 @@ TEST(IncrementalMarkingPreservesMonomorphicCallIC) {
v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked())));
- Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector());
+ Handle<TypeFeedbackVector> feedback_vector(f->feedback_vector());
FeedbackVectorHelper feedback_helper(feedback_vector);
int expected_slots = 2;
@@ -3664,7 +3664,7 @@ static Code* FindFirstIC(Code* code, Code::Kind kind) {
static void CheckVectorIC(Handle<JSFunction> f, int slot_index,
InlineCacheState desired_state) {
Handle<TypeFeedbackVector> vector =
- Handle<TypeFeedbackVector>(f->shared()->feedback_vector());
+ Handle<TypeFeedbackVector>(f->feedback_vector());
FeedbackVectorHelper helper(vector);
FeedbackVectorSlot slot = helper.slot(slot_index);
if (vector->GetKind(slot) == FeedbackVectorSlotKind::LOAD_IC) {
@@ -3678,15 +3678,6 @@ static void CheckVectorIC(Handle<JSFunction> f, int slot_index,
}
-static void CheckVectorICCleared(Handle<JSFunction> f, int slot_index) {
- Handle<TypeFeedbackVector> vector =
- Handle<TypeFeedbackVector>(f->shared()->feedback_vector());
- FeedbackVectorSlot slot(slot_index);
- LoadICNexus nexus(vector, slot);
- CHECK(IC::IsCleared(&nexus));
-}
-
-
TEST(IncrementalMarkingPreservesMonomorphicConstructor) {
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
@@ -3701,7 +3692,7 @@ TEST(IncrementalMarkingPreservesMonomorphicConstructor) {
v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked())));
- Handle<TypeFeedbackVector> vector(f->shared()->feedback_vector());
+ Handle<TypeFeedbackVector> vector(f->feedback_vector());
CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell());
SimulateIncrementalMarking(CcTest::heap());
@@ -3711,44 +3702,6 @@ TEST(IncrementalMarkingPreservesMonomorphicConstructor) {
}
-TEST(IncrementalMarkingClearsMonomorphicConstructor) {
- if (i::FLAG_always_opt) return;
- CcTest::InitializeVM();
- Isolate* isolate = CcTest::i_isolate();
- v8::HandleScope scope(CcTest::isolate());
- v8::Local<v8::Value> fun1;
- v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
-
- {
- LocalContext env;
- CompileRun("function fun() { this.x = 1; };");
- fun1 = env->Global()->Get(env.local(), v8_str("fun")).ToLocalChecked();
- }
-
- // Prepare function f that contains a monomorphic constructor for object
- // originating from a different native context.
- CHECK(CcTest::global()->Set(ctx, v8_str("fun1"), fun1).FromJust());
- CompileRun(
- "function fun() { this.x = 1; };"
- "function f(o) { return new o(); } f(fun1); f(fun1);");
- Handle<JSFunction> f = Handle<JSFunction>::cast(
- v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
- CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked())));
-
-
- Handle<TypeFeedbackVector> vector(f->shared()->feedback_vector());
- CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell());
-
- // Fire context dispose notification.
- CcTest::isolate()->ContextDisposedNotification();
- SimulateIncrementalMarking(CcTest::heap());
- CcTest::heap()->CollectAllGarbage();
-
- CHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(isolate),
- vector->Get(FeedbackVectorSlot(0)));
-}
-
-
TEST(IncrementalMarkingPreservesMonomorphicIC) {
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
@@ -3771,38 +3724,6 @@ TEST(IncrementalMarkingPreservesMonomorphicIC) {
}
-TEST(IncrementalMarkingClearsMonomorphicIC) {
- if (i::FLAG_always_opt) return;
- CcTest::InitializeVM();
- v8::HandleScope scope(CcTest::isolate());
- v8::Local<v8::Value> obj1;
- v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
-
- {
- LocalContext env;
- CompileRun("function fun() { this.x = 1; }; var obj = new fun();");
- obj1 = env->Global()->Get(env.local(), v8_str("obj")).ToLocalChecked();
- }
-
- // Prepare function f that contains a monomorphic IC for object
- // originating from a different native context.
- CHECK(CcTest::global()->Set(ctx, v8_str("obj1"), obj1).FromJust());
- CompileRun("function f(o) { return o.x; } f(obj1); f(obj1);");
- Handle<JSFunction> f = Handle<JSFunction>::cast(
- v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
- CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked())));
-
- CheckVectorIC(f, 0, MONOMORPHIC);
-
- // Fire context dispose notification.
- CcTest::isolate()->ContextDisposedNotification();
- SimulateIncrementalMarking(CcTest::heap());
- CcTest::heap()->CollectAllGarbage();
-
- CheckVectorICCleared(f, 0);
-}
-
-
TEST(IncrementalMarkingPreservesPolymorphicIC) {
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
@@ -3840,8 +3761,7 @@ TEST(IncrementalMarkingPreservesPolymorphicIC) {
CheckVectorIC(f, 0, POLYMORPHIC);
}
-
-TEST(IncrementalMarkingClearsPolymorphicIC) {
+TEST(ContextDisposeDoesntClearPolymorphicIC) {
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
@@ -3876,7 +3796,7 @@ TEST(IncrementalMarkingClearsPolymorphicIC) {
SimulateIncrementalMarking(CcTest::heap());
CcTest::heap()->CollectAllGarbage();
- CheckVectorICCleared(f, 0);
+ CheckVectorIC(f, 0, POLYMORPHIC);
}
@@ -4292,7 +4212,8 @@ TEST(Regress513507) {
if (!code->is_optimized_code()) return;
}
- Handle<TypeFeedbackVector> vector = handle(shared->feedback_vector());
+ Handle<TypeFeedbackVector> vector =
+ TypeFeedbackVector::New(isolate, handle(shared->feedback_metadata()));
Handle<LiteralsArray> lit =
LiteralsArray::New(isolate, vector, shared->num_literals(), TENURED);
Handle<Context> context(isolate->context());
@@ -4349,7 +4270,8 @@ TEST(Regress514122) {
if (!code->is_optimized_code()) return;
}
- Handle<TypeFeedbackVector> vector = handle(shared->feedback_vector());
+ Handle<TypeFeedbackVector> vector =
+ TypeFeedbackVector::New(isolate, handle(shared->feedback_metadata()));
Handle<LiteralsArray> lit =
LiteralsArray::New(isolate, vector, shared->num_literals(), TENURED);
Handle<Context> context(isolate->context());
@@ -5053,7 +4975,7 @@ TEST(WeakFunctionInConstructor) {
// cleared. Now, verify that one additional call with a new function
// allows monomorphicity.
Handle<TypeFeedbackVector> feedback_vector = Handle<TypeFeedbackVector>(
- createObj->shared()->feedback_vector(), CcTest::i_isolate());
+ createObj->feedback_vector(), CcTest::i_isolate());
for (int i = 0; i < 20; i++) {
Object* slot_value = feedback_vector->Get(FeedbackVectorSlot(0));
CHECK(slot_value->IsWeakCell());
@@ -5254,12 +5176,11 @@ Handle<JSFunction> GetFunctionByName(Isolate* isolate, const char* name) {
return Handle<JSFunction>::cast(obj);
}
-
-void CheckIC(Code* code, Code::Kind kind, SharedFunctionInfo* shared,
- int slot_index, InlineCacheState state) {
+void CheckIC(Handle<JSFunction> function, Code::Kind kind, int slot_index,
+ InlineCacheState state) {
if (kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC ||
kind == Code::CALL_IC) {
- TypeFeedbackVector* vector = shared->feedback_vector();
+ TypeFeedbackVector* vector = function->feedback_vector();
FeedbackVectorSlot slot(slot_index);
if (kind == Code::LOAD_IC) {
LoadICNexus nexus(vector, slot);
@@ -5272,7 +5193,7 @@ void CheckIC(Code* code, Code::Kind kind, SharedFunctionInfo* shared,
CHECK_EQ(nexus.StateFromFeedback(), state);
}
} else {
- Code* ic = FindFirstIC(code, kind);
+ Code* ic = FindFirstIC(function->code(), kind);
CHECK(ic->is_inline_cache_stub());
CHECK(ic->ic_state() == state);
}
@@ -5303,12 +5224,12 @@ TEST(MonomorphicStaysMonomorphicAfterGC) {
CompileRun("(testIC())");
}
heap->CollectAllGarbage();
- CheckIC(loadIC->code(), Code::LOAD_IC, loadIC->shared(), 0, MONOMORPHIC);
+ CheckIC(loadIC, Code::LOAD_IC, 0, MONOMORPHIC);
{
v8::HandleScope scope(CcTest::isolate());
CompileRun("(testIC())");
}
- CheckIC(loadIC->code(), Code::LOAD_IC, loadIC->shared(), 0, MONOMORPHIC);
+ CheckIC(loadIC, Code::LOAD_IC, 0, MONOMORPHIC);
}
@@ -5339,12 +5260,12 @@ TEST(PolymorphicStaysPolymorphicAfterGC) {
CompileRun("(testIC())");
}
heap->CollectAllGarbage();
- CheckIC(loadIC->code(), Code::LOAD_IC, loadIC->shared(), 0, POLYMORPHIC);
+ CheckIC(loadIC, Code::LOAD_IC, 0, POLYMORPHIC);
{
v8::HandleScope scope(CcTest::isolate());
CompileRun("(testIC())");
}
- CheckIC(loadIC->code(), Code::LOAD_IC, loadIC->shared(), 0, POLYMORPHIC);
+ CheckIC(loadIC, Code::LOAD_IC, 0, POLYMORPHIC);
}
« no previous file with comments | « test/cctest/compiler/test-run-jscalls.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698