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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 V(KeyedStoreElement) \ | 83 V(KeyedStoreElement) \ |
84 V(DebuggerStatement) \ | 84 V(DebuggerStatement) \ |
85 V(NameDictionaryLookup) \ | 85 V(NameDictionaryLookup) \ |
86 V(ElementsTransitionAndStore) \ | 86 V(ElementsTransitionAndStore) \ |
87 V(TransitionElementsKind) \ | 87 V(TransitionElementsKind) \ |
88 V(StoreArrayLiteralElement) \ | 88 V(StoreArrayLiteralElement) \ |
89 V(StubFailureTrampoline) \ | 89 V(StubFailureTrampoline) \ |
90 V(ArrayConstructor) \ | 90 V(ArrayConstructor) \ |
91 V(InternalArrayConstructor) \ | 91 V(InternalArrayConstructor) \ |
92 V(ProfileEntryHook) \ | 92 V(ProfileEntryHook) \ |
93 V(StoreGlobal) \ | |
94 /* IC Handler stubs */ \ | 93 /* IC Handler stubs */ \ |
95 V(LoadField) \ | 94 V(LoadField) \ |
96 V(KeyedLoadField) | 95 V(KeyedLoadField) |
97 | 96 |
98 // List of code stubs only used on ARM platforms. | 97 // List of code stubs only used on ARM platforms. |
99 #if V8_TARGET_ARCH_ARM | 98 #if V8_TARGET_ARCH_ARM |
100 #define CODE_STUB_LIST_ARM(V) \ | 99 #define CODE_STUB_LIST_ARM(V) \ |
101 V(GetProperty) \ | 100 V(GetProperty) \ |
102 V(SetProperty) \ | 101 V(SetProperty) \ |
103 V(InvokeBuiltin) \ | 102 V(InvokeBuiltin) \ |
(...skipping 30 matching lines...) Expand all Loading... |
134 #define DEF_ENUM(name) name, | 133 #define DEF_ENUM(name) name, |
135 CODE_STUB_LIST(DEF_ENUM) | 134 CODE_STUB_LIST(DEF_ENUM) |
136 #undef DEF_ENUM | 135 #undef DEF_ENUM |
137 NoCache, // marker for stubs that do custom caching | 136 NoCache, // marker for stubs that do custom caching |
138 NUMBER_OF_IDS | 137 NUMBER_OF_IDS |
139 }; | 138 }; |
140 | 139 |
141 // Retrieve the code for the stub. Generate the code if needed. | 140 // Retrieve the code for the stub. Generate the code if needed. |
142 Handle<Code> GetCode(Isolate* isolate); | 141 Handle<Code> GetCode(Isolate* isolate); |
143 | 142 |
144 // Retrieve the code for the stub, make and return a copy of the code. | |
145 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate); | |
146 static Major MajorKeyFromKey(uint32_t key) { | 143 static Major MajorKeyFromKey(uint32_t key) { |
147 return static_cast<Major>(MajorKeyBits::decode(key)); | 144 return static_cast<Major>(MajorKeyBits::decode(key)); |
148 } | 145 } |
149 static int MinorKeyFromKey(uint32_t key) { | 146 static int MinorKeyFromKey(uint32_t key) { |
150 return MinorKeyBits::decode(key); | 147 return MinorKeyBits::decode(key); |
151 } | 148 } |
152 | 149 |
153 // Gets the major key from a code object that is a code stub or binary op IC. | 150 // Gets the major key from a code object that is a code stub or binary op IC. |
154 static Major GetMajorKey(Code* code_stub) { | 151 static Major GetMajorKey(Code* code_stub) { |
155 return static_cast<Major>(code_stub->major_key()); | 152 return static_cast<Major>(code_stub->major_key()); |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 | 512 |
516 void Generate(MacroAssembler* masm); | 513 void Generate(MacroAssembler* masm); |
517 | 514 |
518 private: | 515 private: |
519 int slots_; | 516 int slots_; |
520 | 517 |
521 Major MajorKey() { return FastNewBlockContext; } | 518 Major MajorKey() { return FastNewBlockContext; } |
522 int MinorKey() { return slots_; } | 519 int MinorKey() { return slots_; } |
523 }; | 520 }; |
524 | 521 |
525 class StoreGlobalStub : public HydrogenCodeStub { | |
526 public: | |
527 StoreGlobalStub(StrictModeFlag strict_mode, bool is_constant) { | |
528 bit_field_ = StrictModeBits::encode(strict_mode) | | |
529 IsConstantBits::encode(is_constant); | |
530 } | |
531 | |
532 virtual Handle<Code> GenerateCode(); | |
533 | |
534 virtual void InitializeInterfaceDescriptor( | |
535 Isolate* isolate, | |
536 CodeStubInterfaceDescriptor* descriptor); | |
537 | |
538 virtual Code::Kind GetCodeKind() const { return Code::STORE_IC; } | |
539 virtual InlineCacheState GetICState() { return MONOMORPHIC; } | |
540 virtual Code::ExtraICState GetExtraICState() { return bit_field_; } | |
541 | |
542 bool is_constant() { | |
543 return IsConstantBits::decode(bit_field_); | |
544 } | |
545 void set_is_constant(bool value) { | |
546 bit_field_ = IsConstantBits::update(bit_field_, value); | |
547 } | |
548 | |
549 Representation representation() { | |
550 return Representation::FromKind(RepresentationBits::decode(bit_field_)); | |
551 } | |
552 void set_representation(Representation r) { | |
553 bit_field_ = RepresentationBits::update(bit_field_, r.kind()); | |
554 } | |
555 | |
556 private: | |
557 virtual int NotMissMinorKey() { return GetExtraICState(); } | |
558 Major MajorKey() { return StoreGlobal; } | |
559 | |
560 class StrictModeBits: public BitField<StrictModeFlag, 0, 1> {}; | |
561 class IsConstantBits: public BitField<bool, 1, 1> {}; | |
562 class RepresentationBits: public BitField<Representation::Kind, 2, 8> {}; | |
563 | |
564 int bit_field_; | |
565 | |
566 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); | |
567 }; | |
568 | |
569 | 522 |
570 class FastCloneShallowArrayStub : public HydrogenCodeStub { | 523 class FastCloneShallowArrayStub : public HydrogenCodeStub { |
571 public: | 524 public: |
572 // Maximum length of copied elements array. | 525 // Maximum length of copied elements array. |
573 static const int kMaximumClonedLength = 8; | 526 static const int kMaximumClonedLength = 8; |
574 enum Mode { | 527 enum Mode { |
575 CLONE_ELEMENTS, | 528 CLONE_ELEMENTS, |
576 CLONE_DOUBLE_ELEMENTS, | 529 CLONE_DOUBLE_ELEMENTS, |
577 COPY_ON_WRITE_ELEMENTS, | 530 COPY_ON_WRITE_ELEMENTS, |
578 CLONE_ANY_ELEMENTS, | 531 CLONE_ANY_ELEMENTS, |
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2223 int MinorKey() { return 0; } | 2176 int MinorKey() { return 0; } |
2224 | 2177 |
2225 void Generate(MacroAssembler* masm); | 2178 void Generate(MacroAssembler* masm); |
2226 | 2179 |
2227 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2180 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
2228 }; | 2181 }; |
2229 | 2182 |
2230 } } // namespace v8::internal | 2183 } } // namespace v8::internal |
2231 | 2184 |
2232 #endif // V8_CODE_STUBS_H_ | 2185 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |