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

Unified Diff: src/isolate.cc

Issue 264333007: Add OnCompileError handler and v8::CompileError debug event (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 7 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
« src/debug.cc ('K') | « src/isolate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 3542b994ff3338ffd3860b763f49b4730dfe6d54..b44e63e90948bf1e76e76b4592222d1bbe2ac0bd 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -989,19 +989,29 @@ bool Isolate::ShouldReportException(bool* can_be_caught_externally,
bool Isolate::IsErrorObject(Handle<Object> obj) {
+ return IsTypeObject(obj,
+ factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("$Error")));
+}
+
+
+bool Isolate::IsSyntaxErrorObject(Handle<Object> obj) {
+ return IsTypeObject(obj,
+ factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("$SyntaxError")));
+}
+
+
+bool Isolate::IsTypeObject(Handle<Object> obj, Handle<String> key) {
vsevik 2014/06/06 16:12:01 IsObjectOfType
vsevik 2014/06/06 16:12:01 key -> js_builtin_key
if (!obj->IsJSObject()) return false;
- Handle<String> error_key =
- factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("$Error"));
- Handle<Object> error_constructor = Object::GetProperty(
- js_builtins_object(), error_key).ToHandleChecked();
+ Handle<Object> constructor = Object::GetProperty(
+ js_builtins_object(), key).ToHandleChecked();
DisallowHeapAllocation no_gc;
for (Object* prototype = *obj; !prototype->IsNull();
prototype = prototype->GetPrototype(this)) {
if (!prototype->IsJSObject()) return false;
if (JSObject::cast(prototype)->map()->constructor() ==
- *error_constructor) {
+ *constructor) {
return true;
}
}
@@ -1029,6 +1039,11 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) {
thread_local_top()->rethrowing_message_ = false;
+ // notify debugger of SyntaxError
+ if (location != NULL && IsSyntaxErrorObject(exception_handle)) {
+ debugger_->OnSyntaxError(location->script());
+ }
+
// Notify debugger of exception.
if (catchable_by_javascript) {
debugger_->OnException(
« src/debug.cc ('K') | « src/isolate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698