| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 case FeedbackSlotKind::kKindsNumber: | 223 case FeedbackSlotKind::kKindsNumber: |
| 224 UNREACHABLE(); | 224 UNREACHABLE(); |
| 225 array->set(index, Smi::kZero, SKIP_WRITE_BARRIER); | 225 array->set(index, Smi::kZero, SKIP_WRITE_BARRIER); |
| 226 break; | 226 break; |
| 227 } | 227 } |
| 228 for (int j = 1; j < entry_size; j++) { | 228 for (int j = 1; j < entry_size; j++) { |
| 229 array->set(index + j, extra_value, SKIP_WRITE_BARRIER); | 229 array->set(index + j, extra_value, SKIP_WRITE_BARRIER); |
| 230 } | 230 } |
| 231 i += entry_size; | 231 i += entry_size; |
| 232 } | 232 } |
| 233 return Handle<FeedbackVector>::cast(array); | 233 |
| 234 Handle<FeedbackVector> result = Handle<FeedbackVector>::cast(array); |
| 235 if (isolate->IsCodeCoverageEnabled()) AddToCodeCoverageList(isolate, result); |
| 236 return result; |
| 234 } | 237 } |
| 235 | 238 |
| 236 // static | 239 // static |
| 237 Handle<FeedbackVector> FeedbackVector::Copy(Isolate* isolate, | 240 Handle<FeedbackVector> FeedbackVector::Copy(Isolate* isolate, |
| 238 Handle<FeedbackVector> vector) { | 241 Handle<FeedbackVector> vector) { |
| 239 Handle<FeedbackVector> result; | 242 Handle<FeedbackVector> result; |
| 240 result = Handle<FeedbackVector>::cast( | 243 result = Handle<FeedbackVector>::cast( |
| 241 isolate->factory()->CopyFixedArray(Handle<FixedArray>::cast(vector))); | 244 isolate->factory()->CopyFixedArray(Handle<FixedArray>::cast(vector))); |
| 245 if (isolate->IsCodeCoverageEnabled()) AddToCodeCoverageList(isolate, result); |
| 242 return result; | 246 return result; |
| 243 } | 247 } |
| 244 | 248 |
| 249 // static |
| 250 void FeedbackVector::AddToCodeCoverageList(Isolate* isolate, |
| 251 Handle<FeedbackVector> vector) { |
| 252 DCHECK(isolate->IsCodeCoverageEnabled()); |
| 253 if (!vector->shared_function_info()->IsSubjectToDebugging()) return; |
| 254 Handle<ArrayList> list = |
| 255 Handle<ArrayList>::cast(isolate->factory()->code_coverage_list()); |
| 256 list = ArrayList::Add(list, vector); |
| 257 isolate->SetCodeCoverageList(*list); |
| 258 } |
| 259 |
| 245 // This logic is copied from | 260 // This logic is copied from |
| 246 // StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget. | 261 // StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget. |
| 247 static bool ClearLogic(Isolate* isolate) { | 262 static bool ClearLogic(Isolate* isolate) { |
| 248 return FLAG_cleanup_code_caches_at_gc && isolate->serializer_enabled(); | 263 return FLAG_cleanup_code_caches_at_gc && isolate->serializer_enabled(); |
| 249 } | 264 } |
| 250 | 265 |
| 251 void FeedbackVector::ClearSlotsImpl(SharedFunctionInfo* shared, | 266 void FeedbackVector::ClearSlotsImpl(SharedFunctionInfo* shared, |
| 252 bool force_clear) { | 267 bool force_clear) { |
| 253 Isolate* isolate = GetIsolate(); | 268 Isolate* isolate = GetIsolate(); |
| 254 if (!force_clear && !ClearLogic(isolate)) return; | 269 if (!force_clear && !ClearLogic(isolate)) return; |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic( | 1011 void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic( |
| 997 Handle<Name> name, Handle<Map> receiver_map) { | 1012 Handle<Name> name, Handle<Map> receiver_map) { |
| 998 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); | 1013 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); |
| 999 | 1014 |
| 1000 SetFeedback(*cell); | 1015 SetFeedback(*cell); |
| 1001 SetFeedbackExtra(*name); | 1016 SetFeedbackExtra(*name); |
| 1002 } | 1017 } |
| 1003 | 1018 |
| 1004 } // namespace internal | 1019 } // namespace internal |
| 1005 } // namespace v8 | 1020 } // namespace v8 |
| OLD | NEW |