Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 9215d0fa27c9ee90adf2490fc64bba067e32264d..f7b310003e0c1140936a8c86d51638534acd824a 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -7489,6 +7489,16 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall( |
return true; |
} |
break; |
+ case kMathRandom: |
+ if (argument_count == 1 && check_type == RECEIVER_MAP_CHECK) { |
+ AddCheckConstantFunction(expr->holder(), receiver, receiver_map); |
+ Drop(1); // Receiver. |
+ HGlobalObject* global_object = Add<HGlobalObject>(); |
+ HRandom* result = New<HRandom>(global_object); |
+ ast_context()->ReturnInstruction(result, expr->id()); |
+ return true; |
+ } |
+ break; |
case kMathMax: |
case kMathMin: |
if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) { |
@@ -9863,6 +9873,14 @@ void HOptimizedGraphBuilder::GenerateLog(CallRuntime* call) { |
} |
+// Fast support for Math.random(). |
+void HOptimizedGraphBuilder::GenerateRandomHeapNumber(CallRuntime* call) { |
+ HGlobalObject* global_object = Add<HGlobalObject>(); |
+ HRandom* result = New<HRandom>(global_object); |
+ return ast_context()->ReturnInstruction(result, call->id()); |
+} |
+ |
+ |
// Fast support for StringAdd. |
void HOptimizedGraphBuilder::GenerateStringAdd(CallRuntime* call) { |
ASSERT_EQ(2, call->arguments()->length()); |