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

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

Issue 866493003: Retry "Use a WeakCell in the CallIC type vector." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 5 years, 10 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
« no previous file with comments | « test/cctest/test-feedback-vector.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3302 matching lines...) Expand 10 before | Expand all | Expand 10 after
3313 // Check size. 3313 // Check size.
3314 FieldIndex index = FieldIndex::ForDescriptor(internal_obj->map(), 0); 3314 FieldIndex index = FieldIndex::ForDescriptor(internal_obj->map(), 0);
3315 ObjectHashTable* hashtable = ObjectHashTable::cast( 3315 ObjectHashTable* hashtable = ObjectHashTable::cast(
3316 internal_obj->RawFastPropertyAt(index)); 3316 internal_obj->RawFastPropertyAt(index));
3317 // HashTable header (5) and 4 initial entries (8). 3317 // HashTable header (5) and 4 initial entries (8).
3318 CHECK_LE(hashtable->SizeFor(hashtable->length()), 13 * kPointerSize); 3318 CHECK_LE(hashtable->SizeFor(hashtable->length()), 13 * kPointerSize);
3319 } 3319 }
3320 } 3320 }
3321 3321
3322 3322
3323 TEST(IncrementalMarkingClearsTypeFeedbackInfo) { 3323 TEST(IncrementalMarkingPreservesMonomorphicCallIC) {
3324 if (i::FLAG_always_opt) return; 3324 if (i::FLAG_always_opt) return;
3325 CcTest::InitializeVM(); 3325 CcTest::InitializeVM();
3326 v8::HandleScope scope(CcTest::isolate()); 3326 v8::HandleScope scope(CcTest::isolate());
3327 v8::Local<v8::Value> fun1, fun2; 3327 v8::Local<v8::Value> fun1, fun2;
3328 3328
3329 { 3329 {
3330 LocalContext env; 3330 LocalContext env;
3331 CompileRun("function fun() {};"); 3331 CompileRun("function fun() {};");
3332 fun1 = env->Global()->Get(v8_str("fun")); 3332 fun1 = env->Global()->Get(v8_str("fun"));
3333 } 3333 }
(...skipping 14 matching lines...) Expand all
3348 v8::Utils::OpenHandle( 3348 v8::Utils::OpenHandle(
3349 *v8::Handle<v8::Function>::Cast( 3349 *v8::Handle<v8::Function>::Cast(
3350 CcTest::global()->Get(v8_str("f")))); 3350 CcTest::global()->Get(v8_str("f"))));
3351 3351
3352 Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); 3352 Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector());
3353 3353
3354 int expected_slots = 2; 3354 int expected_slots = 2;
3355 CHECK_EQ(expected_slots, feedback_vector->ICSlots()); 3355 CHECK_EQ(expected_slots, feedback_vector->ICSlots());
3356 int slot1 = 0; 3356 int slot1 = 0;
3357 int slot2 = 1; 3357 int slot2 = 1;
3358 CHECK(feedback_vector->Get(FeedbackVectorICSlot(slot1))->IsJSFunction()); 3358 CHECK(feedback_vector->Get(FeedbackVectorICSlot(slot1))->IsWeakCell());
3359 CHECK(feedback_vector->Get(FeedbackVectorICSlot(slot2))->IsJSFunction()); 3359 CHECK(feedback_vector->Get(FeedbackVectorICSlot(slot2))->IsWeakCell());
3360 3360
3361 SimulateIncrementalMarking(CcTest::heap()); 3361 SimulateIncrementalMarking(CcTest::heap());
3362 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); 3362 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
3363 3363
3364 CHECK_EQ(feedback_vector->Get(FeedbackVectorICSlot(slot1)), 3364 CHECK(!WeakCell::cast(feedback_vector->Get(FeedbackVectorICSlot(slot1)))
3365 *TypeFeedbackVector::UninitializedSentinel(CcTest::i_isolate())); 3365 ->cleared());
3366 CHECK_EQ(feedback_vector->Get(FeedbackVectorICSlot(slot2)), 3366 CHECK(!WeakCell::cast(feedback_vector->Get(FeedbackVectorICSlot(slot2)))
3367 *TypeFeedbackVector::UninitializedSentinel(CcTest::i_isolate())); 3367 ->cleared());
3368 } 3368 }
3369 3369
3370 3370
3371 static Code* FindFirstIC(Code* code, Code::Kind kind) { 3371 static Code* FindFirstIC(Code* code, Code::Kind kind) {
3372 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | 3372 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) |
3373 RelocInfo::ModeMask(RelocInfo::CONSTRUCT_CALL) | 3373 RelocInfo::ModeMask(RelocInfo::CONSTRUCT_CALL) |
3374 RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID); 3374 RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID);
3375 for (RelocIterator it(code, mask); !it.done(); it.next()) { 3375 for (RelocIterator it(code, mask); !it.done(); it.next()) {
3376 RelocInfo* info = it.rinfo(); 3376 RelocInfo* info = it.rinfo();
3377 Code* target = Code::GetCodeFromTargetAddress(info->target_address()); 3377 Code* target = Code::GetCodeFromTargetAddress(info->target_address());
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
5088 #ifdef DEBUG 5088 #ifdef DEBUG
5089 TEST(PathTracer) { 5089 TEST(PathTracer) {
5090 CcTest::InitializeVM(); 5090 CcTest::InitializeVM();
5091 v8::HandleScope scope(CcTest::isolate()); 5091 v8::HandleScope scope(CcTest::isolate());
5092 5092
5093 v8::Local<v8::Value> result = CompileRun("'abc'"); 5093 v8::Local<v8::Value> result = CompileRun("'abc'");
5094 Handle<Object> o = v8::Utils::OpenHandle(*result); 5094 Handle<Object> o = v8::Utils::OpenHandle(*result);
5095 CcTest::i_isolate()->heap()->TracePathToObject(*o); 5095 CcTest::i_isolate()->heap()->TracePathToObject(*o);
5096 } 5096 }
5097 #endif // DEBUG 5097 #endif // DEBUG
OLDNEW
« no previous file with comments | « test/cctest/test-feedback-vector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698