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

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

Issue 6826032: Remove code from the deprecated GenericBinaryOpStub. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 8 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/type-info.cc ('k') | src/x64/code-stubs-x64.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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 ToBooleanStub() { } 64 ToBooleanStub() { }
65 65
66 void Generate(MacroAssembler* masm); 66 void Generate(MacroAssembler* masm);
67 67
68 private: 68 private:
69 Major MajorKey() { return ToBoolean; } 69 Major MajorKey() { return ToBoolean; }
70 int MinorKey() { return 0; } 70 int MinorKey() { return 0; }
71 }; 71 };
72 72
73 73
74 // Flag that indicates how to generate code for the stub GenericBinaryOpStub.
75 enum GenericBinaryFlags {
76 NO_GENERIC_BINARY_FLAGS = 0,
77 NO_SMI_CODE_IN_STUB = 1 << 0 // Omit smi code in stub.
78 };
79
80
81 class GenericBinaryOpStub: public CodeStub {
82 public:
83 GenericBinaryOpStub(Token::Value op,
84 OverwriteMode mode,
85 GenericBinaryFlags flags,
86 TypeInfo operands_type = TypeInfo::Unknown())
87 : op_(op),
88 mode_(mode),
89 flags_(flags),
90 args_in_registers_(false),
91 args_reversed_(false),
92 static_operands_type_(operands_type),
93 runtime_operands_type_(BinaryOpIC::DEFAULT),
94 name_(NULL) {
95 ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
96 }
97
98 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo runtime_operands_type)
99 : op_(OpBits::decode(key)),
100 mode_(ModeBits::decode(key)),
101 flags_(FlagBits::decode(key)),
102 args_in_registers_(ArgsInRegistersBits::decode(key)),
103 args_reversed_(ArgsReversedBits::decode(key)),
104 static_operands_type_(TypeInfo::ExpandedRepresentation(
105 StaticTypeInfoBits::decode(key))),
106 runtime_operands_type_(runtime_operands_type),
107 name_(NULL) {
108 }
109
110 // Generate code to call the stub with the supplied arguments. This will add
111 // code at the call site to prepare arguments either in registers or on the
112 // stack together with the actual call.
113 void GenerateCall(MacroAssembler* masm, Register left, Register right);
114 void GenerateCall(MacroAssembler* masm, Register left, Smi* right);
115 void GenerateCall(MacroAssembler* masm, Smi* left, Register right);
116
117 bool ArgsInRegistersSupported() {
118 return (op_ == Token::ADD) || (op_ == Token::SUB)
119 || (op_ == Token::MUL) || (op_ == Token::DIV);
120 }
121
122 private:
123 Token::Value op_;
124 OverwriteMode mode_;
125 GenericBinaryFlags flags_;
126 bool args_in_registers_; // Arguments passed in registers not on the stack.
127 bool args_reversed_; // Left and right argument are swapped.
128
129 // Number type information of operands, determined by code generator.
130 TypeInfo static_operands_type_;
131
132 // Operand type information determined at runtime.
133 BinaryOpIC::TypeInfo runtime_operands_type_;
134
135 char* name_;
136
137 const char* GetName();
138
139 #ifdef DEBUG
140 void Print() {
141 PrintF("GenericBinaryOpStub %d (op %s), "
142 "(mode %d, flags %d, registers %d, reversed %d, type_info %s)\n",
143 MinorKey(),
144 Token::String(op_),
145 static_cast<int>(mode_),
146 static_cast<int>(flags_),
147 static_cast<int>(args_in_registers_),
148 static_cast<int>(args_reversed_),
149 static_operands_type_.ToString());
150 }
151 #endif
152
153 // Minor key encoding in 17 bits TTNNNFRAOOOOOOOMM.
154 class ModeBits: public BitField<OverwriteMode, 0, 2> {};
155 class OpBits: public BitField<Token::Value, 2, 7> {};
156 class ArgsInRegistersBits: public BitField<bool, 9, 1> {};
157 class ArgsReversedBits: public BitField<bool, 10, 1> {};
158 class FlagBits: public BitField<GenericBinaryFlags, 11, 1> {};
159 class StaticTypeInfoBits: public BitField<int, 12, 3> {};
160 class RuntimeTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 15, 3> {};
161
162 Major MajorKey() { return GenericBinaryOp; }
163 int MinorKey() {
164 // Encode the parameters in a unique 18 bit value.
165 return OpBits::encode(op_)
166 | ModeBits::encode(mode_)
167 | FlagBits::encode(flags_)
168 | ArgsInRegistersBits::encode(args_in_registers_)
169 | ArgsReversedBits::encode(args_reversed_)
170 | StaticTypeInfoBits::encode(
171 static_operands_type_.ThreeBitRepresentation())
172 | RuntimeTypeInfoBits::encode(runtime_operands_type_);
173 }
174
175 void Generate(MacroAssembler* masm);
176 void GenerateSmiCode(MacroAssembler* masm, Label* slow);
177 void GenerateLoadArguments(MacroAssembler* masm);
178 void GenerateReturn(MacroAssembler* masm);
179 void GenerateRegisterArgsPush(MacroAssembler* masm);
180 void GenerateTypeTransition(MacroAssembler* masm);
181
182 bool IsOperationCommutative() {
183 return (op_ == Token::ADD) || (op_ == Token::MUL);
184 }
185
186 void SetArgsInRegisters() { args_in_registers_ = true; }
187 void SetArgsReversed() { args_reversed_ = true; }
188 bool HasSmiCodeInStub() { return (flags_ & NO_SMI_CODE_IN_STUB) == 0; }
189 bool HasArgsInRegisters() { return args_in_registers_; }
190 bool HasArgsReversed() { return args_reversed_; }
191
192 bool ShouldGenerateSmiCode() {
193 return HasSmiCodeInStub() &&
194 runtime_operands_type_ != BinaryOpIC::HEAP_NUMBERS &&
195 runtime_operands_type_ != BinaryOpIC::STRINGS;
196 }
197
198 bool ShouldGenerateFPCode() {
199 return runtime_operands_type_ != BinaryOpIC::STRINGS;
200 }
201
202 virtual int GetCodeKind() { return Code::BINARY_OP_IC; }
203
204 virtual InlineCacheState GetICState() {
205 return BinaryOpIC::ToState(runtime_operands_type_);
206 }
207
208 friend class CodeGenerator;
209 friend class LCodeGen;
210 };
211
212
213 class TypeRecordingBinaryOpStub: public CodeStub { 74 class TypeRecordingBinaryOpStub: public CodeStub {
214 public: 75 public:
215 TypeRecordingBinaryOpStub(Token::Value op, OverwriteMode mode) 76 TypeRecordingBinaryOpStub(Token::Value op, OverwriteMode mode)
216 : op_(op), 77 : op_(op),
217 mode_(mode), 78 mode_(mode),
218 operands_type_(TRBinaryOpIC::UNINITIALIZED), 79 operands_type_(TRBinaryOpIC::UNINITIALIZED),
219 result_type_(TRBinaryOpIC::UNINITIALIZED), 80 result_type_(TRBinaryOpIC::UNINITIALIZED),
220 name_(NULL) { 81 name_(NULL) {
221 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); 82 ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
222 } 83 }
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 void Print() { 329 void Print() {
469 PrintF("NumberToStringStub\n"); 330 PrintF("NumberToStringStub\n");
470 } 331 }
471 #endif 332 #endif
472 }; 333 };
473 334
474 335
475 } } // namespace v8::internal 336 } } // namespace v8::internal
476 337
477 #endif // V8_X64_CODE_STUBS_X64_H_ 338 #endif // V8_X64_CODE_STUBS_X64_H_
OLDNEW
« no previous file with comments | « src/type-info.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698