OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // ----------- S t a t e ------------- | 183 // ----------- S t a t e ------------- |
184 // -- r2 : name | 184 // -- r2 : name |
185 // -- lr : return address | 185 // -- lr : return address |
186 // -- [sp] : receiver | 186 // -- [sp] : receiver |
187 // ----------------------------------- | 187 // ----------------------------------- |
188 | 188 |
189 Label miss, load_length, check_wrapper; | 189 Label miss, load_length, check_wrapper; |
190 | 190 |
191 __ ldr(r0, MemOperand(sp, 0)); | 191 __ ldr(r0, MemOperand(sp, 0)); |
192 | 192 |
193 // Check if the object is a string. | 193 // Check if the object is a string leaving the instance type in the |
| 194 // r1 register. |
194 GenerateStringCheck(masm, r0, r1, r3, &miss, &check_wrapper); | 195 GenerateStringCheck(masm, r0, r1, r3, &miss, &check_wrapper); |
195 | 196 |
196 // Load length directly from the string. | 197 // Load length directly from the string. |
197 __ bind(&load_length); | 198 __ bind(&load_length); |
198 __ and_(r1, r1, Operand(kStringSizeMask)); | 199 __ and_(r1, r1, Operand(kStringSizeMask)); |
199 __ add(r1, r1, Operand(String::kHashShift)); | 200 __ add(r1, r1, Operand(String::kHashShift)); |
200 __ ldr(r0, FieldMemOperand(r0, String::kLengthOffset)); | 201 __ ldr(r0, FieldMemOperand(r0, String::kLengthOffset)); |
201 __ mov(r0, Operand(r0, LSR, r1)); | 202 __ mov(r0, Operand(r0, LSR, r1)); |
202 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); | 203 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); |
203 __ Ret(); | 204 __ Ret(); |
204 | 205 |
205 // Check if the object is a JSValue wrapper. | 206 // Check if the object is a JSValue wrapper. |
206 __ bind(&check_wrapper); | 207 __ bind(&check_wrapper); |
207 __ cmp(r0, Operand(JS_VALUE_TYPE)); | 208 __ cmp(r1, Operand(JS_VALUE_TYPE)); |
208 __ b(ne, &miss); | 209 __ b(ne, &miss); |
209 | 210 |
210 // Check if the wrapped value is a string and load the length | 211 // Check if the wrapped value is a string and load the length |
211 // directly if it is. | 212 // directly if it is. |
212 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset)); | 213 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset)); |
213 GenerateStringCheck(masm, r0, r1, r3, &miss, &miss); | 214 GenerateStringCheck(masm, r0, r1, r3, &miss, &miss); |
214 __ b(&load_length); | 215 __ b(&load_length); |
215 | 216 |
216 // Cache miss: Jump to runtime. | 217 // Cache miss: Jump to runtime. |
217 __ bind(&miss); | 218 __ bind(&miss); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 587 |
587 // Perform tail call to the entry. | 588 // Perform tail call to the entry. |
588 __ TailCallRuntime(f, 3); | 589 __ TailCallRuntime(f, 3); |
589 } | 590 } |
590 | 591 |
591 | 592 |
592 #undef __ | 593 #undef __ |
593 | 594 |
594 | 595 |
595 } } // namespace v8::internal | 596 } } // namespace v8::internal |
OLD | NEW |