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