| Index: runtime/vm/flow_graph_builder.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_builder.cc (revision 35632)
|
| +++ runtime/vm/flow_graph_builder.cc (working copy)
|
| @@ -39,6 +39,25 @@
|
| DECLARE_FLAG(bool, enable_type_checks);
|
|
|
|
|
| +
|
| +// TODO(srdjan): Allow compiler to add constants as they are encountered in
|
| +// the compilation.
|
| +const double kCommonDoubleConstants[15] =
|
| + {-1.0, -0.5, -0.1, 0.0, 0.1, 0.5, 1.0, 2.0, 4.0, 5.0,
|
| + 10.0, 20.0, 30.0, 64.0, 255.0};
|
| +
|
| +uword FlowGraphBuilder::FindDoubleConstant(double value) {
|
| + intptr_t len = sizeof(kCommonDoubleConstants) / sizeof(double); // NOLINT
|
| + for (intptr_t i = 0; i < len; i++) {
|
| + // Bitwise compare.
|
| + if (*reinterpret_cast<int64_t*>(&value) ==
|
| + *reinterpret_cast<const int64_t*>(&kCommonDoubleConstants[i])) {
|
| + return reinterpret_cast<uword>(&kCommonDoubleConstants[i]);
|
| + }
|
| + }
|
| + return 0;
|
| +}
|
| +
|
| // Base class for a stack of enclosing statements of interest (e.g.,
|
| // blocks (breakable) and loops (continuable)).
|
| class NestedStatement : public ValueObject {
|
|
|