diff options
Diffstat (limited to 'chromium/v8/src/checks.h')
-rw-r--r-- | chromium/v8/src/checks.h | 90 |
1 files changed, 29 insertions, 61 deletions
diff --git a/chromium/v8/src/checks.h b/chromium/v8/src/checks.h index f7b145fc8a8..dd7a3955fb1 100644 --- a/chromium/v8/src/checks.h +++ b/chromium/v8/src/checks.h @@ -1,39 +1,18 @@ // Copyright 2012 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #ifndef V8_CHECKS_H_ #define V8_CHECKS_H_ #include <string.h> -#include "../include/v8stdint.h" +#include "include/v8stdint.h" +#include "src/base/build_config.h" extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); + // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during // development, but they should not be relied on in the final product. #ifdef DEBUG @@ -51,6 +30,24 @@ extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); #define UNREACHABLE() ((void) 0) #endif +// Simulator specific helpers. +// We can't use USE_SIMULATOR here because it isn't defined yet. +#if V8_TARGET_ARCH_ARM64 && !V8_HOST_ARCH_ARM64 + // TODO(all): If possible automatically prepend an indicator like + // UNIMPLEMENTED or LOCATION. + #define ASM_UNIMPLEMENTED(message) \ + __ Debug(message, __LINE__, NO_PARAM) + #define ASM_UNIMPLEMENTED_BREAK(message) \ + __ Debug(message, __LINE__, \ + FLAG_ignore_asm_unimplemented_break ? NO_PARAM : BREAK) + #define ASM_LOCATION(message) \ + __ Debug("LOCATION: " message, __LINE__, NO_PARAM) +#else + #define ASM_UNIMPLEMENTED(message) + #define ASM_UNIMPLEMENTED_BREAK(message) + #define ASM_LOCATION(message) +#endif + // The CHECK macro checks that the given condition is true; if not, it // prints a message to stderr and aborts. @@ -245,33 +242,6 @@ inline void CheckNonEqualsHelper(const char* file, #define CHECK_LE(a, b) CHECK((a) <= (b)) -// Use C++11 static_assert if possible, which gives error -// messages that are easier to understand on first sight. -#if V8_HAS_CXX11_STATIC_ASSERT -#define STATIC_CHECK(test) static_assert(test, #test) -#else -// This is inspired by the static assertion facility in boost. This -// is pretty magical. If it causes you trouble on a platform you may -// find a fix in the boost code. -template <bool> class StaticAssertion; -template <> class StaticAssertion<true> { }; -// This macro joins two tokens. If one of the tokens is a macro the -// helper call causes it to be resolved before joining. -#define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b) -#define SEMI_STATIC_JOIN_HELPER(a, b) a##b -// Causes an error during compilation of the condition is not -// statically known to be true. It is formulated as a typedef so that -// it can be used wherever a typedef can be used. Beware that this -// actually causes each use to introduce a new defined type with a -// name depending on the source line. -template <int> class StaticAssertionHelper { }; -#define STATIC_CHECK(test) \ - typedef \ - StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \ - SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) V8_UNUSED -#endif - - #ifdef DEBUG #ifndef OPTIMIZED_DEBUG #define ENABLE_SLOW_ASSERTS 1 @@ -288,8 +258,12 @@ extern bool FLAG_enable_slow_asserts; #define SLOW_ASSERT(condition) ((void) 0) const bool FLAG_enable_slow_asserts = false; #endif -} // namespace internal -} // namespace v8 + +// Exposed for making debugging easier (to see where your function is being +// called, just add a call to DumpBacktrace). +void DumpBacktrace(); + +} } // namespace v8::internal // The ASSERT macro is equivalent to CHECK except that it only @@ -311,12 +285,6 @@ const bool FLAG_enable_slow_asserts = false; #define ASSERT_LT(v1, v2) ((void) 0) #define ASSERT_LE(v1, v2) ((void) 0) #endif -// Static asserts has no impact on runtime performance, so they can be -// safely enabled in release mode. Moreover, the ((void) 0) expression -// obeys different syntax rules than typedef's, e.g. it can't appear -// inside class declaration, this leads to inconsistency between debug -// and release compilation modes behavior. -#define STATIC_ASSERT(test) STATIC_CHECK(test) #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) |