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

Side by Side Diff: src/ic.cc

Issue 9403009: Count ICs that have type information. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 289
290 290
291 Failure* IC::ReferenceError(const char* type, Handle<String> name) { 291 Failure* IC::ReferenceError(const char* type, Handle<String> name) {
292 HandleScope scope(isolate()); 292 HandleScope scope(isolate());
293 Handle<Object> error = isolate()->factory()->NewReferenceError( 293 Handle<Object> error = isolate()->factory()->NewReferenceError(
294 type, HandleVector(&name, 1)); 294 type, HandleVector(&name, 1));
295 return isolate()->Throw(*error); 295 return isolate()->Throw(*error);
296 } 296 }
297 297
298 298
299 void IC::PostPatching() { 299 void IC::PostPatching(Address address, Code* target, Code* old_target) {
300 if (FLAG_watch_ic_patching) { 300 bool increment_ics_with_typeinfo = false;
301 if (FLAG_type_info_threshold > 0) {
302 if (old_target->is_inline_cache_stub() &&
303 target->is_inline_cache_stub()) {
304 State old_state = old_target->ic_state();
305 State new_state = target->ic_state();
306 if ((old_state == UNINITIALIZED || old_state == PREMONOMORPHIC) &&
307 (new_state != UNINITIALIZED && new_state != PREMONOMORPHIC)) {
308 increment_ics_with_typeinfo = true;
309 }
310 }
311 }
312 if (FLAG_watch_ic_patching || FLAG_type_info_threshold) {
301 Isolate::Current()->runtime_profiler()->NotifyICChanged(); 313 Isolate::Current()->runtime_profiler()->NotifyICChanged();
302 // We do not want to optimize until the ICs have settled down, 314 // We do not want to optimize until the ICs have settled down,
303 // so when they are patched, we postpone optimization for the 315 // so when they are patched, we postpone optimization for the
304 // current function and the functions above it on the stack that 316 // current function and the functions above it on the stack that
305 // might want to inline this one. 317 // might want to inline this one.
306 StackFrameIterator it; 318 StackFrameIterator it;
307 if (it.done()) return; 319 if (it.done()) return;
308 it.Advance(); 320 it.Advance();
309 static const int kStackFramesToMark = Compiler::kMaxInliningLevels - 1; 321 static const int kStackFramesToMark = Compiler::kMaxInliningLevels - 1;
310 for (int i = 0; i < kStackFramesToMark; ++i) { 322 for (int i = 0; i < kStackFramesToMark; ++i) {
311 if (it.done()) return; 323 if (it.done()) return;
312 StackFrame* raw_frame = it.frame(); 324 StackFrame* raw_frame = it.frame();
313 if (raw_frame->is_java_script()) { 325 if (raw_frame->is_java_script()) {
314 JSFunction* function = 326 JSFunction* function =
315 JSFunction::cast(JavaScriptFrame::cast(raw_frame)->function()); 327 JSFunction::cast(JavaScriptFrame::cast(raw_frame)->function());
316 function->shared()->set_profiler_ticks(0); 328 if (function->IsOptimized()) continue;
329 SharedFunctionInfo* shared = function->shared();
330 if (FLAG_watch_ic_patching) {
331 shared->set_profiler_ticks(0);
332 }
333 if (increment_ics_with_typeinfo) {
334 Code* code = shared->code();
335 if (address > code->instruction_start() &&
Vyacheslav Egorov (Chromium) 2012/02/15 12:07:39 I think Code has Contains method.
Jakob Kummerow 2012/02/17 16:07:52 Thanks for the suggestion; but this is obsolete an
336 address < code->instruction_end()) {
337 shared->set_ic_typeinfo_count(shared->ic_typeinfo_count() + 1);
Vyacheslav Egorov (Chromium) 2012/02/15 12:07:39 Please add a small comment that this what this cod
Jakob Kummerow 2012/02/17 16:07:52 This is obsolete too.
338 increment_ics_with_typeinfo = false; // Done.
339 }
340 }
317 } 341 }
318 it.Advance(); 342 it.Advance();
319 } 343 }
320 } 344 }
321 } 345 }
322 346
323 347
324 void IC::Clear(Address address) { 348 void IC::Clear(Address address) {
325 Code* target = GetTargetAtAddress(address); 349 Code* target = GetTargetAtAddress(address);
326 350
(...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 #undef ADDR 2550 #undef ADDR
2527 }; 2551 };
2528 2552
2529 2553
2530 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2554 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2531 return IC_utilities[id]; 2555 return IC_utilities[id];
2532 } 2556 }
2533 2557
2534 2558
2535 } } // namespace v8::internal 2559 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698