OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 | 2 |
3 // Check that we can traverse very deep stacks of ConsStrings using | 3 // Check that we can traverse very deep stacks of ConsStrings using |
4 // StringCharacterStram. Check that Get(int) works on very deep stacks | 4 // StringCharacterStram. Check that Get(int) works on very deep stacks |
5 // of ConsStrings. These operations may not be very fast, but they | 5 // of ConsStrings. These operations may not be very fast, but they |
6 // should be possible without getting errors due to too deep recursion. | 6 // should be possible without getting errors due to too deep recursion. |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 const int kNumSymbols = 30; | 22 const int kNumSymbols = 30; |
23 Handle<Symbol> symbols[kNumSymbols]; | 23 Handle<Symbol> symbols[kNumSymbols]; |
24 | 24 |
25 OFStream os(stdout); | 25 OFStream os(stdout); |
26 for (int i = 0; i < kNumSymbols; ++i) { | 26 for (int i = 0; i < kNumSymbols; ++i) { |
27 symbols[i] = isolate->factory()->NewSymbol(); | 27 symbols[i] = isolate->factory()->NewSymbol(); |
28 CHECK(symbols[i]->IsName()); | 28 CHECK(symbols[i]->IsName()); |
29 CHECK(symbols[i]->IsSymbol()); | 29 CHECK(symbols[i]->IsSymbol()); |
30 CHECK(symbols[i]->HasHashCode()); | 30 CHECK(symbols[i]->HasHashCode()); |
31 CHECK_GT(symbols[i]->Hash(), 0); | 31 CHECK_GT(symbols[i]->Hash(), 0u); |
32 os << Brief(*symbols[i]) << "\n"; | 32 os << Brief(*symbols[i]) << "\n"; |
33 #if OBJECT_PRINT | 33 #if OBJECT_PRINT |
34 symbols[i]->Print(os); | 34 symbols[i]->Print(os); |
35 #endif | 35 #endif |
36 #if VERIFY_HEAP | 36 #if VERIFY_HEAP |
37 symbols[i]->ObjectVerify(); | 37 symbols[i]->ObjectVerify(); |
38 #endif | 38 #endif |
39 } | 39 } |
40 | 40 |
41 CcTest::heap()->CollectGarbage(i::NEW_SPACE); | 41 CcTest::heap()->CollectGarbage(i::NEW_SPACE); |
42 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); | 42 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); |
43 | 43 |
44 // All symbols should be distinct. | 44 // All symbols should be distinct. |
45 for (int i = 0; i < kNumSymbols; ++i) { | 45 for (int i = 0; i < kNumSymbols; ++i) { |
46 CHECK(symbols[i]->SameValue(*symbols[i])); | 46 CHECK(symbols[i]->SameValue(*symbols[i])); |
47 for (int j = i + 1; j < kNumSymbols; ++j) { | 47 for (int j = i + 1; j < kNumSymbols; ++j) { |
48 CHECK(!symbols[i]->SameValue(*symbols[j])); | 48 CHECK(!symbols[i]->SameValue(*symbols[j])); |
49 } | 49 } |
50 } | 50 } |
51 } | 51 } |
OLD | NEW |