| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 loc->start_pos(), str.get()); | 54 loc->start_pos(), str.get()); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 | 58 |
| 59 Handle<JSMessageObject> MessageHandler::MakeMessageObject( | 59 Handle<JSMessageObject> MessageHandler::MakeMessageObject( |
| 60 Isolate* isolate, | 60 Isolate* isolate, |
| 61 const char* type, | 61 const char* type, |
| 62 MessageLocation* loc, | 62 MessageLocation* loc, |
| 63 Vector< Handle<Object> > args, | 63 Vector< Handle<Object> > args, |
| 64 Handle<String> stack_trace, | |
| 65 Handle<JSArray> stack_frames) { | 64 Handle<JSArray> stack_frames) { |
| 66 Factory* factory = isolate->factory(); | 65 Factory* factory = isolate->factory(); |
| 67 Handle<String> type_handle = factory->InternalizeUtf8String(type); | 66 Handle<String> type_handle = factory->InternalizeUtf8String(type); |
| 68 Handle<FixedArray> arguments_elements = | 67 Handle<FixedArray> arguments_elements = |
| 69 factory->NewFixedArray(args.length()); | 68 factory->NewFixedArray(args.length()); |
| 70 for (int i = 0; i < args.length(); i++) { | 69 for (int i = 0; i < args.length(); i++) { |
| 71 arguments_elements->set(i, *args[i]); | 70 arguments_elements->set(i, *args[i]); |
| 72 } | 71 } |
| 73 Handle<JSArray> arguments_handle = | 72 Handle<JSArray> arguments_handle = |
| 74 factory->NewJSArrayWithElements(arguments_elements); | 73 factory->NewJSArrayWithElements(arguments_elements); |
| 75 | 74 |
| 76 int start = 0; | 75 int start = 0; |
| 77 int end = 0; | 76 int end = 0; |
| 78 Handle<Object> script_handle = factory->undefined_value(); | 77 Handle<Object> script_handle = factory->undefined_value(); |
| 79 if (loc) { | 78 if (loc) { |
| 80 start = loc->start_pos(); | 79 start = loc->start_pos(); |
| 81 end = loc->end_pos(); | 80 end = loc->end_pos(); |
| 82 script_handle = GetScriptWrapper(loc->script()); | 81 script_handle = GetScriptWrapper(loc->script()); |
| 83 } | 82 } |
| 84 | 83 |
| 85 Handle<Object> stack_trace_handle = stack_trace.is_null() | |
| 86 ? Handle<Object>::cast(factory->undefined_value()) | |
| 87 : Handle<Object>::cast(stack_trace); | |
| 88 | |
| 89 Handle<Object> stack_frames_handle = stack_frames.is_null() | 84 Handle<Object> stack_frames_handle = stack_frames.is_null() |
| 90 ? Handle<Object>::cast(factory->undefined_value()) | 85 ? Handle<Object>::cast(factory->undefined_value()) |
| 91 : Handle<Object>::cast(stack_frames); | 86 : Handle<Object>::cast(stack_frames); |
| 92 | 87 |
| 93 Handle<JSMessageObject> message = | 88 Handle<JSMessageObject> message = |
| 94 factory->NewJSMessageObject(type_handle, | 89 factory->NewJSMessageObject(type_handle, |
| 95 arguments_handle, | 90 arguments_handle, |
| 96 start, | 91 start, |
| 97 end, | 92 end, |
| 98 script_handle, | 93 script_handle, |
| 99 stack_trace_handle, | |
| 100 stack_frames_handle); | 94 stack_frames_handle); |
| 101 | 95 |
| 102 return message; | 96 return message; |
| 103 } | 97 } |
| 104 | 98 |
| 105 | 99 |
| 106 void MessageHandler::ReportMessage(Isolate* isolate, | 100 void MessageHandler::ReportMessage(Isolate* isolate, |
| 107 MessageLocation* loc, | 101 MessageLocation* loc, |
| 108 Handle<Object> message) { | 102 Handle<Object> message) { |
| 109 // We are calling into embedder's code which can throw exceptions. | 103 // We are calling into embedder's code which can throw exceptions. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 187 |
| 194 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( | 188 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( |
| 195 Isolate* isolate, | 189 Isolate* isolate, |
| 196 Handle<Object> data) { | 190 Handle<Object> data) { |
| 197 HandleScope scope(isolate); | 191 HandleScope scope(isolate); |
| 198 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS); | 192 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS); |
| 199 } | 193 } |
| 200 | 194 |
| 201 | 195 |
| 202 } } // namespace v8::internal | 196 } } // namespace v8::internal |
| OLD | NEW |