Chromium Code Reviews| 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 3685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3696 return ConditionField::encode(static_cast<unsigned>(cc_) >> 28) | 3696 return ConditionField::encode(static_cast<unsigned>(cc_) >> 28) |
| 3697 | RegisterField::encode(lhs_.is(r0)) | 3697 | RegisterField::encode(lhs_.is(r0)) |
| 3698 | StrictField::encode(strict_) | 3698 | StrictField::encode(strict_) |
| 3699 | NeverNanNanField::encode(cc_ == eq ? never_nan_nan_ : false) | 3699 | NeverNanNanField::encode(cc_ == eq ? never_nan_nan_ : false) |
| 3700 | IncludeNumberCompareField::encode(include_number_compare_) | 3700 | IncludeNumberCompareField::encode(include_number_compare_) |
| 3701 | IncludeSmiCompareField::encode(include_smi_compare_); | 3701 | IncludeSmiCompareField::encode(include_smi_compare_); |
| 3702 } | 3702 } |
| 3703 | 3703 |
| 3704 | 3704 |
| 3705 // StringCharCodeAtGenerator | 3705 // StringCharCodeAtGenerator |
| 3706 | |
| 3707 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { | 3706 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
| 3708 Label flat_string; | 3707 Label flat_string; |
| 3709 Label ascii_string; | 3708 Label ascii_string; |
| 3710 Label got_char_code; | 3709 Label got_char_code; |
| 3711 | 3710 |
| 3712 // If the receiver is a smi trigger the non-string case. | 3711 // If the receiver is a smi trigger the non-string case. |
| 3713 __ BranchOnSmi(object_, receiver_not_string_); | 3712 __ BranchOnSmi(object_, receiver_not_string_); |
| 3714 | 3713 |
| 3715 // Fetch the instance type of the receiver into result register. | 3714 // Fetch the instance type of the receiver into result register. |
| 3716 __ ldr(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); | 3715 __ ldr(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4855 __ IncrementCounter(&Counters::string_add_native, 1, r2, r3); | 4854 __ IncrementCounter(&Counters::string_add_native, 1, r2, r3); |
| 4856 __ add(sp, sp, Operand(2 * kPointerSize)); | 4855 __ add(sp, sp, Operand(2 * kPointerSize)); |
| 4857 __ Ret(); | 4856 __ Ret(); |
| 4858 | 4857 |
| 4859 // Just jump to runtime to add the two strings. | 4858 // Just jump to runtime to add the two strings. |
| 4860 __ bind(&string_add_runtime); | 4859 __ bind(&string_add_runtime); |
| 4861 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 4860 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
| 4862 } | 4861 } |
| 4863 | 4862 |
| 4864 | 4863 |
| 4864 void StringCharAtStub::Generate(MacroAssembler* masm) { | |
| 4865 // Expects two arguments (object, index) on the stack: | |
| 4866 // lr: return address | |
| 4867 // sp[0]: index | |
| 4868 // sp[4]: object | |
| 4869 Register object = r1; | |
| 4870 Register index = r0; | |
| 4871 Register scratch1 = r2; | |
| 4872 Register scratch2 = r3; | |
| 4873 Register result = r0; | |
| 4874 | |
| 4875 // Get object and index from the stack. | |
| 4876 __ pop(index); | |
| 4877 __ pop(object); | |
| 4878 | |
| 4879 Label need_conversion; | |
| 4880 Label index_out_of_range; | |
| 4881 Label done; | |
| 4882 StringCharAtGenerator generator(object, | |
| 4883 index, | |
| 4884 scratch1, | |
| 4885 scratch2, | |
| 4886 result, | |
| 4887 &need_conversion, | |
| 4888 &need_conversion, | |
| 4889 &index_out_of_range, | |
| 4890 STRING_INDEX_IS_NUMBER); | |
| 4891 generator.GenerateFast(masm); | |
| 4892 __ b(&done); | |
| 4893 | |
| 4894 __ bind(&index_out_of_range); | |
| 4895 // When the index is out of range, the spec requires us to return | |
| 4896 // the empty string. | |
| 4897 __ LoadRoot(result, Heap::kEmptyStringRootIndex); | |
| 4898 __ jmp(&done); | |
| 4899 | |
| 4900 __ bind(&need_conversion); | |
| 4901 // Move smi zero into the result register, which will trigger | |
| 4902 // conversion. | |
| 4903 __ mov(result, Operand(Smi::FromInt(0))); | |
| 4904 __ jmp(&done); | |
| 4905 | |
| 4906 StubRuntimeCallHelper call_helper; | |
|
Søren Thygesen Gjesse
2011/01/19 11:18:03
Control never goes here.
Mads Ager (chromium)
2011/01/19 11:32:42
It does but in a round-about way. |generator| has
| |
| 4907 generator.GenerateSlow(masm, call_helper); | |
| 4908 | |
| 4909 __ bind(&done); | |
| 4910 __ Ret(); | |
| 4911 } | |
| 4912 | |
| 4913 | |
| 4865 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { | 4914 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { |
| 4866 ASSERT(state_ == CompareIC::SMIS); | 4915 ASSERT(state_ == CompareIC::SMIS); |
| 4867 Label miss; | 4916 Label miss; |
| 4868 __ orr(r2, r1, r0); | 4917 __ orr(r2, r1, r0); |
| 4869 __ tst(r2, Operand(kSmiTagMask)); | 4918 __ tst(r2, Operand(kSmiTagMask)); |
| 4870 __ b(ne, &miss); | 4919 __ b(ne, &miss); |
| 4871 | 4920 |
| 4872 if (GetCondition() == eq) { | 4921 if (GetCondition() == eq) { |
| 4873 // For equality we do not care about the sign of the result. | 4922 // For equality we do not care about the sign of the result. |
| 4874 __ sub(r0, r0, r1, SetCC); | 4923 __ sub(r0, r0, r1, SetCC); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4976 __ pop(r1); | 5025 __ pop(r1); |
| 4977 __ Jump(r2); | 5026 __ Jump(r2); |
| 4978 } | 5027 } |
| 4979 | 5028 |
| 4980 | 5029 |
| 4981 #undef __ | 5030 #undef __ |
| 4982 | 5031 |
| 4983 } } // namespace v8::internal | 5032 } } // namespace v8::internal |
| 4984 | 5033 |
| 4985 #endif // V8_TARGET_ARCH_ARM | 5034 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |