Commit 6bd923b5 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cleanup] Save binary size in macro use inside UpdateFeedbackType.

We can call FeedbackTypeOf before the switch statement to avoid
generating callsites for every operation. This CL saves 4 KiB binary
size.

Bug: v8:8238
Change-Id: I0f9d7a155e0cec219306ca1fb35f1eb9ff18a36f
Reviewed-on: https://chromium-review.googlesource.com/1254207
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56340}
parent 53012103
...@@ -431,11 +431,17 @@ class RepresentationSelector { ...@@ -431,11 +431,17 @@ class RepresentationSelector {
} }
} }
// We preload these values here to avoid increasing the binary size too
// much, which happens if we inline the calls into the macros below.
Type input0_type;
if (node->InputCount() > 0) input0_type = FeedbackTypeOf(node->InputAt(0));
Type input1_type;
if (node->InputCount() > 1) input1_type = FeedbackTypeOf(node->InputAt(1));
switch (node->opcode()) { switch (node->opcode()) {
#define DECLARE_CASE(Name) \ #define DECLARE_CASE(Name) \
case IrOpcode::k##Name: { \ case IrOpcode::k##Name: { \
new_type = op_typer_.Name(FeedbackTypeOf(node->InputAt(0)), \ new_type = op_typer_.Name(input0_type, input1_type); \
FeedbackTypeOf(node->InputAt(1))); \
break; \ break; \
} }
SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_CASE) SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_CASE)
...@@ -444,9 +450,7 @@ class RepresentationSelector { ...@@ -444,9 +450,7 @@ class RepresentationSelector {
#define DECLARE_CASE(Name) \ #define DECLARE_CASE(Name) \
case IrOpcode::k##Name: { \ case IrOpcode::k##Name: { \
new_type = \ new_type = Type::Intersect(op_typer_.Name(input0_type, input1_type), \
Type::Intersect(op_typer_.Name(FeedbackTypeOf(node->InputAt(0)), \
FeedbackTypeOf(node->InputAt(1))), \
info->restriction_type(), graph_zone()); \ info->restriction_type(), graph_zone()); \
break; \ break; \
} }
...@@ -455,7 +459,7 @@ class RepresentationSelector { ...@@ -455,7 +459,7 @@ class RepresentationSelector {
#define DECLARE_CASE(Name) \ #define DECLARE_CASE(Name) \
case IrOpcode::k##Name: { \ case IrOpcode::k##Name: { \
new_type = op_typer_.Name(FeedbackTypeOf(node->InputAt(0))); \ new_type = op_typer_.Name(input0_type); \
break; \ break; \
} }
SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_CASE) SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_CASE)
...@@ -463,8 +467,7 @@ class RepresentationSelector { ...@@ -463,8 +467,7 @@ class RepresentationSelector {
#define DECLARE_CASE(Name) \ #define DECLARE_CASE(Name) \
case IrOpcode::k##Name: { \ case IrOpcode::k##Name: { \
new_type = \ new_type = Type::Intersect(op_typer_.Name(input0_type), \
Type::Intersect(op_typer_.Name(FeedbackTypeOf(node->InputAt(0))), \
info->restriction_type(), graph_zone()); \ info->restriction_type(), graph_zone()); \
break; \ break; \
} }
...@@ -472,29 +475,26 @@ class RepresentationSelector { ...@@ -472,29 +475,26 @@ class RepresentationSelector {
#undef DECLARE_CASE #undef DECLARE_CASE
case IrOpcode::kConvertReceiver: case IrOpcode::kConvertReceiver:
new_type = op_typer_.ConvertReceiver(FeedbackTypeOf(node->InputAt(0))); new_type = op_typer_.ConvertReceiver(input0_type);
break; break;
case IrOpcode::kPlainPrimitiveToNumber: case IrOpcode::kPlainPrimitiveToNumber:
new_type = op_typer_.ToNumber(FeedbackTypeOf(node->InputAt(0))); new_type = op_typer_.ToNumber(input0_type);
break; break;
case IrOpcode::kCheckBounds: case IrOpcode::kCheckBounds:
new_type = Type::Intersect( new_type =
op_typer_.CheckBounds(FeedbackTypeOf(node->InputAt(0)), Type::Intersect(op_typer_.CheckBounds(input0_type, input1_type),
FeedbackTypeOf(node->InputAt(1))),
info->restriction_type(), graph_zone()); info->restriction_type(), graph_zone());
break; break;
case IrOpcode::kCheckFloat64Hole: case IrOpcode::kCheckFloat64Hole:
new_type = Type::Intersect( new_type = Type::Intersect(op_typer_.CheckFloat64Hole(input0_type),
op_typer_.CheckFloat64Hole(FeedbackTypeOf(node->InputAt(0))),
info->restriction_type(), graph_zone()); info->restriction_type(), graph_zone());
break; break;
case IrOpcode::kCheckNumber: case IrOpcode::kCheckNumber:
new_type = Type::Intersect( new_type = Type::Intersect(op_typer_.CheckNumber(input0_type),
op_typer_.CheckNumber(FeedbackTypeOf(node->InputAt(0))),
info->restriction_type(), graph_zone()); info->restriction_type(), graph_zone());
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment