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

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

Issue 10837165: Lattice-based representation inference, powered by left/right specific type feedback for BinaryOps … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback; fixed tests Created 8 years, 1 month 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 | « no previous file | src/arm/code-stubs-arm.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 virtual InlineCacheState GetICState() { 135 virtual InlineCacheState GetICState() {
136 return UnaryOpIC::ToState(operand_type_); 136 return UnaryOpIC::ToState(operand_type_);
137 } 137 }
138 138
139 virtual void FinishCode(Handle<Code> code) { 139 virtual void FinishCode(Handle<Code> code) {
140 code->set_unary_op_type(operand_type_); 140 code->set_unary_op_type(operand_type_);
141 } 141 }
142 }; 142 };
143 143
144 144
145 class BinaryOpStub: public CodeStub {
146 public:
147 BinaryOpStub(Token::Value op, OverwriteMode mode)
148 : op_(op),
149 mode_(mode),
150 operands_type_(BinaryOpIC::UNINITIALIZED),
151 result_type_(BinaryOpIC::UNINITIALIZED) {
152 use_vfp2_ = CpuFeatures::IsSupported(VFP2);
153 ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
154 }
155
156 BinaryOpStub(
157 int key,
158 BinaryOpIC::TypeInfo operands_type,
159 BinaryOpIC::TypeInfo result_type = BinaryOpIC::UNINITIALIZED)
160 : op_(OpBits::decode(key)),
161 mode_(ModeBits::decode(key)),
162 use_vfp2_(VFP2Bits::decode(key)),
163 operands_type_(operands_type),
164 result_type_(result_type) { }
165
166 private:
167 enum SmiCodeGenerateHeapNumberResults {
168 ALLOW_HEAPNUMBER_RESULTS,
169 NO_HEAPNUMBER_RESULTS
170 };
171
172 Token::Value op_;
173 OverwriteMode mode_;
174 bool use_vfp2_;
175
176 // Operand type information determined at runtime.
177 BinaryOpIC::TypeInfo operands_type_;
178 BinaryOpIC::TypeInfo result_type_;
179
180 virtual void PrintName(StringStream* stream);
181
182 // Minor key encoding in 16 bits RRRTTTVOOOOOOOMM.
183 class ModeBits: public BitField<OverwriteMode, 0, 2> {};
184 class OpBits: public BitField<Token::Value, 2, 7> {};
185 class VFP2Bits: public BitField<bool, 9, 1> {};
186 class OperandTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 10, 3> {};
187 class ResultTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 13, 3> {};
188
189 Major MajorKey() { return BinaryOp; }
190 int MinorKey() {
191 return OpBits::encode(op_)
192 | ModeBits::encode(mode_)
193 | VFP2Bits::encode(use_vfp2_)
194 | OperandTypeInfoBits::encode(operands_type_)
195 | ResultTypeInfoBits::encode(result_type_);
196 }
197
198 void Generate(MacroAssembler* masm);
199 void GenerateGeneric(MacroAssembler* masm);
200 void GenerateSmiSmiOperation(MacroAssembler* masm);
201 void GenerateFPOperation(MacroAssembler* masm,
202 bool smi_operands,
203 Label* not_numbers,
204 Label* gc_required);
205 void GenerateSmiCode(MacroAssembler* masm,
206 Label* use_runtime,
207 Label* gc_required,
208 SmiCodeGenerateHeapNumberResults heapnumber_results);
209 void GenerateLoadArguments(MacroAssembler* masm);
210 void GenerateReturn(MacroAssembler* masm);
211 void GenerateUninitializedStub(MacroAssembler* masm);
212 void GenerateSmiStub(MacroAssembler* masm);
213 void GenerateInt32Stub(MacroAssembler* masm);
214 void GenerateHeapNumberStub(MacroAssembler* masm);
215 void GenerateOddballStub(MacroAssembler* masm);
216 void GenerateStringStub(MacroAssembler* masm);
217 void GenerateBothStringStub(MacroAssembler* masm);
218 void GenerateGenericStub(MacroAssembler* masm);
219 void GenerateAddStrings(MacroAssembler* masm);
220 void GenerateCallRuntime(MacroAssembler* masm);
221
222 void GenerateHeapResultAllocation(MacroAssembler* masm,
223 Register result,
224 Register heap_number_map,
225 Register scratch1,
226 Register scratch2,
227 Label* gc_required);
228 void GenerateRegisterArgsPush(MacroAssembler* masm);
229 void GenerateTypeTransition(MacroAssembler* masm);
230 void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm);
231
232 virtual int GetCodeKind() { return Code::BINARY_OP_IC; }
233
234 virtual InlineCacheState GetICState() {
235 return BinaryOpIC::ToState(operands_type_);
236 }
237
238 virtual void FinishCode(Handle<Code> code) {
239 code->set_binary_op_type(operands_type_);
240 code->set_binary_op_result_type(result_type_);
241 }
242
243 friend class CodeGenerator;
244 };
245
246
247 class StringHelper : public AllStatic { 145 class StringHelper : public AllStatic {
248 public: 146 public:
249 // Generate code for copying characters using a simple loop. This should only 147 // Generate code for copying characters using a simple loop. This should only
250 // be used in places where the number of characters is small and the 148 // be used in places where the number of characters is small and the
251 // additional setup and checking in GenerateCopyCharactersLong adds too much 149 // additional setup and checking in GenerateCopyCharactersLong adds too much
252 // overhead. Copying of overlapping regions is not supported. 150 // overhead. Copying of overlapping regions is not supported.
253 // Dest register ends at the position after the last character written. 151 // Dest register ends at the position after the last character written.
254 static void GenerateCopyCharacters(MacroAssembler* masm, 152 static void GenerateCopyCharacters(MacroAssembler* masm,
255 Register dest, 153 Register dest,
256 Register src, 154 Register src,
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 // Loads smis from r0 and r1 (right and left in binary operations) into 615 // Loads smis from r0 and r1 (right and left in binary operations) into
718 // floating point registers. Depending on the destination the values ends up 616 // floating point registers. Depending on the destination the values ends up
719 // either d7 and d6 or in r2/r3 and r0/r1 respectively. If the destination is 617 // either d7 and d6 or in r2/r3 and r0/r1 respectively. If the destination is
720 // floating point registers VFP3 must be supported. If core registers are 618 // floating point registers VFP3 must be supported. If core registers are
721 // requested when VFP3 is supported d6 and d7 will be scratched. 619 // requested when VFP3 is supported d6 and d7 will be scratched.
722 static void LoadSmis(MacroAssembler* masm, 620 static void LoadSmis(MacroAssembler* masm,
723 Destination destination, 621 Destination destination,
724 Register scratch1, 622 Register scratch1,
725 Register scratch2); 623 Register scratch2);
726 624
727 // Loads objects from r0 and r1 (right and left in binary operations) into
728 // floating point registers. Depending on the destination the values ends up
729 // either d7 and d6 or in r2/r3 and r0/r1 respectively. If the destination is
730 // floating point registers VFP3 must be supported. If core registers are
731 // requested when VFP3 is supported d6 and d7 will still be scratched. If
732 // either r0 or r1 is not a number (not smi and not heap number object) the
733 // not_number label is jumped to with r0 and r1 intact.
734 static void LoadOperands(MacroAssembler* masm,
735 FloatingPointHelper::Destination destination,
736 Register heap_number_map,
737 Register scratch1,
738 Register scratch2,
739 Label* not_number);
740
741 // Convert the smi or heap number in object to an int32 using the rules 625 // Convert the smi or heap number in object to an int32 using the rules
742 // for ToInt32 as described in ECMAScript 9.5.: the value is truncated 626 // for ToInt32 as described in ECMAScript 9.5.: the value is truncated
743 // and brought into the range -2^31 .. +2^31 - 1. 627 // and brought into the range -2^31 .. +2^31 - 1.
744 static void ConvertNumberToInt32(MacroAssembler* masm, 628 static void ConvertNumberToInt32(MacroAssembler* masm,
745 Register object, 629 Register object,
746 Register dst, 630 Register dst,
747 Register heap_number_map, 631 Register heap_number_map,
748 Register scratch1, 632 Register scratch1,
749 Register scratch2, 633 Register scratch2,
750 Register scratch3, 634 Register scratch3,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 // Requires the following layout on entry: 713 // Requires the following layout on entry:
830 // r0: Left value (least significant part of mantissa). 714 // r0: Left value (least significant part of mantissa).
831 // r1: Left value (sign, exponent, top of mantissa). 715 // r1: Left value (sign, exponent, top of mantissa).
832 // r2: Right value (least significant part of mantissa). 716 // r2: Right value (least significant part of mantissa).
833 // r3: Right value (sign, exponent, top of mantissa). 717 // r3: Right value (sign, exponent, top of mantissa).
834 static void CallCCodeForDoubleOperation(MacroAssembler* masm, 718 static void CallCCodeForDoubleOperation(MacroAssembler* masm,
835 Token::Value op, 719 Token::Value op,
836 Register heap_number_result, 720 Register heap_number_result,
837 Register scratch); 721 Register scratch);
838 722
839 private: 723 // Loads the objects from |object| into floating point registers.
724 // Depending on |destination| the value ends up either in |dst| or
725 // in |dst1|/|dst2|. If |destination| is kVFPRegisters, then VFP3
726 // must be supported. If kCoreRegisters are requested and VFP3 is
727 // supported, |dst| will be scratched. If |object| is neither smi nor
728 // heap number, |not_number| is jumped to with |object| still intact.
840 static void LoadNumber(MacroAssembler* masm, 729 static void LoadNumber(MacroAssembler* masm,
841 FloatingPointHelper::Destination destination, 730 FloatingPointHelper::Destination destination,
842 Register object, 731 Register object,
843 DwVfpRegister dst, 732 DwVfpRegister dst,
844 Register dst1, 733 Register dst1,
845 Register dst2, 734 Register dst2,
846 Register heap_number_map, 735 Register heap_number_map,
847 Register scratch1, 736 Register scratch1,
848 Register scratch2, 737 Register scratch2,
849 Label* not_number); 738 Label* not_number);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 785
897 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; 786 class LookupModeBits: public BitField<LookupMode, 0, 1> {};
898 787
899 LookupMode mode_; 788 LookupMode mode_;
900 }; 789 };
901 790
902 791
903 } } // namespace v8::internal 792 } } // namespace v8::internal
904 793
905 #endif // V8_ARM_CODE_STUBS_ARM_H_ 794 #endif // V8_ARM_CODE_STUBS_ARM_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698