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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 Failure* TypeError(const char* type, | 158 Failure* TypeError(const char* type, |
159 Handle<Object> object, | 159 Handle<Object> object, |
160 Handle<Object> key); | 160 Handle<Object> key); |
161 Failure* ReferenceError(const char* type, Handle<String> name); | 161 Failure* ReferenceError(const char* type, Handle<String> name); |
162 | 162 |
163 // Access the target code for the given IC address. | 163 // Access the target code for the given IC address. |
164 static inline Code* GetTargetAtAddress(Address address); | 164 static inline Code* GetTargetAtAddress(Address address); |
165 static inline void SetTargetAtAddress(Address address, Code* target); | 165 static inline void SetTargetAtAddress(Address address, Code* target); |
166 static void PostPatching(Address address, Code* target, Code* old_target); | 166 static void PostPatching(Address address, Code* target, Code* old_target); |
167 | 167 |
| 168 void PatchCache(State state, |
| 169 StrictModeFlag strict_mode, |
| 170 Handle<JSObject> receiver, |
| 171 Handle<String> name, |
| 172 Handle<Code> code); |
| 173 virtual void UpdateMegamorphicCache(Map* map, String* name, Code* code); |
| 174 virtual Handle<Code> megamorphic_stub() { |
| 175 UNREACHABLE(); |
| 176 return Handle<Code>::null(); |
| 177 } |
| 178 virtual Handle<Code> megamorphic_stub_strict() { |
| 179 UNREACHABLE(); |
| 180 return Handle<Code>::null(); |
| 181 } |
| 182 |
168 private: | 183 private: |
169 // Frame pointer for the frame that uses (calls) the IC. | 184 // Frame pointer for the frame that uses (calls) the IC. |
170 Address fp_; | 185 Address fp_; |
171 | 186 |
172 // All access to the program counter of an IC structure is indirect | 187 // All access to the program counter of an IC structure is indirect |
173 // to make the code GC safe. This feature is crucial since | 188 // to make the code GC safe. This feature is crucial since |
174 // GetProperty and SetProperty are called and they in turn might | 189 // GetProperty and SetProperty are called and they in turn might |
175 // invoke the garbage collector. | 190 // invoke the garbage collector. |
176 Address* pc_address_; | 191 Address* pc_address_; |
177 | 192 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 369 |
355 // Update the inline cache and the global stub cache based on the | 370 // Update the inline cache and the global stub cache based on the |
356 // lookup result. | 371 // lookup result. |
357 void UpdateCaches(LookupResult* lookup, | 372 void UpdateCaches(LookupResult* lookup, |
358 State state, | 373 State state, |
359 Handle<Object> object, | 374 Handle<Object> object, |
360 Handle<String> name); | 375 Handle<String> name); |
361 virtual Handle<Code> ComputeLoadMonomorphic(LookupResult* lookup, | 376 virtual Handle<Code> ComputeLoadMonomorphic(LookupResult* lookup, |
362 Handle<JSObject> receiver, | 377 Handle<JSObject> receiver, |
363 Handle<String> name); | 378 Handle<String> name); |
364 virtual void UpdateMegamorphicCache(Map* map, String* name, Code* code); | |
365 | 379 |
366 private: | 380 private: |
367 // Stub accessors. | 381 // Stub accessors. |
368 static Handle<Code> initialize_stub() { | 382 static Handle<Code> initialize_stub() { |
369 return Isolate::Current()->builtins()->LoadIC_Initialize(); | 383 return Isolate::Current()->builtins()->LoadIC_Initialize(); |
370 } | 384 } |
371 virtual Handle<Code> pre_monomorphic_stub() { | 385 virtual Handle<Code> pre_monomorphic_stub() { |
372 return isolate()->builtins()->LoadIC_PreMonomorphic(); | 386 return isolate()->builtins()->LoadIC_PreMonomorphic(); |
373 } | 387 } |
374 | 388 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 virtual Handle<Code> global_proxy_stub() { | 509 virtual Handle<Code> global_proxy_stub() { |
496 return isolate()->builtins()->StoreIC_GlobalProxy(); | 510 return isolate()->builtins()->StoreIC_GlobalProxy(); |
497 } | 511 } |
498 virtual Handle<Code> global_proxy_stub_strict() { | 512 virtual Handle<Code> global_proxy_stub_strict() { |
499 return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); | 513 return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); |
500 } | 514 } |
501 | 515 |
502 | 516 |
503 // Update the inline cache and the global stub cache based on the | 517 // Update the inline cache and the global stub cache based on the |
504 // lookup result. | 518 // lookup result. |
505 virtual void UpdateStoreCaches(LookupResult* lookup, | 519 void UpdateCaches(LookupResult* lookup, |
506 State state, | 520 State state, |
507 StrictModeFlag strict_mode, | 521 StrictModeFlag strict_mode, |
508 Handle<JSObject> receiver, | 522 Handle<JSObject> receiver, |
509 Handle<String> name, | 523 Handle<String> name, |
510 Handle<Object> value); | 524 Handle<Object> value); |
| 525 // Compute the code stub for this store; used for rewriting to |
| 526 // monomorphic state and making sure that the code stub is in the |
| 527 // stub cache. |
| 528 virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, |
| 529 StrictModeFlag strict_mode, |
| 530 Handle<JSObject> receiver, |
| 531 Handle<String> name); |
511 | 532 |
512 private: | 533 private: |
513 void set_target(Code* code) { | 534 void set_target(Code* code) { |
514 // Strict mode must be preserved across IC patching. | 535 // Strict mode must be preserved across IC patching. |
515 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == | 536 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == |
516 Code::GetStrictMode(target()->extra_ic_state())); | 537 Code::GetStrictMode(target()->extra_ic_state())); |
517 IC::set_target(code); | 538 IC::set_target(code); |
518 } | 539 } |
519 | 540 |
520 static Handle<Code> initialize_stub() { | 541 static Handle<Code> initialize_stub() { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 static void GenerateRuntimeSetProperty(MacroAssembler* masm, | 621 static void GenerateRuntimeSetProperty(MacroAssembler* masm, |
601 StrictModeFlag strict_mode); | 622 StrictModeFlag strict_mode); |
602 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); | 623 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); |
603 static void GenerateNonStrictArguments(MacroAssembler* masm); | 624 static void GenerateNonStrictArguments(MacroAssembler* masm); |
604 static void GenerateTransitionElementsSmiToDouble(MacroAssembler* masm); | 625 static void GenerateTransitionElementsSmiToDouble(MacroAssembler* masm); |
605 static void GenerateTransitionElementsDoubleToObject(MacroAssembler* masm); | 626 static void GenerateTransitionElementsDoubleToObject(MacroAssembler* masm); |
606 | 627 |
607 protected: | 628 protected: |
608 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } | 629 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } |
609 | 630 |
610 // Update the inline cache. | 631 virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, |
611 virtual void UpdateStoreCaches(LookupResult* lookup, | 632 StrictModeFlag strict_mode, |
612 State state, | 633 Handle<JSObject> receiver, |
613 StrictModeFlag strict_mode, | 634 Handle<String> name); |
614 Handle<JSObject> receiver, | 635 virtual void UpdateMegamorphicCache(Map* map, String* name, Code* code) { } |
615 Handle<String> name, | |
616 Handle<Object> value); | |
617 | 636 |
618 virtual Handle<Code> megamorphic_stub() { | 637 virtual Handle<Code> megamorphic_stub() { |
619 return isolate()->builtins()->KeyedStoreIC_Generic(); | 638 return isolate()->builtins()->KeyedStoreIC_Generic(); |
620 } | 639 } |
621 virtual Handle<Code> megamorphic_stub_strict() { | 640 virtual Handle<Code> megamorphic_stub_strict() { |
622 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); | 641 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); |
623 } | 642 } |
624 | 643 |
625 Handle<Code> StoreElementStub(Handle<JSObject> receiver, | 644 Handle<Code> StoreElementStub(Handle<JSObject> receiver, |
626 StubKind stub_kind, | 645 StubKind stub_kind, |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 | 807 |
789 // Helper for BinaryOpIC and CompareIC. | 808 // Helper for BinaryOpIC and CompareIC. |
790 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 809 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
791 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); | 810 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); |
792 | 811 |
793 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss); | 812 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss); |
794 | 813 |
795 } } // namespace v8::internal | 814 } } // namespace v8::internal |
796 | 815 |
797 #endif // V8_IC_H_ | 816 #endif // V8_IC_H_ |
OLD | NEW |