Chromium Code Reviews| 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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 870 CHECK_EQ(length, ascii_str->length()); | 870 CHECK_EQ(length, ascii_str->length()); |
| 871 DeleteArray(non_ascii); | 871 DeleteArray(non_ascii); |
| 872 DeleteArray(ascii); | 872 DeleteArray(ascii); |
| 873 } | 873 } |
| 874 } | 874 } |
| 875 | 875 |
| 876 | 876 |
| 877 static int ObjectsFoundInHeap(Heap* heap, Handle<Object> objs[], int size) { | 877 static int ObjectsFoundInHeap(Heap* heap, Handle<Object> objs[], int size) { |
| 878 // Count the number of objects found in the heap. | 878 // Count the number of objects found in the heap. |
| 879 int found_count = 0; | 879 int found_count = 0; |
| 880 HeapIterator iterator(heap); | 880 HeapIterator iterator(heap); |
|
Michael Starzinger
2013/06/14 13:30:15
The correct fix is actually to add a call to "heap
Hannes Payer (out of office)
2013/06/14 13:44:38
Done.
| |
| 881 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 881 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| 882 for (int i = 0; i < size; i++) { | 882 for (int i = 0; i < size; i++) { |
| 883 if (*objs[i] == obj) { | 883 if (*objs[i] == obj) { |
| 884 found_count++; | 884 found_count++; |
| 885 } | 885 } |
| 886 } | 886 } |
| 887 } | 887 } |
| 888 return found_count; | 888 return found_count; |
| 889 } | 889 } |
| 890 | 890 |
| 891 | 891 |
| 892 TEST(Iteration) { | 892 TEST(Iteration) { |
| 893 i::FLAG_stress_compaction = false; | |
| 893 CcTest::InitializeVM(); | 894 CcTest::InitializeVM(); |
| 894 Isolate* isolate = Isolate::Current(); | 895 Isolate* isolate = Isolate::Current(); |
| 895 Factory* factory = isolate->factory(); | 896 Factory* factory = isolate->factory(); |
| 896 v8::HandleScope scope(CcTest::isolate()); | 897 v8::HandleScope scope(CcTest::isolate()); |
| 897 | 898 |
| 898 // Array of objects to scan haep for. | 899 // Array of objects to scan haep for. |
| 899 const int objs_count = 6; | 900 const int objs_count = 6; |
| 900 Handle<Object> objs[objs_count]; | 901 Handle<Object> objs[objs_count]; |
| 901 int next_objs_index = 0; | 902 int next_objs_index = 0; |
| 902 | 903 |
| (...skipping 2269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3172 " var a = new Array(n);" | 3173 " var a = new Array(n);" |
| 3173 " for (var i = 0; i < n; i += 100) a[i] = i;" | 3174 " for (var i = 0; i < n; i += 100) a[i] = i;" |
| 3174 "};" | 3175 "};" |
| 3175 "f(10 * 1024 * 1024);"); | 3176 "f(10 * 1024 * 1024);"); |
| 3176 IncrementalMarking* marking = HEAP->incremental_marking(); | 3177 IncrementalMarking* marking = HEAP->incremental_marking(); |
| 3177 if (marking->IsStopped()) marking->Start(); | 3178 if (marking->IsStopped()) marking->Start(); |
| 3178 // This big step should be sufficient to mark the whole array. | 3179 // This big step should be sufficient to mark the whole array. |
| 3179 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 3180 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
| 3180 ASSERT(marking->IsComplete()); | 3181 ASSERT(marking->IsComplete()); |
| 3181 } | 3182 } |
| OLD | NEW |