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