| 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 ASSERT(kNotStringTag != 0); | 320 ASSERT(kNotStringTag != 0); |
| 321 __ test(scratch, Immediate(kNotStringTag)); | 321 __ test(scratch, Immediate(kNotStringTag)); |
| 322 __ j(not_zero, non_string_object, not_taken); | 322 __ j(not_zero, non_string_object, not_taken); |
| 323 } | 323 } |
| 324 | 324 |
| 325 | 325 |
| 326 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, | 326 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, |
| 327 Register receiver, | 327 Register receiver, |
| 328 Register scratch1, | 328 Register scratch1, |
| 329 Register scratch2, | 329 Register scratch2, |
| 330 Label* miss) { | 330 Label* miss, |
| 331 bool support_wrappers) { |
| 331 Label check_wrapper; | 332 Label check_wrapper; |
| 332 | 333 |
| 333 // Check if the object is a string leaving the instance type in the | 334 // Check if the object is a string leaving the instance type in the |
| 334 // scratch register. | 335 // scratch register. |
| 335 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); | 336 GenerateStringCheck(masm, receiver, scratch1, miss, |
| 337 support_wrappers ? &check_wrapper : miss); |
| 336 | 338 |
| 337 // Load length from the string and convert to a smi. | 339 // Load length from the string and convert to a smi. |
| 338 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); | 340 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); |
| 339 __ ret(0); | 341 __ ret(0); |
| 340 | 342 |
| 341 // Check if the object is a JSValue wrapper. | 343 if (support_wrappers) { |
| 342 __ bind(&check_wrapper); | 344 // Check if the object is a JSValue wrapper. |
| 343 __ cmp(scratch1, JS_VALUE_TYPE); | 345 __ bind(&check_wrapper); |
| 344 __ j(not_equal, miss, not_taken); | 346 __ cmp(scratch1, JS_VALUE_TYPE); |
| 347 __ j(not_equal, miss, not_taken); |
| 345 | 348 |
| 346 // Check if the wrapped value is a string and load the length | 349 // Check if the wrapped value is a string and load the length |
| 347 // directly if it is. | 350 // directly if it is. |
| 348 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); | 351 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); |
| 349 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); | 352 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); |
| 350 __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); | 353 __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); |
| 351 __ ret(0); | 354 __ ret(0); |
| 355 } |
| 352 } | 356 } |
| 353 | 357 |
| 354 | 358 |
| 355 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, | 359 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, |
| 356 Register receiver, | 360 Register receiver, |
| 357 Register scratch1, | 361 Register scratch1, |
| 358 Register scratch2, | 362 Register scratch2, |
| 359 Label* miss_label) { | 363 Label* miss_label) { |
| 360 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 364 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
| 361 __ mov(eax, Operand(scratch1)); | 365 __ mov(eax, Operand(scratch1)); |
| (...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3082 // -- esp[0] : return address | 3086 // -- esp[0] : return address |
| 3083 // ----------------------------------- | 3087 // ----------------------------------- |
| 3084 Label miss; | 3088 Label miss; |
| 3085 | 3089 |
| 3086 __ IncrementCounter(&Counters::keyed_load_string_length, 1); | 3090 __ IncrementCounter(&Counters::keyed_load_string_length, 1); |
| 3087 | 3091 |
| 3088 // Check that the name has not changed. | 3092 // Check that the name has not changed. |
| 3089 __ cmp(Operand(eax), Immediate(Handle<String>(name))); | 3093 __ cmp(Operand(eax), Immediate(Handle<String>(name))); |
| 3090 __ j(not_equal, &miss, not_taken); | 3094 __ j(not_equal, &miss, not_taken); |
| 3091 | 3095 |
| 3092 GenerateLoadStringLength(masm(), edx, ecx, ebx, &miss); | 3096 GenerateLoadStringLength(masm(), edx, ecx, ebx, &miss, true); |
| 3093 __ bind(&miss); | 3097 __ bind(&miss); |
| 3094 __ DecrementCounter(&Counters::keyed_load_string_length, 1); | 3098 __ DecrementCounter(&Counters::keyed_load_string_length, 1); |
| 3095 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3099 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 3096 | 3100 |
| 3097 // Return the generated code. | 3101 // Return the generated code. |
| 3098 return GetCode(CALLBACKS, name); | 3102 return GetCode(CALLBACKS, name); |
| 3099 } | 3103 } |
| 3100 | 3104 |
| 3101 | 3105 |
| 3102 MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { | 3106 MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3662 | 3666 |
| 3663 return GetCode(flags); | 3667 return GetCode(flags); |
| 3664 } | 3668 } |
| 3665 | 3669 |
| 3666 | 3670 |
| 3667 #undef __ | 3671 #undef __ |
| 3668 | 3672 |
| 3669 } } // namespace v8::internal | 3673 } } // namespace v8::internal |
| 3670 | 3674 |
| 3671 #endif // V8_TARGET_ARCH_IA32 | 3675 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |