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); | |
225 __ ret(0); | 224 __ ret(0); |
226 | 225 |
227 // Check if the object is a JSValue wrapper. | 226 // Check if the object is a JSValue wrapper. |
228 __ bind(&check_wrapper); | 227 __ bind(&check_wrapper); |
229 __ cmp(scratch1, JS_VALUE_TYPE); | 228 __ cmp(scratch1, JS_VALUE_TYPE); |
230 __ j(not_equal, miss, not_taken); | 229 __ j(not_equal, miss, not_taken); |
231 | 230 |
232 // Check if the wrapped value is a string and load the length | 231 // Check if the wrapped value is a string and load the length |
233 // directly if it is. | 232 // directly if it is. |
234 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); | 233 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); |
235 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); | 234 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); |
236 __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); | 235 __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); |
237 __ SmiTag(eax); | |
238 __ ret(0); | 236 __ ret(0); |
239 } | 237 } |
240 | 238 |
241 | 239 |
242 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, | 240 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, |
243 Register receiver, | 241 Register receiver, |
244 Register scratch1, | 242 Register scratch1, |
245 Register scratch2, | 243 Register scratch2, |
246 Label* miss_label) { | 244 Label* miss_label) { |
247 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 245 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
(...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 2394 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
2397 | 2395 |
2398 // Return the generated code. | 2396 // Return the generated code. |
2399 return GetCode(); | 2397 return GetCode(); |
2400 } | 2398 } |
2401 | 2399 |
2402 | 2400 |
2403 #undef __ | 2401 #undef __ |
2404 | 2402 |
2405 } } // namespace v8::internal | 2403 } } // namespace v8::internal |
OLD | NEW |