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

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: fix confusing --trace-opt output 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
« no previous file with comments | « src/ic.h ('k') | src/ic-inl.h » ('j') | src/objects-inl.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_type_info_threshold > 0) {
301 if (old_target->is_inline_cache_stub() &&
302 target->is_inline_cache_stub()) {
303 State old_state = old_target->ic_state();
304 State new_state = target->ic_state();
305 bool was_uninitialized =
306 old_state == UNINITIALIZED || old_state == PREMONOMORPHIC;
307 bool is_uninitialized =
308 new_state == UNINITIALIZED || new_state == PREMONOMORPHIC;
309 int delta = 0;
310 if (was_uninitialized && !is_uninitialized) {
311 delta = 1;
312 } else if (!was_uninitialized && is_uninitialized) {
313 delta = -1;
314 }
315 if (delta != 0) {
316 Code* host = target->GetHeap()->isolate()->
317 inner_pointer_to_code_cache()->GetCacheEntry(address)->code;
318 TypeFeedbackInfo* info =
319 TypeFeedbackInfo::cast(host->type_feedback_info());
320 info->set_ic_with_typeinfo_count(
321 info->ic_with_typeinfo_count() + delta);
322 }
323 }
324 }
300 if (FLAG_watch_ic_patching) { 325 if (FLAG_watch_ic_patching) {
301 Isolate::Current()->runtime_profiler()->NotifyICChanged(); 326 Isolate::Current()->runtime_profiler()->NotifyICChanged();
302 // We do not want to optimize until the ICs have settled down, 327 // We do not want to optimize until the ICs have settled down,
303 // so when they are patched, we postpone optimization for the 328 // so when they are patched, we postpone optimization for the
304 // current function and the functions above it on the stack that 329 // current function and the functions above it on the stack that
305 // might want to inline this one. 330 // might want to inline this one.
306 StackFrameIterator it; 331 StackFrameIterator it;
307 if (it.done()) return; 332 if (it.done()) return;
308 it.Advance(); 333 it.Advance();
309 static const int kStackFramesToMark = Compiler::kMaxInliningLevels - 1; 334 static const int kStackFramesToMark = Compiler::kMaxInliningLevels - 1;
310 for (int i = 0; i < kStackFramesToMark; ++i) { 335 for (int i = 0; i < kStackFramesToMark; ++i) {
311 if (it.done()) return; 336 if (it.done()) return;
312 StackFrame* raw_frame = it.frame(); 337 StackFrame* raw_frame = it.frame();
313 if (raw_frame->is_java_script()) { 338 if (raw_frame->is_java_script()) {
314 JSFunction* function = 339 JSFunction* function =
315 JSFunction::cast(JavaScriptFrame::cast(raw_frame)->function()); 340 JSFunction::cast(JavaScriptFrame::cast(raw_frame)->function());
316 function->shared()->set_profiler_ticks(0); 341 if (function->IsOptimized()) continue;
342 SharedFunctionInfo* shared = function->shared();
343 shared->set_profiler_ticks(0);
317 } 344 }
318 it.Advance(); 345 it.Advance();
319 } 346 }
320 } 347 }
321 } 348 }
322 349
323 350
324 void IC::Clear(Address address) { 351 void IC::Clear(Address address) {
325 Code* target = GetTargetAtAddress(address); 352 Code* target = GetTargetAtAddress(address);
326 353
(...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 #undef ADDR 2553 #undef ADDR
2527 }; 2554 };
2528 2555
2529 2556
2530 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2557 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2531 return IC_utilities[id]; 2558 return IC_utilities[id];
2532 } 2559 }
2533 2560
2534 2561
2535 } } // namespace v8::internal 2562 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/ic-inl.h » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698