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

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

Issue 767743002: Hydrogen code stubs for vector-based ICs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 6 years 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/type-feedback-vector.h ('k') | src/x64/code-stubs-x64.cc » ('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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/ic/ic.h" 7 #include "src/ic/ic.h"
8 #include "src/ic/ic-state.h" 8 #include "src/ic/ic-state.h"
9 #include "src/objects.h" 9 #include "src/objects.h"
10 #include "src/type-feedback-vector-inl.h" 10 #include "src/type-feedback-vector-inl.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length, TENURED); 92 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length, TENURED);
93 if (ic_slot_count > 0) { 93 if (ic_slot_count > 0) {
94 array->set(kFirstICSlotIndex, 94 array->set(kFirstICSlotIndex,
95 Smi::FromInt(slot_count + index_count + kReservedIndexCount)); 95 Smi::FromInt(slot_count + index_count + kReservedIndexCount));
96 } else { 96 } else {
97 array->set(kFirstICSlotIndex, Smi::FromInt(length)); 97 array->set(kFirstICSlotIndex, Smi::FromInt(length));
98 } 98 }
99 array->set(kWithTypesIndex, Smi::FromInt(0)); 99 array->set(kWithTypesIndex, Smi::FromInt(0));
100 array->set(kGenericCountIndex, Smi::FromInt(0)); 100 array->set(kGenericCountIndex, Smi::FromInt(0));
101 // Fill the indexes with zeros.
102 for (int i = 0; i < index_count; i++) {
103 array->set(kReservedIndexCount + i, Smi::FromInt(0));
104 }
101 105
102 // Ensure we can skip the write barrier 106 // Ensure we can skip the write barrier
103 Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate); 107 Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate);
104 DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel); 108 DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel);
105 for (int i = kReservedIndexCount + index_count; i < length; i++) { 109 for (int i = kReservedIndexCount + index_count; i < length; i++) {
106 array->set(i, *uninitialized_sentinel, SKIP_WRITE_BARRIER); 110 array->set(i, *uninitialized_sentinel, SKIP_WRITE_BARRIER);
107 } 111 }
108 112
109 Handle<TypeFeedbackVector> vector = Handle<TypeFeedbackVector>::cast(array); 113 Handle<TypeFeedbackVector> vector = Handle<TypeFeedbackVector>::cast(array);
110 if (FLAG_vector_ics) { 114 if (FLAG_vector_ics) {
(...skipping 16 matching lines...) Expand all
127 131
128 132
129 // This logic is copied from 133 // This logic is copied from
130 // StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget. 134 // StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget.
131 // TODO(mvstanton): with weak handling of all vector ics, this logic should 135 // TODO(mvstanton): with weak handling of all vector ics, this logic should
132 // actually be completely eliminated and we no longer need to clear the 136 // actually be completely eliminated and we no longer need to clear the
133 // vector ICs. 137 // vector ICs.
134 static bool ClearLogic(Heap* heap, int ic_age, Code::Kind kind, 138 static bool ClearLogic(Heap* heap, int ic_age, Code::Kind kind,
135 InlineCacheState state) { 139 InlineCacheState state) {
136 if (FLAG_cleanup_code_caches_at_gc && 140 if (FLAG_cleanup_code_caches_at_gc &&
137 (kind == Code::CALL_IC || state == MEGAMORPHIC || state == GENERIC || 141 (kind == Code::CALL_IC || heap->flush_monomorphic_ics() ||
138 state == POLYMORPHIC || heap->flush_monomorphic_ics() ||
139 // TODO(mvstanton): is this ic_age granular enough? it comes from 142 // TODO(mvstanton): is this ic_age granular enough? it comes from
140 // the SharedFunctionInfo which may change on a different schedule 143 // the SharedFunctionInfo which may change on a different schedule
141 // than ic targets. 144 // than ic targets.
142 // ic_age != heap->global_ic_age() || 145 // ic_age != heap->global_ic_age() ||
143 // is_invalidated_weak_stub || 146 // is_invalidated_weak_stub ||
144 heap->isolate()->serializer_enabled())) { 147 heap->isolate()->serializer_enabled())) {
145 return true; 148 return true;
146 } 149 }
147 return false; 150 return false;
148 } 151 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 254 }
252 255
253 256
254 InlineCacheState KeyedLoadICNexus::StateFromFeedback() const { 257 InlineCacheState KeyedLoadICNexus::StateFromFeedback() const {
255 Isolate* isolate = GetIsolate(); 258 Isolate* isolate = GetIsolate();
256 Object* feedback = GetFeedback(); 259 Object* feedback = GetFeedback();
257 if (feedback == *vector()->UninitializedSentinel(isolate)) { 260 if (feedback == *vector()->UninitializedSentinel(isolate)) {
258 return UNINITIALIZED; 261 return UNINITIALIZED;
259 } else if (feedback == *vector()->PremonomorphicSentinel(isolate)) { 262 } else if (feedback == *vector()->PremonomorphicSentinel(isolate)) {
260 return PREMONOMORPHIC; 263 return PREMONOMORPHIC;
261 } else if (feedback == *vector()->MegamorphicSentinel(isolate)) {
262 return MEGAMORPHIC;
263 } else if (feedback == *vector()->GenericSentinel(isolate)) { 264 } else if (feedback == *vector()->GenericSentinel(isolate)) {
264 return GENERIC; 265 return GENERIC;
265 } else if (feedback->IsFixedArray()) { 266 } else if (feedback->IsFixedArray()) {
266 FixedArray* array = FixedArray::cast(feedback); 267 FixedArray* array = FixedArray::cast(feedback);
267 int length = array->length(); 268 int length = array->length();
268 DCHECK(length >= 3); 269 DCHECK(length >= 3);
269 return length == 3 ? MONOMORPHIC : POLYMORPHIC; 270 return length == 3 ? MONOMORPHIC : POLYMORPHIC;
270 } 271 }
271 272
272 return UNINITIALIZED; 273 return UNINITIALIZED;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 void CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) { 316 void CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) {
316 SetFeedback(*function); 317 SetFeedback(*function);
317 } 318 }
318 319
319 320
320 void KeyedLoadICNexus::ConfigureGeneric() { 321 void KeyedLoadICNexus::ConfigureGeneric() {
321 SetFeedback(*vector()->GenericSentinel(GetIsolate()), SKIP_WRITE_BARRIER); 322 SetFeedback(*vector()->GenericSentinel(GetIsolate()), SKIP_WRITE_BARRIER);
322 } 323 }
323 324
324 325
325 void KeyedLoadICNexus::ConfigureMegamorphic() {
326 SetFeedback(*vector()->MegamorphicSentinel(GetIsolate()), SKIP_WRITE_BARRIER);
327 }
328
329
330 void LoadICNexus::ConfigureMegamorphic() { 326 void LoadICNexus::ConfigureMegamorphic() {
331 SetFeedback(*vector()->MegamorphicSentinel(GetIsolate()), SKIP_WRITE_BARRIER); 327 SetFeedback(*vector()->MegamorphicSentinel(GetIsolate()), SKIP_WRITE_BARRIER);
332 } 328 }
333 329
334 330
335 void LoadICNexus::ConfigurePremonomorphic() { 331 void LoadICNexus::ConfigurePremonomorphic() {
336 SetFeedback(*vector()->PremonomorphicSentinel(GetIsolate()), 332 SetFeedback(*vector()->PremonomorphicSentinel(GetIsolate()),
337 SKIP_WRITE_BARRIER); 333 SKIP_WRITE_BARRIER);
338 } 334 }
339 335
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 if (feedback->IsFixedArray()) { 488 if (feedback->IsFixedArray()) {
493 FixedArray* array = FixedArray::cast(feedback); 489 FixedArray* array = FixedArray::cast(feedback);
494 DCHECK(array->length() >= 3); 490 DCHECK(array->length() >= 3);
495 Object* name = array->get(0); 491 Object* name = array->get(0);
496 if (name->IsName()) return Name::cast(name); 492 if (name->IsName()) return Name::cast(name);
497 } 493 }
498 return NULL; 494 return NULL;
499 } 495 }
500 } 496 }
501 } // namespace v8::internal 497 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-feedback-vector.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698