Chromium Code Reviews| 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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 662 bind(&ok); | 662 bind(&ok); | 
| 663 } | 663 } | 
| 664 | 664 | 
| 665 | 665 | 
| 666 void MacroAssembler::AbortIfNotSmi(Register object) { | 666 void MacroAssembler::AbortIfNotSmi(Register object) { | 
| 667 test(object, Immediate(kSmiTagMask)); | 667 test(object, Immediate(kSmiTagMask)); | 
| 668 Assert(equal, "Operand is not a smi"); | 668 Assert(equal, "Operand is not a smi"); | 
| 669 } | 669 } | 
| 670 | 670 | 
| 671 | 671 | 
| 672 void MacroAssembler::AbortIfNotFixedArray(Register object) { | |
| 673 Label ok, fail; | |
| 674 CheckMap(object, | |
| 675 isolate()->factory()->fixed_array_map(), | |
| 676 &fail, | |
| 677 DONT_DO_SMI_CHECK); | |
| 678 jmp(&ok); | |
| 679 bind(&fail); | |
| 680 Abort("Operand is not a fixed array"); | |
| 681 bind(&ok); | |
| 682 } | |
| 683 | |
| 684 | |
| 672 void MacroAssembler::AbortIfNotString(Register object) { | 685 void MacroAssembler::AbortIfNotString(Register object) { | 
| 673 test(object, Immediate(kSmiTagMask)); | 686 test(object, Immediate(kSmiTagMask)); | 
| 674 Assert(not_equal, "Operand is not a string"); | 687 Assert(not_equal, "Operand is not a string"); | 
| 675 push(object); | 688 push(object); | 
| 676 mov(object, FieldOperand(object, HeapObject::kMapOffset)); | 689 mov(object, FieldOperand(object, HeapObject::kMapOffset)); | 
| 677 CmpInstanceType(object, FIRST_NONSTRING_TYPE); | 690 CmpInstanceType(object, FIRST_NONSTRING_TYPE); | 
| 678 pop(object); | 691 pop(object); | 
| 679 Assert(below, "Operand is not a string"); | 692 Assert(below, "Operand is not a string"); | 
| 680 } | 693 } | 
| 681 | 694 | 
| (...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2511 } else { | 2524 } else { | 
| 2512 CallRuntime(Runtime::kAbort, 2); | 2525 CallRuntime(Runtime::kAbort, 2); | 
| 2513 } | 2526 } | 
| 2514 // will not return here | 2527 // will not return here | 
| 2515 int3(); | 2528 int3(); | 
| 2516 } | 2529 } | 
| 2517 | 2530 | 
| 2518 | 2531 | 
| 2519 void MacroAssembler::LoadInstanceDescriptors(Register map, | 2532 void MacroAssembler::LoadInstanceDescriptors(Register map, | 
| 2520 Register descriptors) { | 2533 Register descriptors) { | 
| 2521 mov(descriptors, | 2534 mov(descriptors, FieldOperand(map, | 
| 2522 FieldOperand(map, Map::kInstanceDescriptorsOrBitField3Offset)); | 2535 Map::kInstanceDescriptorsOrBackPointerOffset)); | 
| 2523 Label not_smi; | 2536 | 
| 2524 JumpIfNotSmi(descriptors, ¬_smi); | 2537 Label ok, fail; | 
| 2538 CheckMap(descriptors, | |
| 2539 isolate()->factory()->fixed_array_map(), | |
| 2540 &fail, | |
| 2541 DONT_DO_SMI_CHECK); | |
| 2542 jmp(&ok); | |
| 2543 bind(&fail); | |
| 2525 mov(descriptors, isolate()->factory()->empty_descriptor_array()); | 2544 mov(descriptors, isolate()->factory()->empty_descriptor_array()); | 
| 2526 bind(¬_smi); | 2545 bind(&ok); | 
| 2546 | |
| 2547 if (emit_debug_code()) { | |
| 2548 AbortIfNotFixedArray(descriptors); | |
| 
 
Jakob Kummerow
2012/07/10 12:26:25
This check is pretty pointless, don't you think? Y
 
Toon Verwaest
2012/07/10 13:28:28
Done.
 
Toon Verwaest
2012/07/10 13:28:28
Done.
 
 | |
| 2549 } | |
| 2527 } | 2550 } | 
| 2528 | 2551 | 
| 2529 | 2552 | 
| 2530 void MacroAssembler::LoadPowerOf2(XMMRegister dst, | 2553 void MacroAssembler::LoadPowerOf2(XMMRegister dst, | 
| 2531 Register scratch, | 2554 Register scratch, | 
| 2532 int power) { | 2555 int power) { | 
| 2533 ASSERT(is_uintn(power + HeapNumber::kExponentBias, | 2556 ASSERT(is_uintn(power + HeapNumber::kExponentBias, | 
| 2534 HeapNumber::kExponentBits)); | 2557 HeapNumber::kExponentBits)); | 
| 2535 mov(scratch, Immediate(power + HeapNumber::kExponentBias)); | 2558 mov(scratch, Immediate(power + HeapNumber::kExponentBias)); | 
| 2536 movd(dst, scratch); | 2559 movd(dst, scratch); | 
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2879 // Check that there are no elements. Register ecx contains the | 2902 // Check that there are no elements. Register ecx contains the | 
| 2880 // current JS object we've reached through the prototype chain. | 2903 // current JS object we've reached through the prototype chain. | 
| 2881 cmp(FieldOperand(ecx, JSObject::kElementsOffset), | 2904 cmp(FieldOperand(ecx, JSObject::kElementsOffset), | 
| 2882 isolate()->factory()->empty_fixed_array()); | 2905 isolate()->factory()->empty_fixed_array()); | 
| 2883 j(not_equal, call_runtime); | 2906 j(not_equal, call_runtime); | 
| 2884 | 2907 | 
| 2885 // Check that instance descriptors are not empty so that we can | 2908 // Check that instance descriptors are not empty so that we can | 
| 2886 // check for an enum cache. Leave the map in ebx for the subsequent | 2909 // check for an enum cache. Leave the map in ebx for the subsequent | 
| 2887 // prototype load. | 2910 // prototype load. | 
| 2888 mov(ebx, FieldOperand(ecx, HeapObject::kMapOffset)); | 2911 mov(ebx, FieldOperand(ecx, HeapObject::kMapOffset)); | 
| 2889 mov(edx, FieldOperand(ebx, Map::kInstanceDescriptorsOrBitField3Offset)); | 2912 mov(edx, FieldOperand(ebx, Map::kInstanceDescriptorsOrBackPointerOffset)); | 
| 2890 JumpIfSmi(edx, call_runtime); | 2913 CheckMap(edx, | 
| 2914 isolate()->factory()->fixed_array_map(), | |
| 2915 call_runtime, | |
| 2916 DONT_DO_SMI_CHECK); | |
| 2917 | |
| 2918 if (emit_debug_code()) { | |
| 2919 AbortIfNotFixedArray(edx); | |
| 
 
Jakob Kummerow
2012/07/10 12:26:25
This check is entirely pointless. We just did a ma
 
Toon Verwaest
2012/07/10 13:28:28
Done.
 
Toon Verwaest
2012/07/10 13:28:28
Done.
 
 | |
| 2920 } | |
| 2891 | 2921 | 
| 2892 // Check that there is an enum cache in the non-empty instance | 2922 // Check that there is an enum cache in the non-empty instance | 
| 2893 // descriptors (edx). This is the case if the next enumeration | 2923 // descriptors (edx). This is the case if the next enumeration | 
| 2894 // index field does not contain a smi. | 2924 // index field does not contain a smi. | 
| 2895 mov(edx, FieldOperand(edx, DescriptorArray::kEnumerationIndexOffset)); | 2925 mov(edx, FieldOperand(edx, DescriptorArray::kEnumerationIndexOffset)); | 
| 2896 JumpIfSmi(edx, call_runtime); | 2926 JumpIfSmi(edx, call_runtime); | 
| 2897 | 2927 | 
| 2898 // For all objects but the receiver, check that the cache is empty. | 2928 // For all objects but the receiver, check that the cache is empty. | 
| 2899 Label check_prototype; | 2929 Label check_prototype; | 
| 2900 cmp(ecx, eax); | 2930 cmp(ecx, eax); | 
| 2901 j(equal, &check_prototype, Label::kNear); | 2931 j(equal, &check_prototype, Label::kNear); | 
| 2902 mov(edx, FieldOperand(edx, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 2932 mov(edx, FieldOperand(edx, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 
| 2903 cmp(edx, isolate()->factory()->empty_fixed_array()); | 2933 cmp(edx, isolate()->factory()->empty_fixed_array()); | 
| 2904 j(not_equal, call_runtime); | 2934 j(not_equal, call_runtime); | 
| 2905 | 2935 | 
| 2906 // Load the prototype from the map and loop if non-null. | 2936 // Load the prototype from the map and loop if non-null. | 
| 2907 bind(&check_prototype); | 2937 bind(&check_prototype); | 
| 2908 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); | 2938 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); | 
| 2909 cmp(ecx, isolate()->factory()->null_value()); | 2939 cmp(ecx, isolate()->factory()->null_value()); | 
| 2910 j(not_equal, &next); | 2940 j(not_equal, &next); | 
| 2911 } | 2941 } | 
| 2912 | 2942 | 
| 2913 } } // namespace v8::internal | 2943 } } // namespace v8::internal | 
| 2914 | 2944 | 
| 2915 #endif // V8_TARGET_ARCH_IA32 | 2945 #endif // V8_TARGET_ARCH_IA32 | 
| OLD | NEW |