Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
evaluator.h
Go to the documentation of this file.
1// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_COMPILER_BACKEND_EVALUATOR_H_
6#define RUNTIME_VM_COMPILER_BACKEND_EVALUATOR_H_
7
8#if defined(DART_PRECOMPILED_RUNTIME)
9#error "AOT runtime should not use compiler sources (including header files)"
10#endif // defined(DART_PRECOMPILED_RUNTIME)
11
12#include "vm/allocation.h"
16
17namespace dart {
18
19// Namespace for static helper methods that evaluate constant expressions.
20class Evaluator : public AllStatic {
21 public:
22 // Truncates the given int64 value based on the representation.
23 static int64_t TruncateTo(int64_t v, Representation r);
24
25 // Evaluates a binary integer operation and returns a pointer to a
26 // canonicalized RawInteger.
27 static IntegerPtr BinaryIntegerEvaluate(const Object& left,
28 const Object& right,
29 Token::Kind token_kind,
30 bool is_truncating,
31 Representation representation,
32 Thread* thread);
33
34 // Evaluates a unary integer operation and returns a pointer to a
35 // canonicalized RawInteger.
36 static IntegerPtr UnaryIntegerEvaluate(const Object& value,
37 Token::Kind token_kind,
38 Representation representation,
39 Thread* thread);
40
41 // Evaluates an `int.bitLength` operation and returns a pointer to a
42 // canonicalized RawInteger.
43 static IntegerPtr BitLengthEvaluate(const Object& value,
44 Representation representation,
45 Thread* thread);
46
47 // Evaluates a unary double operation and returns the result.
48 static double EvaluateUnaryDoubleOp(const double value,
49 Token::Kind token_kind,
50 Representation representation);
51
52 // Evaluates a binary double operation and returns the result.
53 static double EvaluateBinaryDoubleOp(const double left,
54 const double right,
55 Token::Kind token_kind,
56 Representation representation);
57
58 // Returns whether the value is an int64, and returns the int64 value
59 // through the result parameter.
60 static bool ToIntegerConstant(Value* value, int64_t* result);
61};
62
63} // namespace dart
64
65#endif // RUNTIME_VM_COMPILER_BACKEND_EVALUATOR_H_
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
static int64_t TruncateTo(int64_t v, Representation r)
Definition evaluator.cc:81
static IntegerPtr BitLengthEvaluate(const Object &value, Representation representation, Thread *thread)
Definition evaluator.cc:164
static double EvaluateUnaryDoubleOp(const double value, Token::Kind token_kind, Representation representation)
Definition evaluator.cc:192
static IntegerPtr UnaryIntegerEvaluate(const Object &value, Token::Kind token_kind, Representation representation, Thread *thread)
Definition evaluator.cc:135
static IntegerPtr BinaryIntegerEvaluate(const Object &left, const Object &right, Token::Kind token_kind, bool is_truncating, Representation representation, Thread *thread)
Definition evaluator.cc:99
static double EvaluateBinaryDoubleOp(const double left, const double right, Token::Kind token_kind, Representation representation)
Definition evaluator.cc:238
static bool ToIntegerConstant(Value *value, int64_t *result)
Definition evaluator.cc:281
uint8_t value
GAsyncResult * result
Representation
Definition locations.h:66