Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: test/cctest/test-heap-profiler.cc

Issue 2684313003: Remove SIMD.js from V8. (Closed)
Patch Set: Rebase. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 GetProperty(global, v8::HeapGraphEdge::kProperty, "a"); 471 GetProperty(global, v8::HeapGraphEdge::kProperty, "a");
472 CHECK(a); 472 CHECK(a);
473 CHECK_EQ(a->GetType(), v8::HeapGraphNode::kSymbol); 473 CHECK_EQ(a->GetType(), v8::HeapGraphNode::kSymbol);
474 CHECK(v8_str("symbol")->Equals(env.local(), a->GetName()).FromJust()); 474 CHECK(v8_str("symbol")->Equals(env.local(), a->GetName()).FromJust());
475 const v8::HeapGraphNode* name = 475 const v8::HeapGraphNode* name =
476 GetProperty(a, v8::HeapGraphEdge::kInternal, "name"); 476 GetProperty(a, v8::HeapGraphEdge::kInternal, "name");
477 CHECK(name); 477 CHECK(name);
478 CHECK(v8_str("mySymbol")->Equals(env.local(), name->GetName()).FromJust()); 478 CHECK(v8_str("mySymbol")->Equals(env.local(), name->GetName()).FromJust());
479 } 479 }
480 480
481
482 void CheckSimdSnapshot(const char* program, const char* var_name) {
483 i::FLAG_harmony_simd = true;
484 LocalContext env;
485 v8::HandleScope scope(env->GetIsolate());
486 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
487
488 CompileRun(program);
489 // The TakeHeapSnapshot function does not do enough GCs to ensure
490 // that all garbage is collected. We perform addition GC here
491 // to reclaim a floating AllocationSite and to fix the following failure:
492 // # Check failed: ValidateSnapshot(snapshot).
493 // Stdout:
494 // 28 @ 13523 entry with no retainer: /hidden/ system / AllocationSite
495 // 44 @ 767 $map: /hidden/ system / Map
496 // 44 @ 59 $map: /hidden/ system / Map
497 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
498
499 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot();
500 CHECK(ValidateSnapshot(snapshot));
501 const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
502 const v8::HeapGraphNode* var =
503 GetProperty(global, v8::HeapGraphEdge::kProperty, var_name);
504 CHECK(var);
505 CHECK_EQ(var->GetType(), v8::HeapGraphNode::kSimdValue);
506 }
507
508
509 TEST(HeapSnapshotSimd) {
510 CheckSimdSnapshot("a = SIMD.Float32x4();\n", "a");
511 CheckSimdSnapshot("a = SIMD.Int32x4();\n", "a");
512 CheckSimdSnapshot("a = SIMD.Uint32x4();\n", "a");
513 CheckSimdSnapshot("a = SIMD.Bool32x4();\n", "a");
514 CheckSimdSnapshot("a = SIMD.Int16x8();\n", "a");
515 CheckSimdSnapshot("a = SIMD.Uint16x8();\n", "a");
516 CheckSimdSnapshot("a = SIMD.Bool16x8();\n", "a");
517 CheckSimdSnapshot("a = SIMD.Int8x16();\n", "a");
518 CheckSimdSnapshot("a = SIMD.Uint8x16();\n", "a");
519 CheckSimdSnapshot("a = SIMD.Bool8x16();\n", "a");
520 }
521
522
523 TEST(HeapSnapshotWeakCollection) { 481 TEST(HeapSnapshotWeakCollection) {
524 LocalContext env; 482 LocalContext env;
525 v8::HandleScope scope(env->GetIsolate()); 483 v8::HandleScope scope(env->GetIsolate());
526 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); 484 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
527 485
528 CompileRun( 486 CompileRun(
529 "k = {}; v = {}; s = 'str';\n" 487 "k = {}; v = {}; s = 'str';\n"
530 "ws = new WeakSet(); ws.add(k); ws.add(v); ws[s] = s;\n" 488 "ws = new WeakSet(); ws.add(k); ws.add(v); ws[s] = s;\n"
531 "wm = new WeakMap(); wm.set(k, v); wm[s] = s;\n"); 489 "wm = new WeakMap(); wm.set(k, v); wm[s] = s;\n");
532 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); 490 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot();
(...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 " a[i] = i;\n" 2984 " a[i] = i;\n"
3027 " for (var i = 0; i < 3; ++i)\n" 2985 " for (var i = 0; i < 3; ++i)\n"
3028 " a.shift();\n" 2986 " a.shift();\n"
3029 "}\n"); 2987 "}\n");
3030 2988
3031 CcTest::CollectGarbage(v8::internal::NEW_SPACE); 2989 CcTest::CollectGarbage(v8::internal::NEW_SPACE);
3032 // Should not crash. 2990 // Should not crash.
3033 2991
3034 heap_profiler->StopSamplingHeapProfiler(); 2992 heap_profiler->StopSamplingHeapProfiler();
3035 } 2993 }
OLDNEW
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/Generators.golden ('k') | test/cctest/test-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698