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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 Label* miss) { | 229 Label* miss) { |
230 Label load_length, check_wrapper; | 230 Label load_length, check_wrapper; |
231 | 231 |
232 // Check if the object is a string leaving the instance type in the | 232 // Check if the object is a string leaving the instance type in the |
233 // scratch register. | 233 // scratch register. |
234 GenerateStringCheck(masm, receiver, scratch, miss, &check_wrapper); | 234 GenerateStringCheck(masm, receiver, scratch, miss, &check_wrapper); |
235 | 235 |
236 // Load length from the string and convert to a smi. | 236 // Load length from the string and convert to a smi. |
237 __ bind(&load_length); | 237 __ bind(&load_length); |
238 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); | 238 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); |
239 __ shl(eax, kSmiTagSize); | 239 __ SmiTag(eax); |
240 __ ret(0); | 240 __ ret(0); |
241 | 241 |
242 // Check if the object is a JSValue wrapper. | 242 // Check if the object is a JSValue wrapper. |
243 __ bind(&check_wrapper); | 243 __ bind(&check_wrapper); |
244 __ cmp(scratch, JS_VALUE_TYPE); | 244 __ cmp(scratch, JS_VALUE_TYPE); |
245 __ j(not_equal, miss, not_taken); | 245 __ j(not_equal, miss, not_taken); |
246 | 246 |
247 // Check if the wrapped value is a string and load the length | 247 // Check if the wrapped value is a string and load the length |
248 // directly if it is. | 248 // directly if it is. |
249 __ mov(receiver, FieldOperand(receiver, JSValue::kValueOffset)); | 249 __ mov(receiver, FieldOperand(receiver, JSValue::kValueOffset)); |
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1938 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 1938 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
1939 | 1939 |
1940 // Return the generated code. | 1940 // Return the generated code. |
1941 return GetCode(); | 1941 return GetCode(); |
1942 } | 1942 } |
1943 | 1943 |
1944 | 1944 |
1945 #undef __ | 1945 #undef __ |
1946 | 1946 |
1947 } } // namespace v8::internal | 1947 } } // namespace v8::internal |
OLD | NEW |