OLD | NEW |
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 | 286 |
287 Failure* IC::ReferenceError(const char* type, Handle<String> name) { | 287 Failure* IC::ReferenceError(const char* type, Handle<String> name) { |
288 HandleScope scope(isolate()); | 288 HandleScope scope(isolate()); |
289 Handle<Object> error = isolate()->factory()->NewReferenceError( | 289 Handle<Object> error = isolate()->factory()->NewReferenceError( |
290 type, HandleVector(&name, 1)); | 290 type, HandleVector(&name, 1)); |
291 return isolate()->Throw(*error); | 291 return isolate()->Throw(*error); |
292 } | 292 } |
293 | 293 |
294 | 294 |
| 295 void IC::PostPatching() { |
| 296 if (FLAG_counting_profiler) { |
| 297 Isolate::Current()->runtime_profiler()->NotifyICChanged(); |
| 298 // We do not want to optimize until the ICs have settled down, |
| 299 // so when they are patched, we postpone optimization for the |
| 300 // current function and the functions above it on the stack that |
| 301 // might want to inline this one. |
| 302 StackFrameIterator it; |
| 303 if (it.done()) return; |
| 304 it.Advance(); |
| 305 static const int kStackFramesToMark = Compiler::kMaxInliningLevels - 1; |
| 306 for (int i = 0; i < kStackFramesToMark; ++i) { |
| 307 if (it.done()) return; |
| 308 StackFrame* raw_frame = it.frame(); |
| 309 if (raw_frame->is_java_script()) { |
| 310 JSFunction* function = |
| 311 JSFunction::cast(JavaScriptFrame::cast(raw_frame)->function()); |
| 312 function->shared()->set_profiler_ticks(0); |
| 313 } |
| 314 it.Advance(); |
| 315 } |
| 316 } |
| 317 } |
| 318 |
| 319 |
295 void IC::Clear(Address address) { | 320 void IC::Clear(Address address) { |
296 Code* target = GetTargetAtAddress(address); | 321 Code* target = GetTargetAtAddress(address); |
297 | 322 |
298 // Don't clear debug break inline cache as it will remove the break point. | 323 // Don't clear debug break inline cache as it will remove the break point. |
299 if (target->ic_state() == DEBUG_BREAK) return; | 324 if (target->ic_state() == DEBUG_BREAK) return; |
300 | 325 |
301 switch (target->kind()) { | 326 switch (target->kind()) { |
302 case Code::LOAD_IC: return LoadIC::Clear(address, target); | 327 case Code::LOAD_IC: return LoadIC::Clear(address, target); |
303 case Code::KEYED_LOAD_IC: | 328 case Code::KEYED_LOAD_IC: |
304 return KeyedLoadIC::Clear(address, target); | 329 return KeyedLoadIC::Clear(address, target); |
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2427 #undef ADDR | 2452 #undef ADDR |
2428 }; | 2453 }; |
2429 | 2454 |
2430 | 2455 |
2431 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2456 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2432 return IC_utilities[id]; | 2457 return IC_utilities[id]; |
2433 } | 2458 } |
2434 | 2459 |
2435 | 2460 |
2436 } } // namespace v8::internal | 2461 } } // namespace v8::internal |
OLD | NEW |