| 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 26 matching lines...) Expand all Loading... |
| 37 // The stub cache is used for megamorphic calls and property accesses. | 37 // The stub cache is used for megamorphic calls and property accesses. |
| 38 // It maps (map, name, type)->Code* | 38 // It maps (map, name, type)->Code* |
| 39 | 39 |
| 40 // The design of the table uses the inline cache stubs used for | 40 // The design of the table uses the inline cache stubs used for |
| 41 // mono-morphic calls. The beauty of this, we do not have to | 41 // mono-morphic calls. The beauty of this, we do not have to |
| 42 // invalidate the cache whenever a prototype map is changed. The stub | 42 // invalidate the cache whenever a prototype map is changed. The stub |
| 43 // validates the map chain as in the mono-morphic case. | 43 // validates the map chain as in the mono-morphic case. |
| 44 | 44 |
| 45 class SCTableReference; | 45 class SCTableReference; |
| 46 | 46 |
| 47 class StubCache : public AllStatic { | 47 class StubCache { |
| 48 public: | 48 public: |
| 49 struct Entry { | 49 struct Entry { |
| 50 String* key; | 50 String* key; |
| 51 Code* value; | 51 Code* value; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 | 54 |
| 55 static void Initialize(bool create_heap_objects); | 55 static void Initialize(bool create_heap_objects); |
| 56 | 56 |
| 57 // Computes the right stub matching. Inserts the result in the | 57 // Computes the right stub matching. Inserts the result in the |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 Register name, | 208 Register name, |
| 209 Register scratch, | 209 Register scratch, |
| 210 Register extra); | 210 Register extra); |
| 211 | 211 |
| 212 enum Table { | 212 enum Table { |
| 213 kPrimary, | 213 kPrimary, |
| 214 kSecondary | 214 kSecondary |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 private: | 217 private: |
| 218 StubCache(); |
| 219 |
| 220 friend class Isolate; |
| 218 friend class SCTableReference; | 221 friend class SCTableReference; |
| 219 static const int kPrimaryTableSize = 2048; | 222 static const int kPrimaryTableSize = 2048; |
| 220 static const int kSecondaryTableSize = 512; | 223 static const int kSecondaryTableSize = 512; |
| 221 static Entry primary_[]; | 224 static Entry primary_[]; |
| 222 static Entry secondary_[]; | 225 static Entry secondary_[]; |
| 223 | 226 |
| 224 // Computes the hashed offsets for primary and secondary caches. | 227 // Computes the hashed offsets for primary and secondary caches. |
| 225 static int PrimaryOffset(String* name, Code::Flags flags, Map* map) { | 228 static int PrimaryOffset(String* name, Code::Flags flags, Map* map) { |
| 226 // This works well because the heap object tag size and the hash | 229 // This works well because the heap object tag size and the hash |
| 227 // shift are equal. Shifting down the length field to get the | 230 // shift are equal. Shifting down the length field to get the |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 | 695 |
| 693 JSFunction* constant_function_; | 696 JSFunction* constant_function_; |
| 694 bool is_simple_api_call_; | 697 bool is_simple_api_call_; |
| 695 FunctionTemplateInfo* expected_receiver_type_; | 698 FunctionTemplateInfo* expected_receiver_type_; |
| 696 CallHandlerInfo* api_call_info_; | 699 CallHandlerInfo* api_call_info_; |
| 697 }; | 700 }; |
| 698 | 701 |
| 699 } } // namespace v8::internal | 702 } } // namespace v8::internal |
| 700 | 703 |
| 701 #endif // V8_STUB_CACHE_H_ | 704 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |