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 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 // If we got a map from the runtime call, we can do a fast | 1099 // If we got a map from the runtime call, we can do a fast |
1100 // modification check. Otherwise, we got a fixed array, and we have | 1100 // modification check. Otherwise, we got a fixed array, and we have |
1101 // to do a slow check. | 1101 // to do a slow check. |
1102 Label fixed_array; | 1102 Label fixed_array; |
1103 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), | 1103 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), |
1104 Heap::kMetaMapRootIndex); | 1104 Heap::kMetaMapRootIndex); |
1105 __ j(not_equal, &fixed_array, Label::kNear); | 1105 __ j(not_equal, &fixed_array, Label::kNear); |
1106 | 1106 |
1107 // We got a map in register rax. Get the enumeration cache from it. | 1107 // We got a map in register rax. Get the enumeration cache from it. |
1108 __ bind(&use_cache); | 1108 __ bind(&use_cache); |
| 1109 |
| 1110 Label no_descriptors; |
| 1111 |
| 1112 __ EnumLength(rdx, rax); |
| 1113 __ cmpq(rdx, Immediate(0)); |
| 1114 __ j(equal, &no_descriptors); |
| 1115 |
1109 __ LoadInstanceDescriptors(rax, rcx); | 1116 __ LoadInstanceDescriptors(rax, rcx); |
1110 __ movq(rcx, FieldOperand(rcx, DescriptorArray::kEnumCacheOffset)); | 1117 __ movq(rcx, FieldOperand(rcx, DescriptorArray::kEnumCacheOffset)); |
1111 __ movq(rdx, FieldOperand(rcx, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 1118 __ movq(rcx, FieldOperand(rcx, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
1112 | 1119 |
1113 // Set up the four remaining stack slots. | 1120 // Set up the four remaining stack slots. |
1114 __ push(rax); // Map. | 1121 __ push(rax); // Map. |
1115 __ push(rdx); // Enumeration cache. | 1122 __ push(rcx); // Enumeration cache. |
1116 __ movq(rax, FieldOperand(rdx, FixedArray::kLengthOffset)); | 1123 __ Integer32ToSmi(rdx, rdx); |
1117 __ push(rax); // Enumeration cache length (as smi). | 1124 __ push(rdx); // Number of valid entries for the map in the enum cache. |
1118 __ Push(Smi::FromInt(0)); // Initial index. | 1125 __ Push(Smi::FromInt(0)); // Initial index. |
1119 __ jmp(&loop); | 1126 __ jmp(&loop); |
1120 | 1127 |
| 1128 __ bind(&no_descriptors); |
| 1129 __ addq(rsp, Immediate(kPointerSize)); |
| 1130 __ jmp(&exit); |
| 1131 |
1121 // We got a fixed array in register rax. Iterate through that. | 1132 // We got a fixed array in register rax. Iterate through that. |
1122 Label non_proxy; | 1133 Label non_proxy; |
1123 __ bind(&fixed_array); | 1134 __ bind(&fixed_array); |
1124 | 1135 |
1125 Handle<JSGlobalPropertyCell> cell = | 1136 Handle<JSGlobalPropertyCell> cell = |
1126 isolate()->factory()->NewJSGlobalPropertyCell( | 1137 isolate()->factory()->NewJSGlobalPropertyCell( |
1127 Handle<Object>( | 1138 Handle<Object>( |
1128 Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker))); | 1139 Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker))); |
1129 RecordTypeFeedbackCell(stmt->PrepareId(), cell); | 1140 RecordTypeFeedbackCell(stmt->PrepareId(), cell); |
1130 __ LoadHeapObject(rbx, cell); | 1141 __ LoadHeapObject(rbx, cell); |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 Immediate(FixedArray::kHeaderSize + | 2662 Immediate(FixedArray::kHeaderSize + |
2652 DescriptorArray::kFirstIndex * kPointerSize)); | 2663 DescriptorArray::kFirstIndex * kPointerSize)); |
2653 // Loop through all the keys in the descriptor array. If one of these is the | 2664 // Loop through all the keys in the descriptor array. If one of these is the |
2654 // symbol valueOf the result is false. | 2665 // symbol valueOf the result is false. |
2655 Label entry, loop; | 2666 Label entry, loop; |
2656 __ jmp(&entry); | 2667 __ jmp(&entry); |
2657 __ bind(&loop); | 2668 __ bind(&loop); |
2658 __ movq(rdx, FieldOperand(rbx, 0)); | 2669 __ movq(rdx, FieldOperand(rbx, 0)); |
2659 __ Cmp(rdx, FACTORY->value_of_symbol()); | 2670 __ Cmp(rdx, FACTORY->value_of_symbol()); |
2660 __ j(equal, if_false); | 2671 __ j(equal, if_false); |
2661 __ addq(rbx, Immediate(kPointerSize)); | 2672 |
| 2673 __ addq(rbx, Immediate(kPointerSize * DescriptorArray::kDescriptorSize)); |
2662 __ bind(&entry); | 2674 __ bind(&entry); |
2663 __ cmpq(rbx, rcx); | 2675 __ cmpq(rbx, rcx); |
2664 __ j(not_equal, &loop); | 2676 __ j(not_equal, &loop); |
2665 | 2677 |
2666 // Reload map as register rbx was used as temporary above. | 2678 // Reload map as register rbx was used as temporary above. |
2667 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); | 2679 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); |
2668 | 2680 |
2669 // If a valueOf property is not found on the object check that it's | 2681 // If a valueOf property is not found on the object check that it's |
2670 // prototype is the un-modified String prototype. If not result is false. | 2682 // prototype is the un-modified String prototype. If not result is false. |
2671 __ movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 2683 __ movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
(...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4543 *context_length = 0; | 4555 *context_length = 0; |
4544 return previous_; | 4556 return previous_; |
4545 } | 4557 } |
4546 | 4558 |
4547 | 4559 |
4548 #undef __ | 4560 #undef __ |
4549 | 4561 |
4550 } } // namespace v8::internal | 4562 } } // namespace v8::internal |
4551 | 4563 |
4552 #endif // V8_TARGET_ARCH_X64 | 4564 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |