Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/type-feedback-vector.cc

Issue 2642933003: Revert of Revert [TypeFeedbackVector] Root literal arrays in function literal slots (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-scopes.cc ('k') | test/cctest/cctest.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « src/runtime/runtime-scopes.cc ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698