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

Unified Diff: test/unittests/compiler/js-builtin-reducer-unittest.cc

Issue 635323002: Remove premordial math functions from native context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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/objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/js-builtin-reducer-unittest.cc
diff --git a/test/unittests/compiler/js-builtin-reducer-unittest.cc b/test/unittests/compiler/js-builtin-reducer-unittest.cc
index 541dd09911e05470be3d321c1411bcf9ee1ff12d..b885dbb12a11b72b395c5812fbab38c546fae80e 100644
--- a/test/unittests/compiler/js-builtin-reducer-unittest.cc
+++ b/test/unittests/compiler/js-builtin-reducer-unittest.cc
@@ -35,6 +35,18 @@ class JSBuiltinReducerTest : public GraphTest {
return n;
}
+ Handle<JSFunction> MathFunction(const char* name) {
+ Handle<Object> m =
+ JSObject::GetProperty(isolate()->global_object(),
+ isolate()->factory()->NewStringFromAsciiChecked(
+ "Math")).ToHandleChecked();
+ Handle<JSFunction> f = Handle<JSFunction>::cast(
+ JSObject::GetProperty(
+ m, isolate()->factory()->NewStringFromAsciiChecked(name))
+ .ToHandleChecked());
+ return f;
+ }
+
JSOperatorBuilder* javascript() { return &javascript_; }
private:
@@ -60,7 +72,7 @@ Type* const kNumberTypes[] = {
TEST_F(JSBuiltinReducerTest, MathAbs) {
- Handle<JSFunction> f(isolate()->context()->math_abs_fun());
+ Handle<JSFunction> f = MathFunction("abs");
TRACED_FOREACH(Type*, t0, kNumberTypes) {
Node* p0 = Parameter(t0, 0);
@@ -94,7 +106,7 @@ TEST_F(JSBuiltinReducerTest, MathAbs) {
TEST_F(JSBuiltinReducerTest, MathSqrt) {
- Handle<JSFunction> f(isolate()->context()->math_sqrt_fun());
+ Handle<JSFunction> f = MathFunction("sqrt");
TRACED_FOREACH(Type*, t0, kNumberTypes) {
Node* p0 = Parameter(t0, 0);
@@ -115,7 +127,7 @@ TEST_F(JSBuiltinReducerTest, MathSqrt) {
TEST_F(JSBuiltinReducerTest, MathMax0) {
- Handle<JSFunction> f(isolate()->context()->math_max_fun());
+ Handle<JSFunction> f = MathFunction("max");
Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f));
Node* call =
@@ -129,7 +141,7 @@ TEST_F(JSBuiltinReducerTest, MathMax0) {
TEST_F(JSBuiltinReducerTest, MathMax1) {
- Handle<JSFunction> f(isolate()->context()->math_max_fun());
+ Handle<JSFunction> f = MathFunction("max");
TRACED_FOREACH(Type*, t0, kNumberTypes) {
Node* p0 = Parameter(t0, 0);
@@ -146,7 +158,7 @@ TEST_F(JSBuiltinReducerTest, MathMax1) {
TEST_F(JSBuiltinReducerTest, MathMax2) {
- Handle<JSFunction> f(isolate()->context()->math_max_fun());
+ Handle<JSFunction> f = MathFunction("max");
TRACED_FOREACH(Type*, t0, kNumberTypes) {
TRACED_FOREACH(Type*, t1, kNumberTypes) {
@@ -182,7 +194,7 @@ TEST_F(JSBuiltinReducerTest, MathMax2) {
TEST_F(JSBuiltinReducerTest, MathImul) {
- Handle<JSFunction> f(isolate()->context()->math_imul_fun());
+ Handle<JSFunction> f = MathFunction("imul");
TRACED_FOREACH(Type*, t0, kNumberTypes) {
TRACED_FOREACH(Type*, t1, kNumberTypes) {
@@ -211,13 +223,7 @@ TEST_F(JSBuiltinReducerTest, MathImul) {
TEST_F(JSBuiltinReducerTest, MathFround) {
- Handle<Object> m =
- JSObject::GetProperty(isolate()->global_object(),
- isolate()->factory()->NewStringFromAsciiChecked(
- "Math")).ToHandleChecked();
- Handle<JSFunction> f = Handle<JSFunction>::cast(
- JSObject::GetProperty(m, isolate()->factory()->NewStringFromAsciiChecked(
- "fround")).ToHandleChecked());
+ Handle<JSFunction> f = MathFunction("fround");
TRACED_FOREACH(Type*, t0, kNumberTypes) {
Node* p0 = Parameter(t0, 0);
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698