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

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

Issue 527933002: Unify some PlatformCodeStubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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_X64_CODE_STUBS_X64_H_ 5 #ifndef V8_X64_CODE_STUBS_X64_H_
6 #define V8_X64_CODE_STUBS_X64_H_ 6 #define V8_X64_CODE_STUBS_X64_H_
7 7
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 13
14 void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code); 14 void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code);
15 15
16 class StoreBufferOverflowStub: public PlatformCodeStub {
17 public:
18 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp)
19 : PlatformCodeStub(isolate), save_doubles_(save_fp) { }
20
21 void Generate(MacroAssembler* masm);
22
23 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
24 virtual bool SometimesSetsUpAFrame() { return false; }
25
26 private:
27 SaveFPRegsMode save_doubles_;
28
29 Major MajorKey() const { return StoreBufferOverflow; }
30 uint32_t MinorKey() const { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; }
31 };
32
33 16
34 class StringHelper : public AllStatic { 17 class StringHelper : public AllStatic {
35 public: 18 public:
36 // Generate code for copying characters using the rep movs instruction. 19 // Generate code for copying characters using the rep movs instruction.
37 // Copies rcx characters from rsi to rdi. Copying of overlapping regions is 20 // Copies rcx characters from rsi to rdi. Copying of overlapping regions is
38 // not supported. 21 // not supported.
39 static void GenerateCopyCharacters(MacroAssembler* masm, 22 static void GenerateCopyCharacters(MacroAssembler* masm,
40 Register dest, 23 Register dest,
41 Register src, 24 Register src,
42 Register count, 25 Register count,
43 String::Encoding encoding); 26 String::Encoding encoding);
44 27
45 28
46 // Generate string hash. 29 // Generate string hash.
47 static void GenerateHashInit(MacroAssembler* masm, 30 static void GenerateHashInit(MacroAssembler* masm,
48 Register hash, 31 Register hash,
49 Register character, 32 Register character,
50 Register scratch); 33 Register scratch);
34
51 static void GenerateHashAddCharacter(MacroAssembler* masm, 35 static void GenerateHashAddCharacter(MacroAssembler* masm,
52 Register hash, 36 Register hash,
53 Register character, 37 Register character,
54 Register scratch); 38 Register scratch);
39
55 static void GenerateHashGetHash(MacroAssembler* masm, 40 static void GenerateHashGetHash(MacroAssembler* masm,
56 Register hash, 41 Register hash,
57 Register scratch); 42 Register scratch);
58 43
59 private: 44 // Compares two flat ASCII strings and returns result in rax.
60 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); 45 static void GenerateCompareFlatAsciiStrings(
61 }; 46 MacroAssembler* masm, Register left, Register right, Register scratch1,
47 Register scratch2, Register scratch3, Register scratch4);
62 48
63 49 // Compares two flat ASCII strings for equality and returns result in rax.
64 class SubStringStub: public PlatformCodeStub {
65 public:
66 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
67
68 private:
69 Major MajorKey() const { return SubString; }
70 uint32_t MinorKey() const { return 0; }
71
72 void Generate(MacroAssembler* masm);
73 };
74
75
76 class StringCompareStub: public PlatformCodeStub {
77 public:
78 explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
79
80 // Compares two flat ASCII strings and returns result in rax.
81 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
82 Register left,
83 Register right,
84 Register scratch1,
85 Register scratch2,
86 Register scratch3,
87 Register scratch4);
88
89 // Compares two flat ASCII strings for equality and returns result
90 // in rax.
91 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, 50 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm,
92 Register left, 51 Register left,
93 Register right, 52 Register right,
94 Register scratch1, 53 Register scratch1,
95 Register scratch2); 54 Register scratch2);
96 55
97 private: 56 private:
98 virtual Major MajorKey() const { return StringCompare; }
99 virtual uint32_t MinorKey() const { return 0; }
100 virtual void Generate(MacroAssembler* masm);
101
102 static void GenerateAsciiCharsCompareLoop( 57 static void GenerateAsciiCharsCompareLoop(
103 MacroAssembler* masm, 58 MacroAssembler* masm,
104 Register left, 59 Register left,
105 Register right, 60 Register right,
106 Register length, 61 Register length,
107 Register scratch, 62 Register scratch,
108 Label* chars_not_equal, 63 Label* chars_not_equal,
109 Label::Distance near_jump = Label::kFar); 64 Label::Distance near_jump = Label::kFar);
65
66 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
110 }; 67 };
111 68
112 69
113 class NameDictionaryLookupStub: public PlatformCodeStub { 70 class NameDictionaryLookupStub: public PlatformCodeStub {
114 public: 71 public:
115 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; 72 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP };
116 73
117 NameDictionaryLookupStub(Isolate* isolate, 74 NameDictionaryLookupStub(Isolate* isolate,
118 Register dictionary, 75 Register dictionary,
119 Register result, 76 Register result,
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 RememberedSetAction remembered_set_action_; 370 RememberedSetAction remembered_set_action_;
414 SaveFPRegsMode save_fp_regs_mode_; 371 SaveFPRegsMode save_fp_regs_mode_;
415 Label slow_; 372 Label slow_;
416 RegisterAllocation regs_; 373 RegisterAllocation regs_;
417 }; 374 };
418 375
419 376
420 } } // namespace v8::internal 377 } } // namespace v8::internal
421 378
422 #endif // V8_X64_CODE_STUBS_X64_H_ 379 #endif // V8_X64_CODE_STUBS_X64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698