OLD | NEW |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 private: | 73 private: |
74 Token::Value op_; | 74 Token::Value op_; |
75 UnaryOverwriteMode mode_; | 75 UnaryOverwriteMode mode_; |
76 | 76 |
77 // Operand type information determined at runtime. | 77 // Operand type information determined at runtime. |
78 UnaryOpIC::TypeInfo operand_type_; | 78 UnaryOpIC::TypeInfo operand_type_; |
79 | 79 |
80 char* name_; | 80 char* name_; |
81 | 81 |
82 const char* GetName(); | 82 virtual const char* GetName(); |
83 | 83 |
84 #ifdef DEBUG | 84 #ifdef DEBUG |
85 void Print() { | 85 void Print() { |
86 PrintF("UnaryOpStub %d (op %s), (mode %d, runtime_type_info %s)\n", | 86 PrintF("UnaryOpStub %d (op %s), (mode %d, runtime_type_info %s)\n", |
87 MinorKey(), | 87 MinorKey(), |
88 Token::String(op_), | 88 Token::String(op_), |
89 static_cast<int>(mode_), | 89 static_cast<int>(mode_), |
90 UnaryOpIC::GetName(operand_type_)); | 90 UnaryOpIC::GetName(operand_type_)); |
91 } | 91 } |
92 #endif | 92 #endif |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 Token::Value op_; | 169 Token::Value op_; |
170 OverwriteMode mode_; | 170 OverwriteMode mode_; |
171 bool use_fpu_; | 171 bool use_fpu_; |
172 | 172 |
173 // Operand type information determined at runtime. | 173 // Operand type information determined at runtime. |
174 BinaryOpIC::TypeInfo operands_type_; | 174 BinaryOpIC::TypeInfo operands_type_; |
175 BinaryOpIC::TypeInfo result_type_; | 175 BinaryOpIC::TypeInfo result_type_; |
176 | 176 |
177 char* name_; | 177 char* name_; |
178 | 178 |
179 const char* GetName(); | 179 virtual const char* GetName(); |
180 | 180 |
181 #ifdef DEBUG | 181 #ifdef DEBUG |
182 void Print() { | 182 void Print() { |
183 PrintF("BinaryOpStub %d (op %s), " | 183 PrintF("BinaryOpStub %d (op %s), " |
184 "(mode %d, runtime_type_info %s)\n", | 184 "(mode %d, runtime_type_info %s)\n", |
185 MinorKey(), | 185 MinorKey(), |
186 Token::String(op_), | 186 Token::String(op_), |
187 static_cast<int>(mode_), | 187 static_cast<int>(mode_), |
188 BinaryOpIC::GetName(operands_type_)); | 188 BinaryOpIC::GetName(operands_type_)); |
189 } | 189 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 Major MajorKey() { return WriteInt32ToHeapNumber; } | 368 Major MajorKey() { return WriteInt32ToHeapNumber; } |
369 int MinorKey() { | 369 int MinorKey() { |
370 // Encode the parameters in a unique 16 bit value. | 370 // Encode the parameters in a unique 16 bit value. |
371 return IntRegisterBits::encode(the_int_.code()) | 371 return IntRegisterBits::encode(the_int_.code()) |
372 | HeapNumberRegisterBits::encode(the_heap_number_.code()) | 372 | HeapNumberRegisterBits::encode(the_heap_number_.code()) |
373 | ScratchRegisterBits::encode(scratch_.code()); | 373 | ScratchRegisterBits::encode(scratch_.code()); |
374 } | 374 } |
375 | 375 |
376 void Generate(MacroAssembler* masm); | 376 void Generate(MacroAssembler* masm); |
377 | |
378 const char* GetName() { return "WriteInt32ToHeapNumberStub"; } | |
379 | |
380 #ifdef DEBUG | |
381 void Print() { PrintF("WriteInt32ToHeapNumberStub\n"); } | |
382 #endif | |
383 }; | 377 }; |
384 | 378 |
385 | 379 |
386 class NumberToStringStub: public CodeStub { | 380 class NumberToStringStub: public CodeStub { |
387 public: | 381 public: |
388 NumberToStringStub() { } | 382 NumberToStringStub() { } |
389 | 383 |
390 // 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 |
391 // 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 |
392 // 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 |
393 // 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 |
394 // 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. |
395 static void GenerateLookupNumberStringCache(MacroAssembler* masm, | 389 static void GenerateLookupNumberStringCache(MacroAssembler* masm, |
396 Register object, | 390 Register object, |
397 Register result, | 391 Register result, |
398 Register scratch1, | 392 Register scratch1, |
399 Register scratch2, | 393 Register scratch2, |
400 Register scratch3, | 394 Register scratch3, |
401 bool object_is_smi, | 395 bool object_is_smi, |
402 Label* not_found); | 396 Label* not_found); |
403 | 397 |
404 private: | 398 private: |
405 Major MajorKey() { return NumberToString; } | 399 Major MajorKey() { return NumberToString; } |
406 int MinorKey() { return 0; } | 400 int MinorKey() { return 0; } |
407 | 401 |
408 void Generate(MacroAssembler* masm); | 402 void Generate(MacroAssembler* masm); |
409 | |
410 const char* GetName() { return "NumberToStringStub"; } | |
411 | |
412 #ifdef DEBUG | |
413 void Print() { | |
414 PrintF("NumberToStringStub\n"); | |
415 } | |
416 #endif | |
417 }; | 403 }; |
418 | 404 |
419 | 405 |
420 // 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 |
421 // 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. |
422 // Currently only needed on ARM and MIPS. | 408 // Currently only needed on ARM and MIPS. |
423 class RegExpCEntryStub: public CodeStub { | 409 class RegExpCEntryStub: public CodeStub { |
424 public: | 410 public: |
425 RegExpCEntryStub() {} | 411 RegExpCEntryStub() {} |
426 virtual ~RegExpCEntryStub() {} | 412 virtual ~RegExpCEntryStub() {} |
427 void Generate(MacroAssembler* masm); | 413 void Generate(MacroAssembler* masm); |
428 | 414 |
429 private: | 415 private: |
430 Major MajorKey() { return RegExpCEntry; } | 416 Major MajorKey() { return RegExpCEntry; } |
431 int MinorKey() { return 0; } | 417 int MinorKey() { return 0; } |
432 | 418 |
433 bool NeedsImmovableCode() { return true; } | 419 bool NeedsImmovableCode() { return true; } |
434 | |
435 const char* GetName() { return "RegExpCEntryStub"; } | |
436 }; | 420 }; |
437 | 421 |
438 // 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 |
439 // 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 |
440 // 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 |
441 // 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 |
442 // moved by GC | 426 // moved by GC |
443 class DirectCEntryStub: public CodeStub { | 427 class DirectCEntryStub: public CodeStub { |
444 public: | 428 public: |
445 DirectCEntryStub() {} | 429 DirectCEntryStub() {} |
446 void Generate(MacroAssembler* masm); | 430 void Generate(MacroAssembler* masm); |
447 void GenerateCall(MacroAssembler* masm, | 431 void GenerateCall(MacroAssembler* masm, |
448 ExternalReference function); | 432 ExternalReference function); |
449 void GenerateCall(MacroAssembler* masm, Register target); | 433 void GenerateCall(MacroAssembler* masm, Register target); |
450 | 434 |
451 private: | 435 private: |
452 Major MajorKey() { return DirectCEntry; } | 436 Major MajorKey() { return DirectCEntry; } |
453 int MinorKey() { return 0; } | 437 int MinorKey() { return 0; } |
454 | 438 |
455 bool NeedsImmovableCode() { return true; } | 439 bool NeedsImmovableCode() { return true; } |
456 | |
457 const char* GetName() { return "DirectCEntryStub"; } | |
458 }; | 440 }; |
459 | 441 |
460 class FloatingPointHelper : public AllStatic { | 442 class FloatingPointHelper : public AllStatic { |
461 public: | 443 public: |
462 enum Destination { | 444 enum Destination { |
463 kFPURegisters, | 445 kFPURegisters, |
464 kCoreRegisters | 446 kCoreRegisters |
465 }; | 447 }; |
466 | 448 |
467 | 449 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 static const int kTotalProbes = 20; | 611 static const int kTotalProbes = 20; |
630 | 612 |
631 static const int kCapacityOffset = | 613 static const int kCapacityOffset = |
632 StringDictionary::kHeaderSize + | 614 StringDictionary::kHeaderSize + |
633 StringDictionary::kCapacityIndex * kPointerSize; | 615 StringDictionary::kCapacityIndex * kPointerSize; |
634 | 616 |
635 static const int kElementsStartOffset = | 617 static const int kElementsStartOffset = |
636 StringDictionary::kHeaderSize + | 618 StringDictionary::kHeaderSize + |
637 StringDictionary::kElementsStartIndex * kPointerSize; | 619 StringDictionary::kElementsStartIndex * kPointerSize; |
638 | 620 |
639 | |
640 #ifdef DEBUG | |
641 void Print() { | |
642 PrintF("StringDictionaryLookupStub\n"); | |
643 } | |
644 #endif | |
645 | |
646 Major MajorKey() { return StringDictionaryNegativeLookup; } | 621 Major MajorKey() { return StringDictionaryNegativeLookup; } |
647 | 622 |
648 int MinorKey() { | 623 int MinorKey() { |
649 return LookupModeBits::encode(mode_); | 624 return LookupModeBits::encode(mode_); |
650 } | 625 } |
651 | 626 |
652 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; | 627 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; |
653 | 628 |
654 LookupMode mode_; | 629 LookupMode mode_; |
655 }; | 630 }; |
656 | 631 |
657 | 632 |
658 } } // namespace v8::internal | 633 } } // namespace v8::internal |
659 | 634 |
660 #endif // V8_MIPS_CODE_STUBS_ARM_H_ | 635 #endif // V8_MIPS_CODE_STUBS_ARM_H_ |
OLD | NEW |