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 13 matching lines...) Expand all Loading... |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 #include <utility> | 29 #include <utility> |
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/execution.h" | 35 #include "src/execution.h" |
35 #include "src/factory.h" | 36 #include "src/factory.h" |
36 #include "src/global-handles.h" | 37 #include "src/global-handles.h" |
37 #include "src/ic/ic.h" | 38 #include "src/ic/ic.h" |
38 #include "src/macro-assembler.h" | 39 #include "src/macro-assembler.h" |
39 #include "test/cctest/cctest.h" | 40 #include "test/cctest/cctest.h" |
40 | 41 |
41 using namespace v8::internal; | 42 using namespace v8::internal; |
42 using v8::Just; | 43 using v8::Just; |
43 | 44 |
(...skipping 4291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4335 if (i::FLAG_always_opt || !i::FLAG_crankshaft) return; | 4336 if (i::FLAG_always_opt || !i::FLAG_crankshaft) return; |
4336 if (!i::FLAG_incremental_marking) return; | 4337 if (!i::FLAG_incremental_marking) return; |
4337 i::FLAG_weak_embedded_objects_in_optimized_code = true; | 4338 i::FLAG_weak_embedded_objects_in_optimized_code = true; |
4338 i::FLAG_allow_natives_syntax = true; | 4339 i::FLAG_allow_natives_syntax = true; |
4339 i::FLAG_compilation_cache = false; | 4340 i::FLAG_compilation_cache = false; |
4340 i::FLAG_retain_maps_for_n_gc = 0; | 4341 i::FLAG_retain_maps_for_n_gc = 0; |
4341 CcTest::InitializeVM(); | 4342 CcTest::InitializeVM(); |
4342 Isolate* isolate = CcTest::i_isolate(); | 4343 Isolate* isolate = CcTest::i_isolate(); |
4343 v8::internal::Heap* heap = CcTest::heap(); | 4344 v8::internal::Heap* heap = CcTest::heap(); |
4344 | 4345 |
| 4346 // Get a clean slate regarding optimized functions on the heap. |
| 4347 i::Deoptimizer::DeoptimizeAll(isolate); |
| 4348 heap->CollectAllGarbage(); |
| 4349 |
4345 if (!isolate->use_crankshaft()) return; | 4350 if (!isolate->use_crankshaft()) return; |
4346 HandleScope outer_scope(heap->isolate()); | 4351 HandleScope outer_scope(heap->isolate()); |
4347 for (int i = 0; i < 3; i++) { | 4352 for (int i = 0; i < 3; i++) { |
4348 SimulateIncrementalMarking(heap); | 4353 SimulateIncrementalMarking(heap); |
4349 { | 4354 { |
4350 LocalContext context; | 4355 LocalContext context; |
4351 HandleScope scope(heap->isolate()); | 4356 HandleScope scope(heap->isolate()); |
4352 EmbeddedVector<char, 256> source; | 4357 EmbeddedVector<char, 256> source; |
4353 SNPrintF(source, | 4358 SNPrintF(source, |
4354 "function bar%d() {" | 4359 "function bar%d() {" |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5411 CHECK(pos->IsSmi()); | 5416 CHECK(pos->IsSmi()); |
5412 | 5417 |
5413 Handle<JSArray> stack_trace_array = Handle<JSArray>::cast(stack_trace); | 5418 Handle<JSArray> stack_trace_array = Handle<JSArray>::cast(stack_trace); |
5414 int array_length = Smi::cast(stack_trace_array->length())->value(); | 5419 int array_length = Smi::cast(stack_trace_array->length())->value(); |
5415 for (int i = 0; i < array_length; i++) { | 5420 for (int i = 0; i < array_length; i++) { |
5416 Handle<Object> element = | 5421 Handle<Object> element = |
5417 Object::GetElement(isolate, stack_trace, i).ToHandleChecked(); | 5422 Object::GetElement(isolate, stack_trace, i).ToHandleChecked(); |
5418 CHECK(!element->IsCode()); | 5423 CHECK(!element->IsCode()); |
5419 } | 5424 } |
5420 } | 5425 } |
OLD | NEW |