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

Side by Side Diff: src/type-info.cc

Issue 1262803002: Stop overallocating feedback vector slots. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed nit. Created 5 years, 4 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/ast-numbering.cc ('k') | test/cctest/test-feedback-vector.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/ast.h" 7 #include "src/ast.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/ic/ic.h" 10 #include "src/ic/ic.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 // If we can't find an IC, assume we've seen *something*, but we don't know 101 // If we can't find an IC, assume we've seen *something*, but we don't know
102 // what. PREMONOMORPHIC roughly encodes this meaning. 102 // what. PREMONOMORPHIC roughly encodes this meaning.
103 return PREMONOMORPHIC; 103 return PREMONOMORPHIC;
104 } 104 }
105 105
106 106
107 InlineCacheState TypeFeedbackOracle::LoadInlineCacheState( 107 InlineCacheState TypeFeedbackOracle::LoadInlineCacheState(
108 FeedbackVectorICSlot slot) { 108 FeedbackVectorICSlot slot) {
109 Code::Kind kind = feedback_vector_->GetKind(slot); 109 if (!slot.IsInvalid()) {
110 if (kind == Code::LOAD_IC) { 110 Code::Kind kind = feedback_vector_->GetKind(slot);
111 LoadICNexus nexus(feedback_vector_, slot); 111 if (kind == Code::LOAD_IC) {
112 return nexus.StateFromFeedback(); 112 LoadICNexus nexus(feedback_vector_, slot);
113 } else if (kind == Code::KEYED_LOAD_IC) { 113 return nexus.StateFromFeedback();
114 KeyedLoadICNexus nexus(feedback_vector_, slot); 114 } else if (kind == Code::KEYED_LOAD_IC) {
115 return nexus.StateFromFeedback(); 115 KeyedLoadICNexus nexus(feedback_vector_, slot);
116 return nexus.StateFromFeedback();
117 }
116 } 118 }
117 119
118 // If we can't find an IC, assume we've seen *something*, but we don't know 120 // If we can't find an IC, assume we've seen *something*, but we don't know
119 // what. PREMONOMORPHIC roughly encodes this meaning. 121 // what. PREMONOMORPHIC roughly encodes this meaning.
120 return PREMONOMORPHIC; 122 return PREMONOMORPHIC;
121 } 123 }
122 124
123 125
124 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) { 126 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) {
125 Handle<Object> maybe_code = GetInfo(ast_id); 127 Handle<Object> maybe_code = GetInfo(ast_id);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 all_strings &= receiver_types->at(i)->IsStringMap(); 326 all_strings &= receiver_types->at(i)->IsStringMap();
325 } 327 }
326 return all_strings; 328 return all_strings;
327 } 329 }
328 330
329 331
330 void TypeFeedbackOracle::PropertyReceiverTypes(FeedbackVectorICSlot slot, 332 void TypeFeedbackOracle::PropertyReceiverTypes(FeedbackVectorICSlot slot,
331 Handle<Name> name, 333 Handle<Name> name,
332 SmallMapList* receiver_types) { 334 SmallMapList* receiver_types) {
333 receiver_types->Clear(); 335 receiver_types->Clear();
334 LoadICNexus nexus(feedback_vector_, slot); 336 if (!slot.IsInvalid()) {
335 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); 337 LoadICNexus nexus(feedback_vector_, slot);
336 CollectReceiverTypes(&nexus, name, flags, receiver_types); 338 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC);
339 CollectReceiverTypes(&nexus, name, flags, receiver_types);
340 }
337 } 341 }
338 342
339 343
340 void TypeFeedbackOracle::KeyedPropertyReceiverTypes( 344 void TypeFeedbackOracle::KeyedPropertyReceiverTypes(
341 FeedbackVectorICSlot slot, SmallMapList* receiver_types, bool* is_string, 345 FeedbackVectorICSlot slot, SmallMapList* receiver_types, bool* is_string,
342 IcCheckType* key_type) { 346 IcCheckType* key_type) {
343 receiver_types->Clear(); 347 receiver_types->Clear();
344 KeyedLoadICNexus nexus(feedback_vector_, slot); 348 if (slot.IsInvalid()) {
345 CollectReceiverTypes<FeedbackNexus>(&nexus, receiver_types); 349 *is_string = false;
346 *is_string = HasOnlyStringMaps(receiver_types); 350 *key_type = ELEMENT;
347 *key_type = nexus.FindFirstName() != NULL ? PROPERTY : ELEMENT; 351 } else {
352 KeyedLoadICNexus nexus(feedback_vector_, slot);
353 CollectReceiverTypes<FeedbackNexus>(&nexus, receiver_types);
354 *is_string = HasOnlyStringMaps(receiver_types);
355 *key_type = nexus.FindFirstName() != NULL ? PROPERTY : ELEMENT;
356 }
348 } 357 }
349 358
350 359
351 void TypeFeedbackOracle::AssignmentReceiverTypes(TypeFeedbackId id, 360 void TypeFeedbackOracle::AssignmentReceiverTypes(TypeFeedbackId id,
352 Handle<Name> name, 361 Handle<Name> name,
353 SmallMapList* receiver_types) { 362 SmallMapList* receiver_types) {
354 receiver_types->Clear(); 363 receiver_types->Clear();
355 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); 364 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC);
356 CollectReceiverTypes(id, name, flags, receiver_types); 365 CollectReceiverTypes(id, name, flags, receiver_types);
357 } 366 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 // Dictionary has been allocated with sufficient size for all elements. 524 // Dictionary has been allocated with sufficient size for all elements.
516 DisallowHeapAllocation no_need_to_resize_dictionary; 525 DisallowHeapAllocation no_need_to_resize_dictionary;
517 HandleScope scope(isolate()); 526 HandleScope scope(isolate());
518 USE(UnseededNumberDictionary::AtNumberPut( 527 USE(UnseededNumberDictionary::AtNumberPut(
519 dictionary_, IdToKey(ast_id), handle(target, isolate()))); 528 dictionary_, IdToKey(ast_id), handle(target, isolate())));
520 } 529 }
521 530
522 531
523 } // namespace internal 532 } // namespace internal
524 } // namespace v8 533 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast-numbering.cc ('k') | test/cctest/test-feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698