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