| 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 6245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6256 LocalContext context; | 6256 LocalContext context; |
| 6257 | 6257 |
| 6258 heap->CollectAllGarbage(); | 6258 heap->CollectAllGarbage(); |
| 6259 heap->CollectAllGarbage(); | 6259 heap->CollectAllGarbage(); |
| 6260 | 6260 |
| 6261 int sfi_count = 0; | 6261 int sfi_count = 0; |
| 6262 { | 6262 { |
| 6263 HeapIterator it(heap); | 6263 HeapIterator it(heap); |
| 6264 for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) { | 6264 for (HeapObject* obj = it.next(); obj != NULL; obj = it.next()) { |
| 6265 if (!obj->IsSharedFunctionInfo()) continue; | 6265 if (!obj->IsSharedFunctionInfo()) continue; |
| 6266 // Shared function infos without a script (API functions or C++ builtins) | 6266 sfi_count++; |
| 6267 // are not returned by the iterator because they are not created from a | |
| 6268 // script. They are not interesting for type feedback vector anyways. | |
| 6269 | |
| 6270 // TODO(mvstanton): There are builtins that use type feedback vectors, | |
| 6271 // consider adding these to the iterator. | |
| 6272 SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj); | |
| 6273 if (shared->script()->IsUndefined()) { | |
| 6274 CHECK(shared->native() || shared->feedback_vector()->is_empty()); | |
| 6275 } else { | |
| 6276 sfi_count++; | |
| 6277 } | |
| 6278 } | 6267 } |
| 6279 } | 6268 } |
| 6280 | 6269 |
| 6281 { | 6270 { |
| 6282 SharedFunctionInfo::Iterator iterator(isolate); | 6271 SharedFunctionInfo::Iterator iterator(isolate); |
| 6283 while (iterator.Next()) sfi_count--; | 6272 while (iterator.Next()) sfi_count--; |
| 6284 } | 6273 } |
| 6285 | 6274 |
| 6286 CHECK_EQ(0, sfi_count); | 6275 CHECK_EQ(0, sfi_count); |
| 6287 } | 6276 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 6316 // The CollectGarbage call above starts sweeper threads. | 6305 // The CollectGarbage call above starts sweeper threads. |
| 6317 // The crash will happen if the following two functions | 6306 // The crash will happen if the following two functions |
| 6318 // are called before sweeping finishes. | 6307 // are called before sweeping finishes. |
| 6319 heap->StartIncrementalMarking(); | 6308 heap->StartIncrementalMarking(); |
| 6320 heap->FinalizeIncrementalMarkingIfComplete("test"); | 6309 heap->FinalizeIncrementalMarkingIfComplete("test"); |
| 6321 } | 6310 } |
| 6322 | 6311 |
| 6323 | 6312 |
| 6324 } // namespace internal | 6313 } // namespace internal |
| 6325 } // namespace v8 | 6314 } // namespace v8 |
| OLD | NEW |