Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
64 lines (53 loc) · 1.93 KB

File metadata and controls

64 lines (53 loc) · 1.93 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "hermes/Support/ErrorHandling.h"
#include "llvh/ADT/Twine.h"
namespace hermes {
const std::error_category &oom_category() {
class OOMErrorCategory final : public std::error_category {
const char *name() const noexcept override {
return "vm_allocate_category";
}
std::string message(int condition) const override {
switch (static_cast<OOMError>(condition)) {
case OOMError::None:
return "No error";
case OOMError::MaxHeapReached:
return "Max heap size was exceeded";
case OOMError::MaxStorageReached:
return "Number of storages requested exceeded the limit";
case OOMError::Effective:
return "Effective OOM";
case OOMError::SuperSegmentAlloc:
return "Allocation occurred that was larger than a heap segment";
case OOMError::CopyableVectorCapacityIntegerOverflow:
return "CopyableVector capacity integer overflow";
case OOMError::TestVMLimitReached:
return "A test set a limit for virtual memory that was exceeded";
}
return "Unknown";
}
};
static OOMErrorCategory category;
return category;
}
std::error_code make_error_code(OOMError err) {
return std::error_code(static_cast<int>(err), oom_category());
}
std::string convert_error_to_message(std::error_code code) {
return (llvh::Twine("error_code(value = ") + llvh::Twine(code.value()) +
", category = " + code.category().name() +
", message = " + code.message() + ")")
.str();
}
LLVM_ATTRIBUTE_NORETURN void hermes_fatal(const char *msg) {
llvh::report_fatal_error(msg);
}
LLVM_ATTRIBUTE_NORETURN void hermes_fatal(const std::string &msg) {
llvh::report_fatal_error(msg.c_str());
}
} // namespace hermes
Morty Proxy This is a proxified and sanitized view of the page, visit original site.