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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 | 190 |
191 bool is_target_set() { return target_set_; } | 191 bool is_target_set() { return target_set_; } |
192 | 192 |
193 #ifdef DEBUG | 193 #ifdef DEBUG |
194 char TransitionMarkFromState(IC::State state); | 194 char TransitionMarkFromState(IC::State state); |
195 | 195 |
196 void TraceIC(const char* type, Handle<Object> name); | 196 void TraceIC(const char* type, Handle<Object> name); |
197 #endif | 197 #endif |
198 | 198 |
199 Failure* TypeError(const char* type, | 199 MaybeHandle<Object> TypeError(const char* type, |
200 Handle<Object> object, | 200 Handle<Object> object, |
201 Handle<Object> key); | 201 Handle<Object> key); |
202 Failure* ReferenceError(const char* type, Handle<String> name); | 202 MaybeHandle<Object> ReferenceError(const char* type, Handle<String> name); |
203 | 203 |
204 // Access the target code for the given IC address. | 204 // Access the target code for the given IC address. |
205 static inline Code* GetTargetAtAddress(Address address, | 205 static inline Code* GetTargetAtAddress(Address address, |
206 ConstantPoolArray* constant_pool); | 206 ConstantPoolArray* constant_pool); |
207 static inline void SetTargetAtAddress(Address address, | 207 static inline void SetTargetAtAddress(Address address, |
208 Code* target, | 208 Code* target, |
209 ConstantPoolArray* constant_pool); | 209 ConstantPoolArray* constant_pool); |
210 static void PostPatching(Address address, Code* target, Code* old_target); | 210 static void PostPatching(Address address, Code* target, Code* old_target); |
211 | 211 |
212 // Compute the handler either by compiling or by retrieving a cached version. | 212 // Compute the handler either by compiling or by retrieving a cached version. |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 GenerateMiss(masm); | 390 GenerateMiss(masm); |
391 } | 391 } |
392 static void GenerateMiss(MacroAssembler* masm); | 392 static void GenerateMiss(MacroAssembler* masm); |
393 static void GenerateMegamorphic(MacroAssembler* masm); | 393 static void GenerateMegamorphic(MacroAssembler* masm); |
394 static void GenerateNormal(MacroAssembler* masm); | 394 static void GenerateNormal(MacroAssembler* masm); |
395 static void GenerateRuntimeGetProperty(MacroAssembler* masm); | 395 static void GenerateRuntimeGetProperty(MacroAssembler* masm); |
396 | 396 |
397 static Handle<Code> initialize_stub(Isolate* isolate, | 397 static Handle<Code> initialize_stub(Isolate* isolate, |
398 ExtraICState extra_state); | 398 ExtraICState extra_state); |
399 | 399 |
400 MUST_USE_RESULT MaybeObject* Load(Handle<Object> object, | 400 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, |
401 Handle<String> name); | 401 Handle<String> name); |
402 | 402 |
403 protected: | 403 protected: |
404 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 404 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
405 | 405 |
406 void set_target(Code* code) { | 406 void set_target(Code* code) { |
407 // The contextual mode must be preserved across IC patching. | 407 // The contextual mode must be preserved across IC patching. |
408 ASSERT(GetContextualMode(code->extra_ic_state()) == | 408 ASSERT(GetContextualMode(code->extra_ic_state()) == |
409 GetContextualMode(target()->extra_ic_state())); | 409 GetContextualMode(target()->extra_ic_state())); |
410 | 410 |
411 IC::set_target(code); | 411 IC::set_target(code); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 }; | 452 }; |
453 | 453 |
454 | 454 |
455 class KeyedLoadIC: public LoadIC { | 455 class KeyedLoadIC: public LoadIC { |
456 public: | 456 public: |
457 explicit KeyedLoadIC(FrameDepth depth, Isolate* isolate) | 457 explicit KeyedLoadIC(FrameDepth depth, Isolate* isolate) |
458 : LoadIC(depth, isolate) { | 458 : LoadIC(depth, isolate) { |
459 ASSERT(target()->is_keyed_load_stub()); | 459 ASSERT(target()->is_keyed_load_stub()); |
460 } | 460 } |
461 | 461 |
462 MUST_USE_RESULT MaybeObject* Load(Handle<Object> object, | 462 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, |
463 Handle<Object> key); | 463 Handle<Object> key); |
464 | 464 |
465 // Code generator routines. | 465 // Code generator routines. |
466 static void GenerateMiss(MacroAssembler* masm); | 466 static void GenerateMiss(MacroAssembler* masm); |
467 static void GenerateRuntimeGetProperty(MacroAssembler* masm); | 467 static void GenerateRuntimeGetProperty(MacroAssembler* masm); |
468 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } | 468 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
469 static void GeneratePreMonomorphic(MacroAssembler* masm) { | 469 static void GeneratePreMonomorphic(MacroAssembler* masm) { |
470 GenerateMiss(masm); | 470 GenerateMiss(masm); |
471 } | 471 } |
472 static void GenerateGeneric(MacroAssembler* masm); | 472 static void GenerateGeneric(MacroAssembler* masm); |
473 static void GenerateString(MacroAssembler* masm); | 473 static void GenerateString(MacroAssembler* masm); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 } | 557 } |
558 static void GenerateMiss(MacroAssembler* masm); | 558 static void GenerateMiss(MacroAssembler* masm); |
559 static void GenerateMegamorphic(MacroAssembler* masm); | 559 static void GenerateMegamorphic(MacroAssembler* masm); |
560 static void GenerateNormal(MacroAssembler* masm); | 560 static void GenerateNormal(MacroAssembler* masm); |
561 static void GenerateRuntimeSetProperty(MacroAssembler* masm, | 561 static void GenerateRuntimeSetProperty(MacroAssembler* masm, |
562 StrictMode strict_mode); | 562 StrictMode strict_mode); |
563 | 563 |
564 static Handle<Code> initialize_stub(Isolate* isolate, | 564 static Handle<Code> initialize_stub(Isolate* isolate, |
565 StrictMode strict_mode); | 565 StrictMode strict_mode); |
566 | 566 |
567 MUST_USE_RESULT MaybeObject* Store( | 567 MUST_USE_RESULT MaybeHandle<Object> Store( |
568 Handle<Object> object, | 568 Handle<Object> object, |
569 Handle<String> name, | 569 Handle<String> name, |
570 Handle<Object> value, | 570 Handle<Object> value, |
571 JSReceiver::StoreFromKeyed store_mode = | 571 JSReceiver::StoreFromKeyed store_mode = |
572 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED); | 572 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED); |
573 | 573 |
574 protected: | 574 protected: |
575 virtual Code::Kind kind() const { return Code::STORE_IC; } | 575 virtual Code::Kind kind() const { return Code::STORE_IC; } |
576 virtual Handle<Code> megamorphic_stub(); | 576 virtual Handle<Code> megamorphic_stub(); |
577 | 577 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 static KeyedAccessStoreMode GetKeyedAccessStoreMode( | 646 static KeyedAccessStoreMode GetKeyedAccessStoreMode( |
647 ExtraICState extra_state) { | 647 ExtraICState extra_state) { |
648 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); | 648 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); |
649 } | 649 } |
650 | 650 |
651 KeyedStoreIC(FrameDepth depth, Isolate* isolate) | 651 KeyedStoreIC(FrameDepth depth, Isolate* isolate) |
652 : StoreIC(depth, isolate) { | 652 : StoreIC(depth, isolate) { |
653 ASSERT(target()->is_keyed_store_stub()); | 653 ASSERT(target()->is_keyed_store_stub()); |
654 } | 654 } |
655 | 655 |
656 MUST_USE_RESULT MaybeObject* Store(Handle<Object> object, | 656 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object, |
657 Handle<Object> name, | 657 Handle<Object> name, |
658 Handle<Object> value); | 658 Handle<Object> value); |
659 | 659 |
660 // Code generators for stub routines. Only called once at startup. | 660 // Code generators for stub routines. Only called once at startup. |
661 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } | 661 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
662 static void GeneratePreMonomorphic(MacroAssembler* masm) { | 662 static void GeneratePreMonomorphic(MacroAssembler* masm) { |
663 GenerateMiss(masm); | 663 GenerateMiss(masm); |
664 } | 664 } |
665 static void GenerateMiss(MacroAssembler* masm); | 665 static void GenerateMiss(MacroAssembler* masm); |
666 static void GenerateSlow(MacroAssembler* masm); | 666 static void GenerateSlow(MacroAssembler* masm); |
667 static void GenerateRuntimeSetProperty(MacroAssembler* masm, | 667 static void GenerateRuntimeSetProperty(MacroAssembler* masm, |
668 StrictMode strict_mode); | 668 StrictMode strict_mode); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 Kind left_kind_; | 853 Kind left_kind_; |
854 Kind right_kind_; | 854 Kind right_kind_; |
855 Kind result_kind_; | 855 Kind result_kind_; |
856 Maybe<int> fixed_right_arg_; | 856 Maybe<int> fixed_right_arg_; |
857 }; | 857 }; |
858 | 858 |
859 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } | 859 explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } |
860 | 860 |
861 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); | 861 static Builtins::JavaScript TokenToJSBuiltin(Token::Value op); |
862 | 862 |
863 MaybeObject* Transition(Handle<AllocationSite> allocation_site, | 863 MaybeHandle<Object> Transition(Handle<AllocationSite> allocation_site, |
864 Handle<Object> left, | 864 Handle<Object> left, |
865 Handle<Object> right) V8_WARN_UNUSED_RESULT; | 865 Handle<Object> right) V8_WARN_UNUSED_RESULT; |
866 }; | 866 }; |
867 | 867 |
868 | 868 |
869 class CompareIC: public IC { | 869 class CompareIC: public IC { |
870 public: | 870 public: |
871 // The type/state lattice is defined by the following inequations: | 871 // The type/state lattice is defined by the following inequations: |
872 // UNINITIALIZED < ... | 872 // UNINITIALIZED < ... |
873 // ... < GENERIC | 873 // ... < GENERIC |
874 // SMI < NUMBER | 874 // SMI < NUMBER |
875 // INTERNALIZED_STRING < STRING | 875 // INTERNALIZED_STRING < STRING |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 Token::Value op_; | 937 Token::Value op_; |
938 | 938 |
939 friend class IC; | 939 friend class IC; |
940 }; | 940 }; |
941 | 941 |
942 | 942 |
943 class CompareNilIC: public IC { | 943 class CompareNilIC: public IC { |
944 public: | 944 public: |
945 explicit CompareNilIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {} | 945 explicit CompareNilIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {} |
946 | 946 |
947 MUST_USE_RESULT MaybeObject* CompareNil(Handle<Object> object); | 947 Handle<Object> CompareNil(Handle<Object> object); |
948 | 948 |
949 static Handle<Code> GetUninitialized(); | 949 static Handle<Code> GetUninitialized(); |
950 | 950 |
951 static void Clear(Address address, | 951 static void Clear(Address address, |
952 Code* target, | 952 Code* target, |
953 ConstantPoolArray* constant_pool); | 953 ConstantPoolArray* constant_pool); |
954 | 954 |
955 static MUST_USE_RESULT MaybeObject* DoCompareNilSlow(NilValue nil, | 955 static Handle<Object> DoCompareNilSlow(Isolate* isolate, NilValue nil, |
956 Handle<Object> object); | 956 Handle<Object> object); |
957 }; | 957 }; |
958 | 958 |
959 | 959 |
960 class ToBooleanIC: public IC { | 960 class ToBooleanIC: public IC { |
961 public: | 961 public: |
962 explicit ToBooleanIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } | 962 explicit ToBooleanIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } |
963 | 963 |
964 MaybeObject* ToBoolean(Handle<Object> object); | 964 Handle<Object> ToBoolean(Handle<Object> object); |
965 }; | 965 }; |
966 | 966 |
967 | 967 |
968 // Helper for BinaryOpIC and CompareIC. | 968 // Helper for BinaryOpIC and CompareIC. |
969 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 969 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
970 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); | 970 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); |
971 | 971 |
972 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); | 972 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); |
973 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); | 973 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); |
974 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); | 974 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
975 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); | 975 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); |
976 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); | 976 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); |
977 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); | 977 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); |
978 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite); | 978 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite); |
979 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 979 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
980 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 980 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
981 | 981 |
982 | 982 |
983 } } // namespace v8::internal | 983 } } // namespace v8::internal |
984 | 984 |
985 #endif // V8_IC_H_ | 985 #endif // V8_IC_H_ |
OLD | NEW |