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

Unified Diff: src/code-stubs.cc

Issue 2392533002: Reland of [interpreter] Add string type feedback to add (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 de18700d5ee7856c0b302fdb7ef516f99e088fda..5b9f1d8e03c71ad21bb8a67a7fe101a19557a951 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -1107,12 +1107,14 @@ compiler::Node* AddWithFeedbackStub::Generate(
assembler->Bind(&if_lhsisnotsmi);
{
+ Label check_string(assembler);
+
// Load the map of {lhs}.
Node* lhs_map = assembler->LoadMap(lhs);
// Check if {lhs} is a HeapNumber.
Label if_lhsisnumber(assembler), if_lhsisnotnumber(assembler);
- assembler->GotoUnless(assembler->IsHeapNumberMap(lhs_map), &call_add_stub);
+ assembler->GotoUnless(assembler->IsHeapNumberMap(lhs_map), &check_string);
// Check if the {rhs} is Smi.
Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
@@ -1138,6 +1140,32 @@ compiler::Node* AddWithFeedbackStub::Generate(
var_fadd_rhs.Bind(assembler->LoadHeapNumberValue(rhs));
assembler->Goto(&do_fadd);
}
+
+ assembler->Bind(&check_string);
+ {
+ // Check if the {rhs} is a smi, and exit the string check early if it is.
+ assembler->GotoIf(assembler->WordIsSmi(rhs), &call_add_stub);
rmcilroy 2016/10/04 08:05:31 We should still count this as a string if the lhs
Leszek Swirski 2016/10/04 08:30:40 As above.
+
+ Node* lhs_instance_type = assembler->LoadMapInstanceType(lhs_map);
+
+ assembler->GotoUnless(assembler->Int32LessThan(
+ lhs_instance_type,
+ assembler->Int32Constant(FIRST_NONSTRING_TYPE)),
+ &call_add_stub);
+
+ Node* rhs_instance_type = assembler->LoadInstanceType(rhs);
+
+ assembler->GotoUnless(assembler->Int32LessThan(
+ rhs_instance_type,
+ assembler->Int32Constant(FIRST_NONSTRING_TYPE)),
+ &call_add_stub);
+
+ var_type_feedback.Bind(
+ assembler->Int32Constant(BinaryOperationFeedback::kString));
+ Callable callable = CodeFactory::Add(assembler->isolate());
+ var_result.Bind(assembler->CallStub(callable, context, lhs, rhs));
rmcilroy 2016/10/04 08:05:31 Let's keep the calling of the stub and updating of
Leszek Swirski 2016/10/04 08:30:40 Not sure about this, calling the stub is a small a
+ assembler->Goto(&end);
+ }
}
assembler->Bind(&do_fadd);
@@ -1153,6 +1181,7 @@ compiler::Node* AddWithFeedbackStub::Generate(
assembler->Bind(&call_add_stub);
{
+ assembler->Comment("Calling the stub");
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kAny));
Callable callable = CodeFactory::Add(assembler->isolate());
@@ -1161,6 +1190,7 @@ compiler::Node* AddWithFeedbackStub::Generate(
}
assembler->Bind(&end);
+ assembler->Comment("Updating the feedback");
assembler->UpdateFeedback(var_type_feedback.value(), type_feedback_vector,
slot_id);
return var_result.value();
« 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