OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 | 2 |
3 #include <stdlib.h> | 3 #include <stdlib.h> |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "execution.h" | 7 #include "execution.h" |
8 #include "factory.h" | 8 #include "factory.h" |
9 #include "macro-assembler.h" | 9 #include "macro-assembler.h" |
10 #include "global-handles.h" | 10 #include "global-handles.h" |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 505 |
506 static void CheckSymbols(const char** strings) { | 506 static void CheckSymbols(const char** strings) { |
507 for (const char* string = *strings; *strings != 0; string = *strings++) { | 507 for (const char* string = *strings; *strings != 0; string = *strings++) { |
508 Object* a; | 508 Object* a; |
509 MaybeObject* maybe_a = Heap::LookupAsciiSymbol(string); | 509 MaybeObject* maybe_a = Heap::LookupAsciiSymbol(string); |
510 // LookupAsciiSymbol may return a failure if a GC is needed. | 510 // LookupAsciiSymbol may return a failure if a GC is needed. |
511 if (!maybe_a->ToObject(&a)) continue; | 511 if (!maybe_a->ToObject(&a)) continue; |
512 CHECK(a->IsSymbol()); | 512 CHECK(a->IsSymbol()); |
513 Object* b; | 513 Object* b; |
514 MaybeObject* maybe_b = Heap::LookupAsciiSymbol(string); | 514 MaybeObject* maybe_b = Heap::LookupAsciiSymbol(string); |
515 if (!maybe_maybe_b->ToObject(&b)) continue; | 515 if (!maybe_b->ToObject(&b)) continue; |
516 CHECK_EQ(b, a); | 516 CHECK_EQ(b, a); |
517 CHECK(String::cast(b)->IsEqualTo(CStrVector(string))); | 517 CHECK(String::cast(b)->IsEqualTo(CStrVector(string))); |
518 } | 518 } |
519 } | 519 } |
520 | 520 |
521 | 521 |
522 TEST(SymbolTable) { | 522 TEST(SymbolTable) { |
523 InitializeVM(); | 523 InitializeVM(); |
524 | 524 |
525 CheckSymbols(not_so_random_string_table); | 525 CheckSymbols(not_so_random_string_table); |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 // with and without GCs while iterating the list. | 1088 // with and without GCs while iterating the list. |
1089 for (int i = 0; i < kNumTestContexts; i++) { | 1089 for (int i = 0; i < kNumTestContexts; i++) { |
1090 ctx[i] = v8::Context::New(); | 1090 ctx[i] = v8::Context::New(); |
1091 CHECK_EQ(i + 1, CountGlobalContexts()); | 1091 CHECK_EQ(i + 1, CountGlobalContexts()); |
1092 CHECK_EQ(i + 1, CountGlobalContextsWithGC(i / 2 + 1)); | 1092 CHECK_EQ(i + 1, CountGlobalContextsWithGC(i / 2 + 1)); |
1093 | 1093 |
1094 ctx[i]->Enter(); | 1094 ctx[i]->Enter(); |
1095 ctx[i]->Exit(); | 1095 ctx[i]->Exit(); |
1096 } | 1096 } |
1097 } | 1097 } |
OLD | NEW |