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

Side by Side Diff: src/ic/ic.h

Issue 1129853002: Removing FLAG_vector_ics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment response. Created 5 years, 7 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/ic/ia32/ic-ia32.cc ('k') | src/ic/ic.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 #ifndef V8_IC_H_ 5 #ifndef V8_IC_H_
6 #define V8_IC_H_ 6 #define V8_IC_H_
7 7
8 #include "src/ic/ic-state.h" 8 #include "src/ic/ic-state.h"
9 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 InlineCacheState state = code->ic_state(); 107 InlineCacheState state = code->ic_state();
108 return !FLAG_use_ic || state == UNINITIALIZED || state == PREMONOMORPHIC; 108 return !FLAG_use_ic || state == UNINITIALIZED || state == PREMONOMORPHIC;
109 } 109 }
110 110
111 static bool IsCleared(FeedbackNexus* nexus) { 111 static bool IsCleared(FeedbackNexus* nexus) {
112 InlineCacheState state = nexus->StateFromFeedback(); 112 InlineCacheState state = nexus->StateFromFeedback();
113 return !FLAG_use_ic || state == UNINITIALIZED || state == PREMONOMORPHIC; 113 return !FLAG_use_ic || state == UNINITIALIZED || state == PREMONOMORPHIC;
114 } 114 }
115 115
116 static bool ICUseVector(Code::Kind kind) { 116 static bool ICUseVector(Code::Kind kind) {
117 return (FLAG_vector_ics && 117 return kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC ||
118 (kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC)) ||
119 kind == Code::CALL_IC; 118 kind == Code::CALL_IC;
120 } 119 }
121 120
122 protected: 121 protected:
123 // Get the call-site target; used for determining the state. 122 // Get the call-site target; used for determining the state.
124 Handle<Code> target() const { return target_; } 123 Handle<Code> target() const { return target_; }
125 124
126 Address fp() const { return fp_; } 125 Address fp() const { return fp_; }
127 Address pc() const { return *pc_address_; } 126 Address pc() const { return *pc_address_; }
128 Isolate* isolate() const { return isolate_; } 127 Isolate* isolate() const { return isolate_; }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) { 354 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) {
356 return LoadICState(contextual_mode).GetExtraICState(); 355 return LoadICState(contextual_mode).GetExtraICState();
357 } 356 }
358 357
359 ContextualMode contextual_mode() const { 358 ContextualMode contextual_mode() const {
360 return LoadICState::GetContextualMode(extra_ic_state()); 359 return LoadICState::GetContextualMode(extra_ic_state());
361 } 360 }
362 361
363 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) 362 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL)
364 : IC(depth, isolate, nexus) { 363 : IC(depth, isolate, nexus) {
365 DCHECK(!FLAG_vector_ics || nexus != NULL); 364 DCHECK(nexus != NULL);
366 DCHECK(IsLoadStub()); 365 DCHECK(IsLoadStub());
367 } 366 }
368 367
369 // TODO(mvstanton): The for_queries_only is because we have a case where we 368 // TODO(mvstanton): The for_queries_only is because we have a case where we
370 // construct an IC only to gather the contextual mode, and we don't have 369 // construct an IC only to gather the contextual mode, and we don't have
371 // vector/slot information. for_queries_only is a temporary hack to enable the 370 // vector/slot information. for_queries_only is a temporary hack to enable the
372 // strong DCHECK protection around vector/slot. 371 // strong DCHECK protection around vector/slot.
373 LoadIC(FrameDepth depth, Isolate* isolate, bool for_queries_only) 372 LoadIC(FrameDepth depth, Isolate* isolate, bool for_queries_only)
374 : IC(depth, isolate, NULL, for_queries_only) { 373 : IC(depth, isolate, NULL, for_queries_only) {
375 DCHECK(IsLoadStub()); 374 DCHECK(IsLoadStub());
376 } 375 }
377 376
378 // Returns if this IC is for contextual (no explicit receiver) 377 // Returns if this IC is for contextual (no explicit receiver)
379 // access to properties. 378 // access to properties.
380 bool IsUndeclaredGlobal(Handle<Object> receiver) { 379 bool IsUndeclaredGlobal(Handle<Object> receiver) {
381 if (receiver->IsGlobalObject()) { 380 if (receiver->IsGlobalObject()) {
382 return contextual_mode() == CONTEXTUAL; 381 return contextual_mode() == CONTEXTUAL;
383 } else { 382 } else {
384 DCHECK(contextual_mode() != CONTEXTUAL); 383 DCHECK(contextual_mode() != CONTEXTUAL);
385 return false; 384 return false;
386 } 385 }
387 } 386 }
388 387
389 // Code generator routines. 388 // Code generator routines.
390 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 389 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
391 static void GeneratePreMonomorphic(MacroAssembler* masm) {
392 GenerateMiss(masm);
393 }
394 static void GenerateMiss(MacroAssembler* masm); 390 static void GenerateMiss(MacroAssembler* masm);
395 static void GenerateNormal(MacroAssembler* masm); 391 static void GenerateNormal(MacroAssembler* masm);
396 static void GenerateRuntimeGetProperty(MacroAssembler* masm); 392 static void GenerateRuntimeGetProperty(MacroAssembler* masm);
397 393
398 static Handle<Code> initialize_stub(Isolate* isolate, 394 static Handle<Code> initialize_stub(Isolate* isolate,
399 ExtraICState extra_state); 395 ExtraICState extra_state);
400 static Handle<Code> initialize_stub_in_optimized_code( 396 static Handle<Code> initialize_stub_in_optimized_code(
401 Isolate* isolate, ExtraICState extra_state, State initialization_state); 397 Isolate* isolate, ExtraICState extra_state, State initialization_state);
402 static Handle<Code> load_global(Isolate* isolate, Handle<GlobalObject> global,
403 Handle<String> name);
404 398
405 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, 399 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
406 Handle<Name> name); 400 Handle<Name> name);
407 401
408 static void Clear(Isolate* isolate, Code* host, LoadICNexus* nexus); 402 static void Clear(Isolate* isolate, Code* host, LoadICNexus* nexus);
409 403
410 protected: 404 protected:
411 inline void set_target(Code* code); 405 inline void set_target(Code* code);
412 406
413 Handle<Code> slow_stub() const { 407 Handle<Code> slow_stub() const {
414 if (kind() == Code::LOAD_IC) { 408 if (kind() == Code::LOAD_IC) {
415 return isolate()->builtins()->LoadIC_Slow(); 409 return isolate()->builtins()->LoadIC_Slow();
416 } else { 410 } else {
417 DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); 411 DCHECK_EQ(Code::KEYED_LOAD_IC, kind());
418 return isolate()->builtins()->KeyedLoadIC_Slow(); 412 return isolate()->builtins()->KeyedLoadIC_Slow();
419 } 413 }
420 } 414 }
421 415
422 Handle<Code> megamorphic_stub() override; 416 Handle<Code> megamorphic_stub() override;
423 417
424 // Update the inline cache and the global stub cache based on the 418 // Update the inline cache and the global stub cache based on the
425 // lookup result. 419 // lookup result.
426 void UpdateCaches(LookupIterator* lookup); 420 void UpdateCaches(LookupIterator* lookup);
427 421
428 virtual Handle<Code> CompileHandler(LookupIterator* lookup, 422 virtual Handle<Code> CompileHandler(LookupIterator* lookup,
429 Handle<Object> unused, 423 Handle<Object> unused,
430 CacheHolderFlag cache_holder) override; 424 CacheHolderFlag cache_holder) override;
431 425
432 private: 426 private:
433 virtual Handle<Code> pre_monomorphic_stub() const;
434 static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
435 ExtraICState extra_state);
436
437 Handle<Code> SimpleFieldLoad(FieldIndex index); 427 Handle<Code> SimpleFieldLoad(FieldIndex index);
438 428
439 static void Clear(Isolate* isolate, Address address, Code* target, 429 static void Clear(Isolate* isolate, Address address, Code* target,
440 ConstantPoolArray* constant_pool); 430 ConstantPoolArray* constant_pool);
441 431
442 friend class IC; 432 friend class IC;
443 }; 433 };
444 434
445 435
446 class KeyedLoadIC : public LoadIC { 436 class KeyedLoadIC : public LoadIC {
447 public: 437 public:
448 // ExtraICState bits (building on IC) 438 // ExtraICState bits (building on IC)
449 class IcCheckTypeField : public BitField<IcCheckType, 1, 1> {}; 439 class IcCheckTypeField : public BitField<IcCheckType, 1, 1> {};
450 440
451 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode, 441 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode,
452 IcCheckType key_type) { 442 IcCheckType key_type) {
453 return LoadICState(contextual_mode).GetExtraICState() | 443 return LoadICState(contextual_mode).GetExtraICState() |
454 IcCheckTypeField::encode(key_type); 444 IcCheckTypeField::encode(key_type);
455 } 445 }
456 446
457 static IcCheckType GetKeyType(ExtraICState extra_state) { 447 static IcCheckType GetKeyType(ExtraICState extra_state) {
458 return IcCheckTypeField::decode(extra_state); 448 return IcCheckTypeField::decode(extra_state);
459 } 449 }
460 450
461 KeyedLoadIC(FrameDepth depth, Isolate* isolate, 451 KeyedLoadIC(FrameDepth depth, Isolate* isolate,
462 KeyedLoadICNexus* nexus = NULL) 452 KeyedLoadICNexus* nexus = NULL)
463 : LoadIC(depth, isolate, nexus) { 453 : LoadIC(depth, isolate, nexus) {
464 DCHECK(!FLAG_vector_ics || nexus != NULL); 454 DCHECK(nexus != NULL);
465 DCHECK(target()->is_keyed_load_stub()); 455 DCHECK(target()->is_keyed_load_stub());
466 } 456 }
467 457
468 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, 458 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
469 Handle<Object> key); 459 Handle<Object> key);
470 460
471 // Code generator routines. 461 // Code generator routines.
472 static void GenerateMiss(MacroAssembler* masm); 462 static void GenerateMiss(MacroAssembler* masm);
473 static void GenerateRuntimeGetProperty(MacroAssembler* masm); 463 static void GenerateRuntimeGetProperty(MacroAssembler* masm);
474 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 464 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
475 static void GeneratePreMonomorphic(MacroAssembler* masm) {
476 GenerateMiss(masm);
477 }
478 static void GenerateMegamorphic(MacroAssembler* masm); 465 static void GenerateMegamorphic(MacroAssembler* masm);
479 466
480 // Bit mask to be tested against bit field for the cases when 467 // Bit mask to be tested against bit field for the cases when
481 // generic stub should go into slow case. 468 // generic stub should go into slow case.
482 // Access check is necessary explicitly since generic stub does not perform 469 // Access check is necessary explicitly since generic stub does not perform
483 // map checks. 470 // map checks.
484 static const int kSlowCaseBitFieldMask = 471 static const int kSlowCaseBitFieldMask =
485 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); 472 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor);
486 473
487 static Handle<Code> initialize_stub(Isolate* isolate); 474 static Handle<Code> initialize_stub(Isolate* isolate);
488 static Handle<Code> initialize_stub_in_optimized_code( 475 static Handle<Code> initialize_stub_in_optimized_code(
489 Isolate* isolate, State initialization_state); 476 Isolate* isolate, State initialization_state);
490 static Handle<Code> ChooseMegamorphicStub(Isolate* isolate); 477 static Handle<Code> ChooseMegamorphicStub(Isolate* isolate);
491 static Handle<Code> pre_monomorphic_stub(Isolate* isolate);
492 478
493 static void Clear(Isolate* isolate, Code* host, KeyedLoadICNexus* nexus); 479 static void Clear(Isolate* isolate, Code* host, KeyedLoadICNexus* nexus);
494 480
495 protected: 481 protected:
496 // receiver is HeapObject because it could be a String or a JSObject 482 // receiver is HeapObject because it could be a String or a JSObject
497 Handle<Code> LoadElementStub(Handle<HeapObject> receiver); 483 Handle<Code> LoadElementStub(Handle<HeapObject> receiver);
498 virtual Handle<Code> pre_monomorphic_stub() const {
499 return pre_monomorphic_stub(isolate());
500 }
501 484
502 private: 485 private:
503 static void Clear(Isolate* isolate, Address address, Code* target, 486 static void Clear(Isolate* isolate, Address address, Code* target,
504 ConstantPoolArray* constant_pool); 487 ConstantPoolArray* constant_pool);
505 488
506 friend class IC; 489 friend class IC;
507 }; 490 };
508 491
509 492
510 class StoreIC : public IC { 493 class StoreIC : public IC {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 752
770 // Support functions for interceptor handlers. 753 // Support functions for interceptor handlers.
771 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); 754 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly);
772 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); 755 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor);
773 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); 756 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor);
774 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); 757 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor);
775 } 758 }
776 } // namespace v8::internal 759 } // namespace v8::internal
777 760
778 #endif // V8_IC_H_ 761 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ic/ia32/ic-ia32.cc ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698