Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/log.cc

Issue 200363002: Handlify callers of Object::GetElement. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/log.h ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 if (!log_->IsEnabled() || !FLAG_log_regexp) return; 1191 if (!log_->IsEnabled() || !FLAG_log_regexp) return;
1192 Log::MessageBuilder msg(log_); 1192 Log::MessageBuilder msg(log_);
1193 msg.Append("regexp-compile,"); 1193 msg.Append("regexp-compile,");
1194 LogRegExpSource(regexp); 1194 LogRegExpSource(regexp);
1195 msg.Append(in_cache ? ",hit\n" : ",miss\n"); 1195 msg.Append(in_cache ? ",hit\n" : ",miss\n");
1196 msg.WriteToLogFile(); 1196 msg.WriteToLogFile();
1197 } 1197 }
1198 1198
1199 1199
1200 void Logger::LogRuntime(Vector<const char> format, 1200 void Logger::LogRuntime(Vector<const char> format,
1201 JSArray* args) { 1201 Handle<JSArray> args) {
1202 if (!log_->IsEnabled() || !FLAG_log_runtime) return; 1202 if (!log_->IsEnabled() || !FLAG_log_runtime) return;
1203 HandleScope scope(isolate_);
1204 Log::MessageBuilder msg(log_); 1203 Log::MessageBuilder msg(log_);
1205 for (int i = 0; i < format.length(); i++) { 1204 for (int i = 0; i < format.length(); i++) {
1206 char c = format[i]; 1205 char c = format[i];
1207 if (c == '%' && i <= format.length() - 2) { 1206 if (c == '%' && i <= format.length() - 2) {
1208 i++; 1207 i++;
1209 ASSERT('0' <= format[i] && format[i] <= '9'); 1208 ASSERT('0' <= format[i] && format[i] <= '9');
1210 MaybeObject* maybe = args->GetElement(isolate_, format[i] - '0'); 1209 Handle<Object> obj = Object::GetElement(isolate_, args, format[i] - '0');
1211 Object* obj; 1210 // No exception expected when getting an element from an array literal.
1212 if (!maybe->ToObject(&obj)) { 1211 CHECK_NOT_EMPTY_HANDLE(isolate_, obj);
1213 msg.Append("<exception>");
1214 continue;
1215 }
1216 i++; 1212 i++;
1217 switch (format[i]) { 1213 switch (format[i]) {
1218 case 's': 1214 case 's':
1219 msg.AppendDetailed(String::cast(obj), false); 1215 msg.AppendDetailed(String::cast(*obj), false);
1220 break; 1216 break;
1221 case 'S': 1217 case 'S':
1222 msg.AppendDetailed(String::cast(obj), true); 1218 msg.AppendDetailed(String::cast(*obj), true);
1223 break; 1219 break;
1224 case 'r': 1220 case 'r':
1225 Logger::LogRegExpSource(Handle<JSRegExp>(JSRegExp::cast(obj))); 1221 Logger::LogRegExpSource(Handle<JSRegExp>::cast(obj));
1226 break; 1222 break;
1227 case 'x': 1223 case 'x':
1228 msg.Append("0x%x", Smi::cast(obj)->value()); 1224 msg.Append("0x%x", Smi::cast(*obj)->value());
1229 break; 1225 break;
1230 case 'i': 1226 case 'i':
1231 msg.Append("%i", Smi::cast(obj)->value()); 1227 msg.Append("%i", Smi::cast(*obj)->value());
1232 break; 1228 break;
1233 default: 1229 default:
1234 UNREACHABLE(); 1230 UNREACHABLE();
1235 } 1231 }
1236 } else { 1232 } else {
1237 msg.Append(c); 1233 msg.Append(c);
1238 } 1234 }
1239 } 1235 }
1240 msg.Append('\n'); 1236 msg.Append('\n');
1241 msg.WriteToLogFile(); 1237 msg.WriteToLogFile();
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 if (jit_logger_) { 2155 if (jit_logger_) {
2160 removeCodeEventListener(jit_logger_); 2156 removeCodeEventListener(jit_logger_);
2161 delete jit_logger_; 2157 delete jit_logger_;
2162 jit_logger_ = NULL; 2158 jit_logger_ = NULL;
2163 } 2159 }
2164 2160
2165 return log_->Close(); 2161 return log_->Close();
2166 } 2162 }
2167 2163
2168 } } // namespace v8::internal 2164 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698