OLD | NEW |
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 c++; | 70 c++; |
71 } | 71 } |
72 return (Q[i] = r - x); | 72 return (Q[i] = r - x); |
73 } | 73 } |
74 | 74 |
75 uint32_t next(int max) { | 75 uint32_t next(int max) { |
76 return next() % max; | 76 return next() % max; |
77 } | 77 } |
78 | 78 |
79 bool next(double threshold) { | 79 bool next(double threshold) { |
80 ASSERT(threshold >= 0.0 && threshold <= 1.0); | 80 DCHECK(threshold >= 0.0 && threshold <= 1.0); |
81 if (threshold == 1.0) return true; | 81 if (threshold == 1.0) return true; |
82 if (threshold == 0.0) return false; | 82 if (threshold == 0.0) return false; |
83 uint32_t value = next() % 100000; | 83 uint32_t value = next() % 100000; |
84 return threshold > static_cast<double>(value)/100000.0; | 84 return threshold > static_cast<double>(value)/100000.0; |
85 } | 85 } |
86 | 86 |
87 private: | 87 private: |
88 static const uint32_t kQSize = 4096; | 88 static const uint32_t kQSize = 4096; |
89 uint32_t Q[kQSize]; | 89 uint32_t Q[kQSize]; |
90 uint32_t c; | 90 uint32_t c; |
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 CHECK(isolate->has_pending_exception()); \ | 1403 CHECK(isolate->has_pending_exception()); \ |
1404 isolate->clear_pending_exception(); \ | 1404 isolate->clear_pending_exception(); \ |
1405 dummy.Dispose(); \ | 1405 dummy.Dispose(); \ |
1406 } | 1406 } |
1407 | 1407 |
1408 INVALID_STRING_TEST(NewStringFromAscii, char) | 1408 INVALID_STRING_TEST(NewStringFromAscii, char) |
1409 INVALID_STRING_TEST(NewStringFromUtf8, char) | 1409 INVALID_STRING_TEST(NewStringFromUtf8, char) |
1410 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) | 1410 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) |
1411 | 1411 |
1412 #undef INVALID_STRING_TEST | 1412 #undef INVALID_STRING_TEST |
OLD | NEW |