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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 1846683006: [stubs] Introduce ToIntegerStub and unify the handling of %_ToInteger. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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/compiler/js-intrinsic-lowering.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index c59c8e5337afe750648fd5c50154e505f3fc672c..4e16f97cd170e007831e1658d442e18f94b6e242 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -12283,22 +12283,13 @@ void HOptimizedGraphBuilder::GenerateToInteger(CallRuntime* call) {
if (input->type().IsSmi()) {
return ast_context()->ReturnValue(input);
} else {
- IfBuilder if_inputissmi(this);
- if_inputissmi.If<HIsSmiAndBranch>(input);
- if_inputissmi.Then();
- {
- // Return the input value.
- Push(input);
- Add<HSimulate>(call->id(), FIXED_SIMULATE);
- }
- if_inputissmi.Else();
- {
- Add<HPushArguments>(input);
- Push(Add<HCallRuntime>(Runtime::FunctionForId(Runtime::kToInteger), 1));
- Add<HSimulate>(call->id(), FIXED_SIMULATE);
- }
- if_inputissmi.End();
- return ast_context()->ReturnValue(Pop());
+ Callable callable = CodeFactory::ToInteger(isolate());
+ 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());
}
}
« no previous file with comments | « src/compiler/js-intrinsic-lowering.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698