OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ic/ic.h" | 5 #include "src/ic/ic.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 case Code::LOAD_IC: | 468 case Code::LOAD_IC: |
469 case Code::KEYED_LOAD_IC: | 469 case Code::KEYED_LOAD_IC: |
470 case Code::STORE_IC: | 470 case Code::STORE_IC: |
471 case Code::KEYED_STORE_IC: | 471 case Code::KEYED_STORE_IC: |
472 return; | 472 return; |
473 case Code::COMPARE_IC: | 473 case Code::COMPARE_IC: |
474 return CompareIC::Clear(isolate, address, target, constant_pool); | 474 return CompareIC::Clear(isolate, address, target, constant_pool); |
475 case Code::COMPARE_NIL_IC: | 475 case Code::COMPARE_NIL_IC: |
476 return CompareNilIC::Clear(address, target, constant_pool); | 476 return CompareNilIC::Clear(address, target, constant_pool); |
477 case Code::CALL_IC: // CallICs are vector-based and cleared differently. | 477 case Code::CALL_IC: // CallICs are vector-based and cleared differently. |
478 case Code::CONSTRUCT_IC: | |
479 case Code::BINARY_OP_IC: | 478 case Code::BINARY_OP_IC: |
480 case Code::TO_BOOLEAN_IC: | 479 case Code::TO_BOOLEAN_IC: |
481 // Clearing these is tricky and does not | 480 // Clearing these is tricky and does not |
482 // make any performance difference. | 481 // make any performance difference. |
483 return; | 482 return; |
484 default: | 483 default: |
485 UNREACHABLE(); | 484 UNREACHABLE(); |
486 } | 485 } |
487 } | 486 } |
488 | 487 |
489 | 488 |
490 void KeyedLoadIC::Clear(Isolate* isolate, Code* host, KeyedLoadICNexus* nexus) { | 489 void KeyedLoadIC::Clear(Isolate* isolate, Code* host, KeyedLoadICNexus* nexus) { |
491 if (IsCleared(nexus)) return; | 490 if (IsCleared(nexus)) return; |
492 // Make sure to also clear the map used in inline fast cases. If we | 491 // Make sure to also clear the map used in inline fast cases. If we |
493 // do not clear these maps, cached code can keep objects alive | 492 // do not clear these maps, cached code can keep objects alive |
494 // through the embedded maps. | 493 // through the embedded maps. |
495 State state = nexus->StateFromFeedback(); | 494 State state = nexus->StateFromFeedback(); |
496 nexus->ConfigurePremonomorphic(); | 495 nexus->ConfigurePremonomorphic(); |
497 OnTypeFeedbackChanged(isolate, host, nexus->vector(), state, PREMONOMORPHIC); | 496 OnTypeFeedbackChanged(isolate, host, nexus->vector(), state, PREMONOMORPHIC); |
498 } | 497 } |
499 | 498 |
500 | 499 |
501 void CallIC::Clear(Isolate* isolate, Code* host, CallICNexus* nexus) { | 500 void CallIC::Clear(Isolate* isolate, Code* host, CallICNexus* nexus) { |
502 // Determine our state. | 501 // Determine our state. |
503 Object* feedback = nexus->vector()->Get(nexus->slot()); | 502 Object* feedback = nexus->vector()->Get(nexus->slot()); |
504 State state = nexus->StateFromFeedback(); | 503 State state = nexus->StateFromFeedback(); |
505 | |
506 if (state != UNINITIALIZED && !feedback->IsAllocationSite()) { | |
507 nexus->ConfigureUninitialized(); | |
508 // The change in state must be processed. | |
509 OnTypeFeedbackChanged(isolate, host, nexus->vector(), state, UNINITIALIZED); | |
510 } | |
511 } | |
512 | |
513 | |
514 void ConstructIC::Clear(Isolate* isolate, Code* host, ConstructICNexus* nexus) { | |
515 // Determine our state. | |
516 Object* feedback = nexus->vector()->Get(nexus->slot()); | |
517 State state = nexus->StateFromFeedback(); | |
518 | 504 |
519 if (state != UNINITIALIZED && !feedback->IsAllocationSite()) { | 505 if (state != UNINITIALIZED && !feedback->IsAllocationSite()) { |
520 nexus->ConfigureUninitialized(); | 506 nexus->ConfigureUninitialized(); |
521 // The change in state must be processed. | 507 // The change in state must be processed. |
522 OnTypeFeedbackChanged(isolate, host, nexus->vector(), state, UNINITIALIZED); | 508 OnTypeFeedbackChanged(isolate, host, nexus->vector(), state, UNINITIALIZED); |
523 } | 509 } |
524 } | 510 } |
525 | 511 |
526 | 512 |
527 void LoadIC::Clear(Isolate* isolate, Code* host, LoadICNexus* nexus) { | 513 void LoadIC::Clear(Isolate* isolate, Code* host, LoadICNexus* nexus) { |
(...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2992 KeyedLoadICNexus nexus(vector, vector_slot); | 2978 KeyedLoadICNexus nexus(vector, vector_slot); |
2993 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2979 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2994 ic.UpdateState(receiver, key); | 2980 ic.UpdateState(receiver, key); |
2995 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 2981 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
2996 } | 2982 } |
2997 | 2983 |
2998 return *result; | 2984 return *result; |
2999 } | 2985 } |
3000 } // namespace internal | 2986 } // namespace internal |
3001 } // namespace v8 | 2987 } // namespace v8 |
OLD | NEW |