aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-feedback-vector.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2016-12-23 16:30:57 +0100
committerMichaël Zasso <targos@protonmail.com>2017-01-26 22:46:17 +0100
commit2739185b790e040c3b044c577327f5d44bffad4a (patch)
tree29a466999212f4c85958379d9d400eec8a185ba5 /deps/v8/test/cctest/test-feedback-vector.cc
parenta67a04d7654faaa04c8da00e42981ebc9fd0911c (diff)
downloadandroid-node-v8-2739185b790e040c3b044c577327f5d44bffad4a.tar.gz
android-node-v8-2739185b790e040c3b044c577327f5d44bffad4a.tar.bz2
android-node-v8-2739185b790e040c3b044c577327f5d44bffad4a.zip
deps: update V8 to 5.5.372.40
PR-URL: https://github.com/nodejs/node/pull/9618 Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'deps/v8/test/cctest/test-feedback-vector.cc')
-rw-r--r--deps/v8/test/cctest/test-feedback-vector.cc37
1 files changed, 22 insertions, 15 deletions
diff --git a/deps/v8/test/cctest/test-feedback-vector.cc b/deps/v8/test/cctest/test-feedback-vector.cc
index 4322e746e2..af9c6feef0 100644
--- a/deps/v8/test/cctest/test-feedback-vector.cc
+++ b/deps/v8/test/cctest/test-feedback-vector.cc
@@ -41,8 +41,8 @@ TEST(VectorStructure) {
// Empty vectors are the empty fixed array.
StaticFeedbackVectorSpec empty;
Handle<TypeFeedbackVector> vector = NewTypeFeedbackVector(isolate, &empty);
- CHECK(Handle<FixedArray>::cast(vector)
- .is_identical_to(factory->empty_fixed_array()));
+ CHECK(Handle<FixedArray>::cast(vector).is_identical_to(
+ factory->empty_type_feedback_vector()));
// Which can nonetheless be queried.
CHECK(vector->is_empty());
@@ -199,8 +199,6 @@ TEST(VectorCallICStates) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
Isolate* isolate = CcTest::i_isolate();
- Heap* heap = isolate->heap();
-
// Make sure function f has a call that uses a type feedback slot.
CompileRun(
"function foo() { return 17; }"
@@ -219,7 +217,7 @@ TEST(VectorCallICStates) {
CHECK_EQ(GENERIC, nexus.StateFromFeedback());
// After a collection, state should remain GENERIC.
- heap->CollectAllGarbage();
+ CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CHECK_EQ(GENERIC, nexus.StateFromFeedback());
}
@@ -229,8 +227,6 @@ TEST(VectorCallFeedbackForArray) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
Isolate* isolate = CcTest::i_isolate();
- Heap* heap = isolate->heap();
-
// Make sure function f has a call that uses a type feedback slot.
CompileRun(
"function foo() { return 17; }"
@@ -246,7 +242,7 @@ TEST(VectorCallFeedbackForArray) {
CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
CHECK(nexus.GetFeedback()->IsAllocationSite());
- heap->CollectAllGarbage();
+ CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
// It should stay monomorphic even after a GC.
CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
}
@@ -273,6 +269,11 @@ TEST(VectorCallCounts) {
CompileRun("f(foo); f(foo);");
CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
CHECK_EQ(3, nexus.ExtractCallCount());
+
+ // Send the IC megamorphic, but we should still have incrementing counts.
+ CompileRun("f(function() { return 12; });");
+ CHECK_EQ(GENERIC, nexus.StateFromFeedback());
+ CHECK_EQ(4, nexus.ExtractCallCount());
}
TEST(VectorConstructCounts) {
@@ -289,13 +290,21 @@ TEST(VectorConstructCounts) {
Handle<JSFunction> f = GetFunction("f");
Handle<TypeFeedbackVector> feedback_vector =
Handle<TypeFeedbackVector>(f->feedback_vector(), isolate);
+
FeedbackVectorSlot slot(0);
+ CallICNexus nexus(feedback_vector, slot);
+ CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+
CHECK(feedback_vector->Get(slot)->IsWeakCell());
CompileRun("f(Foo); f(Foo);");
- FeedbackVectorSlot cslot(1);
- CHECK(feedback_vector->Get(cslot)->IsSmi());
- CHECK_EQ(3, Smi::cast(feedback_vector->Get(cslot))->value());
+ CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(3, nexus.ExtractCallCount());
+
+ // Send the IC megamorphic, but we should still have incrementing counts.
+ CompileRun("f(function() {});");
+ CHECK_EQ(GENERIC, nexus.StateFromFeedback());
+ CHECK_EQ(4, nexus.ExtractCallCount());
}
TEST(VectorLoadICStates) {
@@ -304,7 +313,6 @@ TEST(VectorLoadICStates) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
Isolate* isolate = CcTest::i_isolate();
- Heap* heap = isolate->heap();
// Make sure function f has a call that uses a type feedback slot.
CompileRun(
@@ -348,7 +356,7 @@ TEST(VectorLoadICStates) {
CHECK(!nexus.FindFirstMap());
// After a collection, state should not be reset to PREMONOMORPHIC.
- heap->CollectAllGarbage();
+ CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback());
}
@@ -551,8 +559,7 @@ TEST(ReferenceContextAllocatesNoSlots) {
CHECK_SLOT_KIND(helper, 3, FeedbackVectorSlotKind::STORE_IC);
CHECK_SLOT_KIND(helper, 4, FeedbackVectorSlotKind::LOAD_IC);
CHECK_SLOT_KIND(helper, 5, FeedbackVectorSlotKind::LOAD_IC);
- // Binary operation feedback is a general slot.
- CHECK_SLOT_KIND(helper, 6, FeedbackVectorSlotKind::GENERAL);
+ CHECK_SLOT_KIND(helper, 6, FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC);
}
}