| 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 26 matching lines...) Expand all Loading... |
| 37 CheckMap(Heap::meta_map(), MAP_TYPE, Map::kSize); | 37 CheckMap(Heap::meta_map(), MAP_TYPE, Map::kSize); |
| 38 CheckMap(Heap::heap_number_map(), HEAP_NUMBER_TYPE, HeapNumber::kSize); | 38 CheckMap(Heap::heap_number_map(), HEAP_NUMBER_TYPE, HeapNumber::kSize); |
| 39 CheckMap(Heap::fixed_array_map(), FIXED_ARRAY_TYPE, FixedArray::kHeaderSize); | 39 CheckMap(Heap::fixed_array_map(), FIXED_ARRAY_TYPE, FixedArray::kHeaderSize); |
| 40 CheckMap(Heap::long_string_map(), LONG_STRING_TYPE, | 40 CheckMap(Heap::long_string_map(), LONG_STRING_TYPE, |
| 41 SeqTwoByteString::kAlignedSize); | 41 SeqTwoByteString::kAlignedSize); |
| 42 } | 42 } |
| 43 | 43 |
| 44 | 44 |
| 45 static void CheckOddball(Object* obj, const char* string) { | 45 static void CheckOddball(Object* obj, const char* string) { |
| 46 CHECK(obj->IsOddball()); | 46 CHECK(obj->IsOddball()); |
| 47 #ifndef V8_HOST_ARCH_64_BIT | |
| 48 // TODO(X64): Reenable when native builtins work. | |
| 49 bool exc; | 47 bool exc; |
| 50 Object* print_string = *Execution::ToString(Handle<Object>(obj), &exc); | 48 Object* print_string = *Execution::ToString(Handle<Object>(obj), &exc); |
| 51 CHECK(String::cast(print_string)->IsEqualTo(CStrVector(string))); | 49 CHECK(String::cast(print_string)->IsEqualTo(CStrVector(string))); |
| 52 #endif // V8_HOST_ARCH_64_BIT | |
| 53 } | 50 } |
| 54 | 51 |
| 55 | 52 |
| 56 static void CheckSmi(int value, const char* string) { | 53 static void CheckSmi(int value, const char* string) { |
| 57 #ifndef V8_HOST_ARCH_64_BIT | |
| 58 // TODO(X64): Reenable when native builtins work. | |
| 59 bool exc; | 54 bool exc; |
| 60 Object* print_string = | 55 Object* print_string = |
| 61 *Execution::ToString(Handle<Object>(Smi::FromInt(value)), &exc); | 56 *Execution::ToString(Handle<Object>(Smi::FromInt(value)), &exc); |
| 62 CHECK(String::cast(print_string)->IsEqualTo(CStrVector(string))); | 57 CHECK(String::cast(print_string)->IsEqualTo(CStrVector(string))); |
| 63 #endif // V8_HOST_ARCH_64_BIT | |
| 64 } | 58 } |
| 65 | 59 |
| 66 | 60 |
| 67 static void CheckNumber(double value, const char* string) { | 61 static void CheckNumber(double value, const char* string) { |
| 68 Object* obj = Heap::NumberFromDouble(value); | 62 Object* obj = Heap::NumberFromDouble(value); |
| 69 CHECK(obj->IsNumber()); | 63 CHECK(obj->IsNumber()); |
| 70 #ifndef V8_HOST_ARCH_64_BIT | |
| 71 // TODO(X64): Reenable when native builtins work. | |
| 72 bool exc; | 64 bool exc; |
| 73 Object* print_string = *Execution::ToString(Handle<Object>(obj), &exc); | 65 Object* print_string = *Execution::ToString(Handle<Object>(obj), &exc); |
| 74 CHECK(String::cast(print_string)->IsEqualTo(CStrVector(string))); | 66 CHECK(String::cast(print_string)->IsEqualTo(CStrVector(string))); |
| 75 #endif // V8_HOST_ARCH_64_BIT | |
| 76 } | 67 } |
| 77 | 68 |
| 78 | 69 |
| 79 static void CheckFindCodeObject() { | 70 static void CheckFindCodeObject() { |
| 80 // Test FindCodeObject | 71 // Test FindCodeObject |
| 81 #define __ assm. | 72 #define __ assm. |
| 82 | 73 |
| 83 Assembler assm(NULL, 0); | 74 Assembler assm(NULL, 0); |
| 84 | 75 |
| 85 __ nop(); // supported on all architectures | 76 __ nop(); // supported on all architectures |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 "volatile", | 476 "volatile", |
| 486 "while", | 477 "while", |
| 487 "with", | 478 "with", |
| 488 0 | 479 0 |
| 489 }; | 480 }; |
| 490 | 481 |
| 491 | 482 |
| 492 static void CheckSymbols(const char** strings) { | 483 static void CheckSymbols(const char** strings) { |
| 493 for (const char* string = *strings; *strings != 0; string = *strings++) { | 484 for (const char* string = *strings; *strings != 0; string = *strings++) { |
| 494 Object* a = Heap::LookupAsciiSymbol(string); | 485 Object* a = Heap::LookupAsciiSymbol(string); |
| 486 // LookupAsciiSymbol may return a failure if a GC is needed. |
| 487 if (a->IsFailure()) continue; |
| 495 CHECK(a->IsSymbol()); | 488 CHECK(a->IsSymbol()); |
| 496 Object* b = Heap::LookupAsciiSymbol(string); | 489 Object* b = Heap::LookupAsciiSymbol(string); |
| 490 if (b->IsFailure()) continue; |
| 497 CHECK_EQ(b, a); | 491 CHECK_EQ(b, a); |
| 498 CHECK(String::cast(b)->IsEqualTo(CStrVector(string))); | 492 CHECK(String::cast(b)->IsEqualTo(CStrVector(string))); |
| 499 } | 493 } |
| 500 } | 494 } |
| 501 | 495 |
| 502 | 496 |
| 503 TEST(SymbolTable) { | 497 TEST(SymbolTable) { |
| 504 InitializeVM(); | 498 InitializeVM(); |
| 505 | 499 |
| 506 CheckSymbols(not_so_random_string_table); | 500 CheckSymbols(not_so_random_string_table); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 objs[next_objs_index++] = | 783 objs[next_objs_index++] = |
| 790 Factory::NewStringFromAscii(CStrVector(str), TENURED); | 784 Factory::NewStringFromAscii(CStrVector(str), TENURED); |
| 791 delete[] str; | 785 delete[] str; |
| 792 | 786 |
| 793 // Add a Map object to look for. | 787 // Add a Map object to look for. |
| 794 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); | 788 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); |
| 795 | 789 |
| 796 CHECK_EQ(objs_count, next_objs_index); | 790 CHECK_EQ(objs_count, next_objs_index); |
| 797 CHECK_EQ(objs_count, ObjectsFoundInHeap(objs, objs_count)); | 791 CHECK_EQ(objs_count, ObjectsFoundInHeap(objs, objs_count)); |
| 798 } | 792 } |
| OLD | NEW |