OLD | NEW |
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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 // Support for arguments.length and arguments[?]. | 438 // Support for arguments.length and arguments[?]. |
439 void GenerateArgumentsLength(ZoneList<Expression*>* args); | 439 void GenerateArgumentsLength(ZoneList<Expression*>* args); |
440 void GenerateArguments(ZoneList<Expression*>* args); | 440 void GenerateArguments(ZoneList<Expression*>* args); |
441 | 441 |
442 // Support for accessing the class and value fields of an object. | 442 // Support for accessing the class and value fields of an object. |
443 void GenerateClassOf(ZoneList<Expression*>* args); | 443 void GenerateClassOf(ZoneList<Expression*>* args); |
444 void GenerateValueOf(ZoneList<Expression*>* args); | 444 void GenerateValueOf(ZoneList<Expression*>* args); |
445 void GenerateSetValueOf(ZoneList<Expression*>* args); | 445 void GenerateSetValueOf(ZoneList<Expression*>* args); |
446 | 446 |
447 // Fast support for charCodeAt(n). | 447 // Fast support for charCodeAt(n). |
448 void GenerateFastCharCodeAt(ZoneList<Expression*>* args); | 448 void GenerateStringCharCodeAt(ZoneList<Expression*>* args); |
449 | 449 |
450 // Fast support for string.charAt(n) and string[n]. | 450 // Fast support for string.charAt(n) and string[n]. |
451 void GenerateCharFromCode(ZoneList<Expression*>* args); | 451 void GenerateStringCharFromCode(ZoneList<Expression*>* args); |
| 452 |
| 453 // Fast support for string.charAt(n) and string[n]. |
| 454 void GenerateStringCharAt(ZoneList<Expression*>* args); |
452 | 455 |
453 // Fast support for object equality testing. | 456 // Fast support for object equality testing. |
454 void GenerateObjectEquals(ZoneList<Expression*>* args); | 457 void GenerateObjectEquals(ZoneList<Expression*>* args); |
455 | 458 |
456 void GenerateLog(ZoneList<Expression*>* args); | 459 void GenerateLog(ZoneList<Expression*>* args); |
457 | 460 |
458 // Fast support for Math.random(). | 461 // Fast support for Math.random(). |
459 void GenerateRandomHeapNumber(ZoneList<Expression*>* args); | 462 void GenerateRandomHeapNumber(ZoneList<Expression*>* args); |
460 | 463 |
461 // Fast support for StringAdd. | 464 // Fast support for StringAdd. |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 Token::String(op_), | 689 Token::String(op_), |
687 constant_rhs_); | 690 constant_rhs_); |
688 } | 691 } |
689 } | 692 } |
690 #endif | 693 #endif |
691 }; | 694 }; |
692 | 695 |
693 | 696 |
694 class StringHelper : public AllStatic { | 697 class StringHelper : public AllStatic { |
695 public: | 698 public: |
696 // Generates fast code for getting a char code out of a string | |
697 // object at the given index. May bail out for four reasons (in the | |
698 // listed order): | |
699 // * Receiver is not a string (receiver_not_string label). | |
700 // * Index is not a smi (index_not_smi label). | |
701 // * Index is out of range (index_out_of_range). | |
702 // * Some other reason (slow_case label). In this case it's | |
703 // guaranteed that the above conditions are not violated, | |
704 // e.g. it's safe to assume the receiver is a string and the | |
705 // index is a non-negative smi < length. | |
706 // When successful, object, index, and scratch are clobbered. | |
707 // Otherwise, scratch and result are clobbered. | |
708 static void GenerateFastCharCodeAt(MacroAssembler* masm, | |
709 Register object, | |
710 Register index, | |
711 Register scratch, | |
712 Register result, | |
713 Label* receiver_not_string, | |
714 Label* index_not_smi, | |
715 Label* index_out_of_range, | |
716 Label* slow_case); | |
717 | |
718 // Generates code for creating a one-char string from the given char | |
719 // code. May do a runtime call, so any register can be clobbered | |
720 // and, if the given invoke flag specifies a call, an internal frame | |
721 // is required. In tail call mode the result must be r0 register. | |
722 static void GenerateCharFromCode(MacroAssembler* masm, | |
723 Register code, | |
724 Register scratch, | |
725 Register result, | |
726 InvokeFlag flag); | |
727 | |
728 // Generate code for copying characters using a simple loop. This should only | 699 // Generate code for copying characters using a simple loop. This should only |
729 // be used in places where the number of characters is small and the | 700 // be used in places where the number of characters is small and the |
730 // additional setup and checking in GenerateCopyCharactersLong adds too much | 701 // additional setup and checking in GenerateCopyCharactersLong adds too much |
731 // overhead. Copying of overlapping regions is not supported. | 702 // overhead. Copying of overlapping regions is not supported. |
732 // Dest register ends at the position after the last character written. | 703 // Dest register ends at the position after the last character written. |
733 static void GenerateCopyCharacters(MacroAssembler* masm, | 704 static void GenerateCopyCharacters(MacroAssembler* masm, |
734 Register dest, | 705 Register dest, |
735 Register src, | 706 Register src, |
736 Register count, | 707 Register count, |
737 Register scratch, | 708 Register scratch, |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 return ObjectBits::encode(object_.code()) | | 924 return ObjectBits::encode(object_.code()) | |
954 OffsetBits::encode(offset_.code()) | | 925 OffsetBits::encode(offset_.code()) | |
955 ScratchBits::encode(scratch_.code()); | 926 ScratchBits::encode(scratch_.code()); |
956 } | 927 } |
957 }; | 928 }; |
958 | 929 |
959 | 930 |
960 } } // namespace v8::internal | 931 } } // namespace v8::internal |
961 | 932 |
962 #endif // V8_ARM_CODEGEN_ARM_H_ | 933 #endif // V8_ARM_CODEGEN_ARM_H_ |
OLD | NEW |