| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 String* name, | 126 String* name, |
| 127 String* receiver); | 127 String* receiver); |
| 128 | 128 |
| 129 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadFunctionPrototype( | 129 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadFunctionPrototype( |
| 130 String* name, | 130 String* name, |
| 131 JSFunction* receiver); | 131 JSFunction* receiver); |
| 132 | 132 |
| 133 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadSpecialized( | 133 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadSpecialized( |
| 134 JSObject* receiver); | 134 JSObject* receiver); |
| 135 | 135 |
| 136 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadPixelArray( |
| 137 JSObject* receiver); |
| 138 |
| 136 // --- | 139 // --- |
| 137 | 140 |
| 138 MUST_USE_RESULT static MaybeObject* ComputeStoreField(String* name, | 141 MUST_USE_RESULT static MaybeObject* ComputeStoreField( |
| 139 JSObject* receiver, | 142 String* name, |
| 140 int field_index, | 143 JSObject* receiver, |
| 141 Map* transition = NULL); | 144 int field_index, |
| 145 Map* transition, |
| 146 Code::ExtraICState extra_ic_state); |
| 142 | 147 |
| 143 MUST_USE_RESULT static MaybeObject* ComputeStoreNormal(); | 148 MUST_USE_RESULT static MaybeObject* ComputeStoreNormal( |
| 149 Code::ExtraICState extra_ic_state); |
| 144 | 150 |
| 145 MUST_USE_RESULT static MaybeObject* ComputeStoreGlobal( | 151 MUST_USE_RESULT static MaybeObject* ComputeStoreGlobal( |
| 146 String* name, | 152 String* name, |
| 147 GlobalObject* receiver, | 153 GlobalObject* receiver, |
| 148 JSGlobalPropertyCell* cell); | 154 JSGlobalPropertyCell* cell, |
| 155 Code::ExtraICState extra_ic_state); |
| 149 | 156 |
| 150 MUST_USE_RESULT static MaybeObject* ComputeStoreCallback( | 157 MUST_USE_RESULT static MaybeObject* ComputeStoreCallback( |
| 151 String* name, | 158 String* name, |
| 152 JSObject* receiver, | 159 JSObject* receiver, |
| 153 AccessorInfo* callback); | 160 AccessorInfo* callback, |
| 161 Code::ExtraICState extra_ic_state); |
| 154 | 162 |
| 155 MUST_USE_RESULT static MaybeObject* ComputeStoreInterceptor( | 163 MUST_USE_RESULT static MaybeObject* ComputeStoreInterceptor( |
| 156 String* name, | 164 String* name, |
| 157 JSObject* receiver); | 165 JSObject* receiver, |
| 166 Code::ExtraICState extra_ic_state); |
| 158 | 167 |
| 159 // --- | 168 // --- |
| 160 | 169 |
| 161 MUST_USE_RESULT static MaybeObject* ComputeKeyedStoreField( | 170 MUST_USE_RESULT static MaybeObject* ComputeKeyedStoreField( |
| 162 String* name, | 171 String* name, |
| 163 JSObject* receiver, | 172 JSObject* receiver, |
| 164 int field_index, | 173 int field_index, |
| 165 Map* transition = NULL); | 174 Map* transition = NULL); |
| 166 | 175 |
| 167 MUST_USE_RESULT static MaybeObject* ComputeKeyedStoreSpecialized( | 176 MUST_USE_RESULT static MaybeObject* ComputeKeyedStoreSpecialized( |
| 168 JSObject* receiver); | 177 JSObject* receiver); |
| 169 | 178 |
| 179 MUST_USE_RESULT static MaybeObject* ComputeKeyedStorePixelArray( |
| 180 JSObject* receiver); |
| 181 |
| 182 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadOrStoreExternalArray( |
| 183 JSObject* receiver, |
| 184 bool is_store); |
| 185 |
| 170 // --- | 186 // --- |
| 171 | 187 |
| 172 MUST_USE_RESULT static MaybeObject* ComputeCallField(int argc, | 188 MUST_USE_RESULT static MaybeObject* ComputeCallField(int argc, |
| 173 InLoopFlag in_loop, | 189 InLoopFlag in_loop, |
| 174 Code::Kind, | 190 Code::Kind, |
| 175 String* name, | 191 String* name, |
| 176 Object* object, | 192 Object* object, |
| 177 JSObject* holder, | 193 JSObject* holder, |
| 178 int index); | 194 int index); |
| 179 | 195 |
| 180 MUST_USE_RESULT static MaybeObject* ComputeCallConstant(int argc, | 196 MUST_USE_RESULT static MaybeObject* ComputeCallConstant( |
| 181 InLoopFlag in_loop, | 197 int argc, |
| 182 Code::Kind, | 198 InLoopFlag in_loop, |
| 183 String* name, | 199 Code::Kind, |
| 184 Object* object, | 200 Code::ExtraICState extra_ic_state, |
| 185 JSObject* holder, | 201 String* name, |
| 186 JSFunction* function); | 202 Object* object, |
| 203 JSObject* holder, |
| 204 JSFunction* function); |
| 187 | 205 |
| 188 MUST_USE_RESULT static MaybeObject* ComputeCallNormal(int argc, | 206 MUST_USE_RESULT static MaybeObject* ComputeCallNormal(int argc, |
| 189 InLoopFlag in_loop, | 207 InLoopFlag in_loop, |
| 190 Code::Kind, | 208 Code::Kind, |
| 191 String* name, | 209 String* name, |
| 192 JSObject* receiver); | 210 JSObject* receiver); |
| 193 | 211 |
| 194 MUST_USE_RESULT static MaybeObject* ComputeCallInterceptor(int argc, | 212 MUST_USE_RESULT static MaybeObject* ComputeCallInterceptor(int argc, |
| 195 Code::Kind, | 213 Code::Kind, |
| 196 String* name, | 214 String* name, |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 432 |
| 415 static void GenerateLoadArrayLength(MacroAssembler* masm, | 433 static void GenerateLoadArrayLength(MacroAssembler* masm, |
| 416 Register receiver, | 434 Register receiver, |
| 417 Register scratch, | 435 Register scratch, |
| 418 Label* miss_label); | 436 Label* miss_label); |
| 419 | 437 |
| 420 static void GenerateLoadStringLength(MacroAssembler* masm, | 438 static void GenerateLoadStringLength(MacroAssembler* masm, |
| 421 Register receiver, | 439 Register receiver, |
| 422 Register scratch1, | 440 Register scratch1, |
| 423 Register scratch2, | 441 Register scratch2, |
| 424 Label* miss_label); | 442 Label* miss_label, |
| 443 bool support_wrappers); |
| 425 | 444 |
| 426 static void GenerateLoadFunctionPrototype(MacroAssembler* masm, | 445 static void GenerateLoadFunctionPrototype(MacroAssembler* masm, |
| 427 Register receiver, | 446 Register receiver, |
| 428 Register scratch1, | 447 Register scratch1, |
| 429 Register scratch2, | 448 Register scratch2, |
| 430 Label* miss_label); | 449 Label* miss_label); |
| 431 | 450 |
| 432 static void GenerateStoreField(MacroAssembler* masm, | 451 static void GenerateStoreField(MacroAssembler* masm, |
| 433 JSObject* object, | 452 JSObject* object, |
| 434 int index, | 453 int index, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 void GenerateLoadField(JSObject* object, | 507 void GenerateLoadField(JSObject* object, |
| 489 JSObject* holder, | 508 JSObject* holder, |
| 490 Register receiver, | 509 Register receiver, |
| 491 Register scratch1, | 510 Register scratch1, |
| 492 Register scratch2, | 511 Register scratch2, |
| 493 Register scratch3, | 512 Register scratch3, |
| 494 int index, | 513 int index, |
| 495 String* name, | 514 String* name, |
| 496 Label* miss); | 515 Label* miss); |
| 497 | 516 |
| 498 bool GenerateLoadCallback(JSObject* object, | 517 MaybeObject* GenerateLoadCallback(JSObject* object, |
| 499 JSObject* holder, | 518 JSObject* holder, |
| 500 Register receiver, | 519 Register receiver, |
| 501 Register name_reg, | 520 Register name_reg, |
| 502 Register scratch1, | 521 Register scratch1, |
| 503 Register scratch2, | 522 Register scratch2, |
| 504 Register scratch3, | 523 Register scratch3, |
| 505 AccessorInfo* callback, | 524 AccessorInfo* callback, |
| 506 String* name, | 525 String* name, |
| 507 Label* miss, | 526 Label* miss); |
| 508 Failure** failure); | |
| 509 | 527 |
| 510 void GenerateLoadConstant(JSObject* object, | 528 void GenerateLoadConstant(JSObject* object, |
| 511 JSObject* holder, | 529 JSObject* holder, |
| 512 Register receiver, | 530 Register receiver, |
| 513 Register scratch1, | 531 Register scratch1, |
| 514 Register scratch2, | 532 Register scratch2, |
| 515 Register scratch3, | 533 Register scratch3, |
| 516 Object* value, | 534 Object* value, |
| 517 String* name, | 535 String* name, |
| 518 Label* miss); | 536 Label* miss); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 | 612 |
| 595 MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object, | 613 MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object, |
| 596 JSObject* holder, | 614 JSObject* holder, |
| 597 String* name); | 615 String* name); |
| 598 | 616 |
| 599 MUST_USE_RESULT MaybeObject* CompileLoadArrayLength(String* name); | 617 MUST_USE_RESULT MaybeObject* CompileLoadArrayLength(String* name); |
| 600 MUST_USE_RESULT MaybeObject* CompileLoadStringLength(String* name); | 618 MUST_USE_RESULT MaybeObject* CompileLoadStringLength(String* name); |
| 601 MUST_USE_RESULT MaybeObject* CompileLoadFunctionPrototype(String* name); | 619 MUST_USE_RESULT MaybeObject* CompileLoadFunctionPrototype(String* name); |
| 602 | 620 |
| 603 MUST_USE_RESULT MaybeObject* CompileLoadSpecialized(JSObject* receiver); | 621 MUST_USE_RESULT MaybeObject* CompileLoadSpecialized(JSObject* receiver); |
| 622 MUST_USE_RESULT MaybeObject* CompileLoadPixelArray(JSObject* receiver); |
| 604 | 623 |
| 605 private: | 624 private: |
| 606 MaybeObject* GetCode(PropertyType type, String* name); | 625 MaybeObject* GetCode(PropertyType type, String* name); |
| 607 }; | 626 }; |
| 608 | 627 |
| 609 | 628 |
| 610 class StoreStubCompiler: public StubCompiler { | 629 class StoreStubCompiler: public StubCompiler { |
| 611 public: | 630 public: |
| 631 explicit StoreStubCompiler(Code::ExtraICState extra_ic_state) |
| 632 : extra_ic_state_(extra_ic_state) { } |
| 633 |
| 612 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, | 634 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, |
| 613 int index, | 635 int index, |
| 614 Map* transition, | 636 Map* transition, |
| 615 String* name); | 637 String* name); |
| 616 | 638 |
| 617 MUST_USE_RESULT MaybeObject* CompileStoreCallback(JSObject* object, | 639 MUST_USE_RESULT MaybeObject* CompileStoreCallback(JSObject* object, |
| 618 AccessorInfo* callbacks, | 640 AccessorInfo* callbacks, |
| 619 String* name); | 641 String* name); |
| 620 MUST_USE_RESULT MaybeObject* CompileStoreInterceptor(JSObject* object, | 642 MUST_USE_RESULT MaybeObject* CompileStoreInterceptor(JSObject* object, |
| 621 String* name); | 643 String* name); |
| 622 MUST_USE_RESULT MaybeObject* CompileStoreGlobal(GlobalObject* object, | 644 MUST_USE_RESULT MaybeObject* CompileStoreGlobal(GlobalObject* object, |
| 623 JSGlobalPropertyCell* holder, | 645 JSGlobalPropertyCell* holder, |
| 624 String* name); | 646 String* name); |
| 625 | 647 |
| 626 | 648 |
| 627 private: | 649 private: |
| 628 MaybeObject* GetCode(PropertyType type, String* name); | 650 MaybeObject* GetCode(PropertyType type, String* name); |
| 651 |
| 652 Code::ExtraICState extra_ic_state_; |
| 629 }; | 653 }; |
| 630 | 654 |
| 631 | 655 |
| 632 class KeyedStoreStubCompiler: public StubCompiler { | 656 class KeyedStoreStubCompiler: public StubCompiler { |
| 633 public: | 657 public: |
| 634 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, | 658 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, |
| 635 int index, | 659 int index, |
| 636 Map* transition, | 660 Map* transition, |
| 637 String* name); | 661 String* name); |
| 638 | 662 |
| 639 MUST_USE_RESULT MaybeObject* CompileStoreSpecialized(JSObject* receiver); | 663 MUST_USE_RESULT MaybeObject* CompileStoreSpecialized(JSObject* receiver); |
| 640 | 664 |
| 665 MUST_USE_RESULT MaybeObject* CompileStorePixelArray(JSObject* receiver); |
| 666 |
| 641 private: | 667 private: |
| 642 MaybeObject* GetCode(PropertyType type, String* name); | 668 MaybeObject* GetCode(PropertyType type, String* name); |
| 643 }; | 669 }; |
| 644 | 670 |
| 645 | 671 |
| 646 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call | 672 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call |
| 647 // IC stubs. | 673 // IC stubs. |
| 648 #define CUSTOM_CALL_IC_GENERATORS(V) \ | 674 #define CUSTOM_CALL_IC_GENERATORS(V) \ |
| 649 V(ArrayPush) \ | 675 V(ArrayPush) \ |
| 650 V(ArrayPop) \ | 676 V(ArrayPop) \ |
| 651 V(StringCharCodeAt) \ | 677 V(StringCharCodeAt) \ |
| 652 V(StringCharAt) \ | 678 V(StringCharAt) \ |
| 653 V(StringFromCharCode) \ | 679 V(StringFromCharCode) \ |
| 654 V(MathFloor) \ | 680 V(MathFloor) \ |
| 655 V(MathAbs) | 681 V(MathAbs) |
| 656 | 682 |
| 657 | 683 |
| 658 class CallStubCompiler: public StubCompiler { | 684 class CallStubCompiler: public StubCompiler { |
| 659 public: | 685 public: |
| 660 CallStubCompiler(int argc, | 686 CallStubCompiler(int argc, |
| 661 InLoopFlag in_loop, | 687 InLoopFlag in_loop, |
| 662 Code::Kind kind, | 688 Code::Kind kind, |
| 689 Code::ExtraICState extra_ic_state, |
| 663 InlineCacheHolderFlag cache_holder); | 690 InlineCacheHolderFlag cache_holder); |
| 664 | 691 |
| 665 MUST_USE_RESULT MaybeObject* CompileCallField(JSObject* object, | 692 MUST_USE_RESULT MaybeObject* CompileCallField(JSObject* object, |
| 666 JSObject* holder, | 693 JSObject* holder, |
| 667 int index, | 694 int index, |
| 668 String* name); | 695 String* name); |
| 669 MUST_USE_RESULT MaybeObject* CompileCallConstant(Object* object, | 696 MUST_USE_RESULT MaybeObject* CompileCallConstant(Object* object, |
| 670 JSObject* holder, | 697 JSObject* holder, |
| 671 JSFunction* function, | 698 JSFunction* function, |
| 672 String* name, | 699 String* name, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 698 JSObject* holder, \ | 725 JSObject* holder, \ |
| 699 JSGlobalPropertyCell* cell, \ | 726 JSGlobalPropertyCell* cell, \ |
| 700 JSFunction* function, \ | 727 JSFunction* function, \ |
| 701 String* fname); | 728 String* fname); |
| 702 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) | 729 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) |
| 703 #undef DECLARE_CALL_GENERATOR | 730 #undef DECLARE_CALL_GENERATOR |
| 704 | 731 |
| 705 const ParameterCount arguments_; | 732 const ParameterCount arguments_; |
| 706 const InLoopFlag in_loop_; | 733 const InLoopFlag in_loop_; |
| 707 const Code::Kind kind_; | 734 const Code::Kind kind_; |
| 735 const Code::ExtraICState extra_ic_state_; |
| 708 const InlineCacheHolderFlag cache_holder_; | 736 const InlineCacheHolderFlag cache_holder_; |
| 709 | 737 |
| 710 const ParameterCount& arguments() { return arguments_; } | 738 const ParameterCount& arguments() { return arguments_; } |
| 711 | 739 |
| 712 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); | 740 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); |
| 713 | 741 |
| 714 // Convenience function. Calls GetCode above passing | 742 // Convenience function. Calls GetCode above passing |
| 715 // CONSTANT_FUNCTION type and the name of the given function. | 743 // CONSTANT_FUNCTION type and the name of the given function. |
| 716 MUST_USE_RESULT MaybeObject* GetCode(JSFunction* function); | 744 MUST_USE_RESULT MaybeObject* GetCode(JSFunction* function); |
| 717 | 745 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 // Determines whether the given function can be called using the | 814 // Determines whether the given function can be called using the |
| 787 // fast api call builtin. | 815 // fast api call builtin. |
| 788 void AnalyzePossibleApiFunction(JSFunction* function); | 816 void AnalyzePossibleApiFunction(JSFunction* function); |
| 789 | 817 |
| 790 JSFunction* constant_function_; | 818 JSFunction* constant_function_; |
| 791 bool is_simple_api_call_; | 819 bool is_simple_api_call_; |
| 792 FunctionTemplateInfo* expected_receiver_type_; | 820 FunctionTemplateInfo* expected_receiver_type_; |
| 793 CallHandlerInfo* api_call_info_; | 821 CallHandlerInfo* api_call_info_; |
| 794 }; | 822 }; |
| 795 | 823 |
| 824 class ExternalArrayStubCompiler: public StubCompiler { |
| 825 public: |
| 826 explicit ExternalArrayStubCompiler() {} |
| 827 |
| 828 MUST_USE_RESULT MaybeObject* CompileKeyedLoadStub( |
| 829 ExternalArrayType array_type, Code::Flags flags); |
| 830 |
| 831 MUST_USE_RESULT MaybeObject* CompileKeyedStoreStub( |
| 832 ExternalArrayType array_type, Code::Flags flags); |
| 833 |
| 834 private: |
| 835 MaybeObject* GetCode(Code::Flags flags); |
| 836 }; |
| 837 |
| 796 } } // namespace v8::internal | 838 } } // namespace v8::internal |
| 797 | 839 |
| 798 #endif // V8_STUB_CACHE_H_ | 840 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |