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 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 } | 1274 } |
1275 | 1275 |
1276 | 1276 |
1277 void LCodeGen::DoFixedArrayBaseLength(LFixedArrayBaseLength* instr) { | 1277 void LCodeGen::DoFixedArrayBaseLength(LFixedArrayBaseLength* instr) { |
1278 Register result = ToRegister(instr->result()); | 1278 Register result = ToRegister(instr->result()); |
1279 Register array = ToRegister(instr->InputAt(0)); | 1279 Register array = ToRegister(instr->InputAt(0)); |
1280 __ movq(result, FieldOperand(array, FixedArrayBase::kLengthOffset)); | 1280 __ movq(result, FieldOperand(array, FixedArrayBase::kLengthOffset)); |
1281 } | 1281 } |
1282 | 1282 |
1283 | 1283 |
| 1284 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { |
| 1285 Register result = ToRegister(instr->result()); |
| 1286 Register map = ToRegister(instr->InputAt(0)); |
| 1287 __ EnumLength(result, map); |
| 1288 __ Integer32ToSmi(result, result); |
| 1289 } |
| 1290 |
| 1291 |
1284 void LCodeGen::DoElementsKind(LElementsKind* instr) { | 1292 void LCodeGen::DoElementsKind(LElementsKind* instr) { |
1285 Register result = ToRegister(instr->result()); | 1293 Register result = ToRegister(instr->result()); |
1286 Register input = ToRegister(instr->InputAt(0)); | 1294 Register input = ToRegister(instr->InputAt(0)); |
1287 | 1295 |
1288 // Load map into |result|. | 1296 // Load map into |result|. |
1289 __ movq(result, FieldOperand(input, HeapObject::kMapOffset)); | 1297 __ movq(result, FieldOperand(input, HeapObject::kMapOffset)); |
1290 // Load the map's "bit field 2" into |result|. We only need the first byte. | 1298 // Load the map's "bit field 2" into |result|. We only need the first byte. |
1291 __ movzxbq(result, FieldOperand(result, Map::kBitField2Offset)); | 1299 __ movzxbq(result, FieldOperand(result, Map::kBitField2Offset)); |
1292 // Retrieve elements_kind from bit field 2. | 1300 // Retrieve elements_kind from bit field 2. |
1293 __ and_(result, Immediate(Map::kElementsKindMask)); | 1301 __ and_(result, Immediate(Map::kElementsKindMask)); |
(...skipping 3728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5022 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), | 5030 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), |
5023 Heap::kMetaMapRootIndex); | 5031 Heap::kMetaMapRootIndex); |
5024 DeoptimizeIf(not_equal, instr->environment()); | 5032 DeoptimizeIf(not_equal, instr->environment()); |
5025 __ bind(&use_cache); | 5033 __ bind(&use_cache); |
5026 } | 5034 } |
5027 | 5035 |
5028 | 5036 |
5029 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { | 5037 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { |
5030 Register map = ToRegister(instr->map()); | 5038 Register map = ToRegister(instr->map()); |
5031 Register result = ToRegister(instr->result()); | 5039 Register result = ToRegister(instr->result()); |
| 5040 Label load_cache, done; |
| 5041 __ EnumLength(result, map); |
| 5042 __ cmpq(result, Immediate(0)); |
| 5043 __ j(not_equal, &load_cache); |
| 5044 __ LoadRoot(result, Heap::kEmptyFixedArrayRootIndex); |
| 5045 __ jmp(&done); |
| 5046 __ bind(&load_cache); |
5032 __ LoadInstanceDescriptors(map, result); | 5047 __ LoadInstanceDescriptors(map, result); |
5033 __ movq(result, | 5048 __ movq(result, |
5034 FieldOperand(result, DescriptorArray::kEnumCacheOffset)); | 5049 FieldOperand(result, DescriptorArray::kEnumCacheOffset)); |
5035 __ movq(result, | 5050 __ movq(result, |
5036 FieldOperand(result, FixedArray::SizeFor(instr->idx()))); | 5051 FieldOperand(result, FixedArray::SizeFor(instr->idx()))); |
| 5052 __ bind(&done); |
5037 Condition cc = masm()->CheckSmi(result); | 5053 Condition cc = masm()->CheckSmi(result); |
5038 DeoptimizeIf(cc, instr->environment()); | 5054 DeoptimizeIf(cc, instr->environment()); |
5039 } | 5055 } |
5040 | 5056 |
5041 | 5057 |
5042 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) { | 5058 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) { |
5043 Register object = ToRegister(instr->value()); | 5059 Register object = ToRegister(instr->value()); |
5044 __ cmpq(ToRegister(instr->map()), | 5060 __ cmpq(ToRegister(instr->map()), |
5045 FieldOperand(object, HeapObject::kMapOffset)); | 5061 FieldOperand(object, HeapObject::kMapOffset)); |
5046 DeoptimizeIf(not_equal, instr->environment()); | 5062 DeoptimizeIf(not_equal, instr->environment()); |
(...skipping 24 matching lines...) Expand all Loading... |
5071 FixedArray::kHeaderSize - kPointerSize)); | 5087 FixedArray::kHeaderSize - kPointerSize)); |
5072 __ bind(&done); | 5088 __ bind(&done); |
5073 } | 5089 } |
5074 | 5090 |
5075 | 5091 |
5076 #undef __ | 5092 #undef __ |
5077 | 5093 |
5078 } } // namespace v8::internal | 5094 } } // namespace v8::internal |
5079 | 5095 |
5080 #endif // V8_TARGET_ARCH_X64 | 5096 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |