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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 Register scratch2, | 222 Register scratch2, |
223 Label* miss) { | 223 Label* miss) { |
224 Label check_wrapper; | 224 Label check_wrapper; |
225 | 225 |
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, miss, &check_wrapper); | 228 GenerateStringCheck(masm, receiver, scratch1, scratch2, miss, &check_wrapper); |
229 | 229 |
230 // Load length directly from the string. | 230 // Load length directly from the string. |
231 __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset)); | 231 __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset)); |
232 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); | |
233 __ Ret(); | 232 __ Ret(); |
234 | 233 |
235 // Check if the object is a JSValue wrapper. | 234 // Check if the object is a JSValue wrapper. |
236 __ bind(&check_wrapper); | 235 __ bind(&check_wrapper); |
237 __ cmp(scratch1, Operand(JS_VALUE_TYPE)); | 236 __ cmp(scratch1, Operand(JS_VALUE_TYPE)); |
238 __ b(ne, miss); | 237 __ b(ne, miss); |
239 | 238 |
240 // Unwrap the value and check if the wrapped value is a string. | 239 // Unwrap the value and check if the wrapped value is a string. |
241 __ ldr(scratch1, FieldMemOperand(receiver, JSValue::kValueOffset)); | 240 __ ldr(scratch1, FieldMemOperand(receiver, JSValue::kValueOffset)); |
242 GenerateStringCheck(masm, scratch1, scratch2, scratch2, miss, miss); | 241 GenerateStringCheck(masm, scratch1, scratch2, scratch2, miss, miss); |
243 __ ldr(r0, FieldMemOperand(scratch1, String::kLengthOffset)); | 242 __ ldr(r0, FieldMemOperand(scratch1, String::kLengthOffset)); |
244 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); | |
245 __ Ret(); | 243 __ Ret(); |
246 } | 244 } |
247 | 245 |
248 | 246 |
249 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, | 247 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, |
250 Register receiver, | 248 Register receiver, |
251 Register scratch1, | 249 Register scratch1, |
252 Register scratch2, | 250 Register scratch2, |
253 Label* miss_label) { | 251 Label* miss_label) { |
254 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 252 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
(...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 2173 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
2176 | 2174 |
2177 // Return the generated code. | 2175 // Return the generated code. |
2178 return GetCode(); | 2176 return GetCode(); |
2179 } | 2177 } |
2180 | 2178 |
2181 | 2179 |
2182 #undef __ | 2180 #undef __ |
2183 | 2181 |
2184 } } // namespace v8::internal | 2182 } } // namespace v8::internal |
OLD | NEW |