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 4810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4821 | 4821 |
4822 // If the environment were already registered, we would have no way of | 4822 // If the environment were already registered, we would have no way of |
4823 // backpatching it with the spill slot operands. | 4823 // backpatching it with the spill slot operands. |
4824 ASSERT(!environment->HasBeenRegistered()); | 4824 ASSERT(!environment->HasBeenRegistered()); |
4825 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4825 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
4826 ASSERT(osr_pc_offset_ == -1); | 4826 ASSERT(osr_pc_offset_ == -1); |
4827 osr_pc_offset_ = masm()->pc_offset(); | 4827 osr_pc_offset_ = masm()->pc_offset(); |
4828 } | 4828 } |
4829 | 4829 |
4830 | 4830 |
| 4831 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { |
| 4832 Register result = ToRegister(instr->result()); |
| 4833 Register object = ToRegister(instr->object()); |
| 4834 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 4835 DeoptimizeIf(eq, instr->environment(), object, Operand(at)); |
| 4836 |
| 4837 Register null_value = t1; |
| 4838 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
| 4839 DeoptimizeIf(eq, instr->environment(), object, Operand(null_value)); |
| 4840 |
| 4841 __ And(at, object, kSmiTagMask); |
| 4842 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg)); |
| 4843 |
| 4844 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
| 4845 __ GetObjectType(object, a1, a1); |
| 4846 DeoptimizeIf(le, instr->environment(), a1, Operand(LAST_JS_PROXY_TYPE)); |
| 4847 |
| 4848 Label use_cache, call_runtime; |
| 4849 ASSERT(object.is(a0)); |
| 4850 __ CheckEnumCache(null_value, &call_runtime); |
| 4851 |
| 4852 __ lw(result, FieldMemOperand(object, HeapObject::kMapOffset)); |
| 4853 __ Branch(&use_cache); |
| 4854 |
| 4855 // Get the set of properties to enumerate. |
| 4856 __ bind(&call_runtime); |
| 4857 __ push(object); |
| 4858 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr); |
| 4859 |
| 4860 __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); |
| 4861 ASSERT(result.is(v0)); |
| 4862 __ LoadRoot(at, Heap::kMetaMapRootIndex); |
| 4863 DeoptimizeIf(ne, instr->environment(), a1, Operand(at)); |
| 4864 __ bind(&use_cache); |
| 4865 } |
| 4866 |
| 4867 |
| 4868 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { |
| 4869 Register map = ToRegister(instr->map()); |
| 4870 Register result = ToRegister(instr->result()); |
| 4871 __ LoadInstanceDescriptors(map, result); |
| 4872 __ lw(result, |
| 4873 FieldMemOperand(result, DescriptorArray::kEnumerationIndexOffset)); |
| 4874 __ lw(result, |
| 4875 FieldMemOperand(result, FixedArray::SizeFor(instr->idx()))); |
| 4876 DeoptimizeIf(eq, instr->environment(), result, Operand(zero_reg)); |
| 4877 } |
| 4878 |
| 4879 |
| 4880 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) { |
| 4881 Register object = ToRegister(instr->value()); |
| 4882 Register map = ToRegister(instr->map()); |
| 4883 __ lw(scratch0(), FieldMemOperand(object, HeapObject::kMapOffset)); |
| 4884 DeoptimizeIf(ne, instr->environment(), map, Operand(scratch0())); |
| 4885 } |
| 4886 |
| 4887 |
| 4888 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { |
| 4889 Register object = ToRegister(instr->object()); |
| 4890 Register index = ToRegister(instr->index()); |
| 4891 Register result = ToRegister(instr->result()); |
| 4892 Register scratch = scratch0(); |
| 4893 |
| 4894 Label out_of_object, done; |
| 4895 __ Branch(USE_DELAY_SLOT, &out_of_object, lt, index, Operand(zero_reg)); |
| 4896 __ sll(scratch, index, kPointerSizeLog2 - kSmiTagSize); // In delay slot. |
| 4897 |
| 4898 STATIC_ASSERT(kPointerSizeLog2 > kSmiTagSize); |
| 4899 __ Addu(scratch, object, scratch); |
| 4900 __ lw(result, FieldMemOperand(scratch, JSObject::kHeaderSize)); |
| 4901 |
| 4902 __ Branch(&done); |
| 4903 |
| 4904 __ bind(&out_of_object); |
| 4905 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 4906 // Index is equal to negated out of object property index plus 1. |
| 4907 __ Subu(scratch, result, scratch); |
| 4908 __ lw(result, FieldMemOperand(scratch, |
| 4909 FixedArray::kHeaderSize - kPointerSize)); |
| 4910 __ bind(&done); |
| 4911 } |
| 4912 |
| 4913 |
4831 #undef __ | 4914 #undef __ |
4832 | 4915 |
4833 } } // namespace v8::internal | 4916 } } // namespace v8::internal |
OLD | NEW |