| OLD | NEW |
| 1 | 1 |
| 2 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 2 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
| 4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
| 5 // met: | 5 // met: |
| 6 // | 6 // |
| 7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
| 9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
| 10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "spaces-inl.h" | 34 #include "spaces-inl.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 | 39 |
| 40 // If no message listeners have been registered this one is called | 40 // If no message listeners have been registered this one is called |
| 41 // by default. | 41 // by default. |
| 42 void MessageHandler::DefaultMessageReport(const MessageLocation* loc, | 42 void MessageHandler::DefaultMessageReport(const MessageLocation* loc, |
| 43 Handle<Object> message_obj) { | 43 Handle<Object> message_obj) { |
| 44 SmartPointer<char> str = GetLocalizedMessage(message_obj); | 44 SmartArrayPointer<char> str = GetLocalizedMessage(message_obj); |
| 45 if (loc == NULL) { | 45 if (loc == NULL) { |
| 46 PrintF("%s\n", *str); | 46 PrintF("%s\n", *str); |
| 47 } else { | 47 } else { |
| 48 HandleScope scope; | 48 HandleScope scope; |
| 49 Handle<Object> data(loc->script()->name()); | 49 Handle<Object> data(loc->script()->name()); |
| 50 SmartPointer<char> data_str; | 50 SmartArrayPointer<char> data_str; |
| 51 if (data->IsString()) | 51 if (data->IsString()) |
| 52 data_str = Handle<String>::cast(data)->ToCString(DISALLOW_NULLS); | 52 data_str = Handle<String>::cast(data)->ToCString(DISALLOW_NULLS); |
| 53 PrintF("%s:%i: %s\n", *data_str ? *data_str : "<unknown>", | 53 PrintF("%s:%i: %s\n", *data_str ? *data_str : "<unknown>", |
| 54 loc->start_pos(), *str); | 54 loc->start_pos(), *str); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 | 58 |
| 59 Handle<JSMessageObject> MessageHandler::MakeMessageObject( | 59 Handle<JSMessageObject> MessageHandler::MakeMessageObject( |
| 60 const char* type, | 60 const char* type, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // A string that has been obtained from JS code in this way is | 163 // A string that has been obtained from JS code in this way is |
| 164 // likely to be a complicated ConsString of some sort. We flatten it | 164 // likely to be a complicated ConsString of some sort. We flatten it |
| 165 // here to improve the efficiency of converting it to a C string and | 165 // here to improve the efficiency of converting it to a C string and |
| 166 // other operations that are likely to take place (see GetLocalizedMessage | 166 // other operations that are likely to take place (see GetLocalizedMessage |
| 167 // for example). | 167 // for example). |
| 168 FlattenString(result_string); | 168 FlattenString(result_string); |
| 169 return result_string; | 169 return result_string; |
| 170 } | 170 } |
| 171 | 171 |
| 172 | 172 |
| 173 SmartPointer<char> MessageHandler::GetLocalizedMessage(Handle<Object> data) { | 173 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( |
| 174 Handle<Object> data) { |
| 174 HandleScope scope; | 175 HandleScope scope; |
| 175 return GetMessage(data)->ToCString(DISALLOW_NULLS); | 176 return GetMessage(data)->ToCString(DISALLOW_NULLS); |
| 176 } | 177 } |
| 177 | 178 |
| 178 | 179 |
| 179 } } // namespace v8::internal | 180 } } // namespace v8::internal |
| OLD | NEW |