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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 inline IC::State FeedbackToState(Handle<FixedArray> vector, | 345 inline IC::State FeedbackToState(Handle<FixedArray> vector, |
346 Handle<Smi> slot) const; | 346 Handle<Smi> slot) const; |
347 }; | 347 }; |
348 | 348 |
349 | 349 |
350 OStream& operator<<(OStream& os, const CallIC::State& s); | 350 OStream& operator<<(OStream& os, const CallIC::State& s); |
351 | 351 |
352 | 352 |
353 class LoadIC : public IC { | 353 class LoadIC : public IC { |
354 public: | 354 public: |
355 enum ParameterIndices { kReceiverIndex, kNameIndex, kParameterCount }; | |
356 static const Register ReceiverRegister(); | |
357 static const Register NameRegister(); | |
358 | |
359 // With flag vector-ics, there is an additional argument. And for calls from | |
360 // crankshaft, yet another. | |
361 static const Register SlotRegister(); | |
362 static const Register VectorRegister(); | |
363 | |
364 class State V8_FINAL BASE_EMBEDDED { | 355 class State V8_FINAL BASE_EMBEDDED { |
365 public: | 356 public: |
366 explicit State(ExtraICState extra_ic_state) : state_(extra_ic_state) {} | 357 explicit State(ExtraICState extra_ic_state) : state_(extra_ic_state) {} |
367 | 358 |
368 explicit State(ContextualMode mode) | 359 explicit State(ContextualMode mode) |
369 : state_(ContextualModeBits::encode(mode)) {} | 360 : state_(ContextualModeBits::encode(mode)) {} |
370 | 361 |
371 ExtraICState GetExtraICState() const { return state_; } | 362 ExtraICState GetExtraICState() const { return state_; } |
372 | 363 |
373 ContextualMode contextual_mode() const { | 364 ContextualMode contextual_mode() const { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 return StrictModeState::encode(flag); | 515 return StrictModeState::encode(flag); |
525 } | 516 } |
526 static StrictMode GetStrictMode(ExtraICState state) { | 517 static StrictMode GetStrictMode(ExtraICState state) { |
527 return StrictModeState::decode(state); | 518 return StrictModeState::decode(state); |
528 } | 519 } |
529 | 520 |
530 // For convenience, a statically declared encoding of strict mode extra | 521 // For convenience, a statically declared encoding of strict mode extra |
531 // IC state. | 522 // IC state. |
532 static const ExtraICState kStrictModeState = 1 << StrictModeState::kShift; | 523 static const ExtraICState kStrictModeState = 1 << StrictModeState::kShift; |
533 | 524 |
534 enum ParameterIndices { | |
535 kReceiverIndex, | |
536 kNameIndex, | |
537 kValueIndex, | |
538 kParameterCount | |
539 }; | |
540 static const Register ReceiverRegister(); | |
541 static const Register NameRegister(); | |
542 static const Register ValueRegister(); | |
543 | |
544 StoreIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) { | 525 StoreIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) { |
545 DCHECK(IsStoreStub()); | 526 DCHECK(IsStoreStub()); |
546 } | 527 } |
547 | 528 |
548 StrictMode strict_mode() const { | 529 StrictMode strict_mode() const { |
549 return StrictModeState::decode(extra_ic_state()); | 530 return StrictModeState::decode(extra_ic_state()); |
550 } | 531 } |
551 | 532 |
552 // Code generators for stub routines. Only called once at startup. | 533 // Code generators for stub routines. Only called once at startup. |
553 static void GenerateSlow(MacroAssembler* masm); | 534 static void GenerateSlow(MacroAssembler* masm); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 KeyedAccessStoreMode mode) { | 604 KeyedAccessStoreMode mode) { |
624 return StrictModeState::encode(flag) | | 605 return StrictModeState::encode(flag) | |
625 ExtraICStateKeyedAccessStoreMode::encode(mode); | 606 ExtraICStateKeyedAccessStoreMode::encode(mode); |
626 } | 607 } |
627 | 608 |
628 static KeyedAccessStoreMode GetKeyedAccessStoreMode( | 609 static KeyedAccessStoreMode GetKeyedAccessStoreMode( |
629 ExtraICState extra_state) { | 610 ExtraICState extra_state) { |
630 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); | 611 return ExtraICStateKeyedAccessStoreMode::decode(extra_state); |
631 } | 612 } |
632 | 613 |
633 // The map register isn't part of the normal call specification, but | |
634 // ElementsTransitionAndStoreStub, used in polymorphic keyed store | |
635 // stub implementations requires it to be initialized. | |
636 static const Register MapRegister(); | |
637 | |
638 KeyedStoreIC(FrameDepth depth, Isolate* isolate) : StoreIC(depth, isolate) { | 614 KeyedStoreIC(FrameDepth depth, Isolate* isolate) : StoreIC(depth, isolate) { |
639 DCHECK(target()->is_keyed_store_stub()); | 615 DCHECK(target()->is_keyed_store_stub()); |
640 } | 616 } |
641 | 617 |
642 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object, | 618 MUST_USE_RESULT MaybeHandle<Object> Store(Handle<Object> object, |
643 Handle<Object> name, | 619 Handle<Object> name, |
644 Handle<Object> value); | 620 Handle<Object> value); |
645 | 621 |
646 // Code generators for stub routines. Only called once at startup. | 622 // Code generators for stub routines. Only called once at startup. |
647 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } | 623 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 | 929 |
954 // Support functions for interceptor handlers. | 930 // Support functions for interceptor handlers. |
955 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); | 931 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); |
956 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); | 932 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); |
957 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); | 933 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); |
958 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); | 934 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); |
959 } | 935 } |
960 } // namespace v8::internal | 936 } // namespace v8::internal |
961 | 937 |
962 #endif // V8_IC_H_ | 938 #endif // V8_IC_H_ |
OLD | NEW |