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

Side by Side Diff: test/cctest/test-heap.cc

Issue 650073002: vector-based ICs did not update type feedback counts correctly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed problematic field TypeFeedbackInfo::feedback_vector(). Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3129 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 CcTest::global()->Set(v8_str("fun2"), fun2); 3140 CcTest::global()->Set(v8_str("fun2"), fun2);
3141 CompileRun("function f(a, b) { a(); b(); } f(fun1, fun2);"); 3141 CompileRun("function f(a, b) { a(); b(); } f(fun1, fun2);");
3142 3142
3143 Handle<JSFunction> f = 3143 Handle<JSFunction> f =
3144 v8::Utils::OpenHandle( 3144 v8::Utils::OpenHandle(
3145 *v8::Handle<v8::Function>::Cast( 3145 *v8::Handle<v8::Function>::Cast(
3146 CcTest::global()->Get(v8_str("f")))); 3146 CcTest::global()->Get(v8_str("f"))));
3147 3147
3148 Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); 3148 Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector());
3149 3149
3150 int expected_length = FLAG_vector_ics ? 4 : 2; 3150 int expected_slots = 2;
3151 CHECK_EQ(expected_length, feedback_vector->length()); 3151 CHECK_EQ(expected_slots, feedback_vector->ICSlots());
3152 for (int i = 0; i < expected_length; i++) { 3152 for (int i = 0; i < expected_slots; i++) {
3153 if ((i % 2) == 1) { 3153 CHECK(feedback_vector->Get(FeedbackVectorICSlot(i))->IsJSFunction());
3154 CHECK(feedback_vector->get(i)->IsJSFunction());
3155 }
3156 } 3154 }
3157 3155
3158 SimulateIncrementalMarking(CcTest::heap()); 3156 SimulateIncrementalMarking(CcTest::heap());
3159 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); 3157 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
3160 3158
3161 CHECK_EQ(expected_length, feedback_vector->length()); 3159 CHECK_EQ(expected_slots, feedback_vector->ICSlots());
3162 for (int i = 0; i < expected_length; i++) { 3160 for (int i = 0; i < expected_slots; i++) {
3163 CHECK_EQ(feedback_vector->get(i), 3161 CHECK_EQ(feedback_vector->Get(FeedbackVectorICSlot(i)),
3164 *TypeFeedbackVector::UninitializedSentinel(CcTest::i_isolate())); 3162 *TypeFeedbackVector::UninitializedSentinel(CcTest::i_isolate()));
3165 } 3163 }
3166 } 3164 }
3167 3165
3168 3166
3169 static Code* FindFirstIC(Code* code, Code::Kind kind) { 3167 static Code* FindFirstIC(Code* code, Code::Kind kind) {
3170 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | 3168 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) |
3171 RelocInfo::ModeMask(RelocInfo::CONSTRUCT_CALL) | 3169 RelocInfo::ModeMask(RelocInfo::CONSTRUCT_CALL) |
3172 RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID); 3170 RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID);
3173 for (RelocIterator it(code, mask); !it.done(); it.next()) { 3171 for (RelocIterator it(code, mask); !it.done(); it.next()) {
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
4505 #ifdef DEBUG 4503 #ifdef DEBUG
4506 TEST(PathTracer) { 4504 TEST(PathTracer) {
4507 CcTest::InitializeVM(); 4505 CcTest::InitializeVM();
4508 v8::HandleScope scope(CcTest::isolate()); 4506 v8::HandleScope scope(CcTest::isolate());
4509 4507
4510 v8::Local<v8::Value> result = CompileRun("'abc'"); 4508 v8::Local<v8::Value> result = CompileRun("'abc'");
4511 Handle<Object> o = v8::Utils::OpenHandle(*result); 4509 Handle<Object> o = v8::Utils::OpenHandle(*result);
4512 CcTest::i_isolate()->heap()->TracePathToObject(*o); 4510 CcTest::i_isolate()->heap()->TracePathToObject(*o);
4513 } 4511 }
4514 #endif // DEBUG 4512 #endif // DEBUG
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698