OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 // Creating verbose TryCatch from public API is currently the only way to | 931 // Creating verbose TryCatch from public API is currently the only way to |
932 // force code save location. We do not use this the object directly. | 932 // force code save location. We do not use this the object directly. |
933 v8::TryCatch try_catch; | 933 v8::TryCatch try_catch; |
934 try_catch.SetVerbose(true); | 934 try_catch.SetVerbose(true); |
935 | 935 |
936 // A logical 'try' section. | 936 // A logical 'try' section. |
937 CompileScriptForTracker(isolate, script); | 937 CompileScriptForTracker(isolate, script); |
938 } | 938 } |
939 | 939 |
940 // A logical 'catch' section. | 940 // A logical 'catch' section. |
941 Handle<Object> rethrow_exception; | 941 Handle<JSObject> rethrow_exception; |
942 if (isolate->has_pending_exception()) { | 942 if (isolate->has_pending_exception()) { |
943 Handle<Object> exception(isolate->pending_exception()->ToObjectChecked()); | 943 Handle<Object> exception(isolate->pending_exception()->ToObjectChecked()); |
944 MessageLocation message_location = isolate->GetMessageLocation(); | 944 MessageLocation message_location = isolate->GetMessageLocation(); |
945 | 945 |
946 isolate->clear_pending_message(); | 946 isolate->clear_pending_message(); |
947 isolate->clear_pending_exception(); | 947 isolate->clear_pending_exception(); |
948 | 948 |
949 // If possible, copy positions from message object to exception object. | 949 // If possible, copy positions from message object to exception object. |
950 if (exception->IsJSObject() && !message_location.script().is_null()) { | 950 if (exception->IsJSObject() && !message_location.script().is_null()) { |
951 Handle<JSObject> exception_struct = Handle<JSObject>::cast(exception); | 951 rethrow_exception = Handle<JSObject>::cast(exception); |
952 | 952 |
953 Factory* factory = isolate->factory(); | 953 Factory* factory = isolate->factory(); |
954 JSReceiver::SetProperty(exception_struct, | 954 Handle<String> start_pos_key = |
955 factory->LookupAsciiSymbol("startPosition"), | 955 factory->LookupAsciiSymbol("startPosition"); |
956 Handle<Smi>(Smi::FromInt(message_location.start_pos())), | 956 Handle<String> end_pos_key = |
957 NONE, kNonStrictMode); | 957 factory->LookupAsciiSymbol("endPosition"); |
958 JSReceiver::SetProperty(exception_struct, | 958 Handle<String> script_obj_key = |
959 factory->LookupAsciiSymbol("endPosition"), | 959 factory->LookupAsciiSymbol("scriptObject"); |
960 Handle<Smi>(Smi::FromInt(message_location.end_pos())), | 960 Handle<Smi> start_pos(Smi::FromInt(message_location.start_pos())); |
961 NONE, kNonStrictMode); | 961 Handle<Smi> end_pos(Smi::FromInt(message_location.end_pos())); |
962 JSReceiver::SetProperty(exception_struct, | 962 Handle<JSValue> script_obj = GetScriptWrapper(message_location.script()); |
963 factory->LookupAsciiSymbol("scriptObject"), | 963 JSReceiver::SetProperty( |
964 GetScriptWrapper(message_location.script()), | 964 rethrow_exception, start_pos_key, start_pos, NONE, kNonStrictMode); |
965 NONE, kNonStrictMode); | 965 JSReceiver::SetProperty( |
| 966 rethrow_exception, end_pos_key, end_pos, NONE, kNonStrictMode); |
| 967 JSReceiver::SetProperty( |
| 968 rethrow_exception, script_obj_key, script_obj, NONE, kNonStrictMode); |
966 } | 969 } |
967 | |
968 rethrow_exception = exception; | |
969 } | 970 } |
970 | 971 |
971 // A logical 'finally' section. | 972 // A logical 'finally' section. |
972 isolate->set_active_function_info_listener(NULL); | 973 isolate->set_active_function_info_listener(NULL); |
973 script->set_source(*original_source); | 974 script->set_source(*original_source); |
974 | 975 |
975 if (rethrow_exception.is_null()) { | 976 if (rethrow_exception.is_null()) { |
976 return *(listener.GetResult()); | 977 return *(listener.GetResult()); |
977 } else { | 978 } else { |
978 isolate->Throw(*rethrow_exception); | 979 isolate->Throw(*rethrow_exception); |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2104 | 2105 |
2105 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 2106 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
2106 return false; | 2107 return false; |
2107 } | 2108 } |
2108 | 2109 |
2109 #endif // ENABLE_DEBUGGER_SUPPORT | 2110 #endif // ENABLE_DEBUGGER_SUPPORT |
2110 | 2111 |
2111 | 2112 |
2112 | 2113 |
2113 } } // namespace v8::internal | 2114 } } // namespace v8::internal |
OLD | NEW |