| 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_IC_H_ | 5 #ifndef V8_IC_H_ |
| 6 #define V8_IC_H_ | 6 #define V8_IC_H_ |
| 7 | 7 |
| 8 #include "src/macro-assembler.h" | 8 #include "src/macro-assembler.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 code->VerifyEmbeddedObjectsDependency(); | 156 code->VerifyEmbeddedObjectsDependency(); |
| 157 #endif | 157 #endif |
| 158 SetTargetAtAddress(address(), code, constant_pool()); | 158 SetTargetAtAddress(address(), code, constant_pool()); |
| 159 target_set_ = true; | 159 target_set_ = true; |
| 160 } | 160 } |
| 161 | 161 |
| 162 bool is_target_set() { return target_set_; } | 162 bool is_target_set() { return target_set_; } |
| 163 | 163 |
| 164 char TransitionMarkFromState(IC::State state); | 164 char TransitionMarkFromState(IC::State state); |
| 165 void TraceIC(const char* type, Handle<Object> name); | 165 void TraceIC(const char* type, Handle<Object> name); |
| 166 void TraceIC(const char* type, Handle<Object> name, State old_state, |
| 167 State new_state); |
| 166 | 168 |
| 167 MaybeHandle<Object> TypeError(const char* type, | 169 MaybeHandle<Object> TypeError(const char* type, |
| 168 Handle<Object> object, | 170 Handle<Object> object, |
| 169 Handle<Object> key); | 171 Handle<Object> key); |
| 170 MaybeHandle<Object> ReferenceError(const char* type, Handle<String> name); | 172 MaybeHandle<Object> ReferenceError(const char* type, Handle<String> name); |
| 171 | 173 |
| 172 // Access the target code for the given IC address. | 174 // Access the target code for the given IC address. |
| 173 static inline Code* GetTargetAtAddress(Address address, | 175 static inline Code* GetTargetAtAddress(Address address, |
| 174 ConstantPoolArray* constant_pool); | 176 ConstantPoolArray* constant_pool); |
| 175 static inline void SetTargetAtAddress(Address address, | 177 static inline void SetTargetAtAddress(Address address, |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 enum CallType { METHOD, FUNCTION }; | 330 enum CallType { METHOD, FUNCTION }; |
| 329 | 331 |
| 330 class State V8_FINAL BASE_EMBEDDED { | 332 class State V8_FINAL BASE_EMBEDDED { |
| 331 public: | 333 public: |
| 332 explicit State(ExtraICState extra_ic_state); | 334 explicit State(ExtraICState extra_ic_state); |
| 333 | 335 |
| 334 State(int argc, CallType call_type) | 336 State(int argc, CallType call_type) |
| 335 : argc_(argc), call_type_(call_type) { | 337 : argc_(argc), call_type_(call_type) { |
| 336 } | 338 } |
| 337 | 339 |
| 338 InlineCacheState GetICState() const { return ::v8::internal::GENERIC; } | |
| 339 | |
| 340 ExtraICState GetExtraICState() const; | 340 ExtraICState GetExtraICState() const; |
| 341 | 341 |
| 342 static void GenerateAheadOfTime( | 342 static void GenerateAheadOfTime( |
| 343 Isolate*, void (*Generate)(Isolate*, const State&)); | 343 Isolate*, void (*Generate)(Isolate*, const State&)); |
| 344 | 344 |
| 345 int arg_count() const { return argc_; } | 345 int arg_count() const { return argc_; } |
| 346 CallType call_type() const { return call_type_; } | 346 CallType call_type() const { return call_type_; } |
| 347 | 347 |
| 348 bool CallAsMethod() const { return call_type_ == METHOD; } | 348 bool CallAsMethod() const { return call_type_ == METHOD; } |
| 349 | 349 |
| 350 private: | 350 private: |
| 351 class ArgcBits: public BitField<int, 0, Code::kArgumentsBits> {}; | 351 class ArgcBits: public BitField<int, 0, Code::kArgumentsBits> {}; |
| 352 class CallTypeBits: public BitField<CallType, Code::kArgumentsBits, 1> {}; | 352 class CallTypeBits: public BitField<CallType, Code::kArgumentsBits, 1> {}; |
| 353 | 353 |
| 354 const int argc_; | 354 const int argc_; |
| 355 const CallType call_type_; | 355 const CallType call_type_; |
| 356 }; | 356 }; |
| 357 | 357 |
| 358 explicit CallIC(Isolate* isolate) | 358 explicit CallIC(Isolate* isolate) |
| 359 : IC(EXTRA_CALL_FRAME, isolate) { | 359 : IC(EXTRA_CALL_FRAME, isolate) { |
| 360 } | 360 } |
| 361 | 361 |
| 362 void PatchMegamorphic(Handle<FixedArray> vector, Handle<Smi> slot); | 362 void PatchMegamorphic(Handle<Object> function, Handle<FixedArray> vector, |
| 363 Handle<Smi> slot); |
| 363 | 364 |
| 364 void HandleMiss(Handle<Object> receiver, | 365 void HandleMiss(Handle<Object> receiver, |
| 365 Handle<Object> function, | 366 Handle<Object> function, |
| 366 Handle<FixedArray> vector, | 367 Handle<FixedArray> vector, |
| 367 Handle<Smi> slot); | 368 Handle<Smi> slot); |
| 368 | 369 |
| 369 // Returns true if a custom handler was installed. | 370 // Returns true if a custom handler was installed. |
| 370 bool DoCustomHandler(Handle<Object> receiver, | 371 bool DoCustomHandler(Handle<Object> receiver, |
| 371 Handle<Object> function, | 372 Handle<Object> function, |
| 372 Handle<FixedArray> vector, | 373 Handle<FixedArray> vector, |
| 373 Handle<Smi> slot, | 374 Handle<Smi> slot, |
| 374 const State& state); | 375 const State& state); |
| 375 | 376 |
| 376 // Code generator routines. | 377 // Code generator routines. |
| 377 static Handle<Code> initialize_stub(Isolate* isolate, | 378 static Handle<Code> initialize_stub(Isolate* isolate, |
| 378 int argc, | 379 int argc, |
| 379 CallType call_type); | 380 CallType call_type); |
| 380 | 381 |
| 381 static void Clear(Isolate* isolate, Address address, Code* target, | 382 static void Clear(Isolate* isolate, Address address, Code* target, |
| 382 ConstantPoolArray* constant_pool); | 383 ConstantPoolArray* constant_pool); |
| 383 | 384 |
| 384 private: | 385 private: |
| 385 void UpdateTypeFeedbackInfo(Object* old_feedback, Object* new_feedback); | 386 inline IC::State FeedbackToState(Handle<FixedArray> vector, |
| 386 inline IC::State FeedbackObjectToState(Object* feedback) const; | 387 Handle<Smi> slot) const; |
| 387 }; | 388 }; |
| 388 | 389 |
| 389 | 390 |
| 390 OStream& operator<<(OStream& os, const CallIC::State& s); | 391 OStream& operator<<(OStream& os, const CallIC::State& s); |
| 391 | 392 |
| 392 | 393 |
| 393 class LoadIC: public IC { | 394 class LoadIC: public IC { |
| 394 public: | 395 public: |
| 395 enum ParameterIndices { | 396 enum ParameterIndices { |
| 396 kReceiverIndex, | 397 kReceiverIndex, |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); | 1040 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); |
| 1040 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); | 1041 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); |
| 1041 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); | 1042 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); |
| 1042 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); | 1043 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); |
| 1043 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); | 1044 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); |
| 1044 | 1045 |
| 1045 | 1046 |
| 1046 } } // namespace v8::internal | 1047 } } // namespace v8::internal |
| 1047 | 1048 |
| 1048 #endif // V8_IC_H_ | 1049 #endif // V8_IC_H_ |
| OLD | NEW |