| 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 9934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9945 __ test(key.reg(), Immediate(kSmiTagMask)); | 9945 __ test(key.reg(), Immediate(kSmiTagMask)); |
| 9946 deferred->Branch(not_zero); | 9946 deferred->Branch(not_zero); |
| 9947 } else { | 9947 } else { |
| 9948 if (FLAG_debug_code) __ AbortIfNotSmi(key.reg()); | 9948 if (FLAG_debug_code) __ AbortIfNotSmi(key.reg()); |
| 9949 } | 9949 } |
| 9950 | 9950 |
| 9951 // Check that the receiver is a JSArray. | 9951 // Check that the receiver is a JSArray. |
| 9952 __ CmpObjectType(receiver.reg(), JS_ARRAY_TYPE, tmp.reg()); | 9952 __ CmpObjectType(receiver.reg(), JS_ARRAY_TYPE, tmp.reg()); |
| 9953 deferred->Branch(not_equal); | 9953 deferred->Branch(not_equal); |
| 9954 | 9954 |
| 9955 // Check that the key is within bounds. Both the key and the length of | |
| 9956 // the JSArray are smis. Use unsigned comparison to handle negative keys. | |
| 9957 __ cmp(key.reg(), | |
| 9958 FieldOperand(receiver.reg(), JSArray::kLengthOffset)); | |
| 9959 deferred->Branch(above_equal); | |
| 9960 | |
| 9961 // Get the elements array from the receiver and check that it is not a | 9955 // Get the elements array from the receiver and check that it is not a |
| 9962 // dictionary. | 9956 // dictionary. |
| 9963 __ mov(tmp.reg(), | 9957 __ mov(tmp.reg(), |
| 9964 FieldOperand(receiver.reg(), JSArray::kElementsOffset)); | 9958 FieldOperand(receiver.reg(), JSArray::kElementsOffset)); |
| 9965 | 9959 |
| 9966 // Check whether it is possible to omit the write barrier. If the elements | 9960 // Check whether it is possible to omit the write barrier. If the elements |
| 9967 // array is in new space or the value written is a smi we can safely update | 9961 // array is in new space or the value written is a smi we can safely update |
| 9968 // the elements array without write barrier. | 9962 // the elements array without write barrier. |
| 9969 Label in_new_space; | 9963 Label in_new_space; |
| 9970 __ InNewSpace(tmp.reg(), tmp2.reg(), equal, &in_new_space); | 9964 __ InNewSpace(tmp.reg(), tmp2.reg(), equal, &in_new_space); |
| 9971 if (!value_is_constant) { | 9965 if (!value_is_constant) { |
| 9972 __ test(result.reg(), Immediate(kSmiTagMask)); | 9966 __ test(result.reg(), Immediate(kSmiTagMask)); |
| 9973 deferred->Branch(not_zero); | 9967 deferred->Branch(not_zero); |
| 9974 } | 9968 } |
| 9975 | 9969 |
| 9976 __ bind(&in_new_space); | 9970 __ bind(&in_new_space); |
| 9977 // Bind the deferred code patch site to be able to locate the fixed | 9971 // Bind the deferred code patch site to be able to locate the fixed |
| 9978 // array map comparison. When debugging, we patch this comparison to | 9972 // array map comparison. When debugging, we patch this comparison to |
| 9979 // always fail so that we will hit the IC call in the deferred code | 9973 // always fail so that we will hit the IC call in the deferred code |
| 9980 // which will allow the debugger to break for fast case stores. | 9974 // which will allow the debugger to break for fast case stores. |
| 9981 __ bind(deferred->patch_site()); | 9975 __ bind(deferred->patch_site()); |
| 9982 __ cmp(FieldOperand(tmp.reg(), HeapObject::kMapOffset), | 9976 __ cmp(FieldOperand(tmp.reg(), HeapObject::kMapOffset), |
| 9983 Immediate(FACTORY->fixed_array_map())); | 9977 Immediate(FACTORY->fixed_array_map())); |
| 9984 deferred->Branch(not_equal); | 9978 deferred->Branch(not_equal); |
| 9985 | 9979 |
| 9980 // Check that the key is within bounds. Both the key and the length of |
| 9981 // the JSArray are smis (because the fixed array check above ensures the |
| 9982 // elements are in fast case). Use unsigned comparison to handle negative |
| 9983 // keys. |
| 9984 __ cmp(key.reg(), |
| 9985 FieldOperand(receiver.reg(), JSArray::kLengthOffset)); |
| 9986 deferred->Branch(above_equal); |
| 9987 |
| 9986 // Store the value. | 9988 // Store the value. |
| 9987 __ mov(FixedArrayElementOperand(tmp.reg(), key.reg()), result.reg()); | 9989 __ mov(FixedArrayElementOperand(tmp.reg(), key.reg()), result.reg()); |
| 9988 __ IncrementCounter(COUNTERS->keyed_store_inline(), 1); | 9990 __ IncrementCounter(COUNTERS->keyed_store_inline(), 1); |
| 9989 | 9991 |
| 9990 deferred->BindExit(); | 9992 deferred->BindExit(); |
| 9991 } else { | 9993 } else { |
| 9992 result = frame()->CallKeyedStoreIC(strict_mode_flag()); | 9994 result = frame()->CallKeyedStoreIC(strict_mode_flag()); |
| 9993 // Make sure that we do not have a test instruction after the | 9995 // Make sure that we do not have a test instruction after the |
| 9994 // call. A test instruction after the call is used to | 9996 // call. A test instruction after the call is used to |
| 9995 // indicate that we have generated an inline version of the | 9997 // indicate that we have generated an inline version of the |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10362 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); | 10364 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); |
| 10363 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); | 10365 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); |
| 10364 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); | 10366 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); |
| 10365 } | 10367 } |
| 10366 | 10368 |
| 10367 #undef __ | 10369 #undef __ |
| 10368 | 10370 |
| 10369 } } // namespace v8::internal | 10371 } } // namespace v8::internal |
| 10370 | 10372 |
| 10371 #endif // V8_TARGET_ARCH_IA32 | 10373 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |