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

Unified Diff: src/factory.h

Issue 1295093002: Do not use js builtins object when constructing an error. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix failures. Created 5 years, 4 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 | « src/contexts.h ('k') | src/factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.h
diff --git a/src/factory.h b/src/factory.h
index 96fa74da8ffd064e99201fb4ae4619cb3bfa6dec..57f537effd1970701ad81ea5a29c8973c484c1ad 100644
--- a/src/factory.h
+++ b/src/factory.h
@@ -546,11 +546,6 @@ class Factory final {
Handle<Code> CopyCode(Handle<Code> code, Vector<byte> reloc_info);
// Interface for creating error objects.
-
- Handle<Object> NewError(const char* maker, const char* message,
- Handle<JSArray> args);
- Handle<String> EmergencyNewError(const char* message, Handle<JSArray> args);
-
Handle<Object> NewError(Handle<JSFunction> constructor,
Handle<String> message);
@@ -558,41 +553,28 @@ class Factory final {
return NewRangeError(MessageTemplate::kInvalidStringLength);
}
- Handle<Object> NewError(const char* maker,
+ Handle<Object> NewError(Handle<JSFunction> constructor,
MessageTemplate::Template template_index,
Handle<Object> arg0 = Handle<Object>(),
Handle<Object> arg1 = Handle<Object>(),
Handle<Object> arg2 = Handle<Object>());
- Handle<Object> NewError(MessageTemplate::Template template_index,
- Handle<Object> arg0 = Handle<Object>(),
- Handle<Object> arg1 = Handle<Object>(),
- Handle<Object> arg2 = Handle<Object>());
+#define DEFINE_ERROR(NAME, name) \
+ Handle<Object> New##NAME(MessageTemplate::Template template_index, \
+ Handle<Object> arg0 = Handle<Object>(), \
+ Handle<Object> arg1 = Handle<Object>(), \
+ Handle<Object> arg2 = Handle<Object>()) { \
+ return NewError(isolate()->name##_function(), template_index, arg0, arg1, \
+ arg2); \
+ }
- Handle<Object> NewTypeError(MessageTemplate::Template template_index,
- Handle<Object> arg0 = Handle<Object>(),
- Handle<Object> arg1 = Handle<Object>(),
- Handle<Object> arg2 = Handle<Object>());
-
- Handle<Object> NewSyntaxError(MessageTemplate::Template template_index,
- Handle<Object> arg0 = Handle<Object>(),
- Handle<Object> arg1 = Handle<Object>(),
- Handle<Object> arg2 = Handle<Object>());
-
- Handle<Object> NewReferenceError(MessageTemplate::Template template_index,
- Handle<Object> arg0 = Handle<Object>(),
- Handle<Object> arg1 = Handle<Object>(),
- Handle<Object> arg2 = Handle<Object>());
-
- Handle<Object> NewRangeError(MessageTemplate::Template template_index,
- Handle<Object> arg0 = Handle<Object>(),
- Handle<Object> arg1 = Handle<Object>(),
- Handle<Object> arg2 = Handle<Object>());
-
- Handle<Object> NewEvalError(MessageTemplate::Template template_index,
- Handle<Object> arg0 = Handle<Object>(),
- Handle<Object> arg1 = Handle<Object>(),
- Handle<Object> arg2 = Handle<Object>());
+ DEFINE_ERROR(Error, error)
+ DEFINE_ERROR(EvalError, eval_error)
+ DEFINE_ERROR(RangeError, range_error)
+ DEFINE_ERROR(ReferenceError, reference_error)
+ DEFINE_ERROR(SyntaxError, syntax_error)
+ DEFINE_ERROR(TypeError, type_error)
+#undef DEFINE_ERROR
Handle<String> NumberToString(Handle<Object> number,
bool check_number_string_cache = true);
« no previous file with comments | « src/contexts.h ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698