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 __ test(scratch, Immediate(kNotStringTag)); | 222 __ test(scratch, Immediate(kNotStringTag)); |
223 __ j(not_zero, non_string_object, not_taken); | 223 __ j(not_zero, non_string_object, not_taken); |
224 } | 224 } |
225 | 225 |
226 | 226 |
227 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, | 227 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, |
228 Register receiver, | 228 Register receiver, |
229 Register scratch1, | 229 Register scratch1, |
230 Register scratch2, | 230 Register scratch2, |
231 Label* miss) { | 231 Label* miss) { |
232 Label load_length, check_wrapper; | 232 Label check_wrapper; |
233 | 233 |
234 // Check if the object is a string leaving the instance type in the | 234 // Check if the object is a string leaving the instance type in the |
235 // scratch register. | 235 // scratch register. |
236 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); | 236 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); |
237 | 237 |
238 // Load length from the string and convert to a smi. | 238 // Load length from the string and convert to a smi. |
239 __ bind(&load_length); | |
240 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); | 239 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); |
241 __ SmiTag(eax); | 240 __ SmiTag(eax); |
242 __ ret(0); | 241 __ ret(0); |
243 | 242 |
244 // Check if the object is a JSValue wrapper. | 243 // Check if the object is a JSValue wrapper. |
245 __ bind(&check_wrapper); | 244 __ bind(&check_wrapper); |
246 __ cmp(scratch1, JS_VALUE_TYPE); | 245 __ cmp(scratch1, JS_VALUE_TYPE); |
247 __ j(not_equal, miss, not_taken); | 246 __ j(not_equal, miss, not_taken); |
248 | 247 |
249 // Check if the wrapped value is a string and load the length | 248 // Check if the wrapped value is a string and load the length |
250 // directly if it is. | 249 // directly if it is. |
251 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); | 250 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); |
252 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); | 251 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); |
253 __ jmp(&load_length); | 252 __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); |
| 253 __ SmiTag(eax); |
| 254 __ ret(0); |
254 } | 255 } |
255 | 256 |
256 | 257 |
257 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, | 258 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, |
258 Register receiver, | 259 Register receiver, |
259 Register scratch1, | 260 Register scratch1, |
260 Register scratch2, | 261 Register scratch2, |
261 Label* miss_label) { | 262 Label* miss_label) { |
262 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 263 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
263 __ mov(eax, Operand(scratch1)); | 264 __ mov(eax, Operand(scratch1)); |
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1943 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 1944 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
1944 | 1945 |
1945 // Return the generated code. | 1946 // Return the generated code. |
1946 return GetCode(); | 1947 return GetCode(); |
1947 } | 1948 } |
1948 | 1949 |
1949 | 1950 |
1950 #undef __ | 1951 #undef __ |
1951 | 1952 |
1952 } } // namespace v8::internal | 1953 } } // namespace v8::internal |
OLD | NEW |