| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 void Logger::LogRuntime(Vector<const char> format, JSArray* args) { | 552 void Logger::LogRuntime(Vector<const char> format, JSArray* args) { |
| 553 #ifdef ENABLE_LOGGING_AND_PROFILING | 553 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 554 if (!Log::IsEnabled() || !FLAG_log_runtime) return; | 554 if (!Log::IsEnabled() || !FLAG_log_runtime) return; |
| 555 HandleScope scope; | 555 HandleScope scope; |
| 556 LogMessageBuilder msg; | 556 LogMessageBuilder msg; |
| 557 for (int i = 0; i < format.length(); i++) { | 557 for (int i = 0; i < format.length(); i++) { |
| 558 char c = format[i]; | 558 char c = format[i]; |
| 559 if (c == '%' && i <= format.length() - 2) { | 559 if (c == '%' && i <= format.length() - 2) { |
| 560 i++; | 560 i++; |
| 561 ASSERT('0' <= format[i] && format[i] <= '9'); | 561 ASSERT('0' <= format[i] && format[i] <= '9'); |
| 562 Object* obj = args->GetElement(format[i] - '0'); | 562 MaybeObject* maybe = args->GetElement(format[i] - '0'); |
| 563 Object* obj; |
| 564 if (!maybe->ToObject(&obj)) { |
| 565 msg.Append("<exception>"); |
| 566 continue; |
| 567 } |
| 563 i++; | 568 i++; |
| 564 switch (format[i]) { | 569 switch (format[i]) { |
| 565 case 's': | 570 case 's': |
| 566 msg.AppendDetailed(String::cast(obj), false); | 571 msg.AppendDetailed(String::cast(obj), false); |
| 567 break; | 572 break; |
| 568 case 'S': | 573 case 'S': |
| 569 msg.AppendDetailed(String::cast(obj), true); | 574 msg.AppendDetailed(String::cast(obj), true); |
| 570 break; | 575 break; |
| 571 case 'r': | 576 case 'r': |
| 572 Logger::LogRegExpSource(Handle<JSRegExp>(JSRegExp::cast(obj))); | 577 Logger::LogRegExpSource(Handle<JSRegExp>(JSRegExp::cast(obj))); |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 } | 1646 } |
| 1642 // Otherwise, if the sliding state window computation has not been | 1647 // Otherwise, if the sliding state window computation has not been |
| 1643 // started we do it now. | 1648 // started we do it now. |
| 1644 if (sliding_state_window_ == NULL) { | 1649 if (sliding_state_window_ == NULL) { |
| 1645 sliding_state_window_ = new SlidingStateWindow(); | 1650 sliding_state_window_ = new SlidingStateWindow(); |
| 1646 } | 1651 } |
| 1647 #endif | 1652 #endif |
| 1648 } | 1653 } |
| 1649 | 1654 |
| 1650 } } // namespace v8::internal | 1655 } } // namespace v8::internal |
| OLD | NEW |