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

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

Issue 7348008: Merge up to 8597 to experimental/gc from the bleeding edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 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/mips/builtins-mips.cc ('k') | src/mips/code-stubs-mips.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 TranscendentalCache::Type type_; 52 TranscendentalCache::Type type_;
53 ArgumentType argument_type_; 53 ArgumentType argument_type_;
54 void GenerateCallCFunction(MacroAssembler* masm, Register scratch); 54 void GenerateCallCFunction(MacroAssembler* masm, Register scratch);
55 55
56 Major MajorKey() { return TranscendentalCache; } 56 Major MajorKey() { return TranscendentalCache; }
57 int MinorKey() { return type_ | argument_type_; } 57 int MinorKey() { return type_ | argument_type_; }
58 Runtime::FunctionId RuntimeFunction(); 58 Runtime::FunctionId RuntimeFunction();
59 }; 59 };
60 60
61 61
62 class ToBooleanStub: public CodeStub {
63 public:
64 explicit ToBooleanStub(Register tos) : tos_(tos) { }
65
66 void Generate(MacroAssembler* masm);
67
68 private:
69 Register tos_;
70 Major MajorKey() { return ToBoolean; }
71 int MinorKey() { return tos_.code(); }
72 };
73
74
75 class UnaryOpStub: public CodeStub { 62 class UnaryOpStub: public CodeStub {
76 public: 63 public:
77 UnaryOpStub(Token::Value op, UnaryOverwriteMode mode) 64 UnaryOpStub(Token::Value op,
65 UnaryOverwriteMode mode,
66 UnaryOpIC::TypeInfo operand_type = UnaryOpIC::UNINITIALIZED)
78 : op_(op), 67 : op_(op),
79 mode_(mode), 68 mode_(mode),
80 operand_type_(UnaryOpIC::UNINITIALIZED),
81 name_(NULL) {
82 }
83
84 UnaryOpStub(
85 int key,
86 UnaryOpIC::TypeInfo operand_type)
87 : op_(OpBits::decode(key)),
88 mode_(ModeBits::decode(key)),
89 operand_type_(operand_type), 69 operand_type_(operand_type),
90 name_(NULL) { 70 name_(NULL) {
91 } 71 }
92 72
93 private: 73 private:
94 Token::Value op_; 74 Token::Value op_;
95 UnaryOverwriteMode mode_; 75 UnaryOverwriteMode mode_;
96 76
97 // Operand type information determined at runtime. 77 // Operand type information determined at runtime.
98 UnaryOpIC::TypeInfo operand_type_; 78 UnaryOpIC::TypeInfo operand_type_;
99 79
100 char* name_; 80 char* name_;
101 81
102 const char* GetName(); 82 virtual const char* GetName();
103 83
104 #ifdef DEBUG 84 #ifdef DEBUG
105 void Print() { 85 void Print() {
106 PrintF("UnaryOpStub %d (op %s), " 86 PrintF("UnaryOpStub %d (op %s), (mode %d, runtime_type_info %s)\n",
107 "(mode %d, runtime_type_info %s)\n",
108 MinorKey(), 87 MinorKey(),
109 Token::String(op_), 88 Token::String(op_),
110 static_cast<int>(mode_), 89 static_cast<int>(mode_),
111 UnaryOpIC::GetName(operand_type_)); 90 UnaryOpIC::GetName(operand_type_));
112 } 91 }
113 #endif 92 #endif
114 93
115 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {}; 94 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {};
116 class OpBits: public BitField<Token::Value, 1, 7> {}; 95 class OpBits: public BitField<Token::Value, 1, 7> {};
117 class OperandTypeInfoBits: public BitField<UnaryOpIC::TypeInfo, 8, 3> {}; 96 class OperandTypeInfoBits: public BitField<UnaryOpIC::TypeInfo, 8, 3> {};
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 Token::Value op_; 169 Token::Value op_;
191 OverwriteMode mode_; 170 OverwriteMode mode_;
192 bool use_fpu_; 171 bool use_fpu_;
193 172
194 // Operand type information determined at runtime. 173 // Operand type information determined at runtime.
195 BinaryOpIC::TypeInfo operands_type_; 174 BinaryOpIC::TypeInfo operands_type_;
196 BinaryOpIC::TypeInfo result_type_; 175 BinaryOpIC::TypeInfo result_type_;
197 176
198 char* name_; 177 char* name_;
199 178
200 const char* GetName(); 179 virtual const char* GetName();
201 180
202 #ifdef DEBUG 181 #ifdef DEBUG
203 void Print() { 182 void Print() {
204 PrintF("BinaryOpStub %d (op %s), " 183 PrintF("BinaryOpStub %d (op %s), "
205 "(mode %d, runtime_type_info %s)\n", 184 "(mode %d, runtime_type_info %s)\n",
206 MinorKey(), 185 MinorKey(),
207 Token::String(op_), 186 Token::String(op_),
208 static_cast<int>(mode_), 187 static_cast<int>(mode_),
209 BinaryOpIC::GetName(operands_type_)); 188 BinaryOpIC::GetName(operands_type_));
210 } 189 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 367
389 Major MajorKey() { return WriteInt32ToHeapNumber; } 368 Major MajorKey() { return WriteInt32ToHeapNumber; }
390 int MinorKey() { 369 int MinorKey() {
391 // Encode the parameters in a unique 16 bit value. 370 // Encode the parameters in a unique 16 bit value.
392 return IntRegisterBits::encode(the_int_.code()) 371 return IntRegisterBits::encode(the_int_.code())
393 | HeapNumberRegisterBits::encode(the_heap_number_.code()) 372 | HeapNumberRegisterBits::encode(the_heap_number_.code())
394 | ScratchRegisterBits::encode(scratch_.code()); 373 | ScratchRegisterBits::encode(scratch_.code());
395 } 374 }
396 375
397 void Generate(MacroAssembler* masm); 376 void Generate(MacroAssembler* masm);
398
399 const char* GetName() { return "WriteInt32ToHeapNumberStub"; }
400
401 #ifdef DEBUG
402 void Print() { PrintF("WriteInt32ToHeapNumberStub\n"); }
403 #endif
404 }; 377 };
405 378
406 379
407 class NumberToStringStub: public CodeStub { 380 class NumberToStringStub: public CodeStub {
408 public: 381 public:
409 NumberToStringStub() { } 382 NumberToStringStub() { }
410 383
411 // Generate code to do a lookup in the number string cache. If the number in 384 // Generate code to do a lookup in the number string cache. If the number in
412 // the register object is found in the cache the generated code falls through 385 // the register object is found in the cache the generated code falls through
413 // with the result in the result register. The object and the result register 386 // with the result in the result register. The object and the result register
414 // can be the same. If the number is not found in the cache the code jumps to 387 // can be the same. If the number is not found in the cache the code jumps to
415 // the label not_found with only the content of register object unchanged. 388 // the label not_found with only the content of register object unchanged.
416 static void GenerateLookupNumberStringCache(MacroAssembler* masm, 389 static void GenerateLookupNumberStringCache(MacroAssembler* masm,
417 Register object, 390 Register object,
418 Register result, 391 Register result,
419 Register scratch1, 392 Register scratch1,
420 Register scratch2, 393 Register scratch2,
421 Register scratch3, 394 Register scratch3,
422 bool object_is_smi, 395 bool object_is_smi,
423 Label* not_found); 396 Label* not_found);
424 397
425 private: 398 private:
426 Major MajorKey() { return NumberToString; } 399 Major MajorKey() { return NumberToString; }
427 int MinorKey() { return 0; } 400 int MinorKey() { return 0; }
428 401
429 void Generate(MacroAssembler* masm); 402 void Generate(MacroAssembler* masm);
430
431 const char* GetName() { return "NumberToStringStub"; }
432
433 #ifdef DEBUG
434 void Print() {
435 PrintF("NumberToStringStub\n");
436 }
437 #endif
438 }; 403 };
439 404
440 405
441 // Enter C code from generated RegExp code in a way that allows 406 // Enter C code from generated RegExp code in a way that allows
442 // the C code to fix the return address in case of a GC. 407 // the C code to fix the return address in case of a GC.
443 // Currently only needed on ARM and MIPS. 408 // Currently only needed on ARM and MIPS.
444 class RegExpCEntryStub: public CodeStub { 409 class RegExpCEntryStub: public CodeStub {
445 public: 410 public:
446 RegExpCEntryStub() {} 411 RegExpCEntryStub() {}
447 virtual ~RegExpCEntryStub() {} 412 virtual ~RegExpCEntryStub() {}
448 void Generate(MacroAssembler* masm); 413 void Generate(MacroAssembler* masm);
449 414
450 private: 415 private:
451 Major MajorKey() { return RegExpCEntry; } 416 Major MajorKey() { return RegExpCEntry; }
452 int MinorKey() { return 0; } 417 int MinorKey() { return 0; }
453 418
454 bool NeedsImmovableCode() { return true; } 419 bool NeedsImmovableCode() { return true; }
455
456 const char* GetName() { return "RegExpCEntryStub"; }
457 }; 420 };
458 421
459 // Trampoline stub to call into native code. To call safely into native code 422 // Trampoline stub to call into native code. To call safely into native code
460 // in the presence of compacting GC (which can move code objects) we need to 423 // in the presence of compacting GC (which can move code objects) we need to
461 // keep the code which called into native pinned in the memory. Currently the 424 // keep the code which called into native pinned in the memory. Currently the
462 // simplest approach is to generate such stub early enough so it can never be 425 // simplest approach is to generate such stub early enough so it can never be
463 // moved by GC 426 // moved by GC
464 class DirectCEntryStub: public CodeStub { 427 class DirectCEntryStub: public CodeStub {
465 public: 428 public:
466 DirectCEntryStub() {} 429 DirectCEntryStub() {}
467 void Generate(MacroAssembler* masm); 430 void Generate(MacroAssembler* masm);
468 void GenerateCall(MacroAssembler* masm, 431 void GenerateCall(MacroAssembler* masm,
469 ExternalReference function); 432 ExternalReference function);
470 void GenerateCall(MacroAssembler* masm, Register target); 433 void GenerateCall(MacroAssembler* masm, Register target);
471 434
472 private: 435 private:
473 Major MajorKey() { return DirectCEntry; } 436 Major MajorKey() { return DirectCEntry; }
474 int MinorKey() { return 0; } 437 int MinorKey() { return 0; }
475 438
476 bool NeedsImmovableCode() { return true; } 439 bool NeedsImmovableCode() { return true; }
477
478 const char* GetName() { return "DirectCEntryStub"; }
479 }; 440 };
480 441
481 class FloatingPointHelper : public AllStatic { 442 class FloatingPointHelper : public AllStatic {
482 public: 443 public:
483
484 enum Destination { 444 enum Destination {
485 kFPURegisters, 445 kFPURegisters,
486 kCoreRegisters 446 kCoreRegisters
487 }; 447 };
488 448
489 449
490 // Loads smis from a0 and a1 (right and left in binary operations) into 450 // Loads smis from a0 and a1 (right and left in binary operations) into
491 // floating point registers. Depending on the destination the values ends up 451 // floating point registers. Depending on the destination the values ends up
492 // either f14 and f12 or in a2/a3 and a0/a1 respectively. If the destination 452 // either f14 and f12 or in a2/a3 and a0/a1 respectively. If the destination
493 // is floating point registers FPU must be supported. If core registers are 453 // is floating point registers FPU must be supported. If core registers are
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 static const int kTotalProbes = 20; 611 static const int kTotalProbes = 20;
652 612
653 static const int kCapacityOffset = 613 static const int kCapacityOffset =
654 StringDictionary::kHeaderSize + 614 StringDictionary::kHeaderSize +
655 StringDictionary::kCapacityIndex * kPointerSize; 615 StringDictionary::kCapacityIndex * kPointerSize;
656 616
657 static const int kElementsStartOffset = 617 static const int kElementsStartOffset =
658 StringDictionary::kHeaderSize + 618 StringDictionary::kHeaderSize +
659 StringDictionary::kElementsStartIndex * kPointerSize; 619 StringDictionary::kElementsStartIndex * kPointerSize;
660 620
661
662 #ifdef DEBUG
663 void Print() {
664 PrintF("StringDictionaryLookupStub\n");
665 }
666 #endif
667
668 Major MajorKey() { return StringDictionaryNegativeLookup; } 621 Major MajorKey() { return StringDictionaryNegativeLookup; }
669 622
670 int MinorKey() { 623 int MinorKey() {
671 return LookupModeBits::encode(mode_); 624 return LookupModeBits::encode(mode_);
672 } 625 }
673 626
674 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; 627 class LookupModeBits: public BitField<LookupMode, 0, 1> {};
675 628
676 LookupMode mode_; 629 LookupMode mode_;
677 }; 630 };
678 631
679 632
680 } } // namespace v8::internal 633 } } // namespace v8::internal
681 634
682 #endif // V8_MIPS_CODE_STUBS_ARM_H_ 635 #endif // V8_MIPS_CODE_STUBS_ARM_H_
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698