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

Side by Side Diff: src/ic.h

Issue 181543002: Eliminate extended mode, and other modes clean-up (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 461
462 static void Clear(Isolate* isolate, Address address, Code* target); 462 static void Clear(Isolate* isolate, Address address, Code* target);
463 463
464 friend class IC; 464 friend class IC;
465 }; 465 };
466 466
467 467
468 class StoreIC: public IC { 468 class StoreIC: public IC {
469 public: 469 public:
470 class StrictModeState: public BitField<StrictModeFlag, 1, 1> {}; 470 class StrictModeState: public BitField<StrictMode, 1, 1> {};
471 static ExtraICState ComputeExtraICState(StrictModeFlag flag) { 471 static ExtraICState ComputeExtraICState(StrictMode flag) {
472 return StrictModeState::encode(flag); 472 return StrictModeState::encode(flag);
473 } 473 }
474 474 static StrictMode GetStrictMode(ExtraICState state) {
475 static StrictModeFlag GetStrictMode(ExtraICState state) {
476 return StrictModeState::decode(state); 475 return StrictModeState::decode(state);
477 } 476 }
478 477
479 // For convenience, a statically declared encoding of strict mode extra 478 // For convenience, a statically declared encoding of strict mode extra
480 // IC state. 479 // IC state.
481 static const ExtraICState kStrictModeState = 480 static const ExtraICState kStrictModeState =
482 1 << StrictModeState::kShift; 481 1 << StrictModeState::kShift;
483 482
484 StoreIC(FrameDepth depth, Isolate* isolate) 483 StoreIC(FrameDepth depth, Isolate* isolate)
485 : IC(depth, isolate) { 484 : IC(depth, isolate) {
486 ASSERT(IsStoreStub()); 485 ASSERT(IsStoreStub());
487 } 486 }
488 487
489 StrictModeFlag strict_mode() const { 488 StrictMode strict_mode() const {
490 return StrictModeState::decode(extra_ic_state()); 489 return StrictModeState::decode(extra_ic_state());
491 } 490 }
492 491
493 // Code generators for stub routines. Only called once at startup. 492 // Code generators for stub routines. Only called once at startup.
494 static void GenerateSlow(MacroAssembler* masm); 493 static void GenerateSlow(MacroAssembler* masm);
495 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 494 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
496 static void GeneratePreMonomorphic(MacroAssembler* masm) { 495 static void GeneratePreMonomorphic(MacroAssembler* masm) {
497 GenerateMiss(masm); 496 GenerateMiss(masm);
498 } 497 }
499 static void GenerateMiss(MacroAssembler* masm); 498 static void GenerateMiss(MacroAssembler* masm);
500 static void GenerateMegamorphic(MacroAssembler* masm); 499 static void GenerateMegamorphic(MacroAssembler* masm);
501 static void GenerateNormal(MacroAssembler* masm); 500 static void GenerateNormal(MacroAssembler* masm);
502 static void GenerateRuntimeSetProperty(MacroAssembler* masm, 501 static void GenerateRuntimeSetProperty(MacroAssembler* masm,
503 StrictModeFlag strict_mode); 502 StrictMode strict_mode);
504 503
505 static Handle<Code> initialize_stub(Isolate* isolate, 504 static Handle<Code> initialize_stub(Isolate* isolate,
506 StrictModeFlag strict_mode); 505 StrictMode strict_mode);
507 506
508 MUST_USE_RESULT MaybeObject* Store( 507 MUST_USE_RESULT MaybeObject* Store(
509 Handle<Object> object, 508 Handle<Object> object,
510 Handle<String> name, 509 Handle<String> name,
511 Handle<Object> value, 510 Handle<Object> value,
512 JSReceiver::StoreFromKeyed store_mode = 511 JSReceiver::StoreFromKeyed store_mode =
513 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED); 512 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED);
514 513
515 protected: 514 protected:
516 virtual Code::Kind kind() const { return Code::STORE_IC; } 515 virtual Code::Kind kind() const { return Code::STORE_IC; }
517 virtual Handle<Code> megamorphic_stub(); 516 virtual Handle<Code> megamorphic_stub();
518 517
519 // Stub accessors. 518 // Stub accessors.
520 virtual Handle<Code> generic_stub() const; 519 virtual Handle<Code> generic_stub() const;
521 520
522 virtual Handle<Code> slow_stub() const { 521 virtual Handle<Code> slow_stub() const {
523 return isolate()->builtins()->StoreIC_Slow(); 522 return isolate()->builtins()->StoreIC_Slow();
524 } 523 }
525 524
526 virtual Handle<Code> pre_monomorphic_stub() { 525 virtual Handle<Code> pre_monomorphic_stub() {
527 return pre_monomorphic_stub(isolate(), strict_mode()); 526 return pre_monomorphic_stub(isolate(), strict_mode());
528 } 527 }
529 528
530 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, 529 static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
531 StrictModeFlag strict_mode); 530 StrictMode strict_mode);
532 531
533 // Update the inline cache and the global stub cache based on the 532 // Update the inline cache and the global stub cache based on the
534 // lookup result. 533 // lookup result.
535 void UpdateCaches(LookupResult* lookup, 534 void UpdateCaches(LookupResult* lookup,
536 Handle<JSObject> receiver, 535 Handle<JSObject> receiver,
537 Handle<String> name, 536 Handle<String> name,
538 Handle<Object> value); 537 Handle<Object> value);
539 virtual Handle<Code> CompileHandler(LookupResult* lookup, 538 virtual Handle<Code> CompileHandler(LookupResult* lookup,
540 Handle<Object> object, 539 Handle<Object> object,
541 Handle<String> name, 540 Handle<String> name,
(...skipping 26 matching lines...) Expand all
568 }; 567 };
569 568
570 569
571 class KeyedStoreIC: public StoreIC { 570 class KeyedStoreIC: public StoreIC {
572 public: 571 public:
573 // ExtraICState bits (building on IC) 572 // ExtraICState bits (building on IC)
574 // ExtraICState bits 573 // ExtraICState bits
575 class ExtraICStateKeyedAccessStoreMode: 574 class ExtraICStateKeyedAccessStoreMode:
576 public BitField<KeyedAccessStoreMode, 2, 4> {}; // NOLINT 575 public BitField<KeyedAccessStoreMode, 2, 4> {}; // NOLINT
577 576
578 static ExtraICState ComputeExtraICState(StrictModeFlag flag, 577 static ExtraICState ComputeExtraICState(StrictMode flag,
579 KeyedAccessStoreMode mode) { 578 KeyedAccessStoreMode mode) {
580 return StrictModeState::encode(flag) | 579 return StrictModeState::encode(flag) |
581 ExtraICStateKeyedAccessStoreMode::encode(mode); 580 ExtraICStateKeyedAccessStoreMode::encode(mode);
582 } 581 }
583 582
584 static KeyedAccessStoreMode GetKeyedAccessStoreMode( 583 static KeyedAccessStoreMode GetKeyedAccessStoreMode(
585 ExtraICState extra_state) { 584 ExtraICState extra_state) {
586 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); 585 return ExtraICStateKeyedAccessStoreMode::decode(extra_state);
587 } 586 }
588 587
589 KeyedStoreIC(FrameDepth depth, Isolate* isolate) 588 KeyedStoreIC(FrameDepth depth, Isolate* isolate)
590 : StoreIC(depth, isolate) { 589 : StoreIC(depth, isolate) {
591 ASSERT(target()->is_keyed_store_stub()); 590 ASSERT(target()->is_keyed_store_stub());
592 } 591 }
593 592
594 MUST_USE_RESULT MaybeObject* Store(Handle<Object> object, 593 MUST_USE_RESULT MaybeObject* Store(Handle<Object> object,
595 Handle<Object> name, 594 Handle<Object> name,
596 Handle<Object> value); 595 Handle<Object> value);
597 596
598 // Code generators for stub routines. Only called once at startup. 597 // Code generators for stub routines. Only called once at startup.
599 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 598 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
600 static void GeneratePreMonomorphic(MacroAssembler* masm) { 599 static void GeneratePreMonomorphic(MacroAssembler* masm) {
601 GenerateMiss(masm); 600 GenerateMiss(masm);
602 } 601 }
603 static void GenerateMiss(MacroAssembler* masm); 602 static void GenerateMiss(MacroAssembler* masm);
604 static void GenerateSlow(MacroAssembler* masm); 603 static void GenerateSlow(MacroAssembler* masm);
605 static void GenerateRuntimeSetProperty(MacroAssembler* masm, 604 static void GenerateRuntimeSetProperty(MacroAssembler* masm,
606 StrictModeFlag strict_mode); 605 StrictMode strict_mode);
607 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); 606 static void GenerateGeneric(MacroAssembler* masm, StrictMode strict_mode);
608 static void GenerateSloppyArguments(MacroAssembler* masm); 607 static void GenerateSloppyArguments(MacroAssembler* masm);
609 608
610 protected: 609 protected:
611 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } 610 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
612 611
613 virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {} 612 virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {}
614 613
615 virtual Handle<Code> pre_monomorphic_stub() { 614 virtual Handle<Code> pre_monomorphic_stub() {
616 return pre_monomorphic_stub(isolate(), strict_mode()); 615 return pre_monomorphic_stub(isolate(), strict_mode());
617 } 616 }
618 static Handle<Code> pre_monomorphic_stub(Isolate* isolate, 617 static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
619 StrictModeFlag strict_mode) { 618 StrictMode strict_mode) {
620 if (strict_mode == kStrictMode) { 619 if (strict_mode == STRICT) {
621 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict(); 620 return isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict();
622 } else { 621 } else {
623 return isolate->builtins()->KeyedStoreIC_PreMonomorphic(); 622 return isolate->builtins()->KeyedStoreIC_PreMonomorphic();
624 } 623 }
625 } 624 }
626 virtual Handle<Code> slow_stub() const { 625 virtual Handle<Code> slow_stub() const {
627 return isolate()->builtins()->KeyedStoreIC_Slow(); 626 return isolate()->builtins()->KeyedStoreIC_Slow();
628 } 627 }
629 virtual Handle<Code> megamorphic_stub() { 628 virtual Handle<Code> megamorphic_stub() {
630 if (strict_mode() == kStrictMode) { 629 if (strict_mode() == STRICT) {
631 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); 630 return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
632 } else { 631 } else {
633 return isolate()->builtins()->KeyedStoreIC_Generic(); 632 return isolate()->builtins()->KeyedStoreIC_Generic();
634 } 633 }
635 } 634 }
636 635
637 Handle<Code> StoreElementStub(Handle<JSObject> receiver, 636 Handle<Code> StoreElementStub(Handle<JSObject> receiver,
638 KeyedAccessStoreMode store_mode); 637 KeyedAccessStoreMode store_mode);
639 638
640 private: 639 private:
641 void set_target(Code* code) { 640 void set_target(Code* code) {
642 // Strict mode must be preserved across IC patching. 641 // Strict mode must be preserved across IC patching.
643 ASSERT(GetStrictMode(code->extra_ic_state()) == strict_mode()); 642 ASSERT(GetStrictMode(code->extra_ic_state()) == strict_mode());
644 IC::set_target(code); 643 IC::set_target(code);
645 } 644 }
646 645
647 // Stub accessors. 646 // Stub accessors.
648 virtual Handle<Code> generic_stub() const { 647 virtual Handle<Code> generic_stub() const {
649 if (strict_mode() == kStrictMode) { 648 if (strict_mode() == STRICT) {
650 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); 649 return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
651 } else { 650 } else {
652 return isolate()->builtins()->KeyedStoreIC_Generic(); 651 return isolate()->builtins()->KeyedStoreIC_Generic();
653 } 652 }
654 } 653 }
655 654
656 Handle<Code> sloppy_arguments_stub() { 655 Handle<Code> sloppy_arguments_stub() {
657 return isolate()->builtins()->KeyedStoreIC_SloppyArguments(); 656 return isolate()->builtins()->KeyedStoreIC_SloppyArguments();
658 } 657 }
659 658
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 905 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
907 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); 906 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss);
908 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite); 907 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite);
909 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 908 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
910 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 909 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
911 910
912 911
913 } } // namespace v8::internal 912 } } // namespace v8::internal
914 913
915 #endif // V8_IC_H_ 914 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698