Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 10824079: Use a special EnumLength field to indicate number of valid enum cache values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/handles.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3699 matching lines...) Expand 10 before | Expand all | Expand 10 after
3710 &fail, 3710 &fail,
3711 DONT_DO_SMI_CHECK); 3711 DONT_DO_SMI_CHECK);
3712 ldr(descriptors, FieldMemOperand(temp, TransitionArray::kDescriptorsOffset)); 3712 ldr(descriptors, FieldMemOperand(temp, TransitionArray::kDescriptorsOffset));
3713 jmp(&ok); 3713 jmp(&ok);
3714 bind(&fail); 3714 bind(&fail);
3715 mov(descriptors, Operand(FACTORY->empty_descriptor_array())); 3715 mov(descriptors, Operand(FACTORY->empty_descriptor_array()));
3716 bind(&ok); 3716 bind(&ok);
3717 } 3717 }
3718 3718
3719 3719
3720 void MacroAssembler::EnumLength(Register dst, Register map) {
3721 STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
3722 ldr(dst, FieldMemOperand(map, Map::kBitField3Offset));
3723 and_(dst, dst, Operand(Smi::FromInt(Map::EnumLengthBits::kMask)));
3724 }
3725
3726
3720 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { 3727 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) {
3721 Label next;
3722 // Preload a couple of values used in the loop.
3723 Register empty_fixed_array_value = r6; 3728 Register empty_fixed_array_value = r6;
3724 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); 3729 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex);
3725 mov(r1, r0); 3730 Label next, start;
3731 mov(r2, r0);
3732
3733 // Check if the enum length field is properly initialized, indicating that
3734 // there is an enum cache.
3735 ldr(r1, FieldMemOperand(r2, HeapObject::kMapOffset));
3736
3737 EnumLength(r3, r1);
3738 cmp(r3, Operand(Smi::FromInt(Map::kInvalidEnumCache)));
3739 b(eq, call_runtime);
3740
3741 jmp(&start);
3742
3726 bind(&next); 3743 bind(&next);
3744 ldr(r1, FieldMemOperand(r2, HeapObject::kMapOffset));
3727 3745
3728 // Check that there are no elements. Register r1 contains the 3746 // For all objects but the receiver, check that the cache is empty.
3729 // current JS object we've reached through the prototype chain. 3747 EnumLength(r3, r1);
3730 ldr(r2, FieldMemOperand(r1, JSObject::kElementsOffset)); 3748 cmp(r3, Operand(Smi::FromInt(0)));
3749 b(ne, call_runtime);
3750
3751 bind(&start);
3752
3753 // Check that there are no elements. Register r2 contains the current JS
3754 // object we've reached through the prototype chain.
3755 ldr(r2, FieldMemOperand(r2, JSObject::kElementsOffset));
3731 cmp(r2, empty_fixed_array_value); 3756 cmp(r2, empty_fixed_array_value);
3732 b(ne, call_runtime); 3757 b(ne, call_runtime);
3733 3758
3734 // Check that instance descriptors are not empty so that we can 3759 ldr(r2, FieldMemOperand(r1, Map::kPrototypeOffset));
3735 // check for an enum cache. Leave the map in r2 for the subsequent 3760 cmp(r2, null_value);
3736 // prototype load.
3737 ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset));
3738 ldr(r3, FieldMemOperand(r2, Map::kTransitionsOrBackPointerOffset));
3739
3740 CheckMap(r3,
3741 r7,
3742 isolate()->factory()->fixed_array_map(),
3743 call_runtime,
3744 DONT_DO_SMI_CHECK);
3745
3746 LoadRoot(r7, Heap::kEmptyDescriptorArrayRootIndex);
3747 ldr(r3, FieldMemOperand(r3, TransitionArray::kDescriptorsOffset));
3748 cmp(r3, r7);
3749 b(eq, call_runtime);
3750
3751 // Check that there is an enum cache in the non-empty instance
3752 // descriptors (r3). This is the case if the next enumeration
3753 // index field does not contain a smi.
3754 ldr(r3, FieldMemOperand(r3, DescriptorArray::kEnumCacheOffset));
3755 JumpIfSmi(r3, call_runtime);
3756
3757 // For all objects but the receiver, check that the cache is empty.
3758 Label check_prototype;
3759 cmp(r1, r0);
3760 b(eq, &check_prototype);
3761 ldr(r3, FieldMemOperand(r3, DescriptorArray::kEnumCacheBridgeCacheOffset));
3762 cmp(r3, empty_fixed_array_value);
3763 b(ne, call_runtime);
3764
3765 // Load the prototype from the map and loop if non-null.
3766 bind(&check_prototype);
3767 ldr(r1, FieldMemOperand(r2, Map::kPrototypeOffset));
3768 cmp(r1, null_value);
3769 b(ne, &next); 3761 b(ne, &next);
3770 } 3762 }
3771 3763
3772 3764
3773 #ifdef DEBUG 3765 #ifdef DEBUG
3774 bool AreAliased(Register reg1, 3766 bool AreAliased(Register reg1,
3775 Register reg2, 3767 Register reg2,
3776 Register reg3, 3768 Register reg3,
3777 Register reg4, 3769 Register reg4,
3778 Register reg5, 3770 Register reg5,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3829 void CodePatcher::EmitCondition(Condition cond) { 3821 void CodePatcher::EmitCondition(Condition cond) {
3830 Instr instr = Assembler::instr_at(masm_.pc_); 3822 Instr instr = Assembler::instr_at(masm_.pc_);
3831 instr = (instr & ~kCondMask) | cond; 3823 instr = (instr & ~kCondMask) | cond;
3832 masm_.emit(instr); 3824 masm_.emit(instr);
3833 } 3825 }
3834 3826
3835 3827
3836 } } // namespace v8::internal 3828 } } // namespace v8::internal
3837 3829
3838 #endif // V8_TARGET_ARCH_ARM 3830 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698