1 // Copyright 2020 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 "include/cppgc/internal/logging.h"
6 #include "include/cppgc/source-location.h"
7
8 #include "src/base/logging.h"
9
10 namespace cppgc {
11 namespace internal {
12
DCheckImpl(const char * message,const SourceLocation & loc)13 void DCheckImpl(const char* message, const SourceLocation& loc) {
14 V8_Dcheck(loc.FileName(), static_cast<int>(loc.Line()), message);
15 }
16
FatalImpl(const char * message,const SourceLocation & loc)17 void FatalImpl(const char* message, const SourceLocation& loc) {
18 #if DEBUG
19 V8_Fatal(loc.FileName(), static_cast<int>(loc.Line()), "Check failed: %s.",
20 message);
21 #elif !defined(OFFICIAL_BUILD)
22 V8_Fatal("Check failed: %s.", message);
23 #else
24 V8_Fatal("ignored");
25 #endif
26 }
27
28 } // namespace internal
29 } // namespace cppgc
30