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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 int entry_size = TypeFeedbackMetadata::GetSlotSize(kind); | 245 int entry_size = TypeFeedbackMetadata::GetSlotSize(kind); |
246 | 246 |
247 if (kind == FeedbackVectorSlotKind::CREATE_CLOSURE) { | 247 if (kind == FeedbackVectorSlotKind::CREATE_CLOSURE) { |
248 // This fixed array is filled with undefined. | 248 // This fixed array is filled with undefined. |
249 int length = metadata->GetParameter(parameter_index++); | 249 int length = metadata->GetParameter(parameter_index++); |
250 if (length == 0) { | 250 if (length == 0) { |
251 // This is a native function literal. We can always point to | 251 // This is a native function literal. We can always point to |
252 // the empty literals array here. | 252 // the empty literals array here. |
253 array->set(index, *factory->empty_literals_array(), SKIP_WRITE_BARRIER); | 253 array->set(index, *factory->empty_literals_array(), SKIP_WRITE_BARRIER); |
254 } else { | 254 } else { |
255 Handle<FixedArray> value = factory->NewFixedArray(length); | 255 // TODO(mvstanton): Create the array. |
256 array->set(index, *value); | 256 // Handle<FixedArray> value = factory->NewFixedArray(length); |
| 257 // array->set(index, *value); |
| 258 array->set(index, *factory->empty_literals_array(), SKIP_WRITE_BARRIER); |
257 } | 259 } |
258 } | 260 } |
259 i += entry_size; | 261 i += entry_size; |
260 } | 262 } |
261 | 263 |
262 DisallowHeapAllocation no_gc; | 264 DisallowHeapAllocation no_gc; |
263 | 265 |
264 // Ensure we can skip the write barrier | 266 // Ensure we can skip the write barrier |
265 Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate); | 267 Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate); |
266 DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel); | 268 DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 break; | 369 break; |
368 } | 370 } |
369 case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC: | 371 case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC: |
370 case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC: { | 372 case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC: { |
371 DCHECK(Get(slot)->IsSmi()); | 373 DCHECK(Get(slot)->IsSmi()); |
372 // don't clear these smi slots. | 374 // don't clear these smi slots. |
373 // Set(slot, Smi::kZero); | 375 // Set(slot, Smi::kZero); |
374 break; | 376 break; |
375 } | 377 } |
376 case FeedbackVectorSlotKind::CREATE_CLOSURE: { | 378 case FeedbackVectorSlotKind::CREATE_CLOSURE: { |
377 // Clear the literals in the embedded LiteralsArray. | 379 // Fill the array with undefined. |
378 LiteralsArray* literals = LiteralsArray::cast(Get(slot)); | 380 FixedArray* array = FixedArray::cast(Get(slot)); |
379 for (int i = 0; i < literals->literals_count(); i++) { | 381 for (int i = 1; i < array->length(); i++) { |
380 literals->set_literal_undefined(i); | 382 array->set_undefined(i); |
381 } | 383 } |
382 break; | 384 break; |
383 } | 385 } |
384 case FeedbackVectorSlotKind::GENERAL: { | 386 case FeedbackVectorSlotKind::GENERAL: { |
385 if (obj->IsHeapObject()) { | 387 if (obj->IsHeapObject()) { |
386 InstanceType instance_type = | 388 InstanceType instance_type = |
387 HeapObject::cast(obj)->map()->instance_type(); | 389 HeapObject::cast(obj)->map()->instance_type(); |
388 // AllocationSites are exempt from clearing. They don't store Maps | 390 // AllocationSites are exempt from clearing. They don't store Maps |
389 // or Code pointers which can cause memory leaks if not cleared | 391 // or Code pointers which can cause memory leaks if not cleared |
390 // regularly. | 392 // regularly. |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic( | 1089 void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic( |
1088 Handle<Name> name, Handle<Map> receiver_map) { | 1090 Handle<Name> name, Handle<Map> receiver_map) { |
1089 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); | 1091 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); |
1090 | 1092 |
1091 SetFeedback(*cell); | 1093 SetFeedback(*cell); |
1092 SetFeedbackExtra(*name); | 1094 SetFeedbackExtra(*name); |
1093 } | 1095 } |
1094 | 1096 |
1095 } // namespace internal | 1097 } // namespace internal |
1096 } // namespace v8 | 1098 } // namespace v8 |
OLD | NEW |