Revision: 20307
Author: yang...@chromium.org
Date: Thu Mar 27 14:45:56 2014 UTC
Log: Clean up runtime functions for Maths.
R=dslo...@google.com, dslo...@chromium.org
Review URL: https://codereview.chromium.org/212763008
http://code.google.com/p/v8/source/detail?r=20307
Modified:
/branches/bleeding_edge/src/arm/code-stubs-arm.cc
/branches/bleeding_edge/src/arm/full-codegen-arm.cc
/branches/bleeding_edge/src/arm64/code-stubs-arm64.cc
/branches/bleeding_edge/src/arm64/full-codegen-arm64.cc
/branches/bleeding_edge/src/harmony-math.js
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/ia32/code-stubs-ia32.cc
/branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
/branches/bleeding_edge/src/math.js
/branches/bleeding_edge/src/mips/code-stubs-mips.cc
/branches/bleeding_edge/src/mips/full-codegen-mips.cc
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/runtime.h
/branches/bleeding_edge/src/x64/code-stubs-x64.cc
/branches/bleeding_edge/src/x64/full-codegen-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Thu Mar 27 10:41:45
2014 UTC
+++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Thu Mar 27 14:45:56
2014 UTC
@@ -1428,7 +1428,7 @@
if (exponent_type_ == ON_STACK) {
// The arguments are still on the stack.
__ bind(&call_runtime);
- __ TailCallRuntime(Runtime::kMath_pow_cfunction, 2, 1);
+ __ TailCallRuntime(Runtime::kHiddenMathPow, 2, 1);
// The stub is called from non-optimized code, which expects the result
// as heap number in exponent.
=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Wed Mar 26 15:51:48
2014 UTC
+++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Thu Mar 27 14:45:56
2014 UTC
@@ -3757,26 +3757,6 @@
__ CallStub(&stub);
context()->Plug(r0);
}
-
-
-void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
- // Load the argument on the stack and call the runtime function.
- ZoneList<Expression*>* args = expr->arguments();
- ASSERT(args->length() == 1);
- VisitForStackValue(args->at(0));
- __ CallRuntime(Runtime::kMath_log, 1);
- context()->Plug(r0);
-}
-
-
-void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) {
- // Load the argument on the stack and call the runtime function.
- ZoneList<Expression*>* args = expr->arguments();
- ASSERT(args->length() == 1);
- VisitForStackValue(args->at(0));
- __ CallRuntime(Runtime::kMath_sqrt, 1);
- context()->Plug(r0);
-}
void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
=======================================
--- /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc Thu Mar 27
10:41:45 2014 UTC
+++ /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc Thu Mar 27
14:45:56 2014 UTC
@@ -1389,7 +1389,7 @@
__ Bind(&call_runtime);
// Put the arguments back on the stack.
__ Push(base_tagged, exponent_tagged);
- __ TailCallRuntime(Runtime::kMath_pow_cfunction, 2, 1);
+ __ TailCallRuntime(Runtime::kHiddenMathPow, 2, 1);
// Return.
__ Bind(&done);
=======================================
--- /branches/bleeding_edge/src/arm64/full-codegen-arm64.cc Wed Mar 26
15:51:48 2014 UTC
+++ /branches/bleeding_edge/src/arm64/full-codegen-arm64.cc Thu Mar 27
14:45:56 2014 UTC
@@ -3490,26 +3490,6 @@
__ CallStub(&stub);
context()->Plug(x0);
}
-
-
-void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
- // Load the argument on the stack and call the runtime function.
- ZoneList<Expression*>* args = expr->arguments();
- ASSERT(args->length() == 1);
- VisitForStackValue(args->at(0));
- __ CallRuntime(Runtime::kMath_log, 1);
- context()->Plug(x0);
-}
-
-
-void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) {
- // Load the argument on the stack and call the runtime function.
- ZoneList<Expression*>* args = expr->arguments();
- ASSERT(args->length() == 1);
- VisitForStackValue(args->at(0));
- __ CallRuntime(Runtime::kMath_sqrt, 1);
- context()->Plug(x0);
-}
void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
=======================================
--- /branches/bleeding_edge/src/harmony-math.js Mon Mar 10 08:21:18 2014 UTC
+++ /branches/bleeding_edge/src/harmony-math.js Thu Mar 27 14:45:56 2014 UTC
@@ -156,7 +156,7 @@
// ES6 draft 09-27-13, section 20.2.2.16.
function MathFround(x) {
- return %Math_fround(TO_NUMBER_INLINE(x));
+ return %MathFround(TO_NUMBER_INLINE(x));
}
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Wed Mar 26 15:51:48 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc Thu Mar 27 14:45:56 2014 UTC
@@ -10783,6 +10783,15 @@
HInstruction* result = NewUncasted<HUnaryMathOperation>(value,
kMathSqrt);
return ast_context()->ReturnInstruction(result, call->id());
}
+
+
+void HOptimizedGraphBuilder::GenerateMathExp(CallRuntime* call) {
+ ASSERT(call->arguments()->length() == 1);
+ CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
+ HValue* value = Pop();
+ HInstruction* result = NewUncasted<HUnaryMathOperation>(value, kMathExp);
+ return ast_context()->ReturnInstruction(result, call->id());
+}
void HOptimizedGraphBuilder::GenerateGetCachedArrayIndex(CallRuntime*
call) {
=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Thu Mar 27 10:41:45
2014 UTC
+++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Thu Mar 27 14:45:56
2014 UTC
@@ -1014,7 +1014,7 @@
if (exponent_type_ == ON_STACK) {
// The arguments are still on the stack.
__ bind(&call_runtime);
- __ TailCallRuntime(Runtime::kMath_pow_cfunction, 2, 1);
+ __ TailCallRuntime(Runtime::kHiddenMathPow, 2, 1);
// The stub is called from non-optimized code, which expects the result
// as heap number in exponent.
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Wed Mar 26
15:51:48 2014 UTC
+++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Thu Mar 27
14:45:56 2014 UTC
@@ -3539,7 +3539,7 @@
MathPowStub stub(MathPowStub::ON_STACK);
__ CallStub(&stub);
} else {
- __ CallRuntime(Runtime::kMath_pow, 2);
+ __ CallRuntime(Runtime::kHiddenMathPowSlow, 2);
}
context()->Plug(eax);
}
@@ -3724,26 +3724,6 @@
__ CallStub(&stub);
context()->Plug(eax);
}
-
-
-void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
- // Load the argument on the stack and call the runtime function.
- ZoneList<Expression*>* args = expr->arguments();
- ASSERT(args->length() == 1);
- VisitForStackValue(args->at(0));
- __ CallRuntime(Runtime::kMath_log, 1);
- context()->Plug(eax);
-}
-
-
-void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) {
- // Load the argument on the stack and call the runtime function.
- ZoneList<Expression*>* args = expr->arguments();
- ASSERT(args->length() == 1);
- VisitForStackValue(args->at(0));
- __ CallRuntime(Runtime::kMath_sqrt, 1);
- context()->Plug(eax);
-}
void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
=======================================
--- /branches/bleeding_edge/src/math.js Wed Jan 8 11:55:53 2014 UTC
+++ /branches/bleeding_edge/src/math.js Thu Mar 27 14:45:56 2014 UTC
@@ -52,24 +52,24 @@
// ECMA 262 - 15.8.2.2
function MathAcos(x) {
- return %Math_acos(TO_NUMBER_INLINE(x));
+ return %MathAcos(TO_NUMBER_INLINE(x));
}
// ECMA 262 - 15.8.2.3
function MathAsin(x) {
- return %Math_asin(TO_NUMBER_INLINE(x));
+ return %MathAsin(TO_NUMBER_INLINE(x));
}
// ECMA 262 - 15.8.2.4
function MathAtan(x) {
- return %Math_atan(TO_NUMBER_INLINE(x));
+ return %MathAtan(TO_NUMBER_INLINE(x));
}
// ECMA 262 - 15.8.2.5
// The naming of y and x matches the spec, as does the order in which
// ToNumber (valueOf) is called.
function MathAtan2(y, x) {
- return %Math_atan2(TO_NUMBER_INLINE(y), TO_NUMBER_INLINE(x));
+ return %MathAtan2(TO_NUMBER_INLINE(y), TO_NUMBER_INLINE(x));
}
// ECMA 262 - 15.8.2.6
@@ -85,7 +85,7 @@
// ECMA 262 - 15.8.2.8
function MathExp(x) {
- return %Math_exp(TO_NUMBER_INLINE(x));
+ return %_MathExp(TO_NUMBER_INLINE(x));
}
// ECMA 262 - 15.8.2.9
@@ -100,7 +100,7 @@
// has to be -0, which wouldn't be the case with the shift.
return TO_UINT32(x);
} else {
- return %Math_floor(x);
+ return %MathFloor(x);
}
}
=======================================
--- /branches/bleeding_edge/src/mips/code-stubs-mips.cc Thu Mar 27 10:41:45
2014 UTC
+++ /branches/bleeding_edge/src/mips/code-stubs-mips.cc Thu Mar 27 14:45:56
2014 UTC
@@ -1511,7 +1511,7 @@
if (exponent_type_ == ON_STACK) {
// The arguments are still on the stack.
__ bind(&call_runtime);
- __ TailCallRuntime(Runtime::kMath_pow_cfunction, 2, 1);
+ __ TailCallRuntime(Runtime::kHiddenMathPow, 2, 1);
// The stub is called from non-optimized code, which expects the result
// as heap number in exponent.
=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Wed Mar 26
15:51:48 2014 UTC
+++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Thu Mar 27
14:45:56 2014 UTC
@@ -3796,26 +3796,6 @@
__ CallStub(&stub);
context()->Plug(v0);
}
-
-
-void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
- // Load the argument on the stack and call the runtime function.
- ZoneList<Expression*>* args = expr->arguments();
- ASSERT(args->length() == 1);
- VisitForStackValue(args->at(0));
- __ CallRuntime(Runtime::kMath_log, 1);
- context()->Plug(v0);
-}
-
-
-void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) {
- // Load the argument on the stack and call the runtime function.
- ZoneList<Expression*>* args = expr->arguments();
- ASSERT(args->length() == 1);
- VisitForStackValue(args->at(0));
- __ CallRuntime(Runtime::kMath_sqrt, 1);
- context()->Plug(v0);
-}
void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
=======================================
--- /branches/bleeding_edge/src/runtime.cc Thu Mar 27 10:41:45 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc Thu Mar 27 14:45:56 2014 UTC
@@ -7759,19 +7759,19 @@
}
-#define
RUNTIME_UNARY_MATH(NAME) \
-RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_##NAME)
{ \
+#define RUNTIME_UNARY_MATH(Name,
name) \
+RUNTIME_FUNCTION(MaybeObject*, Runtime_Math##Name)
{ \
SealHandleScope
shs(isolate); \
ASSERT(args.length() ==
1); \
-
isolate->counters()->math_##NAME()->Increment();
\
+
isolate->counters()->math_##name()->Increment();
\
CONVERT_DOUBLE_ARG_CHECKED(x,
0); \
- return
isolate->heap()->AllocateHeapNumber(std::NAME(x)); \
+ return
isolate->heap()->AllocateHeapNumber(std::name(x)); \
}
-RUNTIME_UNARY_MATH(acos)
-RUNTIME_UNARY_MATH(asin)
-RUNTIME_UNARY_MATH(atan)
-RUNTIME_UNARY_MATH(log)
+RUNTIME_UNARY_MATH(Acos, acos)
+RUNTIME_UNARY_MATH(Asin, asin)
+RUNTIME_UNARY_MATH(Atan, atan)
+RUNTIME_UNARY_MATH(Log, log)
#undef RUNTIME_UNARY_MATH
@@ -7807,7 +7807,7 @@
static const double kPiDividedBy4 = 0.78539816339744830962;
-RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_atan2) {
+RUNTIME_FUNCTION(MaybeObject*, Runtime_MathAtan2) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 2);
isolate->counters()->math_atan2()->Increment();
@@ -7830,7 +7830,7 @@
}
-RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_exp) {
+RUNTIME_FUNCTION(MaybeObject*, Runtime_MathExp) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_exp()->Increment();
@@ -7841,7 +7841,7 @@
}
-RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_floor) {
+RUNTIME_FUNCTION(MaybeObject*, Runtime_MathFloor) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_floor()->Increment();
@@ -7853,7 +7853,7 @@
// Slow version of Math.pow. We check for fast paths for special cases.
// Used if SSE2/VFP3 is not available.
-RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow) {
+RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_MathPowSlow) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 2);
isolate->counters()->math_pow()->Increment();
@@ -7876,7 +7876,7 @@
// Fast version of Math.pow if we know that y is not an integer and y is
not
// -0.5 or 0.5. Used as slow case from full codegen.
-RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow_cfunction) {
+RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_MathPow) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 2);
isolate->counters()->math_pow()->Increment();
@@ -7936,7 +7936,7 @@
}
-RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_sqrt) {
+RUNTIME_FUNCTION(MaybeObject*, Runtime_MathSqrt) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 1);
isolate->counters()->math_sqrt()->Increment();
@@ -7946,7 +7946,7 @@
}
-RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_fround) {
+RUNTIME_FUNCTION(MaybeObject*, Runtime_MathFround) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 1);
=======================================
--- /branches/bleeding_edge/src/runtime.h Thu Mar 27 10:41:45 2014 UTC
+++ /branches/bleeding_edge/src/runtime.h Thu Mar 27 14:45:56 2014 UTC
@@ -157,18 +157,13 @@
F(SmiLexicographicCompare, 2, 1) \
\
/* Math */ \
- F(Math_acos, 1, 1) \
- F(Math_asin, 1, 1) \
- F(Math_atan, 1, 1) \
- F(Math_log, 1, 1) \
- F(Math_sqrt, 1, 1) \
- F(Math_exp, 1, 1) \
- F(Math_floor, 1, 1) \
- F(Math_pow, 2, 1) \
- F(Math_pow_cfunction, 2, 1) \
- F(Math_atan2, 2, 1) \
+ F(MathAcos, 1, 1) \
+ F(MathAsin, 1, 1) \
+ F(MathAtan, 1, 1) \
+ F(MathFloor, 1, 1) \
+ F(MathAtan2, 2, 1) \
F(RoundNumber, 1, 1) \
- F(Math_fround, 1, 1) \
+ F(MathFround, 1, 1) \
\
/* Regular expressions */ \
F(RegExpCompile, 3, 1) \
@@ -556,6 +551,7 @@
// by id from code generator, but not via native call by name.
// Entries have the form F(name, number of arguments, number of return
values).
#define RUNTIME_HIDDEN_FUNCTION_LIST(F) \
+ /* String and Regexp */ \
F(NumberToString, 1, 1) \
F(RegExpConstructResult, 3, 1) \
F(RegExpExec, 4, 1) \
@@ -634,7 +630,11 @@
F(InitializeConstContextSlot, 3, 1) \
\
/* Eval */ \
- F(ResolvePossiblyDirectEval, 5, 2)
+ F(ResolvePossiblyDirectEval, 5, 2) \
+ \
+ /* Maths */ \
+ F(MathPowSlow, 2, 1) \
+ F(MathPow, 2, 1)
//
----------------------------------------------------------------------------
// INLINE_FUNCTION_LIST defines all inlined functions accessed
@@ -663,8 +663,6 @@
F(IsSpecObject, 1,
1) \
F(IsStringWrapperSafeForDefaultValueOf, 1,
1) \
F(MathPow, 2,
1) \
- F(MathSqrt, 1,
1) \
- F(MathLog, 1,
1) \
F(IsMinusZero, 1,
1) \
F(HasCachedArrayIndex, 1,
1) \
F(GetCachedArrayIndex, 1,
1) \
@@ -690,13 +688,19 @@
// a corresponding runtime function, that is called from non-optimized
code.
// Entries have the form F(name, number of arguments, number of return
values).
#define INLINE_OPTIMIZED_FUNCTION_LIST(F) \
- F(DoubleHi, 1,
1) \
- F(DoubleLo, 1,
1) \
+ /* Typed Arrays
*/ \
F(ConstructDouble, 2,
1) \
F(TypedArrayInitialize, 5,
1) \
F(DataViewInitialize, 4,
1) \
F(MaxSmi, 0,
1) \
- F(TypedArrayMaxSizeInHeap, 0, 1)
+ F(TypedArrayMaxSizeInHeap, 0,
1) \
+ \
+ /* Maths
*/ \
+ F(DoubleHi, 1,
1) \
+ F(DoubleLo, 1,
1) \
+ F(MathSqrt, 1,
1) \
+ F(MathExp, 1,
1) \
+ F(MathLog, 1, 1)
//---------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.cc Thu Mar 27 10:41:45
2014 UTC
+++ /branches/bleeding_edge/src/x64/code-stubs-x64.cc Thu Mar 27 14:45:56
2014 UTC
@@ -875,7 +875,7 @@
if (exponent_type_ == ON_STACK) {
// The arguments are still on the stack.
__ bind(&call_runtime);
- __ TailCallRuntime(Runtime::kMath_pow_cfunction, 2, 1);
+ __ TailCallRuntime(Runtime::kHiddenMathPow, 2, 1);
// The stub is called from non-optimized code, which expects the result
// as heap number in rax.
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Wed Mar 26 15:51:48
2014 UTC
+++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Thu Mar 27 14:45:56
2014 UTC
@@ -3696,26 +3696,6 @@
__ CallStub(&stub);
context()->Plug(rax);
}
-
-
-void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
- // Load the argument on the stack and call the runtime function.
- ZoneList<Expression*>* args = expr->arguments();
- ASSERT(args->length() == 1);
- VisitForStackValue(args->at(0));
- __ CallRuntime(Runtime::kMath_log, 1);
- context()->Plug(rax);
-}
-
-
-void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) {
- // Load the argument on the stack and call the runtime function.
- ZoneList<Expression*>* args = expr->arguments();
- ASSERT(args->length() == 1);
- VisitForStackValue(args->at(0));
- __ CallRuntime(Runtime::kMath_sqrt, 1);
- context()->Plug(rax);
-}
void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.