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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 Register scratch2, | 214 Register scratch2, |
215 Label* miss) { | 215 Label* miss) { |
216 Label check_wrapper; | 216 Label check_wrapper; |
217 | 217 |
218 // Check if the object is a string leaving the instance type in the | 218 // Check if the object is a string leaving the instance type in the |
219 // scratch register. | 219 // scratch register. |
220 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); | 220 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); |
221 | 221 |
222 // Load length from the string and convert to a smi. | 222 // Load length from the string and convert to a smi. |
223 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); | 223 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); |
| 224 __ SmiTag(eax); |
224 __ ret(0); | 225 __ ret(0); |
225 | 226 |
226 // Check if the object is a JSValue wrapper. | 227 // Check if the object is a JSValue wrapper. |
227 __ bind(&check_wrapper); | 228 __ bind(&check_wrapper); |
228 __ cmp(scratch1, JS_VALUE_TYPE); | 229 __ cmp(scratch1, JS_VALUE_TYPE); |
229 __ j(not_equal, miss, not_taken); | 230 __ j(not_equal, miss, not_taken); |
230 | 231 |
231 // Check if the wrapped value is a string and load the length | 232 // Check if the wrapped value is a string and load the length |
232 // directly if it is. | 233 // directly if it is. |
233 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); | 234 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); |
234 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); | 235 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); |
235 __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); | 236 __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); |
| 237 __ SmiTag(eax); |
236 __ ret(0); | 238 __ ret(0); |
237 } | 239 } |
238 | 240 |
239 | 241 |
240 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, | 242 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, |
241 Register receiver, | 243 Register receiver, |
242 Register scratch1, | 244 Register scratch1, |
243 Register scratch2, | 245 Register scratch2, |
244 Label* miss_label) { | 246 Label* miss_label) { |
245 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 247 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
(...skipping 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2497 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 2499 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
2498 | 2500 |
2499 // Return the generated code. | 2501 // Return the generated code. |
2500 return GetCode(); | 2502 return GetCode(); |
2501 } | 2503 } |
2502 | 2504 |
2503 | 2505 |
2504 #undef __ | 2506 #undef __ |
2505 | 2507 |
2506 } } // namespace v8::internal | 2508 } } // namespace v8::internal |
OLD | NEW |