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

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

Issue 1137703002: Add a MathFloor stub generated with TurboFan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix ARM + co. Created 5 years, 7 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/code-stubs.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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 V(NumberToString) \ 82 V(NumberToString) \
83 V(Typeof) \ 83 V(Typeof) \
84 V(RegExpConstructResult) \ 84 V(RegExpConstructResult) \
85 V(StoreFastElement) \ 85 V(StoreFastElement) \
86 V(StoreScriptContextField) \ 86 V(StoreScriptContextField) \
87 V(StringAdd) \ 87 V(StringAdd) \
88 V(ToBoolean) \ 88 V(ToBoolean) \
89 V(TransitionElementsKind) \ 89 V(TransitionElementsKind) \
90 V(VectorRawKeyedLoad) \ 90 V(VectorRawKeyedLoad) \
91 V(VectorRawLoad) \ 91 V(VectorRawLoad) \
92 /* TurboFanCodeStubs */ \
93 V(StringLengthTF) \
94 V(MathFloor) \
92 /* IC Handler stubs */ \ 95 /* IC Handler stubs */ \
93 V(ArrayBufferViewLoadField) \ 96 V(ArrayBufferViewLoadField) \
94 V(LoadConstant) \ 97 V(LoadConstant) \
95 V(LoadField) \ 98 V(LoadField) \
96 V(KeyedLoadSloppyArguments) \ 99 V(KeyedLoadSloppyArguments) \
97 V(StoreField) \ 100 V(StoreField) \
98 V(StoreGlobal) \ 101 V(StoreGlobal) \
99 V(StoreTransition) \ 102 V(StoreTransition) \
100 V(StringLength) \ 103 V(StringLength) \
101 V(RestParamAccess) 104 V(RestParamAccess)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 #endif 148 #endif
146 149
147 // Combined list of code stubs. 150 // Combined list of code stubs.
148 #define CODE_STUB_LIST(V) \ 151 #define CODE_STUB_LIST(V) \
149 CODE_STUB_LIST_ALL_PLATFORMS(V) \ 152 CODE_STUB_LIST_ALL_PLATFORMS(V) \
150 CODE_STUB_LIST_ARM(V) \ 153 CODE_STUB_LIST_ARM(V) \
151 CODE_STUB_LIST_ARM64(V) \ 154 CODE_STUB_LIST_ARM64(V) \
152 CODE_STUB_LIST_PPC(V) \ 155 CODE_STUB_LIST_PPC(V) \
153 CODE_STUB_LIST_MIPS(V) 156 CODE_STUB_LIST_MIPS(V)
154 157
158 static const int kHasReturnedMinusZeroSentinel = 1;
159
155 // Stub is base classes of all stubs. 160 // Stub is base classes of all stubs.
156 class CodeStub BASE_EMBEDDED { 161 class CodeStub BASE_EMBEDDED {
157 public: 162 public:
158 enum Major { 163 enum Major {
159 // TODO(mvstanton): eliminate the NoCache key by getting rid 164 // TODO(mvstanton): eliminate the NoCache key by getting rid
160 // of the non-monomorphic-cache. 165 // of the non-monomorphic-cache.
161 NoCache = 0, // marker for stubs that do custom caching] 166 NoCache = 0, // marker for stubs that do custom caching]
162 #define DEF_ENUM(name) name, 167 #define DEF_ENUM(name) name,
163 CODE_STUB_LIST(DEF_ENUM) 168 CODE_STUB_LIST(DEF_ENUM)
164 #undef DEF_ENUM 169 #undef DEF_ENUM
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // true, which will cause an assertion if we try to call something that can 204 // true, which will cause an assertion if we try to call something that can
200 // GC or if we try to put a stack frame on top of the junk, which would not 205 // GC or if we try to put a stack frame on top of the junk, which would not
201 // result in a traversable stack. 206 // result in a traversable stack.
202 virtual bool SometimesSetsUpAFrame() { return true; } 207 virtual bool SometimesSetsUpAFrame() { return true; }
203 208
204 // Lookup the code in the (possibly custom) cache. 209 // Lookup the code in the (possibly custom) cache.
205 bool FindCodeInCache(Code** code_out); 210 bool FindCodeInCache(Code** code_out);
206 211
207 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() = 0; 212 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() = 0;
208 213
214 virtual int GetStackParameterCount() const { return 0; }
215
209 virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) {} 216 virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) {}
210 217
211 static void InitializeDescriptor(Isolate* isolate, uint32_t key, 218 static void InitializeDescriptor(Isolate* isolate, uint32_t key,
212 CodeStubDescriptor* desc); 219 CodeStubDescriptor* desc);
213 220
214 static MaybeHandle<Code> GetCode(Isolate* isolate, uint32_t key); 221 static MaybeHandle<Code> GetCode(Isolate* isolate, uint32_t key);
215 222
216 // Returns information for computing the number key. 223 // Returns information for computing the number key.
217 virtual Major MajorKey() const = 0; 224 virtual Major MajorKey() const = 0;
218 uint32_t MinorKey() const { return minor_key_; } 225 uint32_t MinorKey() const { return minor_key_; }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 void Generate(MacroAssembler* masm) override; \ 348 void Generate(MacroAssembler* masm) override; \
342 DEFINE_CODE_STUB(NAME, SUPER) 349 DEFINE_CODE_STUB(NAME, SUPER)
343 350
344 351
345 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \ 352 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \
346 public: \ 353 public: \
347 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ 354 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \
348 Handle<Code> GenerateCode() override; \ 355 Handle<Code> GenerateCode() override; \
349 DEFINE_CODE_STUB(NAME, SUPER) 356 DEFINE_CODE_STUB(NAME, SUPER)
350 357
358 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER, DESC, STACK_PARAMS) \
359 public: \
360 NAME##Stub(Isolate* isolate) : SUPER(isolate) {} \
361 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { \
362 return DESC(isolate()); \
363 }; \
364 virtual const char* GetFunctionName() const override { \
365 return #NAME "_STUB"; \
366 } \
367 int GetStackParameterCount() const override { return STACK_PARAMS; } \
368 Code::StubType GetStubType() const override { return Code::FAST; } \
369 DEFINE_CODE_STUB(NAME, SUPER)
370
351 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ 371 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \
352 public: \ 372 public: \
353 Handle<Code> GenerateCode() override; \ 373 Handle<Code> GenerateCode() override; \
354 DEFINE_CODE_STUB(NAME, SUPER) 374 DEFINE_CODE_STUB(NAME, SUPER)
355 375
356 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ 376 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \
357 public: \ 377 public: \
358 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { \ 378 CallInterfaceDescriptor GetCallInterfaceDescriptor() override { \
359 return NAME##Descriptor(isolate()); \ 379 return NAME##Descriptor(isolate()); \
360 } 380 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 private: 531 private:
512 class IsMissBits : public BitField<bool, kSubMinorKeyBits, 1> {}; 532 class IsMissBits : public BitField<bool, kSubMinorKeyBits, 1> {};
513 class SubMinorKeyBits : public BitField<int, 0, kSubMinorKeyBits> {}; 533 class SubMinorKeyBits : public BitField<int, 0, kSubMinorKeyBits> {};
514 534
515 void GenerateLightweightMiss(MacroAssembler* masm, ExternalReference miss); 535 void GenerateLightweightMiss(MacroAssembler* masm, ExternalReference miss);
516 536
517 DEFINE_CODE_STUB_BASE(HydrogenCodeStub, CodeStub); 537 DEFINE_CODE_STUB_BASE(HydrogenCodeStub, CodeStub);
518 }; 538 };
519 539
520 540
541 class TurboFanCodeStub : public CodeStub {
542 public:
543 Code::Kind GetCodeKind() const override { return Code::STUB; }
544
545 // Retrieve the code for the stub. Generate the code if needed.
546 Handle<Code> GenerateCode() override;
547
548 virtual const char* GetFunctionName() const = 0;
549
550 protected:
551 explicit TurboFanCodeStub(Isolate* isolate) : CodeStub(isolate) {}
552
553 private:
554 DEFINE_CODE_STUB_BASE(TurboFanCodeStub, CodeStub);
555 };
556
557
521 // Helper interface to prepare to/restore after making runtime calls. 558 // Helper interface to prepare to/restore after making runtime calls.
522 class RuntimeCallHelper { 559 class RuntimeCallHelper {
523 public: 560 public:
524 virtual ~RuntimeCallHelper() {} 561 virtual ~RuntimeCallHelper() {}
525 562
526 virtual void BeforeCall(MacroAssembler* masm) const = 0; 563 virtual void BeforeCall(MacroAssembler* masm) const = 0;
527 564
528 virtual void AfterCall(MacroAssembler* masm) const = 0; 565 virtual void AfterCall(MacroAssembler* masm) const = 0;
529 566
530 protected: 567 protected:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 class NopRuntimeCallHelper : public RuntimeCallHelper { 614 class NopRuntimeCallHelper : public RuntimeCallHelper {
578 public: 615 public:
579 NopRuntimeCallHelper() {} 616 NopRuntimeCallHelper() {}
580 617
581 virtual void BeforeCall(MacroAssembler* masm) const {} 618 virtual void BeforeCall(MacroAssembler* masm) const {}
582 619
583 virtual void AfterCall(MacroAssembler* masm) const {} 620 virtual void AfterCall(MacroAssembler* masm) const {}
584 }; 621 };
585 622
586 623
624 class MathFloorStub : public TurboFanCodeStub {
625 DEFINE_TURBOFAN_CODE_STUB(MathFloor, TurboFanCodeStub,
626 MathRoundVariantDescriptor, 1);
627 };
628
629
630 class StringLengthTFStub : public TurboFanCodeStub {
631 DEFINE_TURBOFAN_CODE_STUB(StringLengthTF, TurboFanCodeStub, LoadDescriptor,
632 0);
633
634 public:
635 Code::Kind GetCodeKind() const override { return Code::HANDLER; }
636 InlineCacheState GetICState() const override { return MONOMORPHIC; }
637 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; }
638 };
639
640
587 class NumberToStringStub final : public HydrogenCodeStub { 641 class NumberToStringStub final : public HydrogenCodeStub {
588 public: 642 public:
589 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} 643 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
590 644
591 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 645 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
592 static const int kNumber = 0; 646 static const int kNumber = 0;
593 647
594 DEFINE_CALL_INTERFACE_DESCRIPTOR(NumberToString); 648 DEFINE_CALL_INTERFACE_DESCRIPTOR(NumberToString);
595 DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub); 649 DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub);
596 }; 650 };
(...skipping 2238 matching lines...) Expand 10 before | Expand all | Expand 10 after
2835 2889
2836 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR 2890 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR
2837 #undef DEFINE_PLATFORM_CODE_STUB 2891 #undef DEFINE_PLATFORM_CODE_STUB
2838 #undef DEFINE_HANDLER_CODE_STUB 2892 #undef DEFINE_HANDLER_CODE_STUB
2839 #undef DEFINE_HYDROGEN_CODE_STUB 2893 #undef DEFINE_HYDROGEN_CODE_STUB
2840 #undef DEFINE_CODE_STUB 2894 #undef DEFINE_CODE_STUB
2841 #undef DEFINE_CODE_STUB_BASE 2895 #undef DEFINE_CODE_STUB_BASE
2842 } } // namespace v8::internal 2896 } } // namespace v8::internal
2843 2897
2844 #endif // V8_CODE_STUBS_H_ 2898 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/interface-descriptors-arm64.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698