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/ia32/codegen-ia32.h

Issue 2087009: Custom call IC-s for String.prototype.{charAt,charCodeAt}. (Closed)
Patch Set: ARM port. Created 10 years, 7 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
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 20 matching lines...) Expand all
31 #include "ast.h" 31 #include "ast.h"
32 #include "ic-inl.h" 32 #include "ic-inl.h"
33 #include "jump-target-heavy.h" 33 #include "jump-target-heavy.h"
34 34
35 namespace v8 { 35 namespace v8 {
36 namespace internal { 36 namespace internal {
37 37
38 // Forward declarations 38 // Forward declarations
39 class CompilationInfo; 39 class CompilationInfo;
40 class DeferredCode; 40 class DeferredCode;
41 class FrameRegisterState;
41 class RegisterAllocator; 42 class RegisterAllocator;
42 class RegisterFile; 43 class RegisterFile;
44 class RuntimeCallHelper;
43 45
44 enum InitState { CONST_INIT, NOT_CONST_INIT }; 46 enum InitState { CONST_INIT, NOT_CONST_INIT };
45 enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; 47 enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
46 48
47 49
48 // ------------------------------------------------------------------------- 50 // -------------------------------------------------------------------------
49 // Reference support 51 // Reference support
50 52
51 // A reference is a C++ stack-allocated object that puts a 53 // A reference is a C++ stack-allocated object that puts a
52 // reference on the virtual frame. The reference may be consumed 54 // reference on the virtual frame. The reference may be consumed
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 // Support for arguments.length and arguments[?]. 616 // Support for arguments.length and arguments[?].
615 void GenerateArgumentsLength(ZoneList<Expression*>* args); 617 void GenerateArgumentsLength(ZoneList<Expression*>* args);
616 void GenerateArguments(ZoneList<Expression*>* args); 618 void GenerateArguments(ZoneList<Expression*>* args);
617 619
618 // Support for accessing the class and value fields of an object. 620 // Support for accessing the class and value fields of an object.
619 void GenerateClassOf(ZoneList<Expression*>* args); 621 void GenerateClassOf(ZoneList<Expression*>* args);
620 void GenerateValueOf(ZoneList<Expression*>* args); 622 void GenerateValueOf(ZoneList<Expression*>* args);
621 void GenerateSetValueOf(ZoneList<Expression*>* args); 623 void GenerateSetValueOf(ZoneList<Expression*>* args);
622 624
623 // Fast support for charCodeAt(n). 625 // Fast support for charCodeAt(n).
624 void GenerateFastCharCodeAt(ZoneList<Expression*>* args); 626 void GenerateStringCharCodeAt(ZoneList<Expression*>* args);
625 627
626 // Fast support for string.charAt(n) and string[n]. 628 // Fast support for string.charAt(n) and string[n].
627 void GenerateCharFromCode(ZoneList<Expression*>* args); 629 void GenerateStringCharFromCode(ZoneList<Expression*>* args);
630
631 // Fast support for string.charAt(n) and string[n].
632 void GenerateStringCharAt(ZoneList<Expression*>* args);
628 633
629 // Fast support for object equality testing. 634 // Fast support for object equality testing.
630 void GenerateObjectEquals(ZoneList<Expression*>* args); 635 void GenerateObjectEquals(ZoneList<Expression*>* args);
631 636
632 void GenerateLog(ZoneList<Expression*>* args); 637 void GenerateLog(ZoneList<Expression*>* args);
633 638
634 void GenerateGetFramePointer(ZoneList<Expression*>* args); 639 void GenerateGetFramePointer(ZoneList<Expression*>* args);
635 640
636 // Fast support for Math.random(). 641 // Fast support for Math.random().
637 void GenerateRandomHeapNumber(ZoneList<Expression*>* args); 642 void GenerateRandomHeapNumber(ZoneList<Expression*>* args);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 virtual int GetCodeKind() { return Code::BINARY_OP_IC; } 908 virtual int GetCodeKind() { return Code::BINARY_OP_IC; }
904 909
905 virtual InlineCacheState GetICState() { 910 virtual InlineCacheState GetICState() {
906 return BinaryOpIC::ToState(runtime_operands_type_); 911 return BinaryOpIC::ToState(runtime_operands_type_);
907 } 912 }
908 }; 913 };
909 914
910 915
911 class StringHelper : public AllStatic { 916 class StringHelper : public AllStatic {
912 public: 917 public:
913 // Generates fast code for getting a char code out of a string
914 // object at the given index. May bail out for four reasons (in the
915 // listed order):
916 // * Receiver is not a string (receiver_not_string label).
917 // * Index is not a smi (index_not_smi label).
918 // * Index is out of range (index_out_of_range).
919 // * Some other reason (slow_case label). In this case it's
920 // guaranteed that the above conditions are not violated,
921 // e.g. it's safe to assume the receiver is a string and the
922 // index is a non-negative smi < length.
923 // When successful, object, index, and scratch are clobbered.
924 // Otherwise, scratch and result are clobbered.
925 static void GenerateFastCharCodeAt(MacroAssembler* masm,
926 Register object,
927 Register index,
928 Register scratch,
929 Register result,
930 Label* receiver_not_string,
931 Label* index_not_smi,
932 Label* index_out_of_range,
933 Label* slow_case);
934
935 // Generates code for creating a one-char string from the given char
936 // code. May do a runtime call, so any register can be clobbered
937 // and, if the given invoke flag specifies a call, an internal frame
938 // is required. In tail call mode the result must be eax register.
939 static void GenerateCharFromCode(MacroAssembler* masm,
940 Register code,
941 Register result,
942 InvokeFlag flag);
943
944 // Generate code for copying characters using a simple loop. This should only 918 // Generate code for copying characters using a simple loop. This should only
945 // be used in places where the number of characters is small and the 919 // be used in places where the number of characters is small and the
946 // additional setup and checking in GenerateCopyCharactersREP adds too much 920 // additional setup and checking in GenerateCopyCharactersREP adds too much
947 // overhead. Copying of overlapping regions is not supported. 921 // overhead. Copying of overlapping regions is not supported.
948 static void GenerateCopyCharacters(MacroAssembler* masm, 922 static void GenerateCopyCharacters(MacroAssembler* masm,
949 Register dest, 923 Register dest,
950 Register src, 924 Register src,
951 Register count, 925 Register count,
952 Register scratch, 926 Register scratch,
953 bool ascii); 927 bool ascii);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 void Print() { 1053 void Print() {
1080 PrintF("NumberToStringStub\n"); 1054 PrintF("NumberToStringStub\n");
1081 } 1055 }
1082 #endif 1056 #endif
1083 }; 1057 };
1084 1058
1085 1059
1086 } } // namespace v8::internal 1060 } } // namespace v8::internal
1087 1061
1088 #endif // V8_IA32_CODEGEN_IA32_H_ 1062 #endif // V8_IA32_CODEGEN_IA32_H_
OLDNEW
« src/codegen.h ('K') | « src/full-codegen.cc ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698