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