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

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

Issue 239243018: Heap::AllocateStringFromOneByte() and major part of its callers handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing comment + some cleanup Created 6 years, 8 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-func-name-inference.cc ('k') | test/cctest/test-heap.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 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 CodeDesc desc; 197 CodeDesc desc;
198 masm.GetCode(&desc); 198 masm.GetCode(&desc);
199 Handle<Object> undefined(isolate->heap()->undefined_value(), isolate); 199 Handle<Object> undefined(isolate->heap()->undefined_value(), isolate);
200 Handle<Code> code = factory->NewCode(desc, 200 Handle<Code> code = factory->NewCode(desc,
201 Code::ComputeFlags(Code::STUB), 201 Code::ComputeFlags(Code::STUB),
202 undefined); 202 undefined);
203 CHECK(code->IsCode()); 203 CHECK(code->IsCode());
204 204
205 HASH_FUNCTION hash = FUNCTION_CAST<HASH_FUNCTION>(code->entry()); 205 HASH_FUNCTION hash = FUNCTION_CAST<HASH_FUNCTION>(code->entry());
206 Handle<String> v8_string = factory->NewStringFromOneByte(string); 206 Handle<String> v8_string =
207 factory->NewStringFromOneByte(string).ToHandleChecked();
207 v8_string->set_hash_field(String::kEmptyHashField); 208 v8_string->set_hash_field(String::kEmptyHashField);
208 #ifdef USE_SIMULATOR 209 #ifdef USE_SIMULATOR
209 uint32_t codegen_hash = static_cast<uint32_t>( 210 uint32_t codegen_hash = static_cast<uint32_t>(
210 reinterpret_cast<uintptr_t>(CALL_GENERATED_CODE(hash, 0, 0, 0, 0, 0))); 211 reinterpret_cast<uintptr_t>(CALL_GENERATED_CODE(hash, 0, 0, 0, 0, 0)));
211 #else 212 #else
212 uint32_t codegen_hash = hash(); 213 uint32_t codegen_hash = hash();
213 #endif 214 #endif
214 uint32_t runtime_hash = v8_string->Hash(); 215 uint32_t runtime_hash = v8_string->Hash();
215 CHECK(runtime_hash == codegen_hash); 216 CHECK(runtime_hash == codegen_hash);
216 } 217 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // Some pseudo-random numbers 298 // Some pseudo-random numbers
298 static const uint32_t kLimit = 1000; 299 static const uint32_t kLimit = 1000;
299 for (uint32_t i = 0; i < 5; i++) { 300 for (uint32_t i = 0; i < 5; i++) {
300 for (uint32_t j = 0; j < 5; j++) { 301 for (uint32_t j = 0; j < 5; j++) {
301 check(PseudoRandom(i, j) % kLimit); 302 check(PseudoRandom(i, j) % kLimit);
302 } 303 }
303 } 304 }
304 } 305 }
305 306
306 #undef __ 307 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-func-name-inference.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698