Chromium Code Reviews| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 InlineCacheState state = code->ic_state(); | 132 InlineCacheState state = code->ic_state(); |
| 133 return state == UNINITIALIZED || state == PREMONOMORPHIC; | 133 return state == UNINITIALIZED || state == PREMONOMORPHIC; |
| 134 } | 134 } |
| 135 | 135 |
| 136 // Utility functions to convert maps to types and back. There are two special | 136 // Utility functions to convert maps to types and back. There are two special |
| 137 // cases: | 137 // cases: |
| 138 // - The heap_number_map is used as a marker which includes heap numbers as | 138 // - The heap_number_map is used as a marker which includes heap numbers as |
| 139 // well as smis. | 139 // well as smis. |
| 140 // - The oddball map is only used for booleans. | 140 // - The oddball map is only used for booleans. |
| 141 static Handle<Map> TypeToMap(HeapType* type, Isolate* isolate); | 141 static Handle<Map> TypeToMap(HeapType* type, Isolate* isolate); |
| 142 static Handle<HeapType> MapToType(Handle<Map> map); | 142 template<class T> |
|
rossberg
2014/02/03 16:54:05
Same here.
| |
| 143 static Handle<HeapType> CurrentTypeOf( | 143 static typename T::TypeHandle MapToType(Handle<Map> map, |
| 144 Handle<Object> object, Isolate* isolate); | 144 typename T::Region* region) { |
| 145 if (map->instance_type() == HEAP_NUMBER_TYPE) { | |
| 146 return T::Number(region); | |
| 147 } else if (map->instance_type() == ODDBALL_TYPE) { | |
| 148 // The only oddballs that can be recorded in ICs are booleans. | |
| 149 return T::Boolean(region); | |
| 150 } else { | |
| 151 return T::Class(map, region); | |
| 152 } | |
| 153 } | |
| 154 | |
| 155 static Handle<HeapType> CurrentTypeOf(Handle<Object> object, | |
| 156 Isolate* isolate); | |
| 145 | 157 |
| 146 protected: | 158 protected: |
| 147 // Get the call-site target; used for determining the state. | 159 // Get the call-site target; used for determining the state. |
| 148 Handle<Code> target() const { return target_; } | 160 Handle<Code> target() const { return target_; } |
| 149 | 161 |
| 150 Address fp() const { return fp_; } | 162 Address fp() const { return fp_; } |
| 151 Address pc() const { return *pc_address_; } | 163 Address pc() const { return *pc_address_; } |
| 152 Isolate* isolate() const { return isolate_; } | 164 Isolate* isolate() const { return isolate_; } |
| 153 | 165 |
| 154 #ifdef ENABLE_DEBUGGER_SUPPORT | 166 #ifdef ENABLE_DEBUGGER_SUPPORT |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 889 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); | 901 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); |
| 890 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); | 902 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); |
| 891 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite); | 903 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite); |
| 892 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 904 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
| 893 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 905 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
| 894 | 906 |
| 895 | 907 |
| 896 } } // namespace v8::internal | 908 } } // namespace v8::internal |
| 897 | 909 |
| 898 #endif // V8_IC_H_ | 910 #endif // V8_IC_H_ |
| OLD | NEW |