Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 901e10721d3a02bf5f48d638b2e06ab519ae6835..096174da81caf6bb6df59d4732c93f19cb8571ca 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -12272,6 +12272,24 @@ void HOptimizedGraphBuilder::GenerateToString(CallRuntime* call) { |
} |
+void HOptimizedGraphBuilder::GenerateToNumber(CallRuntime* call) { |
+ DCHECK_EQ(1, call->arguments()->length()); |
+ CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
+ Callable callable = CodeFactory::ToNumber(isolate()); |
+ HValue* input = Pop(); |
+ if (input->type().IsTaggedNumber()) { |
+ return ast_context()->ReturnValue(input); |
+ } else { |
+ HValue* stub = Add<HConstant>(callable.code()); |
+ HValue* values[] = {context(), input}; |
+ HInstruction* result = |
+ New<HCallWithDescriptor>(stub, 0, callable.descriptor(), |
+ Vector<HValue*>(values, arraysize(values))); |
+ return ast_context()->ReturnInstruction(result, call->id()); |
+ } |
+} |
+ |
+ |
void HOptimizedGraphBuilder::GenerateIsJSProxy(CallRuntime* call) { |
DCHECK(call->arguments()->length() == 1); |
CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |