| 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 21 matching lines...) Expand all Loading... |
| 32 #include <sys/stat.h> | 32 #include <sys/stat.h> |
| 33 #include <fcntl.h> | 33 #include <fcntl.h> |
| 34 #include <unistd.h> | 34 #include <unistd.h> |
| 35 #include <errno.h> | 35 #include <errno.h> |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 #include <utility> | 38 #include <utility> |
| 39 | 39 |
| 40 #include "v8.h" | 40 #include "v8.h" |
| 41 | 41 |
| 42 #include "full-codegen.h" |
| 42 #include "global-handles.h" | 43 #include "global-handles.h" |
| 43 #include "snapshot.h" | 44 #include "snapshot.h" |
| 44 #include "cctest.h" | 45 #include "cctest.h" |
| 45 | 46 |
| 46 using namespace v8::internal; | 47 using namespace v8::internal; |
| 47 | 48 |
| 48 | 49 |
| 49 TEST(MarkingDeque) { | 50 TEST(MarkingDeque) { |
| 50 CcTest::InitializeVM(); | 51 CcTest::InitializeVM(); |
| 51 int mem_size = 20 * kPointerSize; | 52 int mem_size = 20 * kPointerSize; |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 FLAG_crankshaft = false; | 487 FLAG_crankshaft = false; |
| 487 FLAG_concurrent_osr = false; | 488 FLAG_concurrent_osr = false; |
| 488 FLAG_concurrent_recompilation = false; | 489 FLAG_concurrent_recompilation = false; |
| 489 | 490 |
| 490 // Only Linux has the proc filesystem and only if it is mapped. If it's not | 491 // Only Linux has the proc filesystem and only if it is mapped. If it's not |
| 491 // there we just skip the test. | 492 // there we just skip the test. |
| 492 if (initial_memory >= 0) { | 493 if (initial_memory >= 0) { |
| 493 CcTest::InitializeVM(); | 494 CcTest::InitializeVM(); |
| 494 intptr_t delta = MemoryInUse() - initial_memory; | 495 intptr_t delta = MemoryInUse() - initial_memory; |
| 495 printf("delta: %" V8_PTR_PREFIX "d kB\n", delta / 1024); | 496 printf("delta: %" V8_PTR_PREFIX "d kB\n", delta / 1024); |
| 496 if (sizeof(initial_memory) == 8) { // 64-bit. | 497 if (v8::internal::Snapshot::IsEnabled()) { |
| 497 if (v8::internal::Snapshot::IsEnabled()) { | 498 CHECK_LE(delta, |
| 498 CHECK_LE(delta, 4100 * 1024); | 499 3000 * 1024 * FullCodeGenerator::kBootCodeSizeMultiplier / 100); |
| 499 } else { | 500 } else { |
| 500 CHECK_LE(delta, 4600 * 1024); | 501 CHECK_LE(delta, |
| 501 } | 502 3300 * 1024 * FullCodeGenerator::kBootCodeSizeMultiplier / 100); |
| 502 } else { // 32-bit. | |
| 503 if (v8::internal::Snapshot::IsEnabled()) { | |
| 504 CHECK_LE(delta, 3100 * 1024); | |
| 505 } else { | |
| 506 CHECK_LE(delta, 3450 * 1024); | |
| 507 } | |
| 508 } | 503 } |
| 509 } | 504 } |
| 510 } | 505 } |
| 511 | 506 |
| 512 | 507 |
| 513 intptr_t ShortLivingIsolate() { | 508 intptr_t ShortLivingIsolate() { |
| 514 v8::Isolate* isolate = v8::Isolate::New(); | 509 v8::Isolate* isolate = v8::Isolate::New(); |
| 515 { v8::Isolate::Scope isolate_scope(isolate); | 510 { v8::Isolate::Scope isolate_scope(isolate); |
| 516 v8::Locker lock(isolate); | 511 v8::Locker lock(isolate); |
| 517 v8::HandleScope handle_scope(isolate); | 512 v8::HandleScope handle_scope(isolate); |
| 518 v8::Local<v8::Context> context = v8::Context::New(isolate); | 513 v8::Local<v8::Context> context = v8::Context::New(isolate); |
| 519 CHECK(!context.IsEmpty()); | 514 CHECK(!context.IsEmpty()); |
| 520 } | 515 } |
| 521 isolate->Dispose(); | 516 isolate->Dispose(); |
| 522 return MemoryInUse(); | 517 return MemoryInUse(); |
| 523 } | 518 } |
| 524 | 519 |
| 525 | 520 |
| 526 TEST(RegressJoinThreadsOnIsolateDeinit) { | 521 TEST(RegressJoinThreadsOnIsolateDeinit) { |
| 527 intptr_t size_limit = ShortLivingIsolate() * 2; | 522 intptr_t size_limit = ShortLivingIsolate() * 2; |
| 528 for (int i = 0; i < 10; i++) { | 523 for (int i = 0; i < 10; i++) { |
| 529 CHECK_GT(size_limit, ShortLivingIsolate()); | 524 CHECK_GT(size_limit, ShortLivingIsolate()); |
| 530 } | 525 } |
| 531 } | 526 } |
| 532 | 527 |
| 533 #endif // __linux__ and !USE_SIMULATOR | 528 #endif // __linux__ and !USE_SIMULATOR |
| OLD | NEW |