Fix a few preprocessor macros that could capture an 'else'.

Namely they are SLOW_ASSERT, RETURN_IF_SCHEDULED_EXCEPTION, and
RETURN_IF_EMTPY_HANDLE_VALUE.

R=svenpanne@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/8983016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10329 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f953e7fc
// Copyright 2011 the V8 project authors. All rights reserved. // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -265,16 +265,16 @@ extern bool FLAG_enable_slow_asserts; ...@@ -265,16 +265,16 @@ extern bool FLAG_enable_slow_asserts;
// The ASSERT macro is equivalent to CHECK except that it only // The ASSERT macro is equivalent to CHECK except that it only
// generates code in debug builds. // generates code in debug builds.
#ifdef DEBUG #ifdef DEBUG
#define ASSERT_RESULT(expr) CHECK(expr) #define ASSERT_RESULT(expr) CHECK(expr)
#define ASSERT(condition) CHECK(condition) #define ASSERT(condition) CHECK(condition)
#define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2) #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2)
#define ASSERT_NE(v1, v2) CHECK_NE(v1, v2) #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2)
#define ASSERT_GE(v1, v2) CHECK_GE(v1, v2) #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2)
#define ASSERT_LT(v1, v2) CHECK_LT(v1, v2) #define ASSERT_LT(v1, v2) CHECK_LT(v1, v2)
#define ASSERT_LE(v1, v2) CHECK_LE(v1, v2) #define ASSERT_LE(v1, v2) CHECK_LE(v1, v2)
#define SLOW_ASSERT(condition) if (FLAG_enable_slow_asserts) CHECK(condition) #define SLOW_ASSERT(condition) CHECK(!FLAG_enable_slow_asserts || (condition))
#else #else
#define ASSERT_RESULT(expr) (expr) #define ASSERT_RESULT(expr) (expr)
#define ASSERT(condition) ((void) 0) #define ASSERT(condition) ((void) 0)
#define ASSERT_EQ(v1, v2) ((void) 0) #define ASSERT_EQ(v1, v2) ((void) 0)
#define ASSERT_NE(v1, v2) ((void) 0) #define ASSERT_NE(v1, v2) ((void) 0)
......
// Copyright 2011 the V8 project authors. All rights reserved. // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -106,15 +106,21 @@ class Simulator; ...@@ -106,15 +106,21 @@ class Simulator;
// of handles to the actual constants. // of handles to the actual constants.
typedef ZoneList<Handle<Object> > ZoneObjectList; typedef ZoneList<Handle<Object> > ZoneObjectList;
#define RETURN_IF_SCHEDULED_EXCEPTION(isolate) \ #define RETURN_IF_SCHEDULED_EXCEPTION(isolate) \
if (isolate->has_scheduled_exception()) \ do { \
return isolate->PromoteScheduledException() Isolate* __isolate__ = (isolate); \
if (__isolate__->has_scheduled_exception()) { \
return __isolate__->PromoteScheduledException(); \
} \
} while (false)
#define RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, value) \ #define RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, value) \
if (call.is_null()) { \ do { \
ASSERT(isolate->has_pending_exception()); \ if ((call).is_null()) { \
return value; \ ASSERT((isolate)->has_pending_exception()); \
} return (value); \
} \
} while (false)
#define RETURN_IF_EMPTY_HANDLE(isolate, call) \ #define RETURN_IF_EMPTY_HANDLE(isolate, call) \
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, Failure::Exception()) RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, Failure::Exception())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment