| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 static void Clear(Isolate* isolate, Address address, Code* target, | 367 static void Clear(Isolate* isolate, Address address, Code* target, |
| 368 ConstantPoolArray* constant_pool); | 368 ConstantPoolArray* constant_pool); |
| 369 }; | 369 }; |
| 370 | 370 |
| 371 | 371 |
| 372 OStream& operator<<(OStream& os, const CallIC::State& s); | 372 OStream& operator<<(OStream& os, const CallIC::State& s); |
| 373 | 373 |
| 374 | 374 |
| 375 class LoadIC: public IC { | 375 class LoadIC: public IC { |
| 376 public: | 376 public: |
| 377 // ExtraICState bits | |
| 378 class ContextualModeBits: public BitField<ContextualMode, 0, 1> {}; | |
| 379 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); | |
| 380 | 377 |
| 381 enum ParameterIndices { | 378 enum ParameterIndices { |
| 382 kReceiverIndex, | 379 kReceiverIndex, |
| 383 kNameIndex, | 380 kNameIndex, |
| 384 kParameterCount | 381 kParameterCount |
| 385 }; | 382 }; |
| 386 static const Register ReceiverRegister(); | 383 static const Register ReceiverRegister(); |
| 387 static const Register NameRegister(); | 384 static const Register NameRegister(); |
| 388 | 385 |
| 389 // With flag vector-ics, there is an additional argument. And for calls from | 386 // With flag vector-ics, there is an additional argument. And for calls from |
| 390 // crankshaft, yet another. | 387 // crankshaft, yet another. |
| 391 static const Register SlotRegister(); | 388 static const Register SlotRegister(); |
| 392 static const Register VectorRegister(); | 389 static const Register VectorRegister(); |
| 393 | 390 |
| 391 class State V8_FINAL BASE_EMBEDDED { |
| 392 public: |
| 393 explicit State(ExtraICState extra_ic_state) |
| 394 : state_(extra_ic_state) {} |
| 395 |
| 396 explicit State(ContextualMode mode) |
| 397 : state_(ContextualModeBits::encode(mode)) {} |
| 398 |
| 399 ExtraICState GetExtraICState() const { return state_; } |
| 400 |
| 401 ContextualMode contextual_mode() const { |
| 402 return ContextualModeBits::decode(state_); |
| 403 } |
| 404 |
| 405 private: |
| 406 class ContextualModeBits: public BitField<ContextualMode, 0, 1> {}; |
| 407 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); |
| 408 |
| 409 const ExtraICState state_; |
| 410 }; |
| 411 |
| 394 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) { | 412 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) { |
| 395 return ContextualModeBits::encode(contextual_mode); | 413 return State(contextual_mode).GetExtraICState(); |
| 396 } | 414 } |
| 397 | 415 |
| 398 static ContextualMode GetContextualMode(ExtraICState state) { | 416 static ContextualMode GetContextualMode(ExtraICState state) { |
| 399 return ContextualModeBits::decode(state); | 417 return State(state).contextual_mode(); |
| 400 } | 418 } |
| 401 | 419 |
| 402 ContextualMode contextual_mode() const { | 420 ContextualMode contextual_mode() const { |
| 403 return ContextualModeBits::decode(extra_ic_state()); | 421 return GetContextualMode(extra_ic_state()); |
| 404 } | 422 } |
| 405 | 423 |
| 406 explicit LoadIC(FrameDepth depth, Isolate* isolate) | 424 explicit LoadIC(FrameDepth depth, Isolate* isolate) |
| 407 : IC(depth, isolate) { | 425 : IC(depth, isolate) { |
| 408 ASSERT(IsLoadStub()); | 426 ASSERT(IsLoadStub()); |
| 409 } | 427 } |
| 410 | 428 |
| 411 // Returns if this IC is for contextual (no explicit receiver) | 429 // Returns if this IC is for contextual (no explicit receiver) |
| 412 // access to properties. | 430 // access to properties. |
| 413 bool IsUndeclaredGlobal(Handle<Object> receiver) { | 431 bool IsUndeclaredGlobal(Handle<Object> receiver) { |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); | 1026 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); |
| 1009 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); | 1027 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); |
| 1010 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); | 1028 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); |
| 1011 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); | 1029 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); |
| 1012 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); | 1030 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); |
| 1013 | 1031 |
| 1014 | 1032 |
| 1015 } } // namespace v8::internal | 1033 } } // namespace v8::internal |
| 1016 | 1034 |
| 1017 #endif // V8_IC_H_ | 1035 #endif // V8_IC_H_ |
| OLD | NEW |