dart-sdk/runtime/vm/double_conversion.h
Teagan Strickland 2e197ae4de [vm/compiler] Tweaks and additions to IL serializer/S-expressions.
* Add a new `SExpDouble` atom and change `SExpNumber` to `SExpInteger`.

* Allow for negative integers in deserialization.

* Add support for `LocalVariable`s and related instructions.

* Function objects are now represented by actual S-expressions generated
  with the new `FunctionToSExp` method. Previously, they were only represented
  by a symbol containing their canonical name.

* The top-level tag for a serialized flow graph is now `FlowGraph`, not
  `function`. This avoids confusion between serialized flow graphs and
  serialized function references. Similarly, the old `FunctionToSExp`
  method is now called `FlowGraphToSExp`.

* Made all SExpression* returning functions that take Object (or subclass)
  instances return nullptr if the passed in instance is the null object,
  except for ObjectToSExp, which returns the symbol `null`.

* Factored out creating tags for the different kind of block/function
  entry and also created an `Entries` section to the top-level `FlowGraph`
  form that contains function entry points similar to the `Constants` one
  instead of inlining entries as separate elements in the `FlowGraph` form.

* Additional extra information in verbose mode for some elements.

Bug: https://github.com/dart-lang/sdk/issues/36882
Change-Id: Iede3865ec64f81955a87fd57b10e74d49ee8414c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110917
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-07-31 11:52:44 +00:00

30 lines
959 B
C++

// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_VM_DOUBLE_CONVERSION_H_
#define RUNTIME_VM_DOUBLE_CONVERSION_H_
#include "vm/allocation.h"
#include "vm/globals.h"
#include "vm/object.h"
namespace dart {
struct DoubleToStringConstants : AllStatic {
static char const kExponentChar;
static const char* const kInfinitySymbol;
static const char* const kNaNSymbol;
};
void DoubleToCString(double d, char* buffer, int buffer_size);
RawString* DoubleToStringAsFixed(double d, int fraction_digits);
RawString* DoubleToStringAsExponential(double d, int fraction_digits);
RawString* DoubleToStringAsPrecision(double d, int precision);
bool CStringToDouble(const char* str, intptr_t length, double* result);
} // namespace dart
#endif // RUNTIME_VM_DOUBLE_CONVERSION_H_