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

Unified Diff: test/cctest/test-serialize.cc

Issue 1806713003: Reland of Allow Math.random to be called when creating a custom startup snapshot. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@testserialize
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-maths.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-serialize.cc
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
index 8477c384f3c245e3a8f844b4a9f8550d97149c60..c90ddb9c5d16ea0324cb1a6f44f160ab3da0a711 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -462,7 +462,8 @@
" e = function(s) { return eval (s); }"
"})();"
"var o = this;"
- "var r = Math.sin(0) + Math.cos(0);"
+ "var r = Math.random();"
+ "var c = Math.sin(0) + Math.cos(0);"
"var f = (function(a, b) { return a + b; }).bind(1, 2, 3);"
"var s = parseInt('12345');");
@@ -558,7 +559,18 @@
->ToNumber(v8_isolate->GetCurrentContext())
.ToLocalChecked()
->Value();
- CHECK_EQ(1, r);
+ CHECK(0.0 <= r && r < 1.0);
+ // Math.random still works.
+ double random = CompileRun("Math.random()")
+ ->ToNumber(v8_isolate->GetCurrentContext())
+ .ToLocalChecked()
+ ->Value();
+ CHECK(0.0 <= random && random < 1.0);
+ double c = CompileRun("c")
+ ->ToNumber(v8_isolate->GetCurrentContext())
+ .ToLocalChecked()
+ ->Value();
+ CHECK_EQ(1, c);
int f = CompileRun("f()")
->ToNumber(v8_isolate->GetCurrentContext())
.ToLocalChecked()
« no previous file with comments | « src/runtime/runtime-maths.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698