| OLD | NEW |
| 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 memory_use += (end - start); | 477 memory_use += (end - start); |
| 478 } | 478 } |
| 479 | 479 |
| 480 line_start = position; | 480 line_start = position; |
| 481 } | 481 } |
| 482 close(fd); | 482 close(fd); |
| 483 return memory_use; | 483 return memory_use; |
| 484 } | 484 } |
| 485 | 485 |
| 486 | 486 |
| 487 TEST(BootUpMemoryUse) { | |
| 488 intptr_t initial_memory = MemoryInUse(); | |
| 489 // Avoid flakiness. | |
| 490 FLAG_crankshaft = false; | |
| 491 FLAG_concurrent_osr = false; | |
| 492 FLAG_concurrent_recompilation = false; | |
| 493 | |
| 494 // Only Linux has the proc filesystem and only if it is mapped. If it's not | |
| 495 // there we just skip the test. | |
| 496 if (initial_memory >= 0) { | |
| 497 CcTest::InitializeVM(); | |
| 498 intptr_t delta = MemoryInUse() - initial_memory; | |
| 499 printf("delta: %" V8_PTR_PREFIX "d kB\n", delta / 1024); | |
| 500 if (v8::internal::Snapshot::IsEnabled()) { | |
| 501 CHECK_LE(delta, | |
| 502 3200 * 1024 * FullCodeGenerator::kBootCodeSizeMultiplier / 100); | |
| 503 } else { | |
| 504 CHECK_LE(delta, | |
| 505 3350 * 1024 * FullCodeGenerator::kBootCodeSizeMultiplier / 100); | |
| 506 } | |
| 507 } | |
| 508 } | |
| 509 | |
| 510 | |
| 511 intptr_t ShortLivingIsolate() { | 487 intptr_t ShortLivingIsolate() { |
| 512 v8::Isolate* isolate = v8::Isolate::New(); | 488 v8::Isolate* isolate = v8::Isolate::New(); |
| 513 { v8::Isolate::Scope isolate_scope(isolate); | 489 { v8::Isolate::Scope isolate_scope(isolate); |
| 514 v8::Locker lock(isolate); | 490 v8::Locker lock(isolate); |
| 515 v8::HandleScope handle_scope(isolate); | 491 v8::HandleScope handle_scope(isolate); |
| 516 v8::Local<v8::Context> context = v8::Context::New(isolate); | 492 v8::Local<v8::Context> context = v8::Context::New(isolate); |
| 517 CHECK(!context.IsEmpty()); | 493 CHECK(!context.IsEmpty()); |
| 518 } | 494 } |
| 519 isolate->Dispose(); | 495 isolate->Dispose(); |
| 520 return MemoryInUse(); | 496 return MemoryInUse(); |
| 521 } | 497 } |
| 522 | 498 |
| 523 | 499 |
| 524 TEST(RegressJoinThreadsOnIsolateDeinit) { | 500 TEST(RegressJoinThreadsOnIsolateDeinit) { |
| 525 intptr_t size_limit = ShortLivingIsolate() * 2; | 501 intptr_t size_limit = ShortLivingIsolate() * 2; |
| 526 for (int i = 0; i < 10; i++) { | 502 for (int i = 0; i < 10; i++) { |
| 527 CHECK_GT(size_limit, ShortLivingIsolate()); | 503 CHECK_GT(size_limit, ShortLivingIsolate()); |
| 528 } | 504 } |
| 529 } | 505 } |
| 530 | 506 |
| 531 #endif // __linux__ and !USE_SIMULATOR | 507 #endif // __linux__ and !USE_SIMULATOR |
| OLD | NEW |