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

Unified Diff: src/factory.cc

Issue 176843003: Add StackOverflowError and expose error type to api. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix test Created 6 years, 10 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/factory.h ('k') | src/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 6bce5d3a6a368d1a47b238944dd1b68a2731ad25..3da473aa890bdd2886e28cfc84734d7f5a15bd65 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1069,18 +1069,8 @@ Handle<Object> Factory::NewReferenceError(Handle<String> message) {
}
-Handle<Object> Factory::NewError(const char* maker,
- const char* message,
- Vector< Handle<Object> > args) {
- // Instantiate a closeable HandleScope for EscapeFrom.
- v8::EscapableHandleScope scope(reinterpret_cast<v8::Isolate*>(isolate()));
- Handle<FixedArray> array = NewFixedArray(args.length());
- for (int i = 0; i < args.length(); i++) {
- array->set(i, *args[i]);
- }
- Handle<JSArray> object = NewJSArrayWithElements(array);
- Handle<Object> result = NewError(maker, message, object);
- return result.EscapeFrom(&scope);
+Handle<Object> Factory::NewStackOverflowError(Handle<String> message) {
+ return NewError("$StackOverflowError", message);
}
@@ -1090,12 +1080,37 @@ Handle<Object> Factory::NewEvalError(const char* message,
}
+Handle<Object> Factory::NewEvalError(Handle<String> message) {
+ return NewError("$EvalError", message);
+}
+
+
+Handle<Object> Factory::NewURIError(Handle<String> message) {
+ return NewError("$URIError", message);
+}
+
+
Handle<Object> Factory::NewError(const char* message,
Vector< Handle<Object> > args) {
return NewError("MakeError", message, args);
}
+Handle<Object> Factory::NewError(const char* maker,
+ const char* message,
+ Vector< Handle<Object> > args) {
+ // Instantiate a closeable HandleScope for EscapeFrom.
+ v8::EscapableHandleScope scope(reinterpret_cast<v8::Isolate*>(isolate()));
+ Handle<FixedArray> array = NewFixedArray(args.length());
+ for (int i = 0; i < args.length(); i++) {
+ array->set(i, *args[i]);
+ }
+ Handle<JSArray> object = NewJSArrayWithElements(array);
+ Handle<Object> result = NewError(maker, message, object);
+ return result.EscapeFrom(&scope);
+}
+
+
Handle<String> Factory::EmergencyNewError(const char* message,
Handle<JSArray> args) {
const int kBufferSize = 1000;
« no previous file with comments | « src/factory.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698