| 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 22 matching lines...) Expand all Loading... |
| 33 #include "globals.h" | 33 #include "globals.h" |
| 34 #include "codegen.h" | 34 #include "codegen.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 // List of code stubs used on all platforms. | 39 // List of code stubs used on all platforms. |
| 40 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 40 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
| 41 V(CallFunction) \ | 41 V(CallFunction) \ |
| 42 V(CallConstruct) \ | 42 V(CallConstruct) \ |
| 43 V(UnaryOp) \ | |
| 44 V(BinaryOp) \ | 43 V(BinaryOp) \ |
| 45 V(StringAdd) \ | 44 V(StringAdd) \ |
| 46 V(SubString) \ | 45 V(SubString) \ |
| 47 V(StringCompare) \ | 46 V(StringCompare) \ |
| 48 V(Compare) \ | 47 V(Compare) \ |
| 49 V(CompareIC) \ | 48 V(CompareIC) \ |
| 50 V(CompareNilIC) \ | 49 V(CompareNilIC) \ |
| 51 V(MathPow) \ | 50 V(MathPow) \ |
| 52 V(StringLength) \ | 51 V(StringLength) \ |
| 53 V(FunctionPrototype) \ | 52 V(FunctionPrototype) \ |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 class StrictModeBits: public BitField<StrictModeFlag, 0, 1> {}; | 585 class StrictModeBits: public BitField<StrictModeFlag, 0, 1> {}; |
| 587 class IsConstantBits: public BitField<bool, 1, 1> {}; | 586 class IsConstantBits: public BitField<bool, 1, 1> {}; |
| 588 class RepresentationBits: public BitField<Representation::Kind, 2, 8> {}; | 587 class RepresentationBits: public BitField<Representation::Kind, 2, 8> {}; |
| 589 | 588 |
| 590 int bit_field_; | 589 int bit_field_; |
| 591 | 590 |
| 592 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); | 591 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); |
| 593 }; | 592 }; |
| 594 | 593 |
| 595 | 594 |
| 596 class UnaryOpStub : public HydrogenCodeStub { | |
| 597 public: | |
| 598 // Stub without type info available -> construct uninitialized | |
| 599 explicit UnaryOpStub(Token::Value operation) | |
| 600 : HydrogenCodeStub(UNINITIALIZED), operation_(operation) { } | |
| 601 explicit UnaryOpStub(Code::ExtraICState ic_state) : | |
| 602 state_(StateBits::decode(ic_state)), | |
| 603 operation_(OperatorBits::decode(ic_state)) { } | |
| 604 | |
| 605 virtual void InitializeInterfaceDescriptor( | |
| 606 Isolate* isolate, | |
| 607 CodeStubInterfaceDescriptor* descriptor); | |
| 608 | |
| 609 virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; } | |
| 610 virtual InlineCacheState GetICState() { | |
| 611 if (state_.Contains(GENERIC)) { | |
| 612 return MEGAMORPHIC; | |
| 613 } else if (state_.IsEmpty()) { | |
| 614 return PREMONOMORPHIC; | |
| 615 } else { | |
| 616 return MONOMORPHIC; | |
| 617 } | |
| 618 } | |
| 619 virtual Code::ExtraICState GetExtraICState() { | |
| 620 return OperatorBits::encode(operation_) | | |
| 621 StateBits::encode(state_.ToIntegral()); | |
| 622 } | |
| 623 | |
| 624 Token::Value operation() { return operation_; } | |
| 625 Handle<JSFunction> ToJSFunction(Isolate* isolate); | |
| 626 Builtins::JavaScript ToJSBuiltin(); | |
| 627 | |
| 628 void UpdateStatus(Handle<Object> object); | |
| 629 MaybeObject* Result(Handle<Object> object, Isolate* isolate); | |
| 630 Handle<Code> GenerateCode(); | |
| 631 Handle<Type> GetType(Isolate* isolate); | |
| 632 | |
| 633 protected: | |
| 634 void PrintState(StringStream* stream); | |
| 635 void PrintBaseName(StringStream* stream); | |
| 636 | |
| 637 private: | |
| 638 enum UnaryOpType { | |
| 639 SMI, | |
| 640 HEAP_NUMBER, | |
| 641 GENERIC, | |
| 642 NUMBER_OF_TYPES | |
| 643 }; | |
| 644 | |
| 645 class State : public EnumSet<UnaryOpType, byte> { | |
| 646 public: | |
| 647 State() : EnumSet<UnaryOpType, byte>() { } | |
| 648 explicit State(byte bits) : EnumSet<UnaryOpType, byte>(bits) { } | |
| 649 void Print(StringStream* stream) const; | |
| 650 }; | |
| 651 | |
| 652 class StateBits : public BitField<int, 0, NUMBER_OF_TYPES> { }; | |
| 653 class OperatorBits : public BitField<Token::Value, NUMBER_OF_TYPES, 8> { }; | |
| 654 | |
| 655 State state_; | |
| 656 Token::Value operation_; | |
| 657 | |
| 658 virtual CodeStub::Major MajorKey() { return UnaryOp; } | |
| 659 virtual int NotMissMinorKey() { return GetExtraICState(); } | |
| 660 }; | |
| 661 | |
| 662 | |
| 663 class FastCloneShallowArrayStub : public HydrogenCodeStub { | 595 class FastCloneShallowArrayStub : public HydrogenCodeStub { |
| 664 public: | 596 public: |
| 665 // Maximum length of copied elements array. | 597 // Maximum length of copied elements array. |
| 666 static const int kMaximumClonedLength = 8; | 598 static const int kMaximumClonedLength = 8; |
| 667 enum Mode { | 599 enum Mode { |
| 668 CLONE_ELEMENTS, | 600 CLONE_ELEMENTS, |
| 669 CLONE_DOUBLE_ELEMENTS, | 601 CLONE_DOUBLE_ELEMENTS, |
| 670 COPY_ON_WRITE_ELEMENTS, | 602 COPY_ON_WRITE_ELEMENTS, |
| 671 CLONE_ANY_ELEMENTS, | 603 CLONE_ANY_ELEMENTS, |
| 672 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS | 604 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS |
| (...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2375 int MinorKey() { return 0; } | 2307 int MinorKey() { return 0; } |
| 2376 | 2308 |
| 2377 void Generate(MacroAssembler* masm); | 2309 void Generate(MacroAssembler* masm); |
| 2378 | 2310 |
| 2379 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2311 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 2380 }; | 2312 }; |
| 2381 | 2313 |
| 2382 } } // namespace v8::internal | 2314 } } // namespace v8::internal |
| 2383 | 2315 |
| 2384 #endif // V8_CODE_STUBS_H_ | 2316 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |