| 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; | |
| 16 | |
| 17 static void InitializeVM() { | |
| 18 if (env.IsEmpty()) { | |
| 19 const char* extensions[] = { "v8/print" }; | |
| 20 v8::ExtensionConfiguration config(1, extensions); | |
| 21 env = v8::Context::New(&config); | |
| 22 } | |
| 23 env->Enter(); | |
| 24 } | |
| 25 | |
| 26 | 15 |
| 27 TEST(Create) { | 16 TEST(Create) { |
| 28 InitializeVM(); | 17 CcTest::InitializeVM(); |
| 29 Isolate* isolate = Isolate::Current(); | 18 Isolate* isolate = Isolate::Current(); |
| 30 HandleScope scope(isolate); | 19 HandleScope scope(isolate); |
| 31 | 20 |
| 32 const int kNumSymbols = 30; | 21 const int kNumSymbols = 30; |
| 33 Handle<Symbol> symbols[kNumSymbols]; | 22 Handle<Symbol> symbols[kNumSymbols]; |
| 34 | 23 |
| 35 for (int i = 0; i < kNumSymbols; ++i) { | 24 for (int i = 0; i < kNumSymbols; ++i) { |
| 36 symbols[i] = isolate->factory()->NewSymbol(); | 25 symbols[i] = isolate->factory()->NewSymbol(); |
| 37 CHECK(symbols[i]->IsName()); | 26 CHECK(symbols[i]->IsName()); |
| 38 CHECK(symbols[i]->IsSymbol()); | 27 CHECK(symbols[i]->IsSymbol()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 52 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 41 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
| 53 | 42 |
| 54 // All symbols should be distinct. | 43 // All symbols should be distinct. |
| 55 for (int i = 0; i < kNumSymbols; ++i) { | 44 for (int i = 0; i < kNumSymbols; ++i) { |
| 56 CHECK(symbols[i]->SameValue(*symbols[i])); | 45 CHECK(symbols[i]->SameValue(*symbols[i])); |
| 57 for (int j = i + 1; j < kNumSymbols; ++j) { | 46 for (int j = i + 1; j < kNumSymbols; ++j) { |
| 58 CHECK(!symbols[i]->SameValue(*symbols[j])); | 47 CHECK(!symbols[i]->SameValue(*symbols[j])); |
| 59 } | 48 } |
| 60 } | 49 } |
| 61 } | 50 } |
| OLD | NEW |