| 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/type-feedback-vector.h" | 5 #include "src/type-feedback-vector.h" |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 142 } |
| 143 | 143 |
| 144 const char* TypeFeedbackMetadata::Kind2String(FeedbackVectorSlotKind kind) { | 144 const char* TypeFeedbackMetadata::Kind2String(FeedbackVectorSlotKind kind) { |
| 145 switch (kind) { | 145 switch (kind) { |
| 146 case FeedbackVectorSlotKind::INVALID: | 146 case FeedbackVectorSlotKind::INVALID: |
| 147 return "INVALID"; | 147 return "INVALID"; |
| 148 case FeedbackVectorSlotKind::CALL_IC: | 148 case FeedbackVectorSlotKind::CALL_IC: |
| 149 return "CALL_IC"; | 149 return "CALL_IC"; |
| 150 case FeedbackVectorSlotKind::LOAD_IC: | 150 case FeedbackVectorSlotKind::LOAD_IC: |
| 151 return "LOAD_IC"; | 151 return "LOAD_IC"; |
| 152 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC: | 152 case FeedbackVectorSlotKind::LOAD_GLOBAL_INSIDE_TYPEOF_IC: |
| 153 return "LOAD_GLOBAL_IC"; | 153 return "LOAD_GLOBAL_INSIDE_TYPEOF_IC"; |
| 154 case FeedbackVectorSlotKind::LOAD_GLOBAL_NOT_INSIDE_TYPEOF_IC: |
| 155 return "LOAD_GLOBAL_NOT_INSIDE_TYPEOF_IC"; |
| 154 case FeedbackVectorSlotKind::KEYED_LOAD_IC: | 156 case FeedbackVectorSlotKind::KEYED_LOAD_IC: |
| 155 return "KEYED_LOAD_IC"; | 157 return "KEYED_LOAD_IC"; |
| 156 case FeedbackVectorSlotKind::STORE_SLOPPY_IC: | 158 case FeedbackVectorSlotKind::STORE_SLOPPY_IC: |
| 157 return "STORE_SLOPPY_IC"; | 159 return "STORE_SLOPPY_IC"; |
| 158 case FeedbackVectorSlotKind::STORE_STRICT_IC: | 160 case FeedbackVectorSlotKind::STORE_STRICT_IC: |
| 159 return "STORE_STRICT_IC"; | 161 return "STORE_STRICT_IC"; |
| 160 case FeedbackVectorSlotKind::KEYED_STORE_SLOPPY_IC: | 162 case FeedbackVectorSlotKind::KEYED_STORE_SLOPPY_IC: |
| 161 return "KEYED_STORE_SLOPPY_IC"; | 163 return "KEYED_STORE_SLOPPY_IC"; |
| 162 case FeedbackVectorSlotKind::KEYED_STORE_STRICT_IC: | 164 case FeedbackVectorSlotKind::KEYED_STORE_STRICT_IC: |
| 163 return "KEYED_STORE_STRICT_IC"; | 165 return "KEYED_STORE_STRICT_IC"; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel); | 210 DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel); |
| 209 Handle<Oddball> undefined_value = factory->undefined_value(); | 211 Handle<Oddball> undefined_value = factory->undefined_value(); |
| 210 for (int i = 0; i < slot_count;) { | 212 for (int i = 0; i < slot_count;) { |
| 211 FeedbackVectorSlot slot(i); | 213 FeedbackVectorSlot slot(i); |
| 212 FeedbackVectorSlotKind kind = metadata->GetKind(slot); | 214 FeedbackVectorSlotKind kind = metadata->GetKind(slot); |
| 213 int index = TypeFeedbackVector::GetIndex(slot); | 215 int index = TypeFeedbackVector::GetIndex(slot); |
| 214 int entry_size = TypeFeedbackMetadata::GetSlotSize(kind); | 216 int entry_size = TypeFeedbackMetadata::GetSlotSize(kind); |
| 215 | 217 |
| 216 Object* extra_value = *uninitialized_sentinel; | 218 Object* extra_value = *uninitialized_sentinel; |
| 217 switch (kind) { | 219 switch (kind) { |
| 218 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC: | 220 case FeedbackVectorSlotKind::LOAD_GLOBAL_INSIDE_TYPEOF_IC: |
| 221 case FeedbackVectorSlotKind::LOAD_GLOBAL_NOT_INSIDE_TYPEOF_IC: |
| 219 array->set(index, isolate->heap()->empty_weak_cell(), | 222 array->set(index, isolate->heap()->empty_weak_cell(), |
| 220 SKIP_WRITE_BARRIER); | 223 SKIP_WRITE_BARRIER); |
| 221 break; | 224 break; |
| 222 case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC: | 225 case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC: |
| 223 case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC: | 226 case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC: |
| 224 array->set(index, Smi::kZero, SKIP_WRITE_BARRIER); | 227 array->set(index, Smi::kZero, SKIP_WRITE_BARRIER); |
| 225 break; | 228 break; |
| 226 case FeedbackVectorSlotKind::CREATE_CLOSURE: { | 229 case FeedbackVectorSlotKind::CREATE_CLOSURE: { |
| 227 Handle<Cell> cell = factory->NewCell(undefined_value); | 230 Handle<Cell> cell = factory->NewCell(undefined_value); |
| 228 array->set(index, *cell); | 231 array->set(index, *cell); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 case FeedbackVectorSlotKind::CALL_IC: { | 300 case FeedbackVectorSlotKind::CALL_IC: { |
| 298 CallICNexus nexus(this, slot); | 301 CallICNexus nexus(this, slot); |
| 299 nexus.Clear(shared->code()); | 302 nexus.Clear(shared->code()); |
| 300 break; | 303 break; |
| 301 } | 304 } |
| 302 case FeedbackVectorSlotKind::LOAD_IC: { | 305 case FeedbackVectorSlotKind::LOAD_IC: { |
| 303 LoadICNexus nexus(this, slot); | 306 LoadICNexus nexus(this, slot); |
| 304 nexus.Clear(shared->code()); | 307 nexus.Clear(shared->code()); |
| 305 break; | 308 break; |
| 306 } | 309 } |
| 307 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC: { | 310 case FeedbackVectorSlotKind::LOAD_GLOBAL_INSIDE_TYPEOF_IC: |
| 311 case FeedbackVectorSlotKind::LOAD_GLOBAL_NOT_INSIDE_TYPEOF_IC: { |
| 308 LoadGlobalICNexus nexus(this, slot); | 312 LoadGlobalICNexus nexus(this, slot); |
| 309 nexus.Clear(shared->code()); | 313 nexus.Clear(shared->code()); |
| 310 break; | 314 break; |
| 311 } | 315 } |
| 312 case FeedbackVectorSlotKind::KEYED_LOAD_IC: { | 316 case FeedbackVectorSlotKind::KEYED_LOAD_IC: { |
| 313 KeyedLoadICNexus nexus(this, slot); | 317 KeyedLoadICNexus nexus(this, slot); |
| 314 nexus.Clear(shared->code()); | 318 nexus.Clear(shared->code()); |
| 315 break; | 319 break; |
| 316 } | 320 } |
| 317 case FeedbackVectorSlotKind::STORE_SLOPPY_IC: | 321 case FeedbackVectorSlotKind::STORE_SLOPPY_IC: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 case FeedbackVectorSlotKind::INVALID: | 365 case FeedbackVectorSlotKind::INVALID: |
| 362 case FeedbackVectorSlotKind::KINDS_NUMBER: | 366 case FeedbackVectorSlotKind::KINDS_NUMBER: |
| 363 UNREACHABLE(); | 367 UNREACHABLE(); |
| 364 break; | 368 break; |
| 365 } | 369 } |
| 366 } | 370 } |
| 367 } | 371 } |
| 368 } | 372 } |
| 369 | 373 |
| 370 | 374 |
| 371 // static | |
| 372 Handle<TypeFeedbackVector> TypeFeedbackVector::DummyVector(Isolate* isolate) { | |
| 373 return isolate->factory()->dummy_vector(); | |
| 374 } | |
| 375 | |
| 376 | |
| 377 Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) { | 375 Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) { |
| 378 Isolate* isolate = GetIsolate(); | 376 Isolate* isolate = GetIsolate(); |
| 379 Handle<Object> feedback = handle(GetFeedback(), isolate); | 377 Handle<Object> feedback = handle(GetFeedback(), isolate); |
| 380 if (!feedback->IsFixedArray() || | 378 if (!feedback->IsFixedArray() || |
| 381 FixedArray::cast(*feedback)->length() != length) { | 379 FixedArray::cast(*feedback)->length() != length) { |
| 382 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length); | 380 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length); |
| 383 SetFeedback(*array); | 381 SetFeedback(*array); |
| 384 return array; | 382 return array; |
| 385 } | 383 } |
| 386 return Handle<FixedArray>::cast(feedback); | 384 return Handle<FixedArray>::cast(feedback); |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic( | 1044 void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic( |
| 1047 Handle<Name> name, Handle<Map> receiver_map) { | 1045 Handle<Name> name, Handle<Map> receiver_map) { |
| 1048 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); | 1046 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); |
| 1049 | 1047 |
| 1050 SetFeedback(*cell); | 1048 SetFeedback(*cell); |
| 1051 SetFeedbackExtra(*name); | 1049 SetFeedbackExtra(*name); |
| 1052 } | 1050 } |
| 1053 | 1051 |
| 1054 } // namespace internal | 1052 } // namespace internal |
| 1055 } // namespace v8 | 1053 } // namespace v8 |
| OLD | NEW |