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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 __ bind(&call_runtime); | 1098 __ bind(&call_runtime); |
1099 __ push(rax); // Duplicate the enumerable object on the stack. | 1099 __ push(rax); // Duplicate the enumerable object on the stack. |
1100 __ CallRuntime(Runtime::kGetPropertyNamesFast, 1); | 1100 __ CallRuntime(Runtime::kGetPropertyNamesFast, 1); |
1101 | 1101 |
1102 // If we got a map from the runtime call, we can do a fast | 1102 // If we got a map from the runtime call, we can do a fast |
1103 // modification check. Otherwise, we got a fixed array, and we have | 1103 // modification check. Otherwise, we got a fixed array, and we have |
1104 // to do a slow check. | 1104 // to do a slow check. |
1105 Label fixed_array; | 1105 Label fixed_array; |
1106 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), | 1106 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), |
1107 Heap::kMetaMapRootIndex); | 1107 Heap::kMetaMapRootIndex); |
1108 __ j(not_equal, &fixed_array, Label::kNear); | 1108 __ j(not_equal, &fixed_array); |
1109 | 1109 |
1110 // We got a map in register rax. Get the enumeration cache from it. | 1110 // We got a map in register rax. Get the enumeration cache from it. |
1111 __ bind(&use_cache); | 1111 __ bind(&use_cache); |
| 1112 |
| 1113 Label no_descriptors; |
| 1114 |
| 1115 __ EnumLength(rdx, rax); |
| 1116 __ Cmp(rdx, Smi::FromInt(0)); |
| 1117 __ j(equal, &no_descriptors); |
| 1118 |
1112 __ LoadInstanceDescriptors(rax, rcx); | 1119 __ LoadInstanceDescriptors(rax, rcx); |
1113 __ movq(rcx, FieldOperand(rcx, DescriptorArray::kEnumCacheOffset)); | 1120 __ movq(rcx, FieldOperand(rcx, DescriptorArray::kEnumCacheOffset)); |
1114 __ movq(rdx, FieldOperand(rcx, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 1121 __ movq(rcx, FieldOperand(rcx, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
1115 | 1122 |
1116 // Set up the four remaining stack slots. | 1123 // Set up the four remaining stack slots. |
1117 __ push(rax); // Map. | 1124 __ push(rax); // Map. |
1118 __ push(rdx); // Enumeration cache. | 1125 __ push(rcx); // Enumeration cache. |
1119 __ movq(rax, FieldOperand(rdx, FixedArray::kLengthOffset)); | 1126 __ push(rdx); // Number of valid entries for the map in the enum cache. |
1120 __ push(rax); // Enumeration cache length (as smi). | |
1121 __ Push(Smi::FromInt(0)); // Initial index. | 1127 __ Push(Smi::FromInt(0)); // Initial index. |
1122 __ jmp(&loop); | 1128 __ jmp(&loop); |
1123 | 1129 |
| 1130 __ bind(&no_descriptors); |
| 1131 __ addq(rsp, Immediate(kPointerSize)); |
| 1132 __ jmp(&exit); |
| 1133 |
1124 // We got a fixed array in register rax. Iterate through that. | 1134 // We got a fixed array in register rax. Iterate through that. |
1125 Label non_proxy; | 1135 Label non_proxy; |
1126 __ bind(&fixed_array); | 1136 __ bind(&fixed_array); |
1127 | 1137 |
1128 Handle<JSGlobalPropertyCell> cell = | 1138 Handle<JSGlobalPropertyCell> cell = |
1129 isolate()->factory()->NewJSGlobalPropertyCell( | 1139 isolate()->factory()->NewJSGlobalPropertyCell( |
1130 Handle<Object>( | 1140 Handle<Object>( |
1131 Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker))); | 1141 Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker))); |
1132 RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell); | 1142 RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell); |
1133 __ LoadHeapObject(rbx, cell); | 1143 __ LoadHeapObject(rbx, cell); |
(...skipping 3409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4543 *context_length = 0; | 4553 *context_length = 0; |
4544 return previous_; | 4554 return previous_; |
4545 } | 4555 } |
4546 | 4556 |
4547 | 4557 |
4548 #undef __ | 4558 #undef __ |
4549 | 4559 |
4550 } } // namespace v8::internal | 4560 } } // namespace v8::internal |
4551 | 4561 |
4552 #endif // V8_TARGET_ARCH_X64 | 4562 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |