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

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: Addressed comments 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
« no previous file with comments | « 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 "cctest.h"
11 #include "objects.h"
12
13 using namespace v8::internal;
14
15 static v8::Persistent<v8::Context> env;
16
17 static void InitializeVM() {
18 if (env.IsEmpty()) {
19 v8::HandleScope scope;
20 const char* extensions[] = { "v8/print" };
21 v8::ExtensionConfiguration config(1, extensions);
22 env = v8::Context::New(&config);
23 }
24 v8::HandleScope scope;
25 env->Enter();
26 }
27
28
29 TEST(Create) {
30 InitializeVM();
31 HandleScope scope;
32 Isolate* isolate = Isolate::Current();
33
34 const int kNumSymbols = 30;
35 Handle<Symbol> symbols[kNumSymbols];
36
37 for (int i = 0; i < kNumSymbols; ++i) {
38 symbols[i] = isolate->factory()->NewSymbol();
39 CHECK(symbols[i]->IsName());
40 CHECK(symbols[i]->IsSymbol());
41 CHECK(symbols[i]->HasHashCode());
42 CHECK_GT(symbols[i]->Hash(), 0);
43 symbols[i]->ShortPrint();
44 PrintF("\n");
45 #if OBJECT_PRINT
46 symbols[i]->Print();
47 #endif
48 #if VERIFY_HEAP
49 symbols[i]->Verify();
50 #endif
51 }
52
53 HEAP->PerformScavenge();
54 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
55
56 // All symbols should be distinct.
57 for (int i = 0; i < kNumSymbols; ++i) {
58 CHECK(symbols[i]->SameValue(*symbols[i]));
59 for (int j = i + 1; j < kNumSymbols; ++j) {
60 CHECK(!symbols[i]->SameValue(*symbols[j]));
61 }
62 }
63 }
OLDNEW
« no previous file with comments | « test/cctest/cctest.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698