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

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

Issue 1202173002: Remove --pretenuring-call-new (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix 64 bit release build break. Created 5 years, 3 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 | « src/x64/code-stubs-x64.cc ('k') | test/cctest/test-mementos.cc » ('j') | 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 3294 matching lines...) Expand 10 before | Expand all | Expand 10 after
3305 Handle<JSObject> o = 3305 Handle<JSObject> o =
3306 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); 3306 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
3307 CHECK(CcTest::heap()->InOldSpace(*o)); 3307 CHECK(CcTest::heap()->InOldSpace(*o));
3308 CHECK(CcTest::heap()->InOldSpace(*double_array_handle_1)); 3308 CHECK(CcTest::heap()->InOldSpace(*double_array_handle_1));
3309 CHECK(CcTest::heap()->InOldSpace(double_array_handle_1->elements())); 3309 CHECK(CcTest::heap()->InOldSpace(double_array_handle_1->elements()));
3310 CHECK(CcTest::heap()->InOldSpace(*double_array_handle_2)); 3310 CHECK(CcTest::heap()->InOldSpace(*double_array_handle_2));
3311 CHECK(CcTest::heap()->InOldSpace(double_array_handle_2->elements())); 3311 CHECK(CcTest::heap()->InOldSpace(double_array_handle_2->elements()));
3312 } 3312 }
3313 3313
3314 3314
3315 // Make sure pretenuring feedback is gathered for constructed objects as well
3316 // as for literals.
3317 TEST(OptimizedPretenuringConstructorCalls) {
3318 if (!i::FLAG_pretenuring_call_new) {
3319 // FLAG_pretenuring_call_new needs to be synced with the snapshot.
3320 return;
3321 }
3322 i::FLAG_allow_natives_syntax = true;
3323 i::FLAG_expose_gc = true;
3324 CcTest::InitializeVM();
3325 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
3326 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
3327 v8::HandleScope scope(CcTest::isolate());
3328
3329 // Grow new space unitl maximum capacity reached.
3330 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) {
3331 CcTest::heap()->new_space()->Grow();
3332 }
3333
3334 i::ScopedVector<char> source(1024);
3335 // Call new is doing slack tracking for the first
3336 // JSFunction::kGenerousAllocationCount allocations, and we can't find
3337 // mementos during that time.
3338 i::SNPrintF(
3339 source,
3340 "var number_elements = %d;"
3341 "var elements = new Array(number_elements);"
3342 "function foo() {"
3343 " this.a = 3;"
3344 " this.b = {};"
3345 "}"
3346 "function f() {"
3347 " for (var i = 0; i < number_elements; i++) {"
3348 " elements[i] = new foo();"
3349 " }"
3350 " return elements[number_elements - 1];"
3351 "};"
3352 "f(); gc();"
3353 "f(); f();"
3354 "%%OptimizeFunctionOnNextCall(f);"
3355 "f();",
3356 AllocationSite::kPretenureMinimumCreated +
3357 JSFunction::kGenerousAllocationCount);
3358
3359 v8::Local<v8::Value> res = CompileRun(source.start());
3360
3361 Handle<JSObject> o =
3362 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
3363
3364 CHECK(CcTest::heap()->InOldSpace(*o));
3365 }
3366
3367
3368 TEST(OptimizedPretenuringCallNew) {
3369 if (!i::FLAG_pretenuring_call_new) {
3370 // FLAG_pretenuring_call_new needs to be synced with the snapshot.
3371 return;
3372 }
3373 i::FLAG_allow_natives_syntax = true;
3374 i::FLAG_expose_gc = true;
3375 CcTest::InitializeVM();
3376 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
3377 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
3378 v8::HandleScope scope(CcTest::isolate());
3379
3380 // Grow new space unitl maximum capacity reached.
3381 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) {
3382 CcTest::heap()->new_space()->Grow();
3383 }
3384
3385 i::ScopedVector<char> source(1024);
3386 // Call new is doing slack tracking for the first
3387 // JSFunction::kGenerousAllocationCount allocations, and we can't find
3388 // mementos during that time.
3389 i::SNPrintF(
3390 source,
3391 "var number_elements = %d;"
3392 "var elements = new Array(number_elements);"
3393 "function g() { this.a = 0; }"
3394 "function f() {"
3395 " for (var i = 0; i < number_elements; i++) {"
3396 " elements[i] = new g();"
3397 " }"
3398 " return elements[number_elements - 1];"
3399 "};"
3400 "f(); gc();"
3401 "f(); f();"
3402 "%%OptimizeFunctionOnNextCall(f);"
3403 "f();",
3404 AllocationSite::kPretenureMinimumCreated +
3405 JSFunction::kGenerousAllocationCount);
3406
3407 v8::Local<v8::Value> res = CompileRun(source.start());
3408
3409 Handle<JSObject> o =
3410 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
3411 CHECK(CcTest::heap()->InOldSpace(*o));
3412 }
3413
3414
3415 // Test regular array literals allocation. 3315 // Test regular array literals allocation.
3416 TEST(OptimizedAllocationArrayLiterals) { 3316 TEST(OptimizedAllocationArrayLiterals) {
3417 i::FLAG_allow_natives_syntax = true; 3317 i::FLAG_allow_natives_syntax = true;
3418 CcTest::InitializeVM(); 3318 CcTest::InitializeVM();
3419 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; 3319 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
3420 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; 3320 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
3421 v8::HandleScope scope(CcTest::isolate()); 3321 v8::HandleScope scope(CcTest::isolate());
3422 3322
3423 v8::Local<v8::Value> res = CompileRun( 3323 v8::Local<v8::Value> res = CompileRun(
3424 "function f() {" 3324 "function f() {"
(...skipping 3187 matching lines...) Expand 10 before | Expand all | Expand 10 after
6612 // The CollectGarbage call above starts sweeper threads. 6512 // The CollectGarbage call above starts sweeper threads.
6613 // The crash will happen if the following two functions 6513 // The crash will happen if the following two functions
6614 // are called before sweeping finishes. 6514 // are called before sweeping finishes.
6615 heap->StartIncrementalMarking(); 6515 heap->StartIncrementalMarking();
6616 heap->FinalizeIncrementalMarkingIfComplete("test"); 6516 heap->FinalizeIncrementalMarkingIfComplete("test");
6617 } 6517 }
6618 6518
6619 6519
6620 } // namespace internal 6520 } // namespace internal
6621 } // namespace v8 6521 } // namespace v8
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | test/cctest/test-mementos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698