v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
type-parser.cc
Go to the documentation of this file.
1
// Copyright 2022 the V8 project authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#include "
src/compiler/turboshaft/type-parser.h
"
6
7
#include <optional>
8
9
namespace
v8::internal::compiler::turboshaft
{
10
11
std::optional<Type>
TypeParser::ParseType
() {
12
if
(
ConsumeIf
(
"Word32"
)) {
13
if
(
IsNext
(
"{"
))
return
ParseSet<Word32Type>
();
14
if
(
IsNext
(
"["
))
return
ParseRange<Word32Type>
();
15
return
Word32Type::Any
();
16
}
else
if
(
ConsumeIf
(
"Word64"
)) {
17
if
(
IsNext
(
"{"
))
return
ParseSet<Word64Type>
();
18
if
(
IsNext
(
"["
))
return
ParseRange<Word64Type>
();
19
return
Word64Type::Any
();
20
}
else
if
(
ConsumeIf
(
"Float32"
)) {
21
// TODO(nicohartmann@): Handle NaN.
22
if
(
IsNext
(
"{"
))
return
ParseSet<Float32Type>
();
23
if
(
IsNext
(
"["
))
return
ParseRange<Float32Type>
();
24
return
Float64Type::Any
();
25
}
else
if
(
ConsumeIf
(
"Float64"
)) {
26
// TODO(nicohartmann@): Handle NaN.
27
if
(
IsNext
(
"{"
))
return
ParseSet<Float64Type>
();
28
if
(
IsNext
(
"["
))
return
ParseRange<Float64Type>
();
29
return
Float64Type::Any
();
30
}
else
{
31
return
std::nullopt;
32
}
33
}
34
35
}
// namespace v8::internal::compiler::turboshaft
v8::internal::compiler::turboshaft::TypeParser::ParseSet
std::optional< T > ParseSet()
Definition
type-parser.h:53
v8::internal::compiler::turboshaft::TypeParser::IsNext
bool IsNext(const std::string_view &prefix)
Definition
type-parser.h:89
v8::internal::compiler::turboshaft::TypeParser::ConsumeIf
bool ConsumeIf(const std::string_view &prefix)
Definition
type-parser.h:81
v8::internal::compiler::turboshaft::TypeParser::ParseRange
std::optional< T > ParseRange()
Definition
type-parser.h:37
v8::internal::compiler::turboshaft::TypeParser::ParseType
std::optional< Type > ParseType()
Definition
type-parser.cc:11
v8::internal::compiler::turboshaft::Type::Any
static Type Any()
Definition
types.h:205
v8::internal::compiler::turboshaft::WordType::Any
static WordType Any()
Definition
types.h:339
v8::internal::compiler::turboshaft
Definition
builtins.h:33
type-parser.h
src
compiler
turboshaft
type-parser.cc
Generated on Sun Apr 6 2025 21:08:53 for v8 by
1.12.0