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 2835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2846 testl(result_reg, Immediate(0xFFFFFF00)); | 2846 testl(result_reg, Immediate(0xFFFFFF00)); |
2847 j(zero, &done, Label::kNear); | 2847 j(zero, &done, Label::kNear); |
2848 Set(result_reg, 255); | 2848 Set(result_reg, 255); |
2849 bind(&done); | 2849 bind(&done); |
2850 } | 2850 } |
2851 | 2851 |
2852 | 2852 |
2853 void MacroAssembler::LoadInstanceDescriptors(Register map, | 2853 void MacroAssembler::LoadInstanceDescriptors(Register map, |
2854 Register descriptors) { | 2854 Register descriptors) { |
2855 movq(descriptors, FieldOperand(map, | 2855 movq(descriptors, FieldOperand(map, |
2856 Map::kInstanceDescriptorsOrBitField3Offset)); | 2856 Map::kInstanceDescriptorsOrBackPointerOffset)); |
2857 Label not_smi; | 2857 |
2858 JumpIfNotSmi(descriptors, ¬_smi, Label::kNear); | 2858 Label ok, fail; |
| 2859 CheckMap(descriptors, |
| 2860 isolate()->factory()->fixed_array_map(), |
| 2861 &fail, |
| 2862 DONT_DO_SMI_CHECK); |
| 2863 jmp(&ok); |
| 2864 bind(&fail); |
2859 Move(descriptors, isolate()->factory()->empty_descriptor_array()); | 2865 Move(descriptors, isolate()->factory()->empty_descriptor_array()); |
2860 bind(¬_smi); | 2866 bind(&ok); |
| 2867 |
| 2868 if (emit_debug_code()) { |
| 2869 AbortIfNotFixedArray(descriptors); |
| 2870 } |
2861 } | 2871 } |
2862 | 2872 |
2863 | 2873 |
2864 void MacroAssembler::DispatchMap(Register obj, | 2874 void MacroAssembler::DispatchMap(Register obj, |
2865 Handle<Map> map, | 2875 Handle<Map> map, |
2866 Handle<Code> success, | 2876 Handle<Code> success, |
2867 SmiCheckType smi_check_type) { | 2877 SmiCheckType smi_check_type) { |
2868 Label fail; | 2878 Label fail; |
2869 if (smi_check_type == DO_SMI_CHECK) { | 2879 if (smi_check_type == DO_SMI_CHECK) { |
2870 JumpIfSmi(obj, &fail); | 2880 JumpIfSmi(obj, &fail); |
(...skipping 27 matching lines...) Expand all Loading... |
2898 Assert(is_smi, "Operand is not a smi"); | 2908 Assert(is_smi, "Operand is not a smi"); |
2899 } | 2909 } |
2900 | 2910 |
2901 | 2911 |
2902 void MacroAssembler::AbortIfNotSmi(const Operand& object) { | 2912 void MacroAssembler::AbortIfNotSmi(const Operand& object) { |
2903 Condition is_smi = CheckSmi(object); | 2913 Condition is_smi = CheckSmi(object); |
2904 Assert(is_smi, "Operand is not a smi"); | 2914 Assert(is_smi, "Operand is not a smi"); |
2905 } | 2915 } |
2906 | 2916 |
2907 | 2917 |
| 2918 void MacroAssembler::AbortIfNotFixedArray(Register object) { |
| 2919 Label ok, fail; |
| 2920 CheckMap(object, |
| 2921 isolate()->factory()->fixed_array_map(), |
| 2922 &fail, |
| 2923 DONT_DO_SMI_CHECK); |
| 2924 jmp(&ok); |
| 2925 bind(&fail); |
| 2926 Abort("Operand is not a fixed array"); |
| 2927 bind(&ok); |
| 2928 } |
| 2929 |
| 2930 |
2908 void MacroAssembler::AbortIfNotZeroExtended(Register int32_register) { | 2931 void MacroAssembler::AbortIfNotZeroExtended(Register int32_register) { |
2909 ASSERT(!int32_register.is(kScratchRegister)); | 2932 ASSERT(!int32_register.is(kScratchRegister)); |
2910 movq(kScratchRegister, 0x100000000l, RelocInfo::NONE); | 2933 movq(kScratchRegister, 0x100000000l, RelocInfo::NONE); |
2911 cmpq(kScratchRegister, int32_register); | 2934 cmpq(kScratchRegister, int32_register); |
2912 Assert(above_equal, "32 bit value in register is not zero-extended"); | 2935 Assert(above_equal, "32 bit value in register is not zero-extended"); |
2913 } | 2936 } |
2914 | 2937 |
2915 | 2938 |
2916 void MacroAssembler::AbortIfNotString(Register object) { | 2939 void MacroAssembler::AbortIfNotString(Register object) { |
2917 testb(object, Immediate(kSmiTagMask)); | 2940 testb(object, Immediate(kSmiTagMask)); |
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4450 // Check that there are no elements. Register rcx contains the | 4473 // Check that there are no elements. Register rcx contains the |
4451 // current JS object we've reached through the prototype chain. | 4474 // current JS object we've reached through the prototype chain. |
4452 cmpq(empty_fixed_array_value, | 4475 cmpq(empty_fixed_array_value, |
4453 FieldOperand(rcx, JSObject::kElementsOffset)); | 4476 FieldOperand(rcx, JSObject::kElementsOffset)); |
4454 j(not_equal, call_runtime); | 4477 j(not_equal, call_runtime); |
4455 | 4478 |
4456 // Check that instance descriptors are not empty so that we can | 4479 // Check that instance descriptors are not empty so that we can |
4457 // check for an enum cache. Leave the map in rbx for the subsequent | 4480 // check for an enum cache. Leave the map in rbx for the subsequent |
4458 // prototype load. | 4481 // prototype load. |
4459 movq(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); | 4482 movq(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); |
4460 movq(rdx, FieldOperand(rbx, Map::kInstanceDescriptorsOrBitField3Offset)); | 4483 movq(rdx, FieldOperand(rbx, Map::kInstanceDescriptorsOrBackPointerOffset)); |
4461 JumpIfSmi(rdx, call_runtime); | 4484 |
| 4485 CheckMap(rdx, |
| 4486 isolate()->factory()->fixed_array_map(), |
| 4487 call_runtime, |
| 4488 DONT_DO_SMI_CHECK); |
| 4489 |
| 4490 if (emit_debug_code()) { |
| 4491 AbortIfNotFixedArray(rdx); |
| 4492 } |
4462 | 4493 |
4463 // Check that there is an enum cache in the non-empty instance | 4494 // Check that there is an enum cache in the non-empty instance |
4464 // descriptors (rdx). This is the case if the next enumeration | 4495 // descriptors (rdx). This is the case if the next enumeration |
4465 // index field does not contain a smi. | 4496 // index field does not contain a smi. |
4466 movq(rdx, FieldOperand(rdx, DescriptorArray::kEnumerationIndexOffset)); | 4497 movq(rdx, FieldOperand(rdx, DescriptorArray::kEnumerationIndexOffset)); |
4467 JumpIfSmi(rdx, call_runtime); | 4498 JumpIfSmi(rdx, call_runtime); |
4468 | 4499 |
4469 // For all objects but the receiver, check that the cache is empty. | 4500 // For all objects but the receiver, check that the cache is empty. |
4470 Label check_prototype; | 4501 Label check_prototype; |
4471 cmpq(rcx, rax); | 4502 cmpq(rcx, rax); |
4472 j(equal, &check_prototype, Label::kNear); | 4503 j(equal, &check_prototype, Label::kNear); |
4473 movq(rdx, FieldOperand(rdx, DescriptorArray::kEnumCacheBridgeCacheOffset)); | 4504 movq(rdx, FieldOperand(rdx, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
4474 cmpq(rdx, empty_fixed_array_value); | 4505 cmpq(rdx, empty_fixed_array_value); |
4475 j(not_equal, call_runtime); | 4506 j(not_equal, call_runtime); |
4476 | 4507 |
4477 // Load the prototype from the map and loop if non-null. | 4508 // Load the prototype from the map and loop if non-null. |
4478 bind(&check_prototype); | 4509 bind(&check_prototype); |
4479 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4510 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
4480 cmpq(rcx, null_value); | 4511 cmpq(rcx, null_value); |
4481 j(not_equal, &next); | 4512 j(not_equal, &next); |
4482 } | 4513 } |
4483 | 4514 |
4484 | 4515 |
4485 } } // namespace v8::internal | 4516 } } // namespace v8::internal |
4486 | 4517 |
4487 #endif // V8_TARGET_ARCH_X64 | 4518 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |