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

Unified Diff: src/code-stubs.cc

Issue 2406843002: [Interpreter] Collect feedback about Oddballs in Subtract Stub. (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | src/globals.h » ('j') | src/globals.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index ee8dd6160552844cd2304e48302591802c9cc453..d8553a3ef729466b2f4d8489f2b2bd99d01f427c 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -836,7 +836,9 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
var_result(assembler, MachineRepresentation::kTagged);
// Check if the {lhs} is a Smi or a HeapObject.
- Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler);
+ Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler),
+ if_lhsisnotnumber(assembler), check_rhsisoddball(assembler),
Leszek Swirski 2016/10/10 11:57:22 move the new label definitions to the above label
mythria 2016/10/10 13:26:00 Thanks, Done.
+ call_with_any_feedback(assembler);
assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi);
assembler->Bind(&if_lhsissmi);
@@ -879,7 +881,7 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
// Check if {rhs} is a HeapNumber.
assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map),
- &call_subtract_stub);
+ &check_rhsisoddball);
// Perform a floating point subtraction.
var_fsub_lhs.Bind(assembler->SmiToFloat64(lhs));
@@ -895,7 +897,7 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
// Check if the {lhs} is a HeapNumber.
assembler->GotoUnless(assembler->IsHeapNumberMap(lhs_map),
- &call_subtract_stub);
+ &if_lhsisnotnumber);
// Check if the {rhs} is a Smi.
Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
@@ -916,7 +918,7 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
// Check if the {rhs} is a HeapNumber.
assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map),
- &call_subtract_stub);
+ &check_rhsisoddball);
// Perform a floating point subtraction.
var_fsub_lhs.Bind(assembler->LoadHeapNumberValue(lhs));
@@ -936,6 +938,62 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
assembler->Goto(&end);
}
+ assembler->Bind(&if_lhsisnotnumber);
+ {
+ // No checks on rhs are done yet. We just know lhs is not number or Smi.
+ Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
Leszek Swirski 2016/10/10 11:57:22 nit: move these declarations to be next to the bra
mythria 2016/10/10 13:26:00 Done.
+
+ // Check if lhs is an oddball.
+ Node* lhs_instance_type = assembler->LoadInstanceType(lhs);
+ Node* lhs_is_oddball = assembler->Word32Equal(
+ lhs_instance_type, assembler->Int32Constant(ODDBALL_TYPE));
+ assembler->GotoUnless(lhs_is_oddball, &call_with_any_feedback);
+
+ assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi);
+
+ assembler->Bind(&if_rhsissmi);
+ {
+ var_type_feedback.Bind(
+ assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball));
+ assembler->Goto(&call_subtract_stub);
Leszek Swirski 2016/10/10 11:57:22 if lhs is an oddball, can we not extract its float
mythria 2016/10/10 13:26:00 As discussed offline, we cannot directly go to fsu
+ }
+
+ assembler->Bind(&if_rhsisnotsmi);
+ {
+ // Load the map of the {rhs}.
+ Node* rhs_map = assembler->LoadMap(rhs);
+
+ // Check if {rhs} is a HeapNumber.
+ assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map),
+ &check_rhsisoddball);
+
+ var_type_feedback.Bind(
+ assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball));
+ assembler->Goto(&call_subtract_stub);
Leszek Swirski 2016/10/10 11:57:22 as above
mythria 2016/10/10 13:26:00 reply above.
+ }
+ }
+
+ assembler->Bind(&check_rhsisoddball);
+ {
+ // Check if rhs is an oddball. At this point we know lhs is either a
+ // Smi or number or oddball and rhs is not a number or Smi.
+ Node* rhs_instance_type = assembler->LoadInstanceType(rhs);
+ Node* rhs_is_oddball = assembler->Word32Equal(
+ rhs_instance_type, assembler->Int32Constant(ODDBALL_TYPE));
+ assembler->GotoUnless(rhs_is_oddball, &call_with_any_feedback);
+
+ var_type_feedback.Bind(
+ assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball));
+ assembler->Goto(&call_subtract_stub);
Leszek Swirski 2016/10/10 11:57:22 as above
mythria 2016/10/10 13:26:00 reply above
+ }
+
+ assembler->Bind(&call_with_any_feedback);
+ {
+ var_type_feedback.Bind(
+ assembler->Int32Constant(BinaryOperationFeedback::kAny));
+ assembler->Goto(&call_subtract_stub);
+ }
+
assembler->Bind(&call_subtract_stub);
{
var_type_feedback.Bind(
« no previous file with comments | « no previous file | src/globals.h » ('j') | src/globals.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698