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

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: 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
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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 JSArray* args) {
1202 if (!log_->IsEnabled() || !FLAG_log_runtime) return; 1202 if (!log_->IsEnabled() || !FLAG_log_runtime) return;
1203 HandleScope scope(isolate_); 1203 HandleScope scope(isolate_);
1204 Handle<JSArray> args_handle(args);
1204 Log::MessageBuilder msg(log_); 1205 Log::MessageBuilder msg(log_);
1205 for (int i = 0; i < format.length(); i++) { 1206 for (int i = 0; i < format.length(); i++) {
1206 char c = format[i]; 1207 char c = format[i];
1207 if (c == '%' && i <= format.length() - 2) { 1208 if (c == '%' && i <= format.length() - 2) {
1208 i++; 1209 i++;
1209 ASSERT('0' <= format[i] && format[i] <= '9'); 1210 ASSERT('0' <= format[i] && format[i] <= '9');
1210 MaybeObject* maybe = args->GetElement(isolate_, format[i] - '0'); 1211 Handle<Object> obj =
1211 Object* obj; 1212 Object::GetElement(isolate_, args_handle, format[i] - '0');
Igor Sheludko 2014/03/17 16:50:44 I'm afraid we can hit ASSERT(AllowHeapAllocation::
Yang 2014/03/18 09:39:38 This will not happen, since all callers to Runtime
1212 if (!maybe->ToObject(&obj)) { 1213 // No exception expected when getting an element from an array literal.
1213 msg.Append("<exception>"); 1214 CHECK_NOT_EMPTY_HANDLE(isolate_, obj);
1214 continue;
1215 }
1216 i++; 1215 i++;
1217 switch (format[i]) { 1216 switch (format[i]) {
1218 case 's': 1217 case 's':
1219 msg.AppendDetailed(String::cast(obj), false); 1218 msg.AppendDetailed(String::cast(*obj), false);
1220 break; 1219 break;
1221 case 'S': 1220 case 'S':
1222 msg.AppendDetailed(String::cast(obj), true); 1221 msg.AppendDetailed(String::cast(*obj), true);
1223 break; 1222 break;
1224 case 'r': 1223 case 'r':
1225 Logger::LogRegExpSource(Handle<JSRegExp>(JSRegExp::cast(obj))); 1224 Logger::LogRegExpSource(Handle<JSRegExp>::cast(obj));
1226 break; 1225 break;
1227 case 'x': 1226 case 'x':
1228 msg.Append("0x%x", Smi::cast(obj)->value()); 1227 msg.Append("0x%x", Smi::cast(*obj)->value());
1229 break; 1228 break;
1230 case 'i': 1229 case 'i':
1231 msg.Append("%i", Smi::cast(obj)->value()); 1230 msg.Append("%i", Smi::cast(*obj)->value());
1232 break; 1231 break;
1233 default: 1232 default:
1234 UNREACHABLE(); 1233 UNREACHABLE();
1235 } 1234 }
1236 } else { 1235 } else {
1237 msg.Append(c); 1236 msg.Append(c);
1238 } 1237 }
1239 } 1238 }
1240 msg.Append('\n'); 1239 msg.Append('\n');
1241 msg.WriteToLogFile(); 1240 msg.WriteToLogFile();
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 if (jit_logger_) { 2158 if (jit_logger_) {
2160 removeCodeEventListener(jit_logger_); 2159 removeCodeEventListener(jit_logger_);
2161 delete jit_logger_; 2160 delete jit_logger_;
2162 jit_logger_ = NULL; 2161 jit_logger_ = NULL;
2163 } 2162 }
2164 2163
2165 return log_->Close(); 2164 return log_->Close();
2166 } 2165 }
2167 2166
2168 } } // namespace v8::internal 2167 } } // namespace v8::internal
OLDNEW
« src/liveedit.cc ('K') | « src/liveedit.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698