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

Side by Side Diff: test/cctest/test-symbols.cc

Issue 12223071: ES6 symbols: Introduce Symbol class, along with abstract Name class (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« src/heap.cc ('K') | « test/cctest/cctest.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2
3 // Check that we can traverse very deep stacks of ConsStrings using
4 // StringCharacterStram. Check that Get(int) works on very deep stacks
5 // of ConsStrings. These operations may not be very fast, but they
6 // should be possible without getting errors due to too deep recursion.
7
8 #include "v8.h"
9
10 #include "objects.h"
11 #include "cctest.h"
Michael Starzinger 2013/02/12 10:03:53 Can we alpha-sort the includes?
rossberg 2013/02/13 10:04:28 Done. Also removed obsolete import of "zone-inl.h"
12 #include "zone-inl.h"
13
14 using namespace v8::internal;
15
16 static v8::Persistent<v8::Context> env;
17
18 static void InitializeVM() {
19 if (env.IsEmpty()) {
20 v8::HandleScope scope;
21 const char* extensions[] = { "v8/print" };
22 v8::ExtensionConfiguration config(1, extensions);
23 env = v8::Context::New(&config);
24 }
25 v8::HandleScope scope;
26 env->Enter();
27 }
28
29
30 TEST(Create) {
31 InitializeVM();
32 HandleScope scope;
33 Isolate* isolate = Isolate::Current();
34
35 const int kNumSymbols = 30;
36 Handle<Symbol> symbols[kNumSymbols];
37
38 for (int i = 0; i < kNumSymbols; ++i) {
39 symbols[i] = isolate->factory()->NewSymbol();
40 CHECK(symbols[i]->IsName());
41 CHECK(symbols[i]->IsSymbol());
42 CHECK(symbols[i]->HasHashCode());
43 CHECK_GT(symbols[i]->Hash(), 0);
44 symbols[i]->ShortPrint();
45 PrintF("\n");
46 #if OBJECT_PRINT
47 symbols[i]->Print();
48 #endif
49 #if VERIFY_HEAP
50 symbols[i]->Verify();
51 #endif
52 }
53
54 HEAP->PerformScavenge();
55 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
56
57 // All symbols should be distinct.
58 for (int i = 0; i < kNumSymbols; ++i) {
59 CHECK(symbols[i]->SameValue(*symbols[i]));
60 for (int j = i + 1; j < kNumSymbols; ++j) {
61 CHECK(!symbols[i]->SameValue(*symbols[j]));
62 }
63 }
64 }
OLDNEW
« src/heap.cc ('K') | « test/cctest/cctest.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698