| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/feedback-vector.h" | 5 #include "src/feedback-vector.h" |
| 6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
| 7 #include "src/feedback-vector-inl.h" | 7 #include "src/feedback-vector-inl.h" |
| 8 #include "src/ic/ic-inl.h" | 8 #include "src/ic/ic-inl.h" |
| 9 #include "src/ic/ic-state.h" | 9 #include "src/ic/ic-state.h" |
| 10 #include "src/objects.h" | 10 #include "src/objects.h" |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 int CallICNexus::ExtractCallCount() { | 584 int CallICNexus::ExtractCallCount() { |
| 585 Object* call_count = GetFeedbackExtra(); | 585 Object* call_count = GetFeedbackExtra(); |
| 586 CHECK(call_count->IsSmi()); | 586 CHECK(call_count->IsSmi()); |
| 587 int value = Smi::cast(call_count)->value(); | 587 int value = Smi::cast(call_count)->value(); |
| 588 return value; | 588 return value; |
| 589 } | 589 } |
| 590 | 590 |
| 591 float CallICNexus::ComputeCallFrequency() { | 591 float CallICNexus::ComputeCallFrequency() { |
| 592 double const invocation_count = vector()->invocation_count(); | 592 double const invocation_count = vector()->invocation_count(); |
| 593 double const call_count = ExtractCallCount(); | 593 double const call_count = ExtractCallCount(); |
| 594 if (invocation_count == 0) { |
| 595 // Prevent division by 0. |
| 596 return 0.0f; |
| 597 } |
| 594 return static_cast<float>(call_count / invocation_count); | 598 return static_cast<float>(call_count / invocation_count); |
| 595 } | 599 } |
| 596 | 600 |
| 597 void CallICNexus::ConfigureUninitialized() { | 601 void CallICNexus::ConfigureUninitialized() { |
| 598 Isolate* isolate = GetIsolate(); | 602 Isolate* isolate = GetIsolate(); |
| 599 SetFeedback(*FeedbackVector::UninitializedSentinel(isolate), | 603 SetFeedback(*FeedbackVector::UninitializedSentinel(isolate), |
| 600 SKIP_WRITE_BARRIER); | 604 SKIP_WRITE_BARRIER); |
| 601 SetFeedbackExtra(Smi::kZero, SKIP_WRITE_BARRIER); | 605 SetFeedbackExtra(Smi::kZero, SKIP_WRITE_BARRIER); |
| 602 } | 606 } |
| 603 | 607 |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic( | 1018 void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic( |
| 1015 Handle<Name> name, Handle<Map> receiver_map) { | 1019 Handle<Name> name, Handle<Map> receiver_map) { |
| 1016 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); | 1020 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); |
| 1017 | 1021 |
| 1018 SetFeedback(*cell); | 1022 SetFeedback(*cell); |
| 1019 SetFeedbackExtra(*name); | 1023 SetFeedbackExtra(*name); |
| 1020 } | 1024 } |
| 1021 | 1025 |
| 1022 } // namespace internal | 1026 } // namespace internal |
| 1023 } // namespace v8 | 1027 } // namespace v8 |
| OLD | NEW |