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

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

Issue 8953016: Fix cctest/test-hashing on MIPS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 if (string.length() > 0) { 99 if (string.length() > 0) {
100 __ li(t1, Operand(string.at(0))); 100 __ li(t1, Operand(string.at(0)));
101 StringHelper::GenerateHashInit(assm, v0, t1); 101 StringHelper::GenerateHashInit(assm, v0, t1);
102 } 102 }
103 for (int i = 1; i < string.length(); i++) { 103 for (int i = 1; i < string.length(); i++) {
104 __ li(t1, Operand(string.at(i))); 104 __ li(t1, Operand(string.at(i)));
105 StringHelper::GenerateHashAddCharacter(assm, v0, t1); 105 StringHelper::GenerateHashAddCharacter(assm, v0, t1);
106 } 106 }
107 StringHelper::GenerateHashGetHash(assm, v0); 107 StringHelper::GenerateHashGetHash(assm, v0);
108 __ jr(ra); 108 __ jr(ra);
109 __ nop();
109 #endif 110 #endif
110 } 111 }
111 112
112 113
113 void check(i::Vector<const char> string) { 114 void check(i::Vector<const char> string) {
114 v8::HandleScope scope; 115 v8::HandleScope scope;
115 v8::internal::byte buffer[2048]; 116 v8::internal::byte buffer[2048];
116 MacroAssembler assm(Isolate::Current(), buffer, sizeof buffer); 117 MacroAssembler assm(Isolate::Current(), buffer, sizeof buffer);
117 118
118 generate(&assm, string); 119 generate(&assm, string);
119 120
120 CodeDesc desc; 121 CodeDesc desc;
121 assm.GetCode(&desc); 122 assm.GetCode(&desc);
122 Code* code = Code::cast(HEAP->CreateCode( 123 Code* code = Code::cast(HEAP->CreateCode(
123 desc, 124 desc,
124 Code::ComputeFlags(Code::STUB), 125 Code::ComputeFlags(Code::STUB),
125 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked()); 126 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked());
126 CHECK(code->IsCode()); 127 CHECK(code->IsCode());
127 128
128 HASH_FUNCTION hash = FUNCTION_CAST<HASH_FUNCTION>(Code::cast(code)->entry()); 129 HASH_FUNCTION hash = FUNCTION_CAST<HASH_FUNCTION>(code->entry());
129 Handle<String> v8_string = FACTORY->NewStringFromAscii(string); 130 Handle<String> v8_string = FACTORY->NewStringFromAscii(string);
130 v8_string->set_hash_field(String::kEmptyHashField); 131 v8_string->set_hash_field(String::kEmptyHashField);
131 #ifdef USE_SIMULATOR 132 #ifdef USE_SIMULATOR
132 uint32_t codegen_hash = 133 uint32_t codegen_hash =
133 reinterpret_cast<uint32_t>(CALL_GENERATED_CODE(hash, 0, 0, 0, 0, 0)); 134 reinterpret_cast<uint32_t>(CALL_GENERATED_CODE(hash, 0, 0, 0, 0, 0));
134 #else 135 #else
135 uint32_t codegen_hash = hash(); 136 uint32_t codegen_hash = hash();
136 #endif 137 #endif
137 uint32_t runtime_hash = v8_string->Hash(); 138 uint32_t runtime_hash = v8_string->Hash();
138 CHECK(runtime_hash == codegen_hash); 139 CHECK(runtime_hash == codegen_hash);
(...skipping 18 matching lines...) Expand all
157 } 158 }
158 check(i::Vector<const char>("", 0)); 159 check(i::Vector<const char>("", 0));
159 check(i::Vector<const char>("*", 1)); 160 check(i::Vector<const char>("*", 1));
160 check(i::Vector<const char>(".zZ", 3)); 161 check(i::Vector<const char>(".zZ", 3));
161 check(i::Vector<const char>("muc", 3)); 162 check(i::Vector<const char>("muc", 3));
162 check(i::Vector<const char>("(>'_')>", 7)); 163 check(i::Vector<const char>("(>'_')>", 7));
163 check(i::Vector<const char>("-=[ vee eight ftw ]=-", 21)); 164 check(i::Vector<const char>("-=[ vee eight ftw ]=-", 21));
164 } 165 }
165 166
166 #undef __ 167 #undef __
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698