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 4333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4344 // use it to get the elements array. | 4344 // use it to get the elements array. |
4345 frame_->Dup(); | 4345 frame_->Dup(); |
4346 Result elements = frame_->Pop(); | 4346 Result elements = frame_->Pop(); |
4347 elements.ToRegister(); | 4347 elements.ToRegister(); |
4348 frame_->Spill(elements.reg()); | 4348 frame_->Spill(elements.reg()); |
4349 // Get the elements array. | 4349 // Get the elements array. |
4350 __ mov(elements.reg(), | 4350 __ mov(elements.reg(), |
4351 FieldOperand(elements.reg(), JSObject::kElementsOffset)); | 4351 FieldOperand(elements.reg(), JSObject::kElementsOffset)); |
4352 | 4352 |
4353 // Write to the indexed properties array. | 4353 // Write to the indexed properties array. |
4354 int offset = i * kPointerSize + Array::kHeaderSize; | 4354 int offset = i * kPointerSize + FixedArray::kHeaderSize; |
4355 __ mov(FieldOperand(elements.reg(), offset), prop_value.reg()); | 4355 __ mov(FieldOperand(elements.reg(), offset), prop_value.reg()); |
4356 | 4356 |
4357 // Update the write barrier for the array address. | 4357 // Update the write barrier for the array address. |
4358 frame_->Spill(prop_value.reg()); // Overwritten by the write barrier. | 4358 frame_->Spill(prop_value.reg()); // Overwritten by the write barrier. |
4359 Result scratch = allocator_->Allocate(); | 4359 Result scratch = allocator_->Allocate(); |
4360 ASSERT(scratch.is_valid()); | 4360 ASSERT(scratch.is_valid()); |
4361 __ RecordWrite(elements.reg(), offset, prop_value.reg(), scratch.reg()); | 4361 __ RecordWrite(elements.reg(), offset, prop_value.reg(), scratch.reg()); |
4362 } | 4362 } |
4363 } | 4363 } |
4364 | 4364 |
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6302 FieldOperand(receiver.reg(), JSObject::kElementsOffset)); | 6302 FieldOperand(receiver.reg(), JSObject::kElementsOffset)); |
6303 __ cmp(FieldOperand(elements.reg(), HeapObject::kMapOffset), | 6303 __ cmp(FieldOperand(elements.reg(), HeapObject::kMapOffset), |
6304 Immediate(Factory::hash_table_map())); | 6304 Immediate(Factory::hash_table_map())); |
6305 deferred->Branch(equal); | 6305 deferred->Branch(equal); |
6306 | 6306 |
6307 // Shift the key to get the actual index value and check that | 6307 // Shift the key to get the actual index value and check that |
6308 // it is within bounds. | 6308 // it is within bounds. |
6309 __ mov(index.reg(), key.reg()); | 6309 __ mov(index.reg(), key.reg()); |
6310 __ sar(index.reg(), kSmiTagSize); | 6310 __ sar(index.reg(), kSmiTagSize); |
6311 __ cmp(index.reg(), | 6311 __ cmp(index.reg(), |
6312 FieldOperand(elements.reg(), Array::kLengthOffset)); | 6312 FieldOperand(elements.reg(), FixedArray::kLengthOffset)); |
6313 deferred->Branch(above_equal); | 6313 deferred->Branch(above_equal); |
6314 | 6314 |
6315 // Load and check that the result is not the hole. We could | 6315 // Load and check that the result is not the hole. We could |
6316 // reuse the index or elements register for the value. | 6316 // reuse the index or elements register for the value. |
6317 // | 6317 // |
6318 // TODO(206): Consider whether it makes sense to try some | 6318 // TODO(206): Consider whether it makes sense to try some |
6319 // heuristic about which register to reuse. For example, if | 6319 // heuristic about which register to reuse. For example, if |
6320 // one is eax, the we can reuse that one because the value | 6320 // one is eax, the we can reuse that one because the value |
6321 // coming from the deferred code will be in eax. | 6321 // coming from the deferred code will be in eax. |
6322 Result value = index; | 6322 Result value = index; |
6323 __ mov(value.reg(), Operand(elements.reg(), | 6323 __ mov(value.reg(), Operand(elements.reg(), |
6324 index.reg(), | 6324 index.reg(), |
6325 times_4, | 6325 times_4, |
6326 Array::kHeaderSize - kHeapObjectTag)); | 6326 FixedArray::kHeaderSize - kHeapObjectTag)); |
6327 elements.Unuse(); | 6327 elements.Unuse(); |
6328 index.Unuse(); | 6328 index.Unuse(); |
6329 __ cmp(Operand(value.reg()), Immediate(Factory::the_hole_value())); | 6329 __ cmp(Operand(value.reg()), Immediate(Factory::the_hole_value())); |
6330 deferred->Branch(equal); | 6330 deferred->Branch(equal); |
6331 __ IncrementCounter(&Counters::keyed_load_inline, 1); | 6331 __ IncrementCounter(&Counters::keyed_load_inline, 1); |
6332 | 6332 |
6333 deferred->BindExit(); | 6333 deferred->BindExit(); |
6334 // Restore the receiver and key to the frame and push the | 6334 // Restore the receiver and key to the frame and push the |
6335 // result on top of it. | 6335 // result on top of it. |
6336 cgen_->frame()->Push(&receiver); | 6336 cgen_->frame()->Push(&receiver); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6488 // break for fast case stores. | 6488 // break for fast case stores. |
6489 __ bind(deferred->patch_site()); | 6489 __ bind(deferred->patch_site()); |
6490 __ cmp(FieldOperand(tmp.reg(), HeapObject::kMapOffset), | 6490 __ cmp(FieldOperand(tmp.reg(), HeapObject::kMapOffset), |
6491 Immediate(Factory::fixed_array_map())); | 6491 Immediate(Factory::fixed_array_map())); |
6492 deferred->Branch(not_equal); | 6492 deferred->Branch(not_equal); |
6493 | 6493 |
6494 // Store the value. | 6494 // Store the value. |
6495 __ mov(Operand(tmp.reg(), | 6495 __ mov(Operand(tmp.reg(), |
6496 key.reg(), | 6496 key.reg(), |
6497 times_2, | 6497 times_2, |
6498 Array::kHeaderSize - kHeapObjectTag), | 6498 FixedArray::kHeaderSize - kHeapObjectTag), |
6499 value.reg()); | 6499 value.reg()); |
6500 __ IncrementCounter(&Counters::keyed_store_inline, 1); | 6500 __ IncrementCounter(&Counters::keyed_store_inline, 1); |
6501 | 6501 |
6502 deferred->BindExit(); | 6502 deferred->BindExit(); |
6503 | 6503 |
6504 cgen_->frame()->Push(&receiver); | 6504 cgen_->frame()->Push(&receiver); |
6505 cgen_->frame()->Push(&key); | 6505 cgen_->frame()->Push(&key); |
6506 cgen_->frame()->Push(&value); | 6506 cgen_->frame()->Push(&value); |
6507 } else { | 6507 } else { |
6508 Result answer = cgen_->frame()->CallKeyedStoreIC(); | 6508 Result answer = cgen_->frame()->CallKeyedStoreIC(); |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7921 | 7921 |
7922 int CompareStub::MinorKey() { | 7922 int CompareStub::MinorKey() { |
7923 // Encode the two parameters in a unique 16 bit value. | 7923 // Encode the two parameters in a unique 16 bit value. |
7924 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); | 7924 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); |
7925 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); | 7925 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); |
7926 } | 7926 } |
7927 | 7927 |
7928 #undef __ | 7928 #undef __ |
7929 | 7929 |
7930 } } // namespace v8::internal | 7930 } } // namespace v8::internal |
OLD | NEW |