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 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 } | 1011 } |
1012 CHECK(heap->old_space()->Contains(clone->address())); | 1012 CHECK(heap->old_space()->Contains(clone->address())); |
1013 } | 1013 } |
1014 | 1014 |
1015 | 1015 |
1016 UNINITIALIZED_TEST(TestCodeFlushing) { | 1016 UNINITIALIZED_TEST(TestCodeFlushing) { |
1017 // If we do not flush code this test is invalid. | 1017 // If we do not flush code this test is invalid. |
1018 if (!FLAG_flush_code) return; | 1018 if (!FLAG_flush_code) return; |
1019 i::FLAG_allow_natives_syntax = true; | 1019 i::FLAG_allow_natives_syntax = true; |
1020 i::FLAG_optimize_for_size = false; | 1020 i::FLAG_optimize_for_size = false; |
1021 v8::Isolate* isolate = v8::Isolate::New(); | 1021 v8::Isolate::CreateParams create_params; |
| 1022 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 1023 v8::Isolate* isolate = v8::Isolate::New(create_params); |
1022 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 1024 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
1023 isolate->Enter(); | 1025 isolate->Enter(); |
1024 Factory* factory = i_isolate->factory(); | 1026 Factory* factory = i_isolate->factory(); |
1025 { | 1027 { |
1026 v8::HandleScope scope(isolate); | 1028 v8::HandleScope scope(isolate); |
1027 v8::Context::New(isolate)->Enter(); | 1029 v8::Context::New(isolate)->Enter(); |
1028 const char* source = | 1030 const char* source = |
1029 "function foo() {" | 1031 "function foo() {" |
1030 " var x = 42;" | 1032 " var x = 42;" |
1031 " var y = 42;" | 1033 " var y = 42;" |
(...skipping 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3677 | 3679 |
3678 | 3680 |
3679 UNINITIALIZED_TEST(ReleaseStackTraceData) { | 3681 UNINITIALIZED_TEST(ReleaseStackTraceData) { |
3680 if (i::FLAG_always_opt) { | 3682 if (i::FLAG_always_opt) { |
3681 // TODO(ulan): Remove this once the memory leak via code_next_link is fixed. | 3683 // TODO(ulan): Remove this once the memory leak via code_next_link is fixed. |
3682 // See: https://codereview.chromium.org/181833004/ | 3684 // See: https://codereview.chromium.org/181833004/ |
3683 return; | 3685 return; |
3684 } | 3686 } |
3685 FLAG_use_ic = false; // ICs retain objects. | 3687 FLAG_use_ic = false; // ICs retain objects. |
3686 FLAG_concurrent_recompilation = false; | 3688 FLAG_concurrent_recompilation = false; |
3687 v8::Isolate* isolate = v8::Isolate::New(); | 3689 v8::Isolate::CreateParams create_params; |
| 3690 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 3691 v8::Isolate* isolate = v8::Isolate::New(create_params); |
3688 { | 3692 { |
3689 v8::Isolate::Scope isolate_scope(isolate); | 3693 v8::Isolate::Scope isolate_scope(isolate); |
3690 v8::HandleScope handle_scope(isolate); | 3694 v8::HandleScope handle_scope(isolate); |
3691 v8::Context::New(isolate)->Enter(); | 3695 v8::Context::New(isolate)->Enter(); |
3692 static const char* source1 = "var error = null; " | 3696 static const char* source1 = "var error = null; " |
3693 /* Normal Error */ "try { " | 3697 /* Normal Error */ "try { " |
3694 " throw new Error(); " | 3698 " throw new Error(); " |
3695 "} catch (e) { " | 3699 "} catch (e) { " |
3696 " error = e; " | 3700 " error = e; " |
3697 "} "; | 3701 "} "; |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4990 CHECK(heap->InOldSpace(*o)); | 4994 CHECK(heap->InOldSpace(*o)); |
4991 Page* page = Page::FromAddress(o->elements()->address()); | 4995 Page* page = Page::FromAddress(o->elements()->address()); |
4992 CHECK(page->parallel_sweeping() <= MemoryChunk::SWEEPING_FINALIZE || | 4996 CHECK(page->parallel_sweeping() <= MemoryChunk::SWEEPING_FINALIZE || |
4993 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); | 4997 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); |
4994 } | 4998 } |
4995 | 4999 |
4996 | 5000 |
4997 UNINITIALIZED_TEST(PromotionQueue) { | 5001 UNINITIALIZED_TEST(PromotionQueue) { |
4998 i::FLAG_expose_gc = true; | 5002 i::FLAG_expose_gc = true; |
4999 i::FLAG_max_semi_space_size = 2 * (Page::kPageSize / MB); | 5003 i::FLAG_max_semi_space_size = 2 * (Page::kPageSize / MB); |
5000 v8::Isolate* isolate = v8::Isolate::New(); | 5004 v8::Isolate::CreateParams create_params; |
| 5005 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 5006 v8::Isolate* isolate = v8::Isolate::New(create_params); |
5001 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5007 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
5002 { | 5008 { |
5003 v8::Isolate::Scope isolate_scope(isolate); | 5009 v8::Isolate::Scope isolate_scope(isolate); |
5004 v8::HandleScope handle_scope(isolate); | 5010 v8::HandleScope handle_scope(isolate); |
5005 v8::Context::New(isolate)->Enter(); | 5011 v8::Context::New(isolate)->Enter(); |
5006 Heap* heap = i_isolate->heap(); | 5012 Heap* heap = i_isolate->heap(); |
5007 NewSpace* new_space = heap->new_space(); | 5013 NewSpace* new_space = heap->new_space(); |
5008 | 5014 |
5009 // In this test we will try to overwrite the promotion queue which is at the | 5015 // In this test we will try to overwrite the promotion queue which is at the |
5010 // end of to-space. To actually make that possible, we need at least two | 5016 // end of to-space. To actually make that possible, we need at least two |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5405 CHECK(pos->IsSmi()); | 5411 CHECK(pos->IsSmi()); |
5406 | 5412 |
5407 Handle<JSArray> stack_trace_array = Handle<JSArray>::cast(stack_trace); | 5413 Handle<JSArray> stack_trace_array = Handle<JSArray>::cast(stack_trace); |
5408 int array_length = Smi::cast(stack_trace_array->length())->value(); | 5414 int array_length = Smi::cast(stack_trace_array->length())->value(); |
5409 for (int i = 0; i < array_length; i++) { | 5415 for (int i = 0; i < array_length; i++) { |
5410 Handle<Object> element = | 5416 Handle<Object> element = |
5411 Object::GetElement(isolate, stack_trace, i).ToHandleChecked(); | 5417 Object::GetElement(isolate, stack_trace, i).ToHandleChecked(); |
5412 CHECK(!element->IsCode()); | 5418 CHECK(!element->IsCode()); |
5413 } | 5419 } |
5414 } | 5420 } |
OLD | NEW |