Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: src/code-stubs.h

Issue 1220783006: Revert of Add unoptimized/optimized variants of MathFloor TF code stub (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm64/interface-descriptors-arm64.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_CODE_STUBS_H_ 5 #ifndef V8_CODE_STUBS_H_
6 #define V8_CODE_STUBS_H_ 6 #define V8_CODE_STUBS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 V(StoreFastElement) \ 87 V(StoreFastElement) \
88 V(StoreScriptContextField) \ 88 V(StoreScriptContextField) \
89 V(StringAdd) \ 89 V(StringAdd) \
90 V(ToBoolean) \ 90 V(ToBoolean) \
91 V(TransitionElementsKind) \ 91 V(TransitionElementsKind) \
92 V(KeyedLoadIC) \ 92 V(KeyedLoadIC) \
93 V(LoadIC) \ 93 V(LoadIC) \
94 /* TurboFanCodeStubs */ \ 94 /* TurboFanCodeStubs */ \
95 V(StringLengthTF) \ 95 V(StringLengthTF) \
96 V(StringAddTF) \ 96 V(StringAddTF) \
97 /* TurboFanICs */ \
98 V(MathFloor) \ 97 V(MathFloor) \
99 /* IC Handler stubs */ \ 98 /* IC Handler stubs */ \
100 V(ArrayBufferViewLoadField) \ 99 V(ArrayBufferViewLoadField) \
101 V(LoadConstant) \ 100 V(LoadConstant) \
102 V(LoadFastElement) \ 101 V(LoadFastElement) \
103 V(LoadField) \ 102 V(LoadField) \
104 V(KeyedLoadSloppyArguments) \ 103 V(KeyedLoadSloppyArguments) \
105 V(KeyedStoreSloppyArguments) \ 104 V(KeyedStoreSloppyArguments) \
106 V(StoreField) \ 105 V(StoreField) \
107 V(StoreGlobal) \ 106 V(StoreGlobal) \
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // true, which will cause an assertion if we try to call something that can 209 // true, which will cause an assertion if we try to call something that can
211 // GC or if we try to put a stack frame on top of the junk, which would not 210 // GC or if we try to put a stack frame on top of the junk, which would not
212 // result in a traversable stack. 211 // result in a traversable stack.
213 virtual bool SometimesSetsUpAFrame() { return true; } 212 virtual bool SometimesSetsUpAFrame() { return true; }
214 213
215 // Lookup the code in the (possibly custom) cache. 214 // Lookup the code in the (possibly custom) cache.
216 bool FindCodeInCache(Code** code_out); 215 bool FindCodeInCache(Code** code_out);
217 216
218 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() const = 0; 217 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() const = 0;
219 218
220 virtual int GetStackParameterCount() const { 219 virtual int GetStackParameterCount() const { return 0; }
221 return GetCallInterfaceDescriptor().GetStackParameterCount();
222 }
223 220
224 virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) {} 221 virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) {}
225 222
226 static void InitializeDescriptor(Isolate* isolate, uint32_t key, 223 static void InitializeDescriptor(Isolate* isolate, uint32_t key,
227 CodeStubDescriptor* desc); 224 CodeStubDescriptor* desc);
228 225
229 static MaybeHandle<Code> GetCode(Isolate* isolate, uint32_t key); 226 static MaybeHandle<Code> GetCode(Isolate* isolate, uint32_t key);
230 227
231 // Returns information for computing the number key. 228 // Returns information for computing the number key.
232 virtual Major MajorKey() const = 0; 229 virtual Major MajorKey() const = 0;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 void Generate(MacroAssembler* masm) override; \ 353 void Generate(MacroAssembler* masm) override; \
357 DEFINE_CODE_STUB(NAME, SUPER) 354 DEFINE_CODE_STUB(NAME, SUPER)
358 355
359 356
360 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \ 357 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \
361 public: \ 358 public: \
362 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ 359 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \
363 Handle<Code> GenerateCode() override; \ 360 Handle<Code> GenerateCode() override; \
364 DEFINE_CODE_STUB(NAME, SUPER) 361 DEFINE_CODE_STUB(NAME, SUPER)
365 362
366 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \
367 public: \
368 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \
369 return DESC##Descriptor(isolate()); \
370 }; \
371 DEFINE_CODE_STUB(NAME, SUPER)
372
373 #define DEFINE_TURBOFAN_IC(NAME, SUPER, DESC) \
374 public: \
375 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \
376 if (GetCallMode() == CALL_FROM_OPTIMIZED_CODE) { \
377 return DESC##CallFromOptimizedCodeDescriptor(isolate()); \
378 } else { \
379 return DESC##CallFromUnoptimizedCodeDescriptor(isolate()); \
380 } \
381 }; \
382 \
383 protected: \
384 DEFINE_CODE_STUB(NAME, SUPER)
385
386 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ 363 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \
387 public: \ 364 public: \
388 Handle<Code> GenerateCode() override; \ 365 Handle<Code> GenerateCode() override; \
389 DEFINE_CODE_STUB(NAME, SUPER) 366 DEFINE_CODE_STUB(NAME, SUPER)
390 367
391 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ 368 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \
392 public: \ 369 public: \
393 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ 370 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \
394 return NAME##Descriptor(isolate()); \ 371 return NAME##Descriptor(isolate()); \
395 } 372 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 Code::StubType GetStubType() const override { return Code::FAST; } 537 Code::StubType GetStubType() const override { return Code::FAST; }
561 538
562 protected: 539 protected:
563 explicit TurboFanCodeStub(Isolate* isolate) : CodeStub(isolate) {} 540 explicit TurboFanCodeStub(Isolate* isolate) : CodeStub(isolate) {}
564 541
565 private: 542 private:
566 DEFINE_CODE_STUB_BASE(TurboFanCodeStub, CodeStub); 543 DEFINE_CODE_STUB_BASE(TurboFanCodeStub, CodeStub);
567 }; 544 };
568 545
569 546
570 class TurboFanIC : public TurboFanCodeStub {
571 public:
572 enum CallMode { CALL_FROM_UNOPTIMIZED_CODE, CALL_FROM_OPTIMIZED_CODE };
573
574 protected:
575 explicit TurboFanIC(Isolate* isolate, CallMode mode)
576 : TurboFanCodeStub(isolate) {
577 minor_key_ = CallModeBits::encode(mode);
578 }
579
580 CallMode GetCallMode() const { return CallModeBits::decode(minor_key_); }
581
582 void set_sub_minor_key(uint32_t key) {
583 minor_key_ = SubMinorKeyBits::update(minor_key_, key);
584 }
585
586 uint32_t sub_minor_key() const { return SubMinorKeyBits::decode(minor_key_); }
587
588 static const int kSubMinorKeyBits = kStubMinorKeyBits - 1;
589
590 private:
591 class CallModeBits : public BitField<CallMode, 0, 1> {};
592 class SubMinorKeyBits : public BitField<int, 1, kSubMinorKeyBits> {};
593 DEFINE_CODE_STUB_BASE(TurboFanIC, TurboFanCodeStub);
594 };
595
596
597 // Helper interface to prepare to/restore after making runtime calls. 547 // Helper interface to prepare to/restore after making runtime calls.
598 class RuntimeCallHelper { 548 class RuntimeCallHelper {
599 public: 549 public:
600 virtual ~RuntimeCallHelper() {} 550 virtual ~RuntimeCallHelper() {}
601 551
602 virtual void BeforeCall(MacroAssembler* masm) const = 0; 552 virtual void BeforeCall(MacroAssembler* masm) const = 0;
603 553
604 virtual void AfterCall(MacroAssembler* masm) const = 0; 554 virtual void AfterCall(MacroAssembler* masm) const = 0;
605 555
606 protected: 556 protected:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 class NopRuntimeCallHelper : public RuntimeCallHelper { 603 class NopRuntimeCallHelper : public RuntimeCallHelper {
654 public: 604 public:
655 NopRuntimeCallHelper() {} 605 NopRuntimeCallHelper() {}
656 606
657 virtual void BeforeCall(MacroAssembler* masm) const {} 607 virtual void BeforeCall(MacroAssembler* masm) const {}
658 608
659 virtual void AfterCall(MacroAssembler* masm) const {} 609 virtual void AfterCall(MacroAssembler* masm) const {}
660 }; 610 };
661 611
662 612
663 class MathFloorStub : public TurboFanIC { 613 class MathFloorStub : public TurboFanCodeStub {
664 public: 614 public:
665 explicit MathFloorStub(Isolate* isolate, TurboFanIC::CallMode mode) 615 explicit MathFloorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
666 : TurboFanIC(isolate, mode) {} 616 int GetStackParameterCount() const override { return 1; }
667 Code::Kind GetCodeKind() const override { return Code::CALL_IC; } 617
668 DEFINE_TURBOFAN_IC(MathFloor, TurboFanIC, MathRoundVariant); 618 DEFINE_CALL_INTERFACE_DESCRIPTOR(MathRoundVariant);
619 DEFINE_CODE_STUB(MathFloor, TurboFanCodeStub);
669 }; 620 };
670 621
671 622
672 class StringLengthTFStub : public TurboFanCodeStub { 623 class StringLengthTFStub : public TurboFanCodeStub {
673 public: 624 public:
674 explicit StringLengthTFStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} 625 explicit StringLengthTFStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
675 626
676 Code::Kind GetCodeKind() const override { return Code::HANDLER; } 627 Code::Kind GetCodeKind() const override { return Code::HANDLER; }
677 InlineCacheState GetICState() const override { return MONOMORPHIC; } 628 InlineCacheState GetICState() const override { return MONOMORPHIC; }
678 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; } 629 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; }
(...skipping 2356 matching lines...) Expand 10 before | Expand all | Expand 10 after
3035 #undef DEFINE_PLATFORM_CODE_STUB 2986 #undef DEFINE_PLATFORM_CODE_STUB
3036 #undef DEFINE_HANDLER_CODE_STUB 2987 #undef DEFINE_HANDLER_CODE_STUB
3037 #undef DEFINE_HYDROGEN_CODE_STUB 2988 #undef DEFINE_HYDROGEN_CODE_STUB
3038 #undef DEFINE_CODE_STUB 2989 #undef DEFINE_CODE_STUB
3039 #undef DEFINE_CODE_STUB_BASE 2990 #undef DEFINE_CODE_STUB_BASE
3040 2991
3041 extern Representation RepresentationFromType(Type* type); 2992 extern Representation RepresentationFromType(Type* type);
3042 } } // namespace v8::internal 2993 } } // namespace v8::internal
3043 2994
3044 #endif // V8_CODE_STUBS_H_ 2995 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/interface-descriptors-arm64.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698