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

Unified Diff: src/code-stubs.cc

Issue 2406843002: [Interpreter] Collect feedback about Oddballs in Subtract Stub. (Closed)
Patch Set: Trying with a landmine. 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 | « gypfiles/get_landmines.py ('k') | src/globals.h » ('j') | no next file with comments »
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..60ecedacd03d584d92da3bf7c1145d1bb312c3b7 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -828,8 +828,9 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
typedef CodeStubAssembler::Variable Variable;
// Shared entry for floating point subtraction.
- Label do_fsub(assembler), end(assembler),
- call_subtract_stub(assembler, Label::kDeferred);
+ Label do_fsub(assembler), end(assembler), call_subtract_stub(assembler),
+ if_lhsisnotnumber(assembler), check_rhsisoddball(assembler),
+ call_with_any_feedback(assembler);
Variable var_fsub_lhs(assembler, MachineRepresentation::kFloat64),
var_fsub_rhs(assembler, MachineRepresentation::kFloat64),
var_type_feedback(assembler, MachineRepresentation::kWord32),
@@ -879,7 +880,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 +896,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 +917,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,10 +937,63 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
assembler->Goto(&end);
}
- assembler->Bind(&call_subtract_stub);
+ assembler->Bind(&if_lhsisnotnumber);
+ {
+ // No checks on rhs are done yet. We just know lhs is not a number or Smi.
+ // 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);
+
+ Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
+ 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);
+ }
+
+ 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);
+ }
+ }
+
+ 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);
+ }
+
+ assembler->Bind(&call_with_any_feedback);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kAny));
+ assembler->Goto(&call_subtract_stub);
+ }
+
+ assembler->Bind(&call_subtract_stub);
+ {
Callable callable = CodeFactory::Subtract(assembler->isolate());
var_result.Bind(assembler->CallStub(callable, context, lhs, rhs));
assembler->Goto(&end);
« no previous file with comments | « gypfiles/get_landmines.py ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698