| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 39 // The stub cache is used for megamorphic calls and property accesses. | 39 // The stub cache is used for megamorphic calls and property accesses. |
| 40 // It maps (map, name, type)->Code* | 40 // It maps (map, name, type)->Code* |
| 41 | 41 |
| 42 // The design of the table uses the inline cache stubs used for | 42 // The design of the table uses the inline cache stubs used for |
| 43 // mono-morphic calls. The beauty of this, we do not have to | 43 // mono-morphic calls. The beauty of this, we do not have to |
| 44 // invalidate the cache whenever a prototype map is changed. The stub | 44 // invalidate the cache whenever a prototype map is changed. The stub |
| 45 // validates the map chain as in the mono-morphic case. | 45 // validates the map chain as in the mono-morphic case. |
| 46 | 46 |
| 47 class StubCache; | 47 class StubCache; |
| 48 | 48 |
| 49 |
| 49 class SCTableReference { | 50 class SCTableReference { |
| 50 public: | 51 public: |
| 51 Address address() const { return address_; } | 52 Address address() const { return address_; } |
| 52 | 53 |
| 53 private: | 54 private: |
| 54 explicit SCTableReference(Address address) : address_(address) {} | 55 explicit SCTableReference(Address address) : address_(address) {} |
| 55 | 56 |
| 56 Address address_; | 57 Address address_; |
| 57 | 58 |
| 58 friend class StubCache; | 59 friend class StubCache; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 JSArray* receiver); | 137 JSArray* receiver); |
| 137 | 138 |
| 138 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadStringLength( | 139 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadStringLength( |
| 139 String* name, | 140 String* name, |
| 140 String* receiver); | 141 String* receiver); |
| 141 | 142 |
| 142 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadFunctionPrototype( | 143 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadFunctionPrototype( |
| 143 String* name, | 144 String* name, |
| 144 JSFunction* receiver); | 145 JSFunction* receiver); |
| 145 | 146 |
| 146 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadSpecialized( | |
| 147 JSObject* receiver); | |
| 148 | |
| 149 // --- | 147 // --- |
| 150 | 148 |
| 151 MUST_USE_RESULT MaybeObject* ComputeStoreField( | 149 MUST_USE_RESULT MaybeObject* ComputeStoreField( |
| 152 String* name, | 150 String* name, |
| 153 JSObject* receiver, | 151 JSObject* receiver, |
| 154 int field_index, | 152 int field_index, |
| 155 Map* transition, | 153 Map* transition, |
| 156 StrictModeFlag strict_mode); | 154 StrictModeFlag strict_mode); |
| 157 | 155 |
| 158 MUST_USE_RESULT MaybeObject* ComputeStoreNormal( | 156 MUST_USE_RESULT MaybeObject* ComputeStoreNormal( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 177 | 175 |
| 178 // --- | 176 // --- |
| 179 | 177 |
| 180 MUST_USE_RESULT MaybeObject* ComputeKeyedStoreField( | 178 MUST_USE_RESULT MaybeObject* ComputeKeyedStoreField( |
| 181 String* name, | 179 String* name, |
| 182 JSObject* receiver, | 180 JSObject* receiver, |
| 183 int field_index, | 181 int field_index, |
| 184 Map* transition, | 182 Map* transition, |
| 185 StrictModeFlag strict_mode); | 183 StrictModeFlag strict_mode); |
| 186 | 184 |
| 187 MUST_USE_RESULT MaybeObject* ComputeKeyedStoreSpecialized( | |
| 188 JSObject* receiver, | |
| 189 StrictModeFlag strict_mode); | |
| 190 | |
| 191 | |
| 192 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadOrStoreExternalArray( | 185 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadOrStoreExternalArray( |
| 193 JSObject* receiver, | 186 JSObject* receiver, |
| 194 bool is_store, | 187 bool is_store, |
| 195 StrictModeFlag strict_mode); | 188 StrictModeFlag strict_mode); |
| 196 | 189 |
| 197 // --- | 190 // --- |
| 198 | 191 |
| 199 MUST_USE_RESULT MaybeObject* ComputeCallField(int argc, | 192 MUST_USE_RESULT MaybeObject* ComputeCallField(int argc, |
| 200 InLoopFlag in_loop, | 193 InLoopFlag in_loop, |
| 201 Code::Kind, | 194 Code::Kind, |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 | 454 |
| 462 static void GenerateStoreField(MacroAssembler* masm, | 455 static void GenerateStoreField(MacroAssembler* masm, |
| 463 JSObject* object, | 456 JSObject* object, |
| 464 int index, | 457 int index, |
| 465 Map* transition, | 458 Map* transition, |
| 466 Register receiver_reg, | 459 Register receiver_reg, |
| 467 Register name_reg, | 460 Register name_reg, |
| 468 Register scratch, | 461 Register scratch, |
| 469 Label* miss_label); | 462 Label* miss_label); |
| 470 | 463 |
| 471 static void GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind); | 464 static void GenerateLoadMiss(MacroAssembler* masm, |
| 465 Code::Kind kind); |
| 466 |
| 467 static void GenerateKeyedLoadMissForceGeneric(MacroAssembler* masm); |
| 472 | 468 |
| 473 // Generates code that verifies that the property holder has not changed | 469 // Generates code that verifies that the property holder has not changed |
| 474 // (checking maps of objects in the prototype chain for fast and global | 470 // (checking maps of objects in the prototype chain for fast and global |
| 475 // objects or doing negative lookup for slow objects, ensures that the | 471 // objects or doing negative lookup for slow objects, ensures that the |
| 476 // property cells for global objects are still empty) and checks that the map | 472 // property cells for global objects are still empty) and checks that the map |
| 477 // of the holder has not changed. If necessary the function also generates | 473 // of the holder has not changed. If necessary the function also generates |
| 478 // code for security check in case of global object holders. Helps to make | 474 // code for security check in case of global object holders. Helps to make |
| 479 // sure that the current IC is still valid. | 475 // sure that the current IC is still valid. |
| 480 // | 476 // |
| 481 // The scratch and holder registers are always clobbered, but the object | 477 // The scratch and holder registers are always clobbered, but the object |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 Object* value); | 622 Object* value); |
| 627 | 623 |
| 628 MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object, | 624 MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object, |
| 629 JSObject* holder, | 625 JSObject* holder, |
| 630 String* name); | 626 String* name); |
| 631 | 627 |
| 632 MUST_USE_RESULT MaybeObject* CompileLoadArrayLength(String* name); | 628 MUST_USE_RESULT MaybeObject* CompileLoadArrayLength(String* name); |
| 633 MUST_USE_RESULT MaybeObject* CompileLoadStringLength(String* name); | 629 MUST_USE_RESULT MaybeObject* CompileLoadStringLength(String* name); |
| 634 MUST_USE_RESULT MaybeObject* CompileLoadFunctionPrototype(String* name); | 630 MUST_USE_RESULT MaybeObject* CompileLoadFunctionPrototype(String* name); |
| 635 | 631 |
| 636 MUST_USE_RESULT MaybeObject* CompileLoadSpecialized(JSObject* receiver); | 632 MUST_USE_RESULT MaybeObject* CompileLoadSpecialized(Handle<Map> receiver_map); |
| 633 |
| 634 MUST_USE_RESULT MaybeObject* CompileLoadMegamorphic( |
| 635 ZoneMapList* receiver_maps, |
| 636 ZoneCodeList* handler_ics); |
| 637 | 637 |
| 638 private: | 638 private: |
| 639 MaybeObject* GetCode(PropertyType type, String* name); | 639 MaybeObject* GetCode(PropertyType type, |
| 640 String* name, |
| 641 InlineCacheState state = MONOMORPHIC); |
| 640 }; | 642 }; |
| 641 | 643 |
| 642 | 644 |
| 643 class StoreStubCompiler: public StubCompiler { | 645 class StoreStubCompiler: public StubCompiler { |
| 644 public: | 646 public: |
| 645 explicit StoreStubCompiler(StrictModeFlag strict_mode) | 647 explicit StoreStubCompiler(StrictModeFlag strict_mode) |
| 646 : strict_mode_(strict_mode) { } | 648 : strict_mode_(strict_mode) { } |
| 647 | 649 |
| 648 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, | 650 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, |
| 649 int index, | 651 int index, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 670 class KeyedStoreStubCompiler: public StubCompiler { | 672 class KeyedStoreStubCompiler: public StubCompiler { |
| 671 public: | 673 public: |
| 672 explicit KeyedStoreStubCompiler(StrictModeFlag strict_mode) | 674 explicit KeyedStoreStubCompiler(StrictModeFlag strict_mode) |
| 673 : strict_mode_(strict_mode) { } | 675 : strict_mode_(strict_mode) { } |
| 674 | 676 |
| 675 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, | 677 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, |
| 676 int index, | 678 int index, |
| 677 Map* transition, | 679 Map* transition, |
| 678 String* name); | 680 String* name); |
| 679 | 681 |
| 680 MUST_USE_RESULT MaybeObject* CompileStoreSpecialized(JSObject* receiver); | 682 MUST_USE_RESULT MaybeObject* CompileStoreSpecialized(Handle<Map> receiver_map)
; |
| 683 |
| 684 MUST_USE_RESULT MaybeObject* CompileStoreMegamorphic( |
| 685 ZoneMapList* receiver_maps, |
| 686 ZoneCodeList* handler_ics); |
| 681 | 687 |
| 682 private: | 688 private: |
| 683 MaybeObject* GetCode(PropertyType type, String* name); | 689 MaybeObject* GetCode(PropertyType type, |
| 690 String* name, |
| 691 InlineCacheState state = MONOMORPHIC); |
| 684 | 692 |
| 685 StrictModeFlag strict_mode_; | 693 StrictModeFlag strict_mode_; |
| 686 }; | 694 }; |
| 687 | 695 |
| 688 | 696 |
| 689 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call | 697 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call |
| 690 // IC stubs. | 698 // IC stubs. |
| 691 #define CUSTOM_CALL_IC_GENERATORS(V) \ | 699 #define CUSTOM_CALL_IC_GENERATORS(V) \ |
| 692 V(ArrayPush) \ | 700 V(ArrayPush) \ |
| 693 V(ArrayPop) \ | 701 V(ArrayPop) \ |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 MUST_USE_RESULT MaybeObject* CompileKeyedStoreStub( | 865 MUST_USE_RESULT MaybeObject* CompileKeyedStoreStub( |
| 858 JSObject* receiver, ExternalArrayType array_type, Code::Flags flags); | 866 JSObject* receiver, ExternalArrayType array_type, Code::Flags flags); |
| 859 | 867 |
| 860 private: | 868 private: |
| 861 MaybeObject* GetCode(Code::Flags flags); | 869 MaybeObject* GetCode(Code::Flags flags); |
| 862 }; | 870 }; |
| 863 | 871 |
| 864 } } // namespace v8::internal | 872 } } // namespace v8::internal |
| 865 | 873 |
| 866 #endif // V8_STUB_CACHE_H_ | 874 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |