| OLD | NEW |
| 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 } | 469 } |
| 470 | 470 |
| 471 static StubKind GetNoTransitionStubKind(StubKind stub_kind) { | 471 static StubKind GetNoTransitionStubKind(StubKind stub_kind) { |
| 472 if (!IsTransitionStubKind(stub_kind)) return stub_kind; | 472 if (!IsTransitionStubKind(stub_kind)) return stub_kind; |
| 473 if (IsGrowStubKind(stub_kind)) return STORE_AND_GROW_NO_TRANSITION; | 473 if (IsGrowStubKind(stub_kind)) return STORE_AND_GROW_NO_TRANSITION; |
| 474 return STORE_NO_TRANSITION; | 474 return STORE_NO_TRANSITION; |
| 475 } | 475 } |
| 476 }; | 476 }; |
| 477 | 477 |
| 478 | 478 |
| 479 enum ICMissMode { |
| 480 MISS_FORCE_GENERIC, |
| 481 MISS |
| 482 }; |
| 483 |
| 484 |
| 479 class KeyedLoadIC: public KeyedIC { | 485 class KeyedLoadIC: public KeyedIC { |
| 480 public: | 486 public: |
| 481 explicit KeyedLoadIC(Isolate* isolate) : KeyedIC(isolate) { | 487 explicit KeyedLoadIC(Isolate* isolate) : KeyedIC(isolate) { |
| 482 ASSERT(target()->is_keyed_load_stub()); | 488 ASSERT(target()->is_keyed_load_stub()); |
| 483 } | 489 } |
| 484 | 490 |
| 485 MUST_USE_RESULT MaybeObject* Load(State state, | 491 MUST_USE_RESULT MaybeObject* Load(State state, |
| 486 Handle<Object> object, | 492 Handle<Object> object, |
| 487 Handle<Object> key, | 493 Handle<Object> key, |
| 488 bool force_generic_stub); | 494 ICMissMode force_generic); |
| 489 | 495 |
| 490 // Code generator routines. | 496 // Code generator routines. |
| 491 static void GenerateMiss(MacroAssembler* masm, bool force_generic); | 497 static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic); |
| 492 static void GenerateRuntimeGetProperty(MacroAssembler* masm); | 498 static void GenerateRuntimeGetProperty(MacroAssembler* masm); |
| 493 static void GenerateInitialize(MacroAssembler* masm) { | 499 static void GenerateInitialize(MacroAssembler* masm) { |
| 494 GenerateMiss(masm, false); | 500 GenerateMiss(masm, MISS); |
| 495 } | 501 } |
| 496 static void GeneratePreMonomorphic(MacroAssembler* masm) { | 502 static void GeneratePreMonomorphic(MacroAssembler* masm) { |
| 497 GenerateMiss(masm, false); | 503 GenerateMiss(masm, MISS); |
| 498 } | 504 } |
| 499 static void GenerateGeneric(MacroAssembler* masm); | 505 static void GenerateGeneric(MacroAssembler* masm); |
| 500 static void GenerateString(MacroAssembler* masm); | 506 static void GenerateString(MacroAssembler* masm); |
| 501 static void GenerateIndexedInterceptor(MacroAssembler* masm); | 507 static void GenerateIndexedInterceptor(MacroAssembler* masm); |
| 502 static void GenerateNonStrictArguments(MacroAssembler* masm); | 508 static void GenerateNonStrictArguments(MacroAssembler* masm); |
| 503 | 509 |
| 504 // Bit mask to be tested against bit field for the cases when | 510 // Bit mask to be tested against bit field for the cases when |
| 505 // generic stub should go into slow case. | 511 // generic stub should go into slow case. |
| 506 // Access check is necessary explicitly since generic stub does not perform | 512 // Access check is necessary explicitly since generic stub does not perform |
| 507 // map checks. | 513 // map checks. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 public: | 653 public: |
| 648 explicit KeyedStoreIC(Isolate* isolate) : KeyedIC(isolate) { | 654 explicit KeyedStoreIC(Isolate* isolate) : KeyedIC(isolate) { |
| 649 ASSERT(target()->is_keyed_store_stub()); | 655 ASSERT(target()->is_keyed_store_stub()); |
| 650 } | 656 } |
| 651 | 657 |
| 652 MUST_USE_RESULT MaybeObject* Store(State state, | 658 MUST_USE_RESULT MaybeObject* Store(State state, |
| 653 StrictModeFlag strict_mode, | 659 StrictModeFlag strict_mode, |
| 654 Handle<Object> object, | 660 Handle<Object> object, |
| 655 Handle<Object> name, | 661 Handle<Object> name, |
| 656 Handle<Object> value, | 662 Handle<Object> value, |
| 657 bool force_generic); | 663 ICMissMode force_generic); |
| 658 | 664 |
| 659 // Code generators for stub routines. Only called once at startup. | 665 // Code generators for stub routines. Only called once at startup. |
| 660 static void GenerateInitialize(MacroAssembler* masm) { | 666 static void GenerateInitialize(MacroAssembler* masm) { |
| 661 GenerateMiss(masm, false); | 667 GenerateMiss(masm, MISS); |
| 662 } | 668 } |
| 663 static void GenerateMiss(MacroAssembler* masm, bool force_generic); | 669 static void GenerateMiss(MacroAssembler* masm, ICMissMode force_generic); |
| 664 static void GenerateSlow(MacroAssembler* masm); | 670 static void GenerateSlow(MacroAssembler* masm); |
| 665 static void GenerateRuntimeSetProperty(MacroAssembler* masm, | 671 static void GenerateRuntimeSetProperty(MacroAssembler* masm, |
| 666 StrictModeFlag strict_mode); | 672 StrictModeFlag strict_mode); |
| 667 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); | 673 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); |
| 668 static void GenerateNonStrictArguments(MacroAssembler* masm); | 674 static void GenerateNonStrictArguments(MacroAssembler* masm); |
| 669 static void GenerateTransitionElementsSmiToDouble(MacroAssembler* masm); | 675 static void GenerateTransitionElementsSmiToDouble(MacroAssembler* masm); |
| 670 static void GenerateTransitionElementsDoubleToObject(MacroAssembler* masm); | 676 static void GenerateTransitionElementsDoubleToObject(MacroAssembler* masm); |
| 671 | 677 |
| 672 virtual Handle<Code> GetElementStubWithoutMapCheck( | 678 virtual Handle<Code> GetElementStubWithoutMapCheck( |
| 673 bool is_js_array, | 679 bool is_js_array, |
| 674 ElementsKind elements_kind, | 680 ElementsKind elements_kind, |
| 675 KeyedAccessGrowMode grow_mode); | 681 KeyedAccessGrowMode grow_mode); |
| 676 | 682 |
| 677 virtual bool IsGeneric() const { | 683 virtual bool IsGeneric() const { |
| 678 return target() == *generic_stub() || | 684 return target() == *generic_stub() || |
| 679 target() == *generic_stub_strict(); | 685 target() == *generic_stub_strict(); |
| 680 } | 686 } |
| 681 | 687 |
| 682 protected: | 688 protected: |
| 683 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } | 689 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } |
| 684 | 690 |
| 685 virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps, | 691 virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps, |
| 686 StrictModeFlag strict_mode, | 692 StrictModeFlag strict_mode, |
| 687 KeyedAccessGrowMode grow_mode); | 693 KeyedAccessGrowMode grow_mode); |
| 688 | 694 |
| 689 private: | 695 private: |
| 690 // Update the inline cache. | 696 // Update the inline cache. |
| 691 void UpdateCaches(LookupResult* lookup, | 697 void UpdateCaches(LookupResult* lookup, |
| 692 State state, | 698 State state, |
| 693 StrictModeFlag strict_mode, | 699 StrictModeFlag strict_mode, |
| 694 Handle<JSObject> receiver, | 700 Handle<JSObject> receiver, |
| 695 Handle<String> name, | 701 Handle<String> name, |
| 696 Handle<Object> value); | 702 Handle<Object> value); |
| 697 | 703 |
| 698 void set_target(Code* code) { | 704 void set_target(Code* code) { |
| 699 // Strict mode must be preserved across IC patching. | 705 // Strict mode must be preserved across IC patching. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 }; | 850 }; |
| 845 | 851 |
| 846 | 852 |
| 847 // Helper for BinaryOpIC and CompareIC. | 853 // Helper for BinaryOpIC and CompareIC. |
| 848 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 854 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
| 849 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); | 855 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); |
| 850 | 856 |
| 851 } } // namespace v8::internal | 857 } } // namespace v8::internal |
| 852 | 858 |
| 853 #endif // V8_IC_H_ | 859 #endif // V8_IC_H_ |
| OLD | NEW |