Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: Source/bindings/v8/V8BindingMacros.h

Issue 121113004: Improve handling of failed integer type conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/v8/V8Binding.cpp ('k') | Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8BindingMacros.h
diff --git a/Source/bindings/v8/V8BindingMacros.h b/Source/bindings/v8/V8BindingMacros.h
index 8098652e2093930f5d7941ee7656f063e10f62c0..f5ab5832bef8783b2b6e8890d6f03dce09915a27 100644
--- a/Source/bindings/v8/V8BindingMacros.h
+++ b/Source/bindings/v8/V8BindingMacros.h
@@ -33,13 +33,13 @@
namespace WebCore {
-#define V8TRYCATCH(type, var, value) \
- type var; \
- { \
- v8::TryCatch block; \
- var = (value); \
- if (block.HasCaught()) \
- return block.ReThrow(); \
+#define V8TRYCATCH(type, var, value) \
+ type var; \
+ { \
+ v8::TryCatch block; \
+ var = (value); \
+ if (UNLIKELY(block.HasCaught())) \
+ return block.ReThrow(); \
}
#define V8TRYCATCH_RETURN(type, var, value, retVal) \
@@ -47,49 +47,53 @@ namespace WebCore {
{ \
v8::TryCatch block; \
var = (value); \
- if (block.HasCaught()) { \
+ if (UNLIKELY(block.HasCaught())) { \
block.ReThrow(); \
return retVal; \
} \
}
-#define V8TRYCATCH_VOID(type, var, value) \
- type var; \
- { \
- v8::TryCatch block; \
- var = (value); \
- if (block.HasCaught()) { \
- block.ReThrow(); \
- return; \
- } \
+#define V8TRYCATCH_EXCEPTION_RETURN(type, var, value, exceptionState, retVal) \
+ type var; \
+ { \
+ v8::TryCatch block; \
+ var = (value); \
+ if (UNLIKELY(block.HasCaught())) \
+ exceptionState.rethrowV8Exception(block.Exception()); \
+ if (UNLIKELY(exceptionState.throwIfNeeded())) \
+ return retVal; \
}
-#define V8TRYCATCH_WITH_TYPECHECK_VOID(type, var, value, isolate) \
- type var; \
- { \
- bool ok = true; \
- { \
- v8::TryCatch block; \
- var = (value); \
- if (block.HasCaught()) { \
- block.ReThrow(); \
- return; \
- } \
- } \
- if (UNLIKELY(!ok)) { \
- throwUninformativeAndGenericTypeError(isolate); \
- return; \
- } \
+#define V8TRYCATCH_VOID(type, var, value) \
+ type var; \
+ { \
+ v8::TryCatch block; \
+ var = (value); \
+ if (UNLIKELY(block.HasCaught())) { \
+ block.ReThrow(); \
+ return; \
+ } \
+ }
+
+#define V8TRYCATCH_EXCEPTION_VOID(type, var, value, exceptionState) \
+ type var; \
+ { \
+ v8::TryCatch block; \
+ var = (value); \
+ if (UNLIKELY(block.HasCaught())) \
+ exceptionState.rethrowV8Exception(block.Exception()); \
+ if (UNLIKELY(exceptionState.throwIfNeeded())) \
+ return; \
}
#define V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(type, var, value, retVal) \
type var(value); \
- if (!var.prepare()) \
+ if (UNLIKELY(!var.prepare())) \
return retVal;
#define V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(type, var, value) \
- type var(value); \
- if (!var.prepare()) \
+ type var(value); \
+ if (UNLIKELY(!var.prepare())) \
return;
} // namespace WebCore
« no previous file with comments | « Source/bindings/v8/V8Binding.cpp ('k') | Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698