| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 __ testl(scratch, Immediate(kNotStringTag)); | 310 __ testl(scratch, Immediate(kNotStringTag)); |
| 311 __ j(not_zero, non_string_object); | 311 __ j(not_zero, non_string_object); |
| 312 } | 312 } |
| 313 | 313 |
| 314 | 314 |
| 315 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, | 315 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, |
| 316 Register receiver, | 316 Register receiver, |
| 317 Register scratch1, | 317 Register scratch1, |
| 318 Register scratch2, | 318 Register scratch2, |
| 319 Label* miss) { | 319 Label* miss) { |
| 320 Label load_length, check_wrapper; | 320 Label check_wrapper; |
| 321 | 321 |
| 322 // Check if the object is a string leaving the instance type in the | 322 // Check if the object is a string leaving the instance type in the |
| 323 // scratch register. | 323 // scratch register. |
| 324 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); | 324 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); |
| 325 | 325 |
| 326 // Load length directly from the string. | 326 // Load length directly from the string. |
| 327 __ bind(&load_length); | |
| 328 __ movl(rax, FieldOperand(receiver, String::kLengthOffset)); | 327 __ movl(rax, FieldOperand(receiver, String::kLengthOffset)); |
| 329 __ Integer32ToSmi(rax, rax); | 328 __ Integer32ToSmi(rax, rax); |
| 330 __ ret(0); | 329 __ ret(0); |
| 331 | 330 |
| 332 // Check if the object is a JSValue wrapper. | 331 // Check if the object is a JSValue wrapper. |
| 333 __ bind(&check_wrapper); | 332 __ bind(&check_wrapper); |
| 334 __ cmpl(scratch1, Immediate(JS_VALUE_TYPE)); | 333 __ cmpl(scratch1, Immediate(JS_VALUE_TYPE)); |
| 335 __ j(not_equal, miss); | 334 __ j(not_equal, miss); |
| 336 | 335 |
| 337 // Check if the wrapped value is a string and load the length | 336 // Check if the wrapped value is a string and load the length |
| 338 // directly if it is. | 337 // directly if it is. |
| 339 __ movq(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); | 338 __ movq(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); |
| 340 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); | 339 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); |
| 341 __ movq(receiver, scratch2); | 340 __ movl(rax, FieldOperand(scratch2, String::kLengthOffset)); |
| 342 __ jmp(&load_length); | 341 __ Integer32ToSmi(rax, rax); |
| 342 __ ret(0); |
| 343 } | 343 } |
| 344 | 344 |
| 345 | 345 |
| 346 template <class Pushable> | 346 template <class Pushable> |
| 347 static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm, | 347 static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm, |
| 348 Register receiver, | 348 Register receiver, |
| 349 Register holder, | 349 Register holder, |
| 350 Pushable name, | 350 Pushable name, |
| 351 JSObject* holder_obj) { | 351 JSObject* holder_obj) { |
| 352 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 352 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
| (...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1867 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 1868 | 1868 |
| 1869 // Return the generated code. | 1869 // Return the generated code. |
| 1870 return GetCode(); | 1870 return GetCode(); |
| 1871 } | 1871 } |
| 1872 | 1872 |
| 1873 | 1873 |
| 1874 #undef __ | 1874 #undef __ |
| 1875 | 1875 |
| 1876 } } // namespace v8::internal | 1876 } } // namespace v8::internal |
| OLD | NEW |