Chromium Code Reviews| 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 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 } | |
|
ulan
2013/07/01 11:35:03
"}" fits in the previous line.
danno
2013/07/01 12:52:23
Done.
| |
| 542 | |
| 543 bool is_constant() { | |
| 544 return IsConstantBits::decode(bit_field_); | |
| 545 } | |
| 546 void set_is_constant(bool value) { | |
| 547 bit_field_ = IsConstantBits::update(bit_field_, value); | |
| 548 } | |
| 549 | |
| 550 Representation representation() { | |
| 551 return Representation::FromKind(RepresentationBits::decode(bit_field_)); | |
| 552 } | |
| 553 void set_representation(Representation r) { | |
| 554 bit_field_ = RepresentationBits::update(bit_field_, r.kind()); | |
| 555 } | |
| 556 | |
| 557 private: | |
| 558 virtual int NotMissMinorKey() { return GetExtraICState(); } | |
| 559 Major MajorKey() { return StoreGlobal; } | |
| 560 | |
| 561 class StrictModeBits: public BitField<StrictModeFlag, 0, 1> {}; | |
| 562 class IsConstantBits: public BitField<bool, 1, 1> {}; | |
| 563 class RepresentationBits: public BitField<Representation::Kind, 2, 8> {}; | |
| 564 | |
| 565 int bit_field_; | |
| 566 | |
| 567 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); | |
| 568 }; | |
| 569 | |
| 522 | 570 |
| 523 class FastCloneShallowArrayStub : public HydrogenCodeStub { | 571 class FastCloneShallowArrayStub : public HydrogenCodeStub { |
| 524 public: | 572 public: |
| 525 // Maximum length of copied elements array. | 573 // Maximum length of copied elements array. |
| 526 static const int kMaximumClonedLength = 8; | 574 static const int kMaximumClonedLength = 8; |
| 527 enum Mode { | 575 enum Mode { |
| 528 CLONE_ELEMENTS, | 576 CLONE_ELEMENTS, |
| 529 CLONE_DOUBLE_ELEMENTS, | 577 CLONE_DOUBLE_ELEMENTS, |
| 530 COPY_ON_WRITE_ELEMENTS, | 578 COPY_ON_WRITE_ELEMENTS, |
| 531 CLONE_ANY_ELEMENTS, | 579 CLONE_ANY_ELEMENTS, |
| (...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2176 int MinorKey() { return 0; } | 2224 int MinorKey() { return 0; } |
| 2177 | 2225 |
| 2178 void Generate(MacroAssembler* masm); | 2226 void Generate(MacroAssembler* masm); |
| 2179 | 2227 |
| 2180 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2228 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 2181 }; | 2229 }; |
| 2182 | 2230 |
| 2183 } } // namespace v8::internal | 2231 } } // namespace v8::internal |
| 2184 | 2232 |
| 2185 #endif // V8_CODE_STUBS_H_ | 2233 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |