Chromium Code Reviews| 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( |