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

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

Issue 18712002: Convert UnaryOpStub to a HydrogenCodeStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address review Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/ia32/code-stubs-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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 virtual bool SometimesSetsUpAFrame() { return false; } 79 virtual bool SometimesSetsUpAFrame() { return false; }
80 80
81 private: 81 private:
82 SaveFPRegsMode save_doubles_; 82 SaveFPRegsMode save_doubles_;
83 83
84 Major MajorKey() { return StoreBufferOverflow; } 84 Major MajorKey() { return StoreBufferOverflow; }
85 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } 85 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; }
86 }; 86 };
87 87
88 88
89 class UnaryOpStub: public PlatformCodeStub {
90 public:
91 UnaryOpStub(Token::Value op,
92 UnaryOverwriteMode mode,
93 UnaryOpIC::TypeInfo operand_type = UnaryOpIC::UNINITIALIZED)
94 : op_(op),
95 mode_(mode),
96 operand_type_(operand_type) {
97 }
98
99 private:
100 Token::Value op_;
101 UnaryOverwriteMode mode_;
102
103 // Operand type information determined at runtime.
104 UnaryOpIC::TypeInfo operand_type_;
105
106 virtual void PrintName(StringStream* stream);
107
108 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {};
109 class OpBits: public BitField<Token::Value, 1, 7> {};
110 class OperandTypeInfoBits: public BitField<UnaryOpIC::TypeInfo, 8, 3> {};
111
112 Major MajorKey() { return UnaryOp; }
113 int MinorKey() {
114 return ModeBits::encode(mode_)
115 | OpBits::encode(op_)
116 | OperandTypeInfoBits::encode(operand_type_);
117 }
118
119 // Note: A lot of the helper functions below will vanish when we use virtual
120 // function instead of switch more often.
121 void Generate(MacroAssembler* masm);
122
123 void GenerateTypeTransition(MacroAssembler* masm);
124
125 void GenerateSmiStub(MacroAssembler* masm);
126 void GenerateSmiStubSub(MacroAssembler* masm);
127 void GenerateSmiStubBitNot(MacroAssembler* masm);
128 void GenerateSmiCodeSub(MacroAssembler* masm,
129 Label* non_smi,
130 Label* undo,
131 Label* slow,
132 Label::Distance non_smi_near = Label::kFar,
133 Label::Distance undo_near = Label::kFar,
134 Label::Distance slow_near = Label::kFar);
135 void GenerateSmiCodeBitNot(MacroAssembler* masm,
136 Label* non_smi,
137 Label::Distance non_smi_near = Label::kFar);
138 void GenerateSmiCodeUndo(MacroAssembler* masm);
139
140 void GenerateNumberStub(MacroAssembler* masm);
141 void GenerateNumberStubSub(MacroAssembler* masm);
142 void GenerateNumberStubBitNot(MacroAssembler* masm);
143 void GenerateHeapNumberCodeSub(MacroAssembler* masm, Label* slow);
144 void GenerateHeapNumberCodeBitNot(MacroAssembler* masm, Label* slow);
145
146 void GenerateGenericStub(MacroAssembler* masm);
147 void GenerateGenericStubSub(MacroAssembler* masm);
148 void GenerateGenericStubBitNot(MacroAssembler* masm);
149 void GenerateGenericCodeFallback(MacroAssembler* masm);
150
151 virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; }
152
153 virtual InlineCacheState GetICState() {
154 return UnaryOpIC::ToState(operand_type_);
155 }
156
157 virtual void FinishCode(Handle<Code> code) {
158 code->set_unary_op_type(operand_type_);
159 }
160 };
161
162
163 class StringHelper : public AllStatic { 89 class StringHelper : public AllStatic {
164 public: 90 public:
165 // Generate code for copying characters using a simple loop. This should only 91 // Generate code for copying characters using a simple loop. This should only
166 // be used in places where the number of characters is small and the 92 // be used in places where the number of characters is small and the
167 // additional setup and checking in GenerateCopyCharactersREP adds too much 93 // additional setup and checking in GenerateCopyCharactersREP adds too much
168 // overhead. Copying of overlapping regions is not supported. 94 // overhead. Copying of overlapping regions is not supported.
169 static void GenerateCopyCharacters(MacroAssembler* masm, 95 static void GenerateCopyCharacters(MacroAssembler* masm,
170 Register dest, 96 Register dest,
171 Register src, 97 Register src,
172 Register count, 98 Register count,
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 Register address_; 574 Register address_;
649 RememberedSetAction remembered_set_action_; 575 RememberedSetAction remembered_set_action_;
650 SaveFPRegsMode save_fp_regs_mode_; 576 SaveFPRegsMode save_fp_regs_mode_;
651 RegisterAllocation regs_; 577 RegisterAllocation regs_;
652 }; 578 };
653 579
654 580
655 } } // namespace v8::internal 581 } } // namespace v8::internal
656 582
657 #endif // V8_IA32_CODE_STUBS_IA32_H_ 583 #endif // V8_IA32_CODE_STUBS_IA32_H_
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698