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

Unified Diff: src/ic/ic.cc

Issue 1053143005: Collect type feedback on result of Math.[round|ceil|floor] (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweaks Created 5 years, 8 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
Index: src/ic/ic.cc
diff --git a/src/ic/ic.cc b/src/ic/ic.cc
index a6ae92a892c06ac9dcc88ecf093a0201e9f0eb12..2e02f2b5af96264694b00465ade7ef3ff769f78c 100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -2212,9 +2212,9 @@ bool CallIC::DoCustomHandler(Handle<Object> function,
// Are we the array function?
Handle<JSFunction> array_function =
Handle<JSFunction>(isolate()->native_context()->array_function());
+ CallICNexus* nexus = casted_nexus<CallICNexus>();
if (array_function.is_identical_to(Handle<JSFunction>::cast(function))) {
// Alter the slot.
- CallICNexus* nexus = casted_nexus<CallICNexus>();
nexus->ConfigureMonomorphicArray();
// Vector-based ICs have a different calling convention in optimized code
@@ -2236,6 +2236,48 @@ bool CallIC::DoCustomHandler(Handle<Object> function,
OnTypeFeedbackChanged(isolate(), get_host(), nexus->vector(), state(),
MONOMORPHIC);
return true;
+ } else {
+ Handle<JSFunction> maybe_builtin(Handle<JSFunction>::cast(function));
+ if (maybe_builtin->shared()->HasBuiltinFunctionId()) {
+ BuiltinFunctionId id = maybe_builtin->shared()->builtin_function_id();
+ switch (id) {
+ case kMathRound: {
+ nexus->ConfigureMonomorphicMathFunction(maybe_builtin);
+ if (AddressIsOptimizedCode()) {
mvstanton 2015/04/28 14:21:20 Could this AddressIsOptimizedCode() { STUB1 } else
danno 2015/04/30 13:34:32 I'd like to avoid the template in this case, since
+ CallIC_RoundStub stub(isolate(), callic_state);
+ set_target(*stub.GetCode());
+ } else {
+ CallIC_RoundTrampolineStub stub(isolate(), callic_state);
+ set_target(*stub.GetCode());
+ }
+ return true;
+ }
+ case kMathFloor:
+ nexus->ConfigureMonomorphicMathFunction(maybe_builtin);
+ if (AddressIsOptimizedCode()) {
+ CallIC_FloorStub stub(isolate(), callic_state);
+ set_target(*stub.GetCode());
+ } else {
+ CallIC_FloorTrampolineStub stub(isolate(), callic_state);
+ set_target(*stub.GetCode());
+ }
+ return true;
+ break;
+ case kMathCeil:
+ nexus->ConfigureMonomorphicMathFunction(maybe_builtin);
+ if (AddressIsOptimizedCode()) {
+ CallIC_CeilStub stub(isolate(), callic_state);
+ set_target(*stub.GetCode());
+ } else {
+ CallIC_CeilTrampolineStub stub(isolate(), callic_state);
+ set_target(*stub.GetCode());
+ }
+ return true;
+ break;
+ default:
+ break;
+ }
+ }
}
return false;
}

Powered by Google App Engine
This is Rietveld 408576698