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 #if V8_TARGET_ARCH_ARM | 99 #if 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 28 matching lines...) Expand all Loading... |
131 #define DEF_ENUM(name) name, | 132 #define DEF_ENUM(name) name, |
132 CODE_STUB_LIST(DEF_ENUM) | 133 CODE_STUB_LIST(DEF_ENUM) |
133 #undef DEF_ENUM | 134 #undef DEF_ENUM |
134 NoCache, // marker for stubs that do custom caching | 135 NoCache, // marker for stubs that do custom caching |
135 NUMBER_OF_IDS | 136 NUMBER_OF_IDS |
136 }; | 137 }; |
137 | 138 |
138 // Retrieve the code for the stub. Generate the code if needed. | 139 // Retrieve the code for the stub. Generate the code if needed. |
139 Handle<Code> GetCode(Isolate* isolate); | 140 Handle<Code> GetCode(Isolate* isolate); |
140 | 141 |
| 142 // Retrieve the code for the stub, make and return a copy of the code. |
| 143 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate); |
141 static Major MajorKeyFromKey(uint32_t key) { | 144 static Major MajorKeyFromKey(uint32_t key) { |
142 return static_cast<Major>(MajorKeyBits::decode(key)); | 145 return static_cast<Major>(MajorKeyBits::decode(key)); |
143 } | 146 } |
144 static int MinorKeyFromKey(uint32_t key) { | 147 static int MinorKeyFromKey(uint32_t key) { |
145 return MinorKeyBits::decode(key); | 148 return MinorKeyBits::decode(key); |
146 } | 149 } |
147 | 150 |
148 // Gets the major key from a code object that is a code stub or binary op IC. | 151 // Gets the major key from a code object that is a code stub or binary op IC. |
149 static Major GetMajorKey(Code* code_stub) { | 152 static Major GetMajorKey(Code* code_stub) { |
150 return static_cast<Major>(code_stub->major_key()); | 153 return static_cast<Major>(code_stub->major_key()); |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 519 |
517 void Generate(MacroAssembler* masm); | 520 void Generate(MacroAssembler* masm); |
518 | 521 |
519 private: | 522 private: |
520 int slots_; | 523 int slots_; |
521 | 524 |
522 Major MajorKey() { return FastNewBlockContext; } | 525 Major MajorKey() { return FastNewBlockContext; } |
523 int MinorKey() { return slots_; } | 526 int MinorKey() { return slots_; } |
524 }; | 527 }; |
525 | 528 |
| 529 class StoreGlobalStub : public HydrogenCodeStub { |
| 530 public: |
| 531 StoreGlobalStub(StrictModeFlag strict_mode, bool is_constant) { |
| 532 bit_field_ = StrictModeBits::encode(strict_mode) | |
| 533 IsConstantBits::encode(is_constant); |
| 534 } |
| 535 |
| 536 virtual Handle<Code> GenerateCode(); |
| 537 |
| 538 virtual void InitializeInterfaceDescriptor( |
| 539 Isolate* isolate, |
| 540 CodeStubInterfaceDescriptor* descriptor); |
| 541 |
| 542 virtual Code::Kind GetCodeKind() const { return Code::STORE_IC; } |
| 543 virtual InlineCacheState GetICState() { return MONOMORPHIC; } |
| 544 virtual Code::ExtraICState GetExtraICState() { return bit_field_; } |
| 545 |
| 546 bool is_constant() { |
| 547 return IsConstantBits::decode(bit_field_); |
| 548 } |
| 549 void set_is_constant(bool value) { |
| 550 bit_field_ = IsConstantBits::update(bit_field_, value); |
| 551 } |
| 552 |
| 553 Representation representation() { |
| 554 return Representation::FromKind(RepresentationBits::decode(bit_field_)); |
| 555 } |
| 556 void set_representation(Representation r) { |
| 557 bit_field_ = RepresentationBits::update(bit_field_, r.kind()); |
| 558 } |
| 559 |
| 560 private: |
| 561 virtual int NotMissMinorKey() { return GetExtraICState(); } |
| 562 Major MajorKey() { return StoreGlobal; } |
| 563 |
| 564 class StrictModeBits: public BitField<StrictModeFlag, 0, 1> {}; |
| 565 class IsConstantBits: public BitField<bool, 1, 1> {}; |
| 566 class RepresentationBits: public BitField<Representation::Kind, 2, 8> {}; |
| 567 |
| 568 int bit_field_; |
| 569 |
| 570 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); |
| 571 }; |
| 572 |
526 | 573 |
527 class UnaryOpStub : public HydrogenCodeStub { | 574 class UnaryOpStub : public HydrogenCodeStub { |
528 public: | 575 public: |
529 // Stub without type info available -> construct uninitialized | 576 // Stub without type info available -> construct uninitialized |
530 explicit UnaryOpStub(Token::Value operation) | 577 explicit UnaryOpStub(Token::Value operation) |
531 : HydrogenCodeStub(UNINITIALIZED), operation_(operation) { } | 578 : HydrogenCodeStub(UNINITIALIZED), operation_(operation) { } |
532 explicit UnaryOpStub(Code::ExtraICState ic_state) : | 579 explicit UnaryOpStub(Code::ExtraICState ic_state) : |
533 state_(StateBits::decode(ic_state)), | 580 state_(StateBits::decode(ic_state)), |
534 operation_(OperatorBits::decode(ic_state)) { } | 581 operation_(OperatorBits::decode(ic_state)) { } |
535 | 582 |
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2247 int MinorKey() { return 0; } | 2294 int MinorKey() { return 0; } |
2248 | 2295 |
2249 void Generate(MacroAssembler* masm); | 2296 void Generate(MacroAssembler* masm); |
2250 | 2297 |
2251 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2298 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
2252 }; | 2299 }; |
2253 | 2300 |
2254 } } // namespace v8::internal | 2301 } } // namespace v8::internal |
2255 | 2302 |
2256 #endif // V8_CODE_STUBS_H_ | 2303 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |