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 "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "cctest.h" | 10 #include "cctest.h" |
11 #include "objects.h" | 11 #include "objects.h" |
12 | 12 |
13 using namespace v8::internal; | 13 using namespace v8::internal; |
14 | 14 |
15 static v8::Persistent<v8::Context> env; | 15 static v8::Persistent<v8::Context> env; |
16 | 16 |
17 static void InitializeVM() { | 17 static void InitializeVM() { |
18 if (env.IsEmpty()) { | 18 if (env.IsEmpty()) { |
19 v8::HandleScope scope; | |
20 const char* extensions[] = { "v8/print" }; | 19 const char* extensions[] = { "v8/print" }; |
21 v8::ExtensionConfiguration config(1, extensions); | 20 v8::ExtensionConfiguration config(1, extensions); |
22 env = v8::Context::New(&config); | 21 env = v8::Context::New(&config); |
23 } | 22 } |
24 v8::HandleScope scope; | |
25 env->Enter(); | 23 env->Enter(); |
26 } | 24 } |
27 | 25 |
28 | 26 |
29 TEST(Create) { | 27 TEST(Create) { |
30 InitializeVM(); | 28 InitializeVM(); |
31 Isolate* isolate = Isolate::Current(); | 29 Isolate* isolate = Isolate::Current(); |
32 HandleScope scope(isolate); | 30 HandleScope scope(isolate); |
33 | 31 |
34 const int kNumSymbols = 30; | 32 const int kNumSymbols = 30; |
(...skipping 19 matching lines...) Expand all Loading... |
54 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 52 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
55 | 53 |
56 // All symbols should be distinct. | 54 // All symbols should be distinct. |
57 for (int i = 0; i < kNumSymbols; ++i) { | 55 for (int i = 0; i < kNumSymbols; ++i) { |
58 CHECK(symbols[i]->SameValue(*symbols[i])); | 56 CHECK(symbols[i]->SameValue(*symbols[i])); |
59 for (int j = i + 1; j < kNumSymbols; ++j) { | 57 for (int j = i + 1; j < kNumSymbols; ++j) { |
60 CHECK(!symbols[i]->SameValue(*symbols[j])); | 58 CHECK(!symbols[i]->SameValue(*symbols[j])); |
61 } | 59 } |
62 } | 60 } |
63 } | 61 } |
OLD | NEW |