OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_STUB_CACHE_H_ | 5 #ifndef V8_STUB_CACHE_H_ |
6 #define V8_STUB_CACHE_H_ | 6 #define V8_STUB_CACHE_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // update strategy on updates is fairly clear and simple: Any existing entry | 118 // update strategy on updates is fairly clear and simple: Any existing entry |
119 // in the primary cache is moved to the secondary cache, and secondary cache | 119 // in the primary cache is moved to the secondary cache, and secondary cache |
120 // entries are overwritten. | 120 // entries are overwritten. |
121 | 121 |
122 // Hash algorithm for the primary table. This algorithm is replicated in | 122 // Hash algorithm for the primary table. This algorithm is replicated in |
123 // assembler for every architecture. Returns an index into the table that | 123 // assembler for every architecture. Returns an index into the table that |
124 // is scaled by 1 << kCacheIndexShift. | 124 // is scaled by 1 << kCacheIndexShift. |
125 static int PrimaryOffset(Name* name, Code::Flags flags, Map* map) { | 125 static int PrimaryOffset(Name* name, Code::Flags flags, Map* map) { |
126 STATIC_ASSERT(kCacheIndexShift == Name::kHashShift); | 126 STATIC_ASSERT(kCacheIndexShift == Name::kHashShift); |
127 // Compute the hash of the name (use entire hash field). | 127 // Compute the hash of the name (use entire hash field). |
128 ASSERT(name->HasHashCode()); | 128 DCHECK(name->HasHashCode()); |
129 uint32_t field = name->hash_field(); | 129 uint32_t field = name->hash_field(); |
130 // Using only the low bits in 64-bit mode is unlikely to increase the | 130 // Using only the low bits in 64-bit mode is unlikely to increase the |
131 // risk of collision even if the heap is spread over an area larger than | 131 // risk of collision even if the heap is spread over an area larger than |
132 // 4Gb (and not at all if it isn't). | 132 // 4Gb (and not at all if it isn't). |
133 uint32_t map_low32bits = | 133 uint32_t map_low32bits = |
134 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map)); | 134 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map)); |
135 // We always set the in_loop bit to zero when generating the lookup code | 135 // We always set the in_loop bit to zero when generating the lookup code |
136 // so do it here too so the hash codes match. | 136 // so do it here too so the hash codes match. |
137 uint32_t iflags = | 137 uint32_t iflags = |
138 (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup); | 138 (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 return code->ic_state() == MONOMORPHIC ? Logger::LOAD_IC_TAG | 349 return code->ic_state() == MONOMORPHIC ? Logger::LOAD_IC_TAG |
350 : Logger::LOAD_POLYMORPHIC_IC_TAG; | 350 : Logger::LOAD_POLYMORPHIC_IC_TAG; |
351 } else if (kind() == Code::KEYED_LOAD_IC) { | 351 } else if (kind() == Code::KEYED_LOAD_IC) { |
352 return code->ic_state() == MONOMORPHIC | 352 return code->ic_state() == MONOMORPHIC |
353 ? Logger::KEYED_LOAD_IC_TAG | 353 ? Logger::KEYED_LOAD_IC_TAG |
354 : Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG; | 354 : Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG; |
355 } else if (kind() == Code::STORE_IC) { | 355 } else if (kind() == Code::STORE_IC) { |
356 return code->ic_state() == MONOMORPHIC ? Logger::STORE_IC_TAG | 356 return code->ic_state() == MONOMORPHIC ? Logger::STORE_IC_TAG |
357 : Logger::STORE_POLYMORPHIC_IC_TAG; | 357 : Logger::STORE_POLYMORPHIC_IC_TAG; |
358 } else { | 358 } else { |
359 ASSERT_EQ(Code::KEYED_STORE_IC, kind()); | 359 DCHECK_EQ(Code::KEYED_STORE_IC, kind()); |
360 return code->ic_state() == MONOMORPHIC | 360 return code->ic_state() == MONOMORPHIC |
361 ? Logger::KEYED_STORE_IC_TAG | 361 ? Logger::KEYED_STORE_IC_TAG |
362 : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; | 362 : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 const ExtraICState extra_ic_state_; | 366 const ExtraICState extra_ic_state_; |
367 }; | 367 }; |
368 | 368 |
369 | 369 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 public: | 635 public: |
636 explicit CallOptimization(LookupResult* lookup); | 636 explicit CallOptimization(LookupResult* lookup); |
637 | 637 |
638 explicit CallOptimization(Handle<JSFunction> function); | 638 explicit CallOptimization(Handle<JSFunction> function); |
639 | 639 |
640 bool is_constant_call() const { | 640 bool is_constant_call() const { |
641 return !constant_function_.is_null(); | 641 return !constant_function_.is_null(); |
642 } | 642 } |
643 | 643 |
644 Handle<JSFunction> constant_function() const { | 644 Handle<JSFunction> constant_function() const { |
645 ASSERT(is_constant_call()); | 645 DCHECK(is_constant_call()); |
646 return constant_function_; | 646 return constant_function_; |
647 } | 647 } |
648 | 648 |
649 bool is_simple_api_call() const { | 649 bool is_simple_api_call() const { |
650 return is_simple_api_call_; | 650 return is_simple_api_call_; |
651 } | 651 } |
652 | 652 |
653 Handle<FunctionTemplateInfo> expected_receiver_type() const { | 653 Handle<FunctionTemplateInfo> expected_receiver_type() const { |
654 ASSERT(is_simple_api_call()); | 654 DCHECK(is_simple_api_call()); |
655 return expected_receiver_type_; | 655 return expected_receiver_type_; |
656 } | 656 } |
657 | 657 |
658 Handle<CallHandlerInfo> api_call_info() const { | 658 Handle<CallHandlerInfo> api_call_info() const { |
659 ASSERT(is_simple_api_call()); | 659 DCHECK(is_simple_api_call()); |
660 return api_call_info_; | 660 return api_call_info_; |
661 } | 661 } |
662 | 662 |
663 enum HolderLookup { | 663 enum HolderLookup { |
664 kHolderNotFound, | 664 kHolderNotFound, |
665 kHolderIsReceiver, | 665 kHolderIsReceiver, |
666 kHolderFound | 666 kHolderFound |
667 }; | 667 }; |
668 Handle<JSObject> LookupHolderOfExpectedType( | 668 Handle<JSObject> LookupHolderOfExpectedType( |
669 Handle<Map> receiver_map, | 669 Handle<Map> receiver_map, |
(...skipping 13 matching lines...) Expand all Loading... |
683 Handle<JSFunction> constant_function_; | 683 Handle<JSFunction> constant_function_; |
684 bool is_simple_api_call_; | 684 bool is_simple_api_call_; |
685 Handle<FunctionTemplateInfo> expected_receiver_type_; | 685 Handle<FunctionTemplateInfo> expected_receiver_type_; |
686 Handle<CallHandlerInfo> api_call_info_; | 686 Handle<CallHandlerInfo> api_call_info_; |
687 }; | 687 }; |
688 | 688 |
689 | 689 |
690 } } // namespace v8::internal | 690 } } // namespace v8::internal |
691 | 691 |
692 #endif // V8_STUB_CACHE_H_ | 692 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |