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

Side by Side Diff: src/ia32/macro-assembler-ia32.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: u Created 8 years, 4 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
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 2517 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 &fail, 2528 &fail,
2529 DONT_DO_SMI_CHECK); 2529 DONT_DO_SMI_CHECK);
2530 mov(descriptors, FieldOperand(temp, TransitionArray::kDescriptorsOffset)); 2530 mov(descriptors, FieldOperand(temp, TransitionArray::kDescriptorsOffset));
2531 jmp(&ok); 2531 jmp(&ok);
2532 bind(&fail); 2532 bind(&fail);
2533 mov(descriptors, isolate()->factory()->empty_descriptor_array()); 2533 mov(descriptors, isolate()->factory()->empty_descriptor_array());
2534 bind(&ok); 2534 bind(&ok);
2535 } 2535 }
2536 2536
2537 2537
2538 void MacroAssembler::EnumLength(Register dst, Register map) {
2539 mov(dst, FieldOperand(map, Map::kBitField3Offset));
2540 DecodeField<Map::EnumLengthBits>(dst);
2541 }
2542
2543
2538 void MacroAssembler::LoadPowerOf2(XMMRegister dst, 2544 void MacroAssembler::LoadPowerOf2(XMMRegister dst,
2539 Register scratch, 2545 Register scratch,
2540 int power) { 2546 int power) {
2541 ASSERT(is_uintn(power + HeapNumber::kExponentBias, 2547 ASSERT(is_uintn(power + HeapNumber::kExponentBias,
2542 HeapNumber::kExponentBits)); 2548 HeapNumber::kExponentBits));
2543 mov(scratch, Immediate(power + HeapNumber::kExponentBias)); 2549 mov(scratch, Immediate(power + HeapNumber::kExponentBias));
2544 movd(dst, scratch); 2550 movd(dst, scratch);
2545 psllq(dst, HeapNumber::kMantissaBits); 2551 psllq(dst, HeapNumber::kMantissaBits);
2546 } 2552 }
2547 2553
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2873 mov(length, Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset)); 2879 mov(length, Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset));
2874 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); 2880 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset));
2875 Check(less_equal, "Live Bytes Count overflow chunk size"); 2881 Check(less_equal, "Live Bytes Count overflow chunk size");
2876 } 2882 }
2877 2883
2878 bind(&done); 2884 bind(&done);
2879 } 2885 }
2880 2886
2881 2887
2882 void MacroAssembler::CheckEnumCache(Label* call_runtime) { 2888 void MacroAssembler::CheckEnumCache(Label* call_runtime) {
2883 Label next; 2889 Label next, start;
2884 mov(ecx, eax); 2890 mov(ecx, eax);
2891
2892 // Check if the enum length field is properly initialized, indicating that
2893 // there is an enum cache.
2894 mov(ebx, FieldOperand(ecx, HeapObject::kMapOffset));
2895
2896 EnumLength(edx, ebx);
2897 cmp(edx, Immediate(Map::kInvalidEnumCache));
2898 j(equal, call_runtime);
2899
2900 jmp(&start);
2901
2885 bind(&next); 2902 bind(&next);
2903 mov(ebx, FieldOperand(ecx, HeapObject::kMapOffset));
2886 2904
2887 // Check that there are no elements. Register ecx contains the 2905 // For all objects but the receiver, check that the cache is empty.
2888 // current JS object we've reached through the prototype chain. 2906 EnumLength(edx, ebx);
2889 cmp(FieldOperand(ecx, JSObject::kElementsOffset), 2907 cmp(edx, Immediate(0));
2890 isolate()->factory()->empty_fixed_array());
2891 j(not_equal, call_runtime); 2908 j(not_equal, call_runtime);
2892 2909
2893 // Check that instance descriptors are not empty so that we can 2910 bind(&start);
2894 // check for an enum cache. Leave the map in ebx for the subsequent
2895 // prototype load.
2896 mov(ebx, FieldOperand(ecx, HeapObject::kMapOffset));
2897 mov(edx, FieldOperand(ebx, Map::kTransitionsOrBackPointerOffset));
2898 CheckMap(edx,
2899 isolate()->factory()->fixed_array_map(),
2900 call_runtime,
2901 DONT_DO_SMI_CHECK);
2902 2911
2903 mov(edx, FieldOperand(edx, TransitionArray::kDescriptorsOffset)); 2912 // Check that there are no elements. Register rcx contains the current JS
2904 cmp(edx, isolate()->factory()->empty_descriptor_array()); 2913 // object we've reached through the prototype chain.
2905 j(equal, call_runtime); 2914 mov(ecx, FieldOperand(ecx, JSObject::kElementsOffset));
2906 2915 cmp(ecx, isolate()->factory()->empty_fixed_array());
2907 // Check that there is an enum cache in the non-empty instance
2908 // descriptors (edx). This is the case if the next enumeration
2909 // index field does not contain a smi.
2910 mov(edx, FieldOperand(edx, DescriptorArray::kEnumCacheOffset));
2911 JumpIfSmi(edx, call_runtime);
2912
2913 // For all objects but the receiver, check that the cache is empty.
2914 Label check_prototype;
2915 cmp(ecx, eax);
2916 j(equal, &check_prototype, Label::kNear);
2917 mov(edx, FieldOperand(edx, DescriptorArray::kEnumCacheBridgeCacheOffset));
2918 cmp(edx, isolate()->factory()->empty_fixed_array());
2919 j(not_equal, call_runtime); 2916 j(not_equal, call_runtime);
2920 2917
2921 // Load the prototype from the map and loop if non-null.
2922 bind(&check_prototype);
2923 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); 2918 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset));
2924 cmp(ecx, isolate()->factory()->null_value()); 2919 cmp(ecx, isolate()->factory()->null_value());
2925 j(not_equal, &next); 2920 j(not_equal, &next);
2926 } 2921 }
2927 2922
2928 } } // namespace v8::internal 2923 } } // namespace v8::internal
2929 2924
2930 #endif // V8_TARGET_ARCH_IA32 2925 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698