v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
encoded-c-signature.cc
Go to the documentation of this file.
1// Copyright 2021 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
6
8#include "src/base/bits.h"
9#include "src/base/logging.h"
10
11namespace v8 {
12namespace internal {
13
18
21 parameter_count_ = static_cast<int>(signature->ArgumentCount());
22 for (int i = 0; i < parameter_count_; ++i) {
23 if (signature->ArgumentInfo(i).GetSequenceType() ==
24 CTypeInfo::SequenceType::kScalar &&
25 CTypeInfo::IsFloatingPointType(signature->ArgumentInfo(i).GetType())) {
26 SetFloat(i);
27 }
28 }
29 // The struct holding the options of the CFunction (e.g. callback) is not
30 // included in the number of regular parameters, so we add it manually here.
31 if (signature->HasOptions()) {
32 parameter_count_++;
33 }
34 if (signature->ReturnInfo().GetSequenceType() ==
35 CTypeInfo::SequenceType::kScalar &&
36 CTypeInfo::IsFloatingPointType(signature->ReturnInfo().GetType())) {
37 if (signature->ReturnInfo().GetType() == CTypeInfo::Type::kFloat64) {
38 SetReturnFloat64();
39 } else {
40 SetReturnFloat32();
41 }
42 }
43}
45
46} // namespace internal
47} // namespace v8
static constexpr bool IsFloatingPointType(Type type)
constexpr unsigned CountPopulation(T value)
Definition bits.h:26
#define CHECK(condition)
Definition logging.h:124
#define END_ALLOW_USE_DEPRECATED()
Definition v8config.h:634
#define START_ALLOW_USE_DEPRECATED()
Definition v8config.h:633