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 #ifndef V8_TYPE_FEEDBACK_VECTOR_H_ | 5 #ifndef V8_TYPE_FEEDBACK_VECTOR_H_ |
6 #define V8_TYPE_FEEDBACK_VECTOR_H_ | 6 #define V8_TYPE_FEEDBACK_VECTOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/checks.h" | 10 #include "src/checks.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 protected: | 256 protected: |
257 Isolate* GetIsolate() const { return vector()->GetIsolate(); } | 257 Isolate* GetIsolate() const { return vector()->GetIsolate(); } |
258 | 258 |
259 void SetFeedback(Object* feedback, | 259 void SetFeedback(Object* feedback, |
260 WriteBarrierMode mode = UPDATE_WRITE_BARRIER) { | 260 WriteBarrierMode mode = UPDATE_WRITE_BARRIER) { |
261 vector()->Set(slot(), feedback, mode); | 261 vector()->Set(slot(), feedback, mode); |
262 } | 262 } |
263 | 263 |
264 Handle<FixedArray> EnsureArrayOfSize(int length); | 264 Handle<FixedArray> EnsureArrayOfSize(int length); |
265 void InstallHandlers(int start_index, TypeHandleList* types, | 265 void InstallHandlers(int start_index, MapHandleList* maps, |
266 CodeHandleList* handlers); | 266 CodeHandleList* handlers); |
267 int ExtractMaps(int start_index, MapHandleList* maps) const; | 267 int ExtractMaps(int start_index, MapHandleList* maps) const; |
268 MaybeHandle<Code> FindHandlerForMap(int start_index, Handle<Map> map) const; | 268 MaybeHandle<Code> FindHandlerForMap(int start_index, Handle<Map> map) const; |
269 bool FindHandlers(int start_index, CodeHandleList* code_list, | 269 bool FindHandlers(int start_index, CodeHandleList* code_list, |
270 int length) const; | 270 int length) const; |
271 | 271 |
272 private: | 272 private: |
273 // The reason for having a vector handle and a raw pointer is that we can and | 273 // The reason for having a vector handle and a raw pointer is that we can and |
274 // should use handles during IC miss, but not during GC when we clear ICs. If | 274 // should use handles during IC miss, but not during GC when we clear ICs. If |
275 // you have a handle to the vector that is better because more operations can | 275 // you have a handle to the vector that is better because more operations can |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 } | 322 } |
323 LoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) | 323 LoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) |
324 : FeedbackNexus(vector, slot) { | 324 : FeedbackNexus(vector, slot) { |
325 DCHECK(vector->GetKind(slot) == Code::LOAD_IC); | 325 DCHECK(vector->GetKind(slot) == Code::LOAD_IC); |
326 } | 326 } |
327 | 327 |
328 void Clear(Code* host); | 328 void Clear(Code* host); |
329 | 329 |
330 void ConfigureMegamorphic(); | 330 void ConfigureMegamorphic(); |
331 void ConfigurePremonomorphic(); | 331 void ConfigurePremonomorphic(); |
332 void ConfigureMonomorphic(Handle<HeapType> type, Handle<Code> handler); | 332 void ConfigureMonomorphic(Handle<Map> receiver_map, Handle<Code> handler); |
333 | 333 |
334 void ConfigurePolymorphic(TypeHandleList* types, CodeHandleList* handlers); | 334 void ConfigurePolymorphic(MapHandleList* maps, CodeHandleList* handlers); |
335 | 335 |
336 InlineCacheState StateFromFeedback() const OVERRIDE; | 336 InlineCacheState StateFromFeedback() const OVERRIDE; |
337 int ExtractMaps(MapHandleList* maps) const OVERRIDE; | 337 int ExtractMaps(MapHandleList* maps) const OVERRIDE; |
338 MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE; | 338 MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE; |
339 virtual bool FindHandlers(CodeHandleList* code_list, | 339 virtual bool FindHandlers(CodeHandleList* code_list, |
340 int length = -1) const OVERRIDE; | 340 int length = -1) const OVERRIDE; |
341 }; | 341 }; |
342 | 342 |
343 | 343 |
344 class KeyedLoadICNexus : public FeedbackNexus { | 344 class KeyedLoadICNexus : public FeedbackNexus { |
345 public: | 345 public: |
346 KeyedLoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) | 346 KeyedLoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) |
347 : FeedbackNexus(vector, slot) { | 347 : FeedbackNexus(vector, slot) { |
348 DCHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC); | 348 DCHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC); |
349 } | 349 } |
350 KeyedLoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) | 350 KeyedLoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) |
351 : FeedbackNexus(vector, slot) { | 351 : FeedbackNexus(vector, slot) { |
352 DCHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC); | 352 DCHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC); |
353 } | 353 } |
354 | 354 |
355 void Clear(Code* host); | 355 void Clear(Code* host); |
356 | 356 |
357 void ConfigureMegamorphic(); | 357 void ConfigureMegamorphic(); |
358 void ConfigurePremonomorphic(); | 358 void ConfigurePremonomorphic(); |
359 // name can be a null handle for element loads. | 359 // name can be a null handle for element loads. |
360 void ConfigureMonomorphic(Handle<Name> name, Handle<HeapType> type, | 360 void ConfigureMonomorphic(Handle<Name> name, Handle<Map> receiver_map, |
361 Handle<Code> handler); | 361 Handle<Code> handler); |
362 // name can be null. | 362 // name can be null. |
363 void ConfigurePolymorphic(Handle<Name> name, TypeHandleList* types, | 363 void ConfigurePolymorphic(Handle<Name> name, MapHandleList* maps, |
364 CodeHandleList* handlers); | 364 CodeHandleList* handlers); |
365 | 365 |
366 InlineCacheState StateFromFeedback() const OVERRIDE; | 366 InlineCacheState StateFromFeedback() const OVERRIDE; |
367 int ExtractMaps(MapHandleList* maps) const OVERRIDE; | 367 int ExtractMaps(MapHandleList* maps) const OVERRIDE; |
368 MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE; | 368 MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE; |
369 virtual bool FindHandlers(CodeHandleList* code_list, | 369 virtual bool FindHandlers(CodeHandleList* code_list, |
370 int length = -1) const OVERRIDE; | 370 int length = -1) const OVERRIDE; |
371 Name* FindFirstName() const OVERRIDE; | 371 Name* FindFirstName() const OVERRIDE; |
372 }; | 372 }; |
373 } | 373 } |
374 } // namespace v8::internal | 374 } // namespace v8::internal |
375 | 375 |
376 #endif // V8_TRANSITIONS_H_ | 376 #endif // V8_TRANSITIONS_H_ |
OLD | NEW |