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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "src/v8.h" | 31 #include "src/v8.h" |
32 | 32 |
33 #include "src/compilation-cache.h" | 33 #include "src/compilation-cache.h" |
34 #include "src/deoptimizer.h" | 34 #include "src/deoptimizer.h" |
35 #include "src/execution.h" | 35 #include "src/execution.h" |
36 #include "src/factory.h" | 36 #include "src/factory.h" |
37 #include "src/global-handles.h" | 37 #include "src/global-handles.h" |
38 #include "src/ic/ic.h" | 38 #include "src/ic/ic.h" |
39 #include "src/macro-assembler.h" | 39 #include "src/macro-assembler.h" |
| 40 #include "src/snapshot/snapshot.h" |
40 #include "test/cctest/cctest.h" | 41 #include "test/cctest/cctest.h" |
41 | 42 |
42 using namespace v8::internal; | 43 using namespace v8::internal; |
43 using v8::Just; | 44 using v8::Just; |
44 | 45 |
45 static void CheckMap(Map* map, int type, int instance_size) { | 46 static void CheckMap(Map* map, int type, int instance_size) { |
46 CHECK(map->IsHeapObject()); | 47 CHECK(map->IsHeapObject()); |
47 #ifdef DEBUG | 48 #ifdef DEBUG |
48 CHECK(CcTest::heap()->Contains(map)); | 49 CHECK(CcTest::heap()->Contains(map)); |
49 #endif | 50 #endif |
(...skipping 4284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4334 | 4335 |
4335 TEST(NoWeakHashTableLeakWithIncrementalMarking) { | 4336 TEST(NoWeakHashTableLeakWithIncrementalMarking) { |
4336 if (i::FLAG_always_opt || !i::FLAG_crankshaft) return; | 4337 if (i::FLAG_always_opt || !i::FLAG_crankshaft) return; |
4337 if (!i::FLAG_incremental_marking) return; | 4338 if (!i::FLAG_incremental_marking) return; |
4338 i::FLAG_weak_embedded_objects_in_optimized_code = true; | 4339 i::FLAG_weak_embedded_objects_in_optimized_code = true; |
4339 i::FLAG_allow_natives_syntax = true; | 4340 i::FLAG_allow_natives_syntax = true; |
4340 i::FLAG_compilation_cache = false; | 4341 i::FLAG_compilation_cache = false; |
4341 i::FLAG_retain_maps_for_n_gc = 0; | 4342 i::FLAG_retain_maps_for_n_gc = 0; |
4342 CcTest::InitializeVM(); | 4343 CcTest::InitializeVM(); |
4343 Isolate* isolate = CcTest::i_isolate(); | 4344 Isolate* isolate = CcTest::i_isolate(); |
| 4345 |
| 4346 // Do not run for no-snap builds. |
| 4347 if (!i::Snapshot::HaveASnapshotToStartFrom(isolate)) return; |
| 4348 |
4344 v8::internal::Heap* heap = CcTest::heap(); | 4349 v8::internal::Heap* heap = CcTest::heap(); |
4345 | 4350 |
4346 // Get a clean slate regarding optimized functions on the heap. | 4351 // Get a clean slate regarding optimized functions on the heap. |
4347 i::Deoptimizer::DeoptimizeAll(isolate); | 4352 i::Deoptimizer::DeoptimizeAll(isolate); |
4348 heap->CollectAllGarbage(); | 4353 heap->CollectAllGarbage(); |
4349 | 4354 |
4350 if (!isolate->use_crankshaft()) return; | 4355 if (!isolate->use_crankshaft()) return; |
4351 HandleScope outer_scope(heap->isolate()); | 4356 HandleScope outer_scope(heap->isolate()); |
4352 for (int i = 0; i < 3; i++) { | 4357 for (int i = 0; i < 3; i++) { |
4353 SimulateIncrementalMarking(heap); | 4358 SimulateIncrementalMarking(heap); |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5416 CHECK(pos->IsSmi()); | 5421 CHECK(pos->IsSmi()); |
5417 | 5422 |
5418 Handle<JSArray> stack_trace_array = Handle<JSArray>::cast(stack_trace); | 5423 Handle<JSArray> stack_trace_array = Handle<JSArray>::cast(stack_trace); |
5419 int array_length = Smi::cast(stack_trace_array->length())->value(); | 5424 int array_length = Smi::cast(stack_trace_array->length())->value(); |
5420 for (int i = 0; i < array_length; i++) { | 5425 for (int i = 0; i < array_length; i++) { |
5421 Handle<Object> element = | 5426 Handle<Object> element = |
5422 Object::GetElement(isolate, stack_trace, i).ToHandleChecked(); | 5427 Object::GetElement(isolate, stack_trace, i).ToHandleChecked(); |
5423 CHECK(!element->IsCode()); | 5428 CHECK(!element->IsCode()); |
5424 } | 5429 } |
5425 } | 5430 } |
OLD | NEW |