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

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

Issue 6577036: [Isolates] Merge from bleeding_edge to isolates, revisions 6100-6300. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 9 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/x64/builtins-x64.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 mode_(mode), 80 mode_(mode),
81 flags_(flags), 81 flags_(flags),
82 args_in_registers_(false), 82 args_in_registers_(false),
83 args_reversed_(false), 83 args_reversed_(false),
84 static_operands_type_(operands_type), 84 static_operands_type_(operands_type),
85 runtime_operands_type_(BinaryOpIC::DEFAULT), 85 runtime_operands_type_(BinaryOpIC::DEFAULT),
86 name_(NULL) { 86 name_(NULL) {
87 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); 87 ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
88 } 88 }
89 89
90 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) 90 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo runtime_operands_type)
91 : op_(OpBits::decode(key)), 91 : op_(OpBits::decode(key)),
92 mode_(ModeBits::decode(key)), 92 mode_(ModeBits::decode(key)),
93 flags_(FlagBits::decode(key)), 93 flags_(FlagBits::decode(key)),
94 args_in_registers_(ArgsInRegistersBits::decode(key)), 94 args_in_registers_(ArgsInRegistersBits::decode(key)),
95 args_reversed_(ArgsReversedBits::decode(key)), 95 args_reversed_(ArgsReversedBits::decode(key)),
96 static_operands_type_(TypeInfo::ExpandedRepresentation( 96 static_operands_type_(TypeInfo::ExpandedRepresentation(
97 StaticTypeInfoBits::decode(key))), 97 StaticTypeInfoBits::decode(key))),
98 runtime_operands_type_(type_info), 98 runtime_operands_type_(runtime_operands_type),
99 name_(NULL) { 99 name_(NULL) {
100 } 100 }
101 101
102 // Generate code to call the stub with the supplied arguments. This will add 102 // Generate code to call the stub with the supplied arguments. This will add
103 // code at the call site to prepare arguments either in registers or on the 103 // code at the call site to prepare arguments either in registers or on the
104 // stack together with the actual call. 104 // stack together with the actual call.
105 void GenerateCall(MacroAssembler* masm, Register left, Register right); 105 void GenerateCall(MacroAssembler* masm, Register left, Register right);
106 void GenerateCall(MacroAssembler* masm, Register left, Smi* right); 106 void GenerateCall(MacroAssembler* masm, Register left, Smi* right);
107 void GenerateCall(MacroAssembler* masm, Smi* left, Register right); 107 void GenerateCall(MacroAssembler* masm, Smi* left, Register right);
108 108
(...skipping 15 matching lines...) Expand all
124 // Operand type information determined at runtime. 124 // Operand type information determined at runtime.
125 BinaryOpIC::TypeInfo runtime_operands_type_; 125 BinaryOpIC::TypeInfo runtime_operands_type_;
126 126
127 char* name_; 127 char* name_;
128 128
129 const char* GetName(); 129 const char* GetName();
130 130
131 #ifdef DEBUG 131 #ifdef DEBUG
132 void Print() { 132 void Print() {
133 PrintF("GenericBinaryOpStub %d (op %s), " 133 PrintF("GenericBinaryOpStub %d (op %s), "
134 "(mode %d, flags %d, registers %d, reversed %d, only_numbers %s)\n", 134 "(mode %d, flags %d, registers %d, reversed %d, type_info %s)\n",
135 MinorKey(), 135 MinorKey(),
136 Token::String(op_), 136 Token::String(op_),
137 static_cast<int>(mode_), 137 static_cast<int>(mode_),
138 static_cast<int>(flags_), 138 static_cast<int>(flags_),
139 static_cast<int>(args_in_registers_), 139 static_cast<int>(args_in_registers_),
140 static_cast<int>(args_reversed_), 140 static_cast<int>(args_reversed_),
141 static_operands_type_.ToString()); 141 static_operands_type_.ToString());
142 } 142 }
143 #endif 143 #endif
144 144
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 virtual int GetCodeKind() { return Code::BINARY_OP_IC; } 194 virtual int GetCodeKind() { return Code::BINARY_OP_IC; }
195 195
196 virtual InlineCacheState GetICState() { 196 virtual InlineCacheState GetICState() {
197 return BinaryOpIC::ToState(runtime_operands_type_); 197 return BinaryOpIC::ToState(runtime_operands_type_);
198 } 198 }
199 199
200 friend class CodeGenerator; 200 friend class CodeGenerator;
201 }; 201 };
202 202
203
204 class TypeRecordingBinaryOpStub: public CodeStub {
205 public:
206 TypeRecordingBinaryOpStub(Token::Value op, OverwriteMode mode)
207 : op_(op),
208 mode_(mode),
209 operands_type_(TRBinaryOpIC::UNINITIALIZED),
210 result_type_(TRBinaryOpIC::UNINITIALIZED),
211 name_(NULL) {
212 ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
213 }
214
215 TypeRecordingBinaryOpStub(
216 int key,
217 TRBinaryOpIC::TypeInfo operands_type,
218 TRBinaryOpIC::TypeInfo result_type = TRBinaryOpIC::UNINITIALIZED)
219 : op_(OpBits::decode(key)),
220 mode_(ModeBits::decode(key)),
221 operands_type_(operands_type),
222 result_type_(result_type),
223 name_(NULL) { }
224
225 private:
226 enum SmiCodeGenerateHeapNumberResults {
227 ALLOW_HEAPNUMBER_RESULTS,
228 NO_HEAPNUMBER_RESULTS
229 };
230
231 Token::Value op_;
232 OverwriteMode mode_;
233
234 // Operand type information determined at runtime.
235 TRBinaryOpIC::TypeInfo operands_type_;
236 TRBinaryOpIC::TypeInfo result_type_;
237
238 char* name_;
239
240 const char* GetName();
241
242 #ifdef DEBUG
243 void Print() {
244 PrintF("TypeRecordingBinaryOpStub %d (op %s), "
245 "(mode %d, runtime_type_info %s)\n",
246 MinorKey(),
247 Token::String(op_),
248 static_cast<int>(mode_),
249 TRBinaryOpIC::GetName(operands_type_));
250 }
251 #endif
252
253 // Minor key encoding in 15 bits RRRTTTOOOOOOOMM.
254 class ModeBits: public BitField<OverwriteMode, 0, 2> {};
255 class OpBits: public BitField<Token::Value, 2, 7> {};
256 class OperandTypeInfoBits: public BitField<TRBinaryOpIC::TypeInfo, 9, 3> {};
257 class ResultTypeInfoBits: public BitField<TRBinaryOpIC::TypeInfo, 12, 3> {};
258
259 Major MajorKey() { return TypeRecordingBinaryOp; }
260 int MinorKey() {
261 return OpBits::encode(op_)
262 | ModeBits::encode(mode_)
263 | OperandTypeInfoBits::encode(operands_type_)
264 | ResultTypeInfoBits::encode(result_type_);
265 }
266
267 void Generate(MacroAssembler* masm);
268 void GenerateGeneric(MacroAssembler* masm);
269 void GenerateSmiCode(MacroAssembler* masm,
270 Label* slow,
271 SmiCodeGenerateHeapNumberResults heapnumber_results);
272 void GenerateLoadArguments(MacroAssembler* masm);
273 void GenerateReturn(MacroAssembler* masm);
274 void GenerateUninitializedStub(MacroAssembler* masm);
275 void GenerateSmiStub(MacroAssembler* masm);
276 void GenerateInt32Stub(MacroAssembler* masm);
277 void GenerateHeapNumberStub(MacroAssembler* masm);
278 void GenerateStringStub(MacroAssembler* masm);
279 void GenerateGenericStub(MacroAssembler* masm);
280
281 void GenerateHeapResultAllocation(MacroAssembler* masm, Label* alloc_failure);
282 void GenerateRegisterArgsPush(MacroAssembler* masm);
283 void GenerateTypeTransition(MacroAssembler* masm);
284 void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm);
285
286 virtual int GetCodeKind() { return Code::TYPE_RECORDING_BINARY_OP_IC; }
287
288 virtual InlineCacheState GetICState() {
289 return TRBinaryOpIC::ToState(operands_type_);
290 }
291
292 virtual void FinishCode(Code* code) {
293 code->set_type_recording_binary_op_type(operands_type_);
294 code->set_type_recording_binary_op_result_type(result_type_);
295 }
296
297 friend class CodeGenerator;
298 };
299
300
203 class StringHelper : public AllStatic { 301 class StringHelper : public AllStatic {
204 public: 302 public:
205 // Generate code for copying characters using a simple loop. This should only 303 // Generate code for copying characters using a simple loop. This should only
206 // be used in places where the number of characters is small and the 304 // be used in places where the number of characters is small and the
207 // additional setup and checking in GenerateCopyCharactersREP adds too much 305 // additional setup and checking in GenerateCopyCharactersREP adds too much
208 // overhead. Copying of overlapping regions is not supported. 306 // overhead. Copying of overlapping regions is not supported.
209 static void GenerateCopyCharacters(MacroAssembler* masm, 307 static void GenerateCopyCharacters(MacroAssembler* masm,
210 Register dest, 308 Register dest,
211 Register src, 309 Register src,
212 Register count, 310 Register count,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 const char* GetName() { return "NumberToStringStub"; } 439 const char* GetName() { return "NumberToStringStub"; }
342 440
343 #ifdef DEBUG 441 #ifdef DEBUG
344 void Print() { 442 void Print() {
345 PrintF("NumberToStringStub\n"); 443 PrintF("NumberToStringStub\n");
346 } 444 }
347 #endif 445 #endif
348 }; 446 };
349 447
350 448
351 class RecordWriteStub : public CodeStub {
352 public:
353 RecordWriteStub(Register object, Register addr, Register scratch)
354 : object_(object), addr_(addr), scratch_(scratch) { }
355
356 void Generate(MacroAssembler* masm);
357
358 private:
359 Register object_;
360 Register addr_;
361 Register scratch_;
362
363 #ifdef DEBUG
364 void Print() {
365 PrintF("RecordWriteStub (object reg %d), (addr reg %d), (scratch reg %d)\n",
366 object_.code(), addr_.code(), scratch_.code());
367 }
368 #endif
369
370 // Minor key encoding in 12 bits. 4 bits for each of the three
371 // registers (object, address and scratch) OOOOAAAASSSS.
372 class ScratchBits : public BitField<uint32_t, 0, 4> {};
373 class AddressBits : public BitField<uint32_t, 4, 4> {};
374 class ObjectBits : public BitField<uint32_t, 8, 4> {};
375
376 Major MajorKey() { return RecordWrite; }
377
378 int MinorKey() {
379 // Encode the registers.
380 return ObjectBits::encode(object_.code()) |
381 AddressBits::encode(addr_.code()) |
382 ScratchBits::encode(scratch_.code());
383 }
384 };
385
386
387 } } // namespace v8::internal 449 } } // namespace v8::internal
388 450
389 #endif // V8_X64_CODE_STUBS_X64_H_ 451 #endif // V8_X64_CODE_STUBS_X64_H_
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698