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

Side by Side Diff: test/cctest/test-heap.cc

Issue 11759008: Introduce ENABLE_LATIN_1 compile flag (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix FilterASCII Created 7 years, 11 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/test-hashing.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 "compilation-cache.h" 7 #include "compilation-cache.h"
8 #include "execution.h" 8 #include "execution.h"
9 #include "factory.h" 9 #include "factory.h"
10 #include "macro-assembler.h" 10 #include "macro-assembler.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 CheckMap(HEAP->heap_number_map(), HEAP_NUMBER_TYPE, HeapNumber::kSize); 55 CheckMap(HEAP->heap_number_map(), HEAP_NUMBER_TYPE, HeapNumber::kSize);
56 CheckMap(HEAP->fixed_array_map(), FIXED_ARRAY_TYPE, kVariableSizeSentinel); 56 CheckMap(HEAP->fixed_array_map(), FIXED_ARRAY_TYPE, kVariableSizeSentinel);
57 CheckMap(HEAP->string_map(), STRING_TYPE, kVariableSizeSentinel); 57 CheckMap(HEAP->string_map(), STRING_TYPE, kVariableSizeSentinel);
58 } 58 }
59 59
60 60
61 static void CheckOddball(Object* obj, const char* string) { 61 static void CheckOddball(Object* obj, const char* string) {
62 CHECK(obj->IsOddball()); 62 CHECK(obj->IsOddball());
63 bool exc; 63 bool exc;
64 Object* print_string = *Execution::ToString(Handle<Object>(obj), &exc); 64 Object* print_string = *Execution::ToString(Handle<Object>(obj), &exc);
65 CHECK(String::cast(print_string)->IsEqualTo(CStrVector(string))); 65 CHECK(String::cast(print_string)->IsUtf8EqualTo(CStrVector(string)));
66 } 66 }
67 67
68 68
69 static void CheckSmi(int value, const char* string) { 69 static void CheckSmi(int value, const char* string) {
70 bool exc; 70 bool exc;
71 Object* print_string = 71 Object* print_string =
72 *Execution::ToString(Handle<Object>(Smi::FromInt(value)), &exc); 72 *Execution::ToString(Handle<Object>(Smi::FromInt(value)), &exc);
73 CHECK(String::cast(print_string)->IsEqualTo(CStrVector(string))); 73 CHECK(String::cast(print_string)->IsUtf8EqualTo(CStrVector(string)));
74 } 74 }
75 75
76 76
77 static void CheckNumber(double value, const char* string) { 77 static void CheckNumber(double value, const char* string) {
78 Object* obj = HEAP->NumberFromDouble(value)->ToObjectChecked(); 78 Object* obj = HEAP->NumberFromDouble(value)->ToObjectChecked();
79 CHECK(obj->IsNumber()); 79 CHECK(obj->IsNumber());
80 bool exc; 80 bool exc;
81 Object* print_string = *Execution::ToString(Handle<Object>(obj), &exc); 81 Object* print_string = *Execution::ToString(Handle<Object>(obj), &exc);
82 CHECK(String::cast(print_string)->IsEqualTo(CStrVector(string))); 82 CHECK(String::cast(print_string)->IsUtf8EqualTo(CStrVector(string)));
83 } 83 }
84 84
85 85
86 static void CheckFindCodeObject() { 86 static void CheckFindCodeObject() {
87 // Test FindCodeObject 87 // Test FindCodeObject
88 #define __ assm. 88 #define __ assm.
89 89
90 Assembler assm(Isolate::Current(), NULL, 0); 90 Assembler assm(Isolate::Current(), NULL, 0);
91 91
92 __ nop(); // supported on all architectures 92 __ nop(); // supported on all architectures
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 for (const char* string = *strings; *strings != 0; string = *strings++) { 537 for (const char* string = *strings; *strings != 0; string = *strings++) {
538 Object* a; 538 Object* a;
539 MaybeObject* maybe_a = HEAP->LookupUtf8Symbol(string); 539 MaybeObject* maybe_a = HEAP->LookupUtf8Symbol(string);
540 // LookupUtf8Symbol may return a failure if a GC is needed. 540 // LookupUtf8Symbol may return a failure if a GC is needed.
541 if (!maybe_a->ToObject(&a)) continue; 541 if (!maybe_a->ToObject(&a)) continue;
542 CHECK(a->IsSymbol()); 542 CHECK(a->IsSymbol());
543 Object* b; 543 Object* b;
544 MaybeObject* maybe_b = HEAP->LookupUtf8Symbol(string); 544 MaybeObject* maybe_b = HEAP->LookupUtf8Symbol(string);
545 if (!maybe_b->ToObject(&b)) continue; 545 if (!maybe_b->ToObject(&b)) continue;
546 CHECK_EQ(b, a); 546 CHECK_EQ(b, a);
547 CHECK(String::cast(b)->IsEqualTo(CStrVector(string))); 547 CHECK(String::cast(b)->IsUtf8EqualTo(CStrVector(string)));
548 } 548 }
549 } 549 }
550 550
551 551
552 TEST(SymbolTable) { 552 TEST(SymbolTable) {
553 InitializeVM(); 553 InitializeVM();
554 554
555 CheckSymbols(not_so_random_string_table); 555 CheckSymbols(not_so_random_string_table);
556 CheckSymbols(not_so_random_string_table); 556 CheckSymbols(not_so_random_string_table);
557 } 557 }
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 for (int i = 0; i < length; i++) { 786 for (int i = 0; i < length; i++) {
787 ascii[i] = 'a'; 787 ascii[i] = 'a';
788 non_ascii[3 * i] = chars[0]; 788 non_ascii[3 * i] = chars[0];
789 non_ascii[3 * i + 1] = chars[1]; 789 non_ascii[3 * i + 1] = chars[1];
790 non_ascii[3 * i + 2] = chars[2]; 790 non_ascii[3 * i + 2] = chars[2];
791 } 791 }
792 Handle<String> non_ascii_sym = 792 Handle<String> non_ascii_sym =
793 FACTORY->LookupUtf8Symbol(Vector<const char>(non_ascii, 3 * length)); 793 FACTORY->LookupUtf8Symbol(Vector<const char>(non_ascii, 3 * length));
794 CHECK_EQ(length, non_ascii_sym->length()); 794 CHECK_EQ(length, non_ascii_sym->length());
795 Handle<String> ascii_sym = 795 Handle<String> ascii_sym =
796 FACTORY->LookupOneByteSymbol(Vector<const char>(ascii, length)); 796 FACTORY->LookupOneByteSymbol(OneByteVector(ascii, length));
797 CHECK_EQ(length, ascii_sym->length()); 797 CHECK_EQ(length, ascii_sym->length());
798 Handle<String> non_ascii_str = 798 Handle<String> non_ascii_str =
799 FACTORY->NewStringFromUtf8(Vector<const char>(non_ascii, 3 * length)); 799 FACTORY->NewStringFromUtf8(Vector<const char>(non_ascii, 3 * length));
800 non_ascii_str->Hash(); 800 non_ascii_str->Hash();
801 CHECK_EQ(length, non_ascii_str->length()); 801 CHECK_EQ(length, non_ascii_str->length());
802 Handle<String> ascii_str = 802 Handle<String> ascii_str =
803 FACTORY->NewStringFromUtf8(Vector<const char>(ascii, length)); 803 FACTORY->NewStringFromUtf8(Vector<const char>(ascii, length));
804 ascii_str->Hash(); 804 ascii_str->Hash();
805 CHECK_EQ(length, ascii_str->length()); 805 CHECK_EQ(length, ascii_str->length());
806 DeleteArray(non_ascii); 806 DeleteArray(non_ascii);
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after
2613 2613
2614 // Simulate incremental marking so that unoptimized code is flushed 2614 // Simulate incremental marking so that unoptimized code is flushed
2615 // even though it still is cached in the optimized code map. 2615 // even though it still is cached in the optimized code map.
2616 SimulateIncrementalMarking(); 2616 SimulateIncrementalMarking();
2617 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 2617 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
2618 2618
2619 // Make a new closure that will get code installed from the code map. 2619 // Make a new closure that will get code installed from the code map.
2620 // Unoptimized code is missing and the deoptimizer will go ballistic. 2620 // Unoptimized code is missing and the deoptimizer will go ballistic.
2621 CompileRun("var g = mkClosure(); g('bozo');"); 2621 CompileRun("var g = mkClosure(); g('bozo');");
2622 } 2622 }
OLDNEW
« no previous file with comments | « test/cctest/test-hashing.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698