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

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

Issue 11498006: Revert 13157, 13145 and 13140: Crankshaft code stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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 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 19 matching lines...) Expand all
30 30
31 #include "ic-inl.h" 31 #include "ic-inl.h"
32 #include "type-info.h" 32 #include "type-info.h"
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 37
38 // Compute a transcendental math function natively, or call the 38 // Compute a transcendental math function natively, or call the
39 // TranscendentalCache runtime function. 39 // TranscendentalCache runtime function.
40 class TranscendentalCacheStub: public PlatformCodeStub { 40 class TranscendentalCacheStub: public CodeStub {
41 public: 41 public:
42 enum ArgumentType { 42 enum ArgumentType {
43 TAGGED = 0, 43 TAGGED = 0,
44 UNTAGGED = 1 << TranscendentalCache::kTranscendentalTypeBits 44 UNTAGGED = 1 << TranscendentalCache::kTranscendentalTypeBits
45 }; 45 };
46 46
47 explicit TranscendentalCacheStub(TranscendentalCache::Type type, 47 explicit TranscendentalCacheStub(TranscendentalCache::Type type,
48 ArgumentType argument_type) 48 ArgumentType argument_type)
49 : type_(type), argument_type_(argument_type) {} 49 : type_(type), argument_type_(argument_type) {}
50 void Generate(MacroAssembler* masm); 50 void Generate(MacroAssembler* masm);
51 static void GenerateOperation(MacroAssembler* masm, 51 static void GenerateOperation(MacroAssembler* masm,
52 TranscendentalCache::Type type); 52 TranscendentalCache::Type type);
53 private: 53 private:
54 TranscendentalCache::Type type_; 54 TranscendentalCache::Type type_;
55 ArgumentType argument_type_; 55 ArgumentType argument_type_;
56 56
57 Major MajorKey() { return TranscendentalCache; } 57 Major MajorKey() { return TranscendentalCache; }
58 int MinorKey() { return type_ | argument_type_; } 58 int MinorKey() { return type_ | argument_type_; }
59 Runtime::FunctionId RuntimeFunction(); 59 Runtime::FunctionId RuntimeFunction();
60 }; 60 };
61 61
62 62
63 class StoreBufferOverflowStub: public PlatformCodeStub { 63 class StoreBufferOverflowStub: public CodeStub {
64 public: 64 public:
65 explicit StoreBufferOverflowStub(SaveFPRegsMode save_fp) 65 explicit StoreBufferOverflowStub(SaveFPRegsMode save_fp)
66 : save_doubles_(save_fp) { } 66 : save_doubles_(save_fp) { }
67 67
68 void Generate(MacroAssembler* masm); 68 void Generate(MacroAssembler* masm);
69 69
70 virtual bool IsPregenerated() { return true; } 70 virtual bool IsPregenerated() { return true; }
71 static void GenerateFixedRegStubsAheadOfTime(); 71 static void GenerateFixedRegStubsAheadOfTime();
72 virtual bool SometimesSetsUpAFrame() { return false; } 72 virtual bool SometimesSetsUpAFrame() { return false; }
73 73
74 private: 74 private:
75 SaveFPRegsMode save_doubles_; 75 SaveFPRegsMode save_doubles_;
76 76
77 Major MajorKey() { return StoreBufferOverflow; } 77 Major MajorKey() { return StoreBufferOverflow; }
78 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } 78 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; }
79 }; 79 };
80 80
81 81
82 class UnaryOpStub: public PlatformCodeStub { 82 class UnaryOpStub: public CodeStub {
83 public: 83 public:
84 UnaryOpStub(Token::Value op, 84 UnaryOpStub(Token::Value op,
85 UnaryOverwriteMode mode, 85 UnaryOverwriteMode mode,
86 UnaryOpIC::TypeInfo operand_type = UnaryOpIC::UNINITIALIZED) 86 UnaryOpIC::TypeInfo operand_type = UnaryOpIC::UNINITIALIZED)
87 : op_(op), 87 : op_(op),
88 mode_(mode), 88 mode_(mode),
89 operand_type_(operand_type) { 89 operand_type_(operand_type) {
90 } 90 }
91 91
92 private: 92 private:
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // Omit left string check in stub (left is definitely a string). 209 // Omit left string check in stub (left is definitely a string).
210 NO_STRING_CHECK_LEFT_IN_STUB = 1 << 0, 210 NO_STRING_CHECK_LEFT_IN_STUB = 1 << 0,
211 // Omit right string check in stub (right is definitely a string). 211 // Omit right string check in stub (right is definitely a string).
212 NO_STRING_CHECK_RIGHT_IN_STUB = 1 << 1, 212 NO_STRING_CHECK_RIGHT_IN_STUB = 1 << 1,
213 // Omit both string checks in stub. 213 // Omit both string checks in stub.
214 NO_STRING_CHECK_IN_STUB = 214 NO_STRING_CHECK_IN_STUB =
215 NO_STRING_CHECK_LEFT_IN_STUB | NO_STRING_CHECK_RIGHT_IN_STUB 215 NO_STRING_CHECK_LEFT_IN_STUB | NO_STRING_CHECK_RIGHT_IN_STUB
216 }; 216 };
217 217
218 218
219 class StringAddStub: public PlatformCodeStub { 219 class StringAddStub: public CodeStub {
220 public: 220 public:
221 explicit StringAddStub(StringAddFlags flags) : flags_(flags) {} 221 explicit StringAddStub(StringAddFlags flags) : flags_(flags) {}
222 222
223 private: 223 private:
224 Major MajorKey() { return StringAdd; } 224 Major MajorKey() { return StringAdd; }
225 int MinorKey() { return flags_; } 225 int MinorKey() { return flags_; }
226 226
227 void Generate(MacroAssembler* masm); 227 void Generate(MacroAssembler* masm);
228 228
229 void GenerateConvertArgument(MacroAssembler* masm, 229 void GenerateConvertArgument(MacroAssembler* masm,
230 int stack_offset, 230 int stack_offset,
231 Register arg, 231 Register arg,
232 Register scratch1, 232 Register scratch1,
233 Register scratch2, 233 Register scratch2,
234 Register scratch3, 234 Register scratch3,
235 Label* slow); 235 Label* slow);
236 236
237 const StringAddFlags flags_; 237 const StringAddFlags flags_;
238 }; 238 };
239 239
240 240
241 class SubStringStub: public PlatformCodeStub { 241 class SubStringStub: public CodeStub {
242 public: 242 public:
243 SubStringStub() {} 243 SubStringStub() {}
244 244
245 private: 245 private:
246 Major MajorKey() { return SubString; } 246 Major MajorKey() { return SubString; }
247 int MinorKey() { return 0; } 247 int MinorKey() { return 0; }
248 248
249 void Generate(MacroAssembler* masm); 249 void Generate(MacroAssembler* masm);
250 }; 250 };
251 251
252 252
253 class StringCompareStub: public PlatformCodeStub { 253 class StringCompareStub: public CodeStub {
254 public: 254 public:
255 StringCompareStub() {} 255 StringCompareStub() {}
256 256
257 // Compares two flat ASCII strings and returns result in rax. 257 // Compares two flat ASCII strings and returns result in rax.
258 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, 258 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
259 Register left, 259 Register left,
260 Register right, 260 Register right,
261 Register scratch1, 261 Register scratch1,
262 Register scratch2, 262 Register scratch2,
263 Register scratch3, 263 Register scratch3,
(...skipping 16 matching lines...) Expand all
280 MacroAssembler* masm, 280 MacroAssembler* masm,
281 Register left, 281 Register left,
282 Register right, 282 Register right,
283 Register length, 283 Register length,
284 Register scratch, 284 Register scratch,
285 Label* chars_not_equal, 285 Label* chars_not_equal,
286 Label::Distance near_jump = Label::kFar); 286 Label::Distance near_jump = Label::kFar);
287 }; 287 };
288 288
289 289
290 class NumberToStringStub: public PlatformCodeStub { 290 class NumberToStringStub: public CodeStub {
291 public: 291 public:
292 NumberToStringStub() { } 292 NumberToStringStub() { }
293 293
294 // Generate code to do a lookup in the number string cache. If the number in 294 // Generate code to do a lookup in the number string cache. If the number in
295 // the register object is found in the cache the generated code falls through 295 // the register object is found in the cache the generated code falls through
296 // with the result in the result register. The object and the result register 296 // with the result in the result register. The object and the result register
297 // can be the same. If the number is not found in the cache the code jumps to 297 // can be the same. If the number is not found in the cache the code jumps to
298 // the label not_found with only the content of register object unchanged. 298 // the label not_found with only the content of register object unchanged.
299 static void GenerateLookupNumberStringCache(MacroAssembler* masm, 299 static void GenerateLookupNumberStringCache(MacroAssembler* masm,
300 Register object, 300 Register object,
301 Register result, 301 Register result,
302 Register scratch1, 302 Register scratch1,
303 Register scratch2, 303 Register scratch2,
304 bool object_is_smi, 304 bool object_is_smi,
305 Label* not_found); 305 Label* not_found);
306 306
307 private: 307 private:
308 static void GenerateConvertHashCodeToIndex(MacroAssembler* masm, 308 static void GenerateConvertHashCodeToIndex(MacroAssembler* masm,
309 Register hash, 309 Register hash,
310 Register mask); 310 Register mask);
311 311
312 Major MajorKey() { return NumberToString; } 312 Major MajorKey() { return NumberToString; }
313 int MinorKey() { return 0; } 313 int MinorKey() { return 0; }
314 314
315 void Generate(MacroAssembler* masm); 315 void Generate(MacroAssembler* masm);
316 }; 316 };
317 317
318 318
319 class StringDictionaryLookupStub: public PlatformCodeStub { 319 class StringDictionaryLookupStub: public CodeStub {
320 public: 320 public:
321 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; 321 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP };
322 322
323 StringDictionaryLookupStub(Register dictionary, 323 StringDictionaryLookupStub(Register dictionary,
324 Register result, 324 Register result,
325 Register index, 325 Register index,
326 LookupMode mode) 326 LookupMode mode)
327 : dictionary_(dictionary), result_(result), index_(index), mode_(mode) { } 327 : dictionary_(dictionary), result_(result), index_(index), mode_(mode) { }
328 328
329 void Generate(MacroAssembler* masm); 329 void Generate(MacroAssembler* masm);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 class IndexBits: public BitField<int, 8, 4> {}; 371 class IndexBits: public BitField<int, 8, 4> {};
372 class LookupModeBits: public BitField<LookupMode, 12, 1> {}; 372 class LookupModeBits: public BitField<LookupMode, 12, 1> {};
373 373
374 Register dictionary_; 374 Register dictionary_;
375 Register result_; 375 Register result_;
376 Register index_; 376 Register index_;
377 LookupMode mode_; 377 LookupMode mode_;
378 }; 378 };
379 379
380 380
381 class RecordWriteStub: public PlatformCodeStub { 381 class RecordWriteStub: public CodeStub {
382 public: 382 public:
383 RecordWriteStub(Register object, 383 RecordWriteStub(Register object,
384 Register value, 384 Register value,
385 Register address, 385 Register address,
386 RememberedSetAction remembered_set_action, 386 RememberedSetAction remembered_set_action,
387 SaveFPRegsMode fp_mode) 387 SaveFPRegsMode fp_mode)
388 : object_(object), 388 : object_(object),
389 value_(value), 389 value_(value),
390 address_(address), 390 address_(address),
391 remembered_set_action_(remembered_set_action), 391 remembered_set_action_(remembered_set_action),
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 Register scratch0_orig_; 554 Register scratch0_orig_;
555 Register object_; 555 Register object_;
556 Register address_; 556 Register address_;
557 Register scratch0_; 557 Register scratch0_;
558 Register scratch1_; 558 Register scratch1_;
559 // Third scratch register is always rcx. 559 // Third scratch register is always rcx.
560 560
561 Register GetRegThatIsNotRcxOr(Register r1, 561 Register GetRegThatIsNotRcxOr(Register r1,
562 Register r2, 562 Register r2,
563 Register r3) { 563 Register r3) {
564 for (int i = 0; i < Register::NumAllocatableRegisters(); i++) { 564 for (int i = 0; i < Register::kNumAllocatableRegisters; i++) {
565 Register candidate = Register::FromAllocationIndex(i); 565 Register candidate = Register::FromAllocationIndex(i);
566 if (candidate.is(rcx)) continue; 566 if (candidate.is(rcx)) continue;
567 if (candidate.is(r1)) continue; 567 if (candidate.is(r1)) continue;
568 if (candidate.is(r2)) continue; 568 if (candidate.is(r2)) continue;
569 if (candidate.is(r3)) continue; 569 if (candidate.is(r3)) continue;
570 return candidate; 570 return candidate;
571 } 571 }
572 UNREACHABLE(); 572 UNREACHABLE();
573 return no_reg; 573 return no_reg;
574 } 574 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 RememberedSetAction remembered_set_action_; 614 RememberedSetAction remembered_set_action_;
615 SaveFPRegsMode save_fp_regs_mode_; 615 SaveFPRegsMode save_fp_regs_mode_;
616 Label slow_; 616 Label slow_;
617 RegisterAllocation regs_; 617 RegisterAllocation regs_;
618 }; 618 };
619 619
620 620
621 } } // namespace v8::internal 621 } } // namespace v8::internal
622 622
623 #endif // V8_X64_CODE_STUBS_X64_H_ 623 #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