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 8580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8591 int original_height = frame()->height(); | 8591 int original_height = frame()->height(); |
8592 #endif | 8592 #endif |
8593 Result result; | 8593 Result result; |
8594 // Inline array load code if inside of a loop. We do not know the | 8594 // Inline array load code if inside of a loop. We do not know the |
8595 // receiver map yet, so we initially generate the code with a check | 8595 // receiver map yet, so we initially generate the code with a check |
8596 // against an invalid map. In the inline cache code, we patch the map | 8596 // against an invalid map. In the inline cache code, we patch the map |
8597 // check if appropriate. | 8597 // check if appropriate. |
8598 if (loop_nesting() > 0) { | 8598 if (loop_nesting() > 0) { |
8599 Comment cmnt(masm_, "[ Inlined load from keyed Property"); | 8599 Comment cmnt(masm_, "[ Inlined load from keyed Property"); |
8600 | 8600 |
| 8601 // Use a fresh temporary to load the elements without destroying |
| 8602 // the receiver which is needed for the deferred slow case. |
| 8603 Result elements = allocator()->Allocate(); |
| 8604 ASSERT(elements.is_valid()); |
| 8605 |
8601 Result key = frame_->Pop(); | 8606 Result key = frame_->Pop(); |
8602 Result receiver = frame_->Pop(); | 8607 Result receiver = frame_->Pop(); |
8603 key.ToRegister(); | 8608 key.ToRegister(); |
8604 receiver.ToRegister(); | 8609 receiver.ToRegister(); |
8605 | 8610 |
8606 // Use a fresh temporary to load the elements without destroying | |
8607 // the receiver which is needed for the deferred slow case. | |
8608 Result elements = allocator()->Allocate(); | |
8609 ASSERT(elements.is_valid()); | |
8610 | |
8611 // Use a fresh temporary for the index and later the loaded | 8611 // Use a fresh temporary for the index and later the loaded |
8612 // value. | 8612 // value. |
8613 result = allocator()->Allocate(); | 8613 result = allocator()->Allocate(); |
8614 ASSERT(result.is_valid()); | 8614 ASSERT(result.is_valid()); |
8615 | 8615 |
8616 DeferredReferenceGetKeyedValue* deferred = | 8616 DeferredReferenceGetKeyedValue* deferred = |
8617 new DeferredReferenceGetKeyedValue(result.reg(), | 8617 new DeferredReferenceGetKeyedValue(result.reg(), |
8618 receiver.reg(), | 8618 receiver.reg(), |
8619 key.reg()); | 8619 key.reg()); |
8620 | 8620 |
8621 __ test(receiver.reg(), Immediate(kSmiTagMask)); | 8621 __ test(receiver.reg(), Immediate(kSmiTagMask)); |
8622 deferred->Branch(zero); | 8622 deferred->Branch(zero); |
8623 | 8623 |
| 8624 // Check that the receiver has the expected map. |
8624 // Initially, use an invalid map. The map is patched in the IC | 8625 // Initially, use an invalid map. The map is patched in the IC |
8625 // initialization code. | 8626 // initialization code. |
8626 __ bind(deferred->patch_site()); | 8627 __ bind(deferred->patch_site()); |
8627 // Use masm-> here instead of the double underscore macro since extra | 8628 // Use masm-> here instead of the double underscore macro since extra |
8628 // coverage code can interfere with the patching. | 8629 // coverage code can interfere with the patching. |
8629 masm_->cmp(FieldOperand(receiver.reg(), HeapObject::kMapOffset), | 8630 masm_->cmp(FieldOperand(receiver.reg(), HeapObject::kMapOffset), |
8630 Immediate(Factory::null_value())); | 8631 Immediate(Factory::null_value())); |
8631 deferred->Branch(not_equal); | 8632 deferred->Branch(not_equal); |
8632 | 8633 |
8633 // Check that the key is a smi. | 8634 // Check that the key is a smi. |
(...skipping 13 matching lines...) Expand all Loading... |
8647 deferred->Branch(not_equal); | 8648 deferred->Branch(not_equal); |
8648 | 8649 |
8649 // Shift the key to get the actual index value and check that | 8650 // Shift the key to get the actual index value and check that |
8650 // it is within bounds. Use unsigned comparison to handle negative keys. | 8651 // it is within bounds. Use unsigned comparison to handle negative keys. |
8651 __ mov(result.reg(), key.reg()); | 8652 __ mov(result.reg(), key.reg()); |
8652 __ SmiUntag(result.reg()); | 8653 __ SmiUntag(result.reg()); |
8653 __ cmp(result.reg(), | 8654 __ cmp(result.reg(), |
8654 FieldOperand(elements.reg(), FixedArray::kLengthOffset)); | 8655 FieldOperand(elements.reg(), FixedArray::kLengthOffset)); |
8655 deferred->Branch(above_equal); | 8656 deferred->Branch(above_equal); |
8656 | 8657 |
8657 // Load and check that the result is not the hole. | |
8658 __ mov(result.reg(), Operand(elements.reg(), | 8658 __ mov(result.reg(), Operand(elements.reg(), |
8659 result.reg(), | 8659 result.reg(), |
8660 times_4, | 8660 times_4, |
8661 FixedArray::kHeaderSize - kHeapObjectTag)); | 8661 FixedArray::kHeaderSize - kHeapObjectTag)); |
8662 elements.Unuse(); | 8662 elements.Unuse(); |
8663 __ cmp(Operand(result.reg()), Immediate(Factory::the_hole_value())); | 8663 __ cmp(Operand(result.reg()), Immediate(Factory::the_hole_value())); |
8664 deferred->Branch(equal); | 8664 deferred->Branch(equal); |
8665 __ IncrementCounter(&Counters::keyed_load_inline, 1); | 8665 __ IncrementCounter(&Counters::keyed_load_inline, 1); |
8666 | 8666 |
8667 deferred->BindExit(); | 8667 deferred->BindExit(); |
(...skipping 4617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13285 // tagged as a small integer. | 13285 // tagged as a small integer. |
13286 __ bind(&runtime); | 13286 __ bind(&runtime); |
13287 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 13287 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
13288 } | 13288 } |
13289 | 13289 |
13290 #undef __ | 13290 #undef __ |
13291 | 13291 |
13292 } } // namespace v8::internal | 13292 } } // namespace v8::internal |
13293 | 13293 |
13294 #endif // V8_TARGET_ARCH_IA32 | 13294 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |