| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 } | 486 } |
| 487 | 487 |
| 488 | 488 |
| 489 void CheckSimdSnapshot(const char* program, const char* var_name) { | 489 void CheckSimdSnapshot(const char* program, const char* var_name) { |
| 490 i::FLAG_harmony_simd = true; | 490 i::FLAG_harmony_simd = true; |
| 491 LocalContext env; | 491 LocalContext env; |
| 492 v8::HandleScope scope(env->GetIsolate()); | 492 v8::HandleScope scope(env->GetIsolate()); |
| 493 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); | 493 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); |
| 494 | 494 |
| 495 CompileRun(program); | 495 CompileRun(program); |
| 496 // The TakeHeapSnapshot function does not do enough GCs to ensure |
| 497 // that all garbage is collected. We perform addition GC here |
| 498 // to reclaim a floating AllocationSite and to fix the following failure: |
| 499 // # Check failed: ValidateSnapshot(snapshot). |
| 500 // Stdout: |
| 501 // 28 @ 13523 entry with no retainer: /hidden/ system / AllocationSite |
| 502 // 44 @ 767 $map: /hidden/ system / Map |
| 503 // 44 @ 59 $map: /hidden/ system / Map |
| 504 CcTest::heap()->CollectAllGarbage(); |
| 505 |
| 496 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); | 506 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); |
| 497 CHECK(ValidateSnapshot(snapshot)); | 507 CHECK(ValidateSnapshot(snapshot)); |
| 498 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); | 508 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
| 499 const v8::HeapGraphNode* var = | 509 const v8::HeapGraphNode* var = |
| 500 GetProperty(global, v8::HeapGraphEdge::kProperty, var_name); | 510 GetProperty(global, v8::HeapGraphEdge::kProperty, var_name); |
| 501 CHECK(var); | 511 CHECK(var); |
| 502 CHECK_EQ(var->GetType(), v8::HeapGraphNode::kSimdValue); | 512 CHECK_EQ(var->GetType(), v8::HeapGraphNode::kSimdValue); |
| 503 } | 513 } |
| 504 | 514 |
| 505 | 515 |
| (...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3050 " a[i] = i;\n" | 3060 " a[i] = i;\n" |
| 3051 " for (var i = 0; i < 3; ++i)\n" | 3061 " for (var i = 0; i < 3; ++i)\n" |
| 3052 " a.shift();\n" | 3062 " a.shift();\n" |
| 3053 "}\n"); | 3063 "}\n"); |
| 3054 | 3064 |
| 3055 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); | 3065 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); |
| 3056 // Should not crash. | 3066 // Should not crash. |
| 3057 | 3067 |
| 3058 heap_profiler->StopSamplingHeapProfiler(); | 3068 heap_profiler->StopSamplingHeapProfiler(); |
| 3059 } | 3069 } |
| OLD | NEW |