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

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

Issue 23548024: Introduce a RandonNumberGenerator class. Refactor the random/private_random uses in Isolate/Context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 7 years, 3 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-platform-win32.cc ('k') | test/cctest/test-random-number-generator.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 // 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 Handle<JSFunction> fun(JSFunction::cast(fun_object->ToObjectChecked())); 89 Handle<JSFunction> fun(JSFunction::cast(fun_object->ToObjectChecked()));
90 90
91 // Optimize function. 91 // Optimize function.
92 Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception); 92 Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception);
93 Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception); 93 Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception);
94 if (!fun->IsOptimized()) fun->MarkForLazyRecompilation(); 94 if (!fun->IsOptimized()) fun->MarkForLazyRecompilation();
95 95
96 // Test with some random values. 96 // Test with some random values.
97 TestSeeds(fun, context, 0xC0C0AFFE, 0x31415926); 97 TestSeeds(fun, context, 0xC0C0AFFE, 0x31415926);
98 TestSeeds(fun, context, 0x01020304, 0xFFFFFFFF); 98 TestSeeds(fun, context, 0x01020304, 0xFFFFFFFF);
99 TestSeeds(fun, context, 0x00000001, 0x00000000); 99 TestSeeds(fun, context, 0x00000001, 0x00000001);
100
101 // Test that we bail out to runtime when seeds are uninitialized (zeros).
102 SetSeeds(seeds, 0, 0);
103 Handle<Object> value =
104 Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception);
105 CHECK(value->IsHeapNumber());
106 CHECK(fun->IsOptimized());
107 double crankshaft_value = HeapNumber::cast(*value)->value();
108 CHECK_NE(0.0, crankshaft_value);
109 } 100 }
OLDNEW
« no previous file with comments | « test/cctest/test-platform-win32.cc ('k') | test/cctest/test-random-number-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698