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) \ |
93 /* IC Handler stubs */ \ | 94 /* IC Handler stubs */ \ |
94 V(LoadField) \ | 95 V(LoadField) \ |
95 V(KeyedLoadField) | 96 V(KeyedLoadField) |
96 | 97 |
97 // List of code stubs only used on ARM platforms. | 98 // List of code stubs only used on ARM platforms. |
98 #ifdef V8_TARGET_ARCH_ARM | 99 #ifdef V8_TARGET_ARCH_ARM |
99 #define CODE_STUB_LIST_ARM(V) \ | 100 #define CODE_STUB_LIST_ARM(V) \ |
100 V(GetProperty) \ | 101 V(GetProperty) \ |
101 V(SetProperty) \ | 102 V(SetProperty) \ |
102 V(InvokeBuiltin) \ | 103 V(InvokeBuiltin) \ |
(...skipping 30 matching lines...) Expand all Loading... |
133 #define DEF_ENUM(name) name, | 134 #define DEF_ENUM(name) name, |
134 CODE_STUB_LIST(DEF_ENUM) | 135 CODE_STUB_LIST(DEF_ENUM) |
135 #undef DEF_ENUM | 136 #undef DEF_ENUM |
136 NoCache, // marker for stubs that do custom caching | 137 NoCache, // marker for stubs that do custom caching |
137 NUMBER_OF_IDS | 138 NUMBER_OF_IDS |
138 }; | 139 }; |
139 | 140 |
140 // Retrieve the code for the stub. Generate the code if needed. | 141 // Retrieve the code for the stub. Generate the code if needed. |
141 Handle<Code> GetCode(Isolate* isolate); | 142 Handle<Code> GetCode(Isolate* isolate); |
142 | 143 |
| 144 // Retrieve the code for the stub, make and return a copy of the code. |
| 145 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate); |
143 static Major MajorKeyFromKey(uint32_t key) { | 146 static Major MajorKeyFromKey(uint32_t key) { |
144 return static_cast<Major>(MajorKeyBits::decode(key)); | 147 return static_cast<Major>(MajorKeyBits::decode(key)); |
145 } | 148 } |
146 static int MinorKeyFromKey(uint32_t key) { | 149 static int MinorKeyFromKey(uint32_t key) { |
147 return MinorKeyBits::decode(key); | 150 return MinorKeyBits::decode(key); |
148 } | 151 } |
149 | 152 |
150 // Gets the major key from a code object that is a code stub or binary op IC. | 153 // Gets the major key from a code object that is a code stub or binary op IC. |
151 static Major GetMajorKey(Code* code_stub) { | 154 static Major GetMajorKey(Code* code_stub) { |
152 return static_cast<Major>(code_stub->major_key()); | 155 return static_cast<Major>(code_stub->major_key()); |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 | 515 |
513 void Generate(MacroAssembler* masm); | 516 void Generate(MacroAssembler* masm); |
514 | 517 |
515 private: | 518 private: |
516 int slots_; | 519 int slots_; |
517 | 520 |
518 Major MajorKey() { return FastNewBlockContext; } | 521 Major MajorKey() { return FastNewBlockContext; } |
519 int MinorKey() { return slots_; } | 522 int MinorKey() { return slots_; } |
520 }; | 523 }; |
521 | 524 |
| 525 class StoreGlobalStub : public HydrogenCodeStub { |
| 526 public: |
| 527 explicit StoreGlobalStub(StrictModeFlag strict_mode, |
| 528 bool is_constant) { |
| 529 bit_field_ = StrictModeBits::encode(strict_mode) | |
| 530 IsConstantBits::encode(is_constant); |
| 531 } |
| 532 |
| 533 virtual Handle<Code> GenerateCode(); |
| 534 |
| 535 virtual void InitializeInterfaceDescriptor( |
| 536 Isolate* isolate, |
| 537 CodeStubInterfaceDescriptor* descriptor); |
| 538 |
| 539 virtual Code::Kind GetCodeKind() const { return Code::STORE_IC; } |
| 540 virtual InlineCacheState GetICState() { return MONOMORPHIC; } |
| 541 virtual Code::ExtraICState GetExtraICState() { |
| 542 return bit_field_; |
| 543 } |
| 544 |
| 545 bool is_constant() { |
| 546 return IsConstantBits::decode(bit_field_); |
| 547 } |
| 548 void set_is_constant(bool value) { |
| 549 bit_field_ = IsConstantBits::update(bit_field_, value); |
| 550 } |
| 551 |
| 552 Representation representation() { |
| 553 return Representation::FromKind(RepresentationBits::decode(bit_field_)); |
| 554 } |
| 555 void set_representation(Representation r) { |
| 556 bit_field_ = RepresentationBits::update(bit_field_, r.kind()); |
| 557 } |
| 558 |
| 559 private: |
| 560 virtual int NotMissMinorKey() { return GetExtraICState(); } |
| 561 Major MajorKey() { return StoreGlobal; } |
| 562 |
| 563 class StrictModeBits: public BitField<StrictModeFlag, 0, 1> {}; |
| 564 class IsConstantBits: public BitField<bool, 1, 1> {}; |
| 565 class RepresentationBits: public BitField<Representation::Kind, 2, 8> {}; |
| 566 |
| 567 int bit_field_; |
| 568 |
| 569 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); |
| 570 }; |
| 571 |
522 | 572 |
523 class FastCloneShallowArrayStub : public HydrogenCodeStub { | 573 class FastCloneShallowArrayStub : public HydrogenCodeStub { |
524 public: | 574 public: |
525 // Maximum length of copied elements array. | 575 // Maximum length of copied elements array. |
526 static const int kMaximumClonedLength = 8; | 576 static const int kMaximumClonedLength = 8; |
527 enum Mode { | 577 enum Mode { |
528 CLONE_ELEMENTS, | 578 CLONE_ELEMENTS, |
529 CLONE_DOUBLE_ELEMENTS, | 579 CLONE_DOUBLE_ELEMENTS, |
530 COPY_ON_WRITE_ELEMENTS, | 580 COPY_ON_WRITE_ELEMENTS, |
531 CLONE_ANY_ELEMENTS, | 581 CLONE_ANY_ELEMENTS, |
(...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2153 | 2203 |
2154 // The current function entry hook. | 2204 // The current function entry hook. |
2155 static FunctionEntryHook entry_hook_; | 2205 static FunctionEntryHook entry_hook_; |
2156 | 2206 |
2157 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2207 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
2158 }; | 2208 }; |
2159 | 2209 |
2160 } } // namespace v8::internal | 2210 } } // namespace v8::internal |
2161 | 2211 |
2162 #endif // V8_CODE_STUBS_H_ | 2212 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |