OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4722 EmitPushTaggedOperand(obj); | 4722 EmitPushTaggedOperand(obj); |
4723 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); | 4723 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); |
4724 LPointerMap* pointers = instr->pointer_map(); | 4724 LPointerMap* pointers = instr->pointer_map(); |
4725 RecordPosition(pointers->position()); | 4725 RecordPosition(pointers->position()); |
4726 SafepointGenerator safepoint_generator( | 4726 SafepointGenerator safepoint_generator( |
4727 this, pointers, Safepoint::kLazyDeopt); | 4727 this, pointers, Safepoint::kLazyDeopt); |
4728 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4728 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4729 } | 4729 } |
4730 | 4730 |
4731 | 4731 |
| 4732 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { |
| 4733 __ cmp(eax, isolate()->factory()->undefined_value()); |
| 4734 DeoptimizeIf(equal, instr->environment()); |
| 4735 |
| 4736 __ cmp(eax, isolate()->factory()->null_value()); |
| 4737 DeoptimizeIf(equal, instr->environment()); |
| 4738 |
| 4739 __ test(eax, Immediate(kSmiTagMask)); |
| 4740 DeoptimizeIf(zero, instr->environment()); |
| 4741 |
| 4742 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
| 4743 __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx); |
| 4744 DeoptimizeIf(below_equal, instr->environment()); |
| 4745 |
| 4746 Label use_cache, call_runtime; |
| 4747 __ CheckEnumCache(&call_runtime); |
| 4748 |
| 4749 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); |
| 4750 __ jmp(&use_cache, Label::kNear); |
| 4751 |
| 4752 // Get the set of properties to enumerate. |
| 4753 __ bind(&call_runtime); |
| 4754 __ push(eax); |
| 4755 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr); |
| 4756 |
| 4757 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), |
| 4758 isolate()->factory()->meta_map()); |
| 4759 DeoptimizeIf(not_equal, instr->environment()); |
| 4760 __ bind(&use_cache); |
| 4761 } |
| 4762 |
| 4763 |
| 4764 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { |
| 4765 Register map = ToRegister(instr->map()); |
| 4766 Register result = ToRegister(instr->result()); |
| 4767 __ LoadInstanceDescriptors(map, result); |
| 4768 __ mov(result, |
| 4769 FieldOperand(result, DescriptorArray::kEnumerationIndexOffset)); |
| 4770 __ mov(result, |
| 4771 FieldOperand(result, FixedArray::SizeFor(instr->idx()))); |
| 4772 __ test(result, result); |
| 4773 DeoptimizeIf(equal, instr->environment()); |
| 4774 } |
| 4775 |
| 4776 |
| 4777 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) { |
| 4778 Register object = ToRegister(instr->value()); |
| 4779 __ cmp(ToRegister(instr->map()), |
| 4780 FieldOperand(object, HeapObject::kMapOffset)); |
| 4781 DeoptimizeIf(not_equal, instr->environment()); |
| 4782 } |
| 4783 |
| 4784 |
| 4785 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { |
| 4786 Register object = ToRegister(instr->object()); |
| 4787 Register index = ToRegister(instr->index()); |
| 4788 |
| 4789 Label out_of_object, done; |
| 4790 __ cmp(index, Immediate(0)); |
| 4791 __ j(less, &out_of_object); |
| 4792 __ mov(object, FieldOperand(object, |
| 4793 index, |
| 4794 times_half_pointer_size, |
| 4795 JSObject::kHeaderSize)); |
| 4796 __ jmp(&done, Label::kNear); |
| 4797 |
| 4798 __ bind(&out_of_object); |
| 4799 __ mov(object, FieldOperand(object, JSObject::kPropertiesOffset)); |
| 4800 __ neg(index); |
| 4801 // Index is now equal to out of object property index plus 1. |
| 4802 __ mov(object, FieldOperand(object, |
| 4803 index, |
| 4804 times_half_pointer_size, |
| 4805 FixedArray::kHeaderSize - kPointerSize)); |
| 4806 __ bind(&done); |
| 4807 } |
| 4808 |
| 4809 |
4732 #undef __ | 4810 #undef __ |
4733 | 4811 |
4734 } } // namespace v8::internal | 4812 } } // namespace v8::internal |
4735 | 4813 |
4736 #endif // V8_TARGET_ARCH_IA32 | 4814 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |