OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // The cast is to resolve the overload for the argument of 0x0. | 208 // The cast is to resolve the overload for the argument of 0x0. |
209 __ cmp(scratch2, Operand(static_cast<int32_t>(kStringTag))); | 209 __ cmp(scratch2, Operand(static_cast<int32_t>(kStringTag))); |
210 __ b(ne, non_string_object); | 210 __ b(ne, non_string_object); |
211 } | 211 } |
212 | 212 |
213 | 213 |
214 // Generate code to load the length from a string object and return the length. | 214 // Generate code to load the length from a string object and return the length. |
215 // If the receiver object is not a string or a wrapped string object the | 215 // If the receiver object is not a string or a wrapped string object the |
216 // execution continues at the miss label. The register containing the | 216 // execution continues at the miss label. The register containing the |
217 // receiver is potentially clobbered. | 217 // receiver is potentially clobbered. |
218 void StubCompiler::GenerateLoadStringLength2(MacroAssembler* masm, | 218 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, |
219 Register receiver, | 219 Register receiver, |
220 Register scratch1, | 220 Register scratch1, |
221 Register scratch2, | 221 Register scratch2, |
222 Label* miss) { | 222 Label* miss) { |
223 Label check_string, check_wrapper; | 223 Label check_string, check_wrapper; |
224 | 224 |
225 __ bind(&check_string); | 225 __ bind(&check_string); |
226 // Check if the object is a string leaving the instance type in the | 226 // Check if the object is a string leaving the instance type in the |
227 // scratch1 register. | 227 // scratch1 register. |
228 GenerateStringCheck(masm, receiver, scratch1, scratch2, | 228 GenerateStringCheck(masm, receiver, scratch1, scratch2, |
229 miss, &check_wrapper); | 229 miss, &check_wrapper); |
230 | 230 |
231 // Load length directly from the string. | 231 // Load length directly from the string. |
232 __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset)); | 232 __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset)); |
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1665 // ----------------------------------- | 1665 // ----------------------------------- |
1666 Label miss; | 1666 Label miss; |
1667 __ IncrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); | 1667 __ IncrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); |
1668 | 1668 |
1669 __ ldr(r2, MemOperand(sp)); | 1669 __ ldr(r2, MemOperand(sp)); |
1670 __ ldr(r0, MemOperand(sp, kPointerSize)); // receiver | 1670 __ ldr(r0, MemOperand(sp, kPointerSize)); // receiver |
1671 | 1671 |
1672 __ cmp(r2, Operand(Handle<String>(name))); | 1672 __ cmp(r2, Operand(Handle<String>(name))); |
1673 __ b(ne, &miss); | 1673 __ b(ne, &miss); |
1674 | 1674 |
1675 GenerateLoadStringLength2(masm(), r0, r1, r3, &miss); | 1675 GenerateLoadStringLength(masm(), r0, r1, r3, &miss); |
1676 __ bind(&miss); | 1676 __ bind(&miss); |
1677 __ DecrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); | 1677 __ DecrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); |
1678 | 1678 |
1679 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1679 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1680 | 1680 |
1681 return GetCode(CALLBACKS, name); | 1681 return GetCode(CALLBACKS, name); |
1682 } | 1682 } |
1683 | 1683 |
1684 | 1684 |
1685 // TODO(1224671): implement the fast case. | 1685 // TODO(1224671): implement the fast case. |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1874 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
1875 | 1875 |
1876 // Return the generated code. | 1876 // Return the generated code. |
1877 return GetCode(); | 1877 return GetCode(); |
1878 } | 1878 } |
1879 | 1879 |
1880 | 1880 |
1881 #undef __ | 1881 #undef __ |
1882 | 1882 |
1883 } } // namespace v8::internal | 1883 } } // namespace v8::internal |
OLD | NEW |