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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 state_ = MONOMORPHIC_PROTOTYPE_FAILURE; | 117 state_ = MONOMORPHIC_PROTOTYPE_FAILURE; |
118 } | 118 } |
119 | 119 |
120 // Clear the inline cache to initial state. | 120 // Clear the inline cache to initial state. |
121 static void Clear(Isolate* isolate, Address address); | 121 static void Clear(Isolate* isolate, Address address); |
122 | 122 |
123 // Returns if this IC is for contextual (no explicit receiver) | 123 // Returns if this IC is for contextual (no explicit receiver) |
124 // access to properties. | 124 // access to properties. |
125 bool IsUndeclaredGlobal(Handle<Object> receiver) { | 125 bool IsUndeclaredGlobal(Handle<Object> receiver) { |
126 if (receiver->IsGlobalObject()) { | 126 if (receiver->IsGlobalObject()) { |
127 return IsContextual(); | 127 return IsCallStub() || IsContextual(); |
128 } else { | 128 } else { |
129 ASSERT(!IsContextual()); | 129 ASSERT(!IsContextual()); |
130 return false; | 130 return false; |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 #ifdef DEBUG | 134 #ifdef DEBUG |
135 bool IsLoadStub() { | 135 bool IsLoadStub() { |
136 return target()->is_load_stub() || target()->is_keyed_load_stub(); | 136 return target()->is_load_stub() || target()->is_keyed_load_stub(); |
137 } | 137 } |
138 | 138 |
139 bool IsStoreStub() { | 139 bool IsStoreStub() { |
140 return target()->is_store_stub() || target()->is_keyed_store_stub(); | 140 return target()->is_store_stub() || target()->is_keyed_store_stub(); |
141 } | 141 } |
142 | 142 |
| 143 #endif |
143 bool IsCallStub() { | 144 bool IsCallStub() { |
144 return target()->is_call_stub() || target()->is_keyed_call_stub(); | 145 return target()->is_call_stub() || target()->is_keyed_call_stub(); |
145 } | 146 } |
146 #endif | |
147 | 147 |
148 // Determines which map must be used for keeping the code stub. | 148 // Determines which map must be used for keeping the code stub. |
149 // These methods should not be called with undefined or null. | 149 // These methods should not be called with undefined or null. |
150 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object); | 150 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object); |
151 // TODO(verwaest): This currently returns a HeapObject rather than JSObject* | 151 // TODO(verwaest): This currently returns a HeapObject rather than JSObject* |
152 // since loading the IC for loading the length from strings are stored on | 152 // since loading the IC for loading the length from strings are stored on |
153 // the string map directly, rather than on the JSObject-typed prototype. | 153 // the string map directly, rather than on the JSObject-typed prototype. |
154 static inline HeapObject* GetCodeCacheHolder(Isolate* isolate, | 154 static inline HeapObject* GetCodeCacheHolder(Isolate* isolate, |
155 Object* object, | 155 Object* object, |
156 InlineCacheHolderFlag holder); | 156 InlineCacheHolderFlag holder); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 316 |
317 enum StringStubFeedback { | 317 enum StringStubFeedback { |
318 DEFAULT_STRING_STUB = 0, | 318 DEFAULT_STRING_STUB = 0, |
319 STRING_INDEX_OUT_OF_BOUNDS = 1 | 319 STRING_INDEX_OUT_OF_BOUNDS = 1 |
320 }; | 320 }; |
321 | 321 |
322 | 322 |
323 class CallICBase: public IC { | 323 class CallICBase: public IC { |
324 public: | 324 public: |
325 // ExtraICState bits | 325 // ExtraICState bits |
326 class StringStubState: public BitField<StringStubFeedback, 1, 1> {}; | 326 class StringStubState: public BitField<StringStubFeedback, 0, 1> {}; |
327 static ExtraICState ComputeExtraICState(ContextualMode mode, | 327 static ExtraICState ComputeExtraICState(StringStubFeedback feedback) { |
328 StringStubFeedback feedback) { | 328 return StringStubState::encode(feedback); |
329 return Contextual::encode(mode) | StringStubState::encode(feedback); | |
330 } | 329 } |
331 | 330 |
332 // Returns a JSFunction or a Failure. | 331 // Returns a JSFunction or a Failure. |
333 MUST_USE_RESULT MaybeObject* LoadFunction(Handle<Object> object, | 332 MUST_USE_RESULT MaybeObject* LoadFunction(Handle<Object> object, |
334 Handle<String> name); | 333 Handle<String> name); |
335 | 334 |
336 protected: | 335 protected: |
337 CallICBase(Code::Kind kind, Isolate* isolate) | 336 CallICBase(Code::Kind kind, Isolate* isolate) |
338 : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {} | 337 : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {} |
339 | 338 |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); | 1024 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); |
1026 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); | 1025 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_Miss); |
1027 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite); | 1026 DECLARE_RUNTIME_FUNCTION(MaybeObject*, BinaryOpIC_MissWithAllocationSite); |
1028 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 1027 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
1029 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 1028 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
1030 | 1029 |
1031 | 1030 |
1032 } } // namespace v8::internal | 1031 } } // namespace v8::internal |
1033 | 1032 |
1034 #endif // V8_IC_H_ | 1033 #endif // V8_IC_H_ |
OLD | NEW |