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

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: 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/ia32/macro-assembler-ia32.h ('k') | src/objects.h » ('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 2879 matching lines...) Expand 10 before | Expand all | Expand 10 after
2890 if (emit_debug_code()) { 2890 if (emit_debug_code()) {
2891 mov(length, Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset)); 2891 mov(length, Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset));
2892 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); 2892 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset));
2893 Check(less_equal, "Live Bytes Count overflow chunk size"); 2893 Check(less_equal, "Live Bytes Count overflow chunk size");
2894 } 2894 }
2895 2895
2896 bind(&done); 2896 bind(&done);
2897 } 2897 }
2898 2898
2899 2899
2900 void MacroAssembler::EnumLength(Register dst, Register map) {
2901 STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
2902 mov(dst, FieldOperand(map, Map::kBitField3Offset));
2903 and_(dst, Immediate(Smi::FromInt(Map::EnumLengthBits::kMask)));
2904 }
2905
2906
2900 void MacroAssembler::CheckEnumCache(Label* call_runtime) { 2907 void MacroAssembler::CheckEnumCache(Label* call_runtime) {
2901 Label next; 2908 Label next, start;
2902 mov(ecx, eax); 2909 mov(ecx, eax);
2910
2911 // Check if the enum length field is properly initialized, indicating that
2912 // there is an enum cache.
2913 mov(ebx, FieldOperand(ecx, HeapObject::kMapOffset));
2914
2915 EnumLength(edx, ebx);
2916 cmp(edx, Immediate(Smi::FromInt(Map::kInvalidEnumCache)));
2917 j(equal, call_runtime);
2918
2919 jmp(&start);
2920
2903 bind(&next); 2921 bind(&next);
2922 mov(ebx, FieldOperand(ecx, HeapObject::kMapOffset));
2904 2923
2905 // Check that there are no elements. Register ecx contains the 2924 // For all objects but the receiver, check that the cache is empty.
2906 // current JS object we've reached through the prototype chain. 2925 EnumLength(edx, ebx);
2907 cmp(FieldOperand(ecx, JSObject::kElementsOffset), 2926 cmp(edx, Immediate(Smi::FromInt(0)));
2908 isolate()->factory()->empty_fixed_array());
2909 j(not_equal, call_runtime); 2927 j(not_equal, call_runtime);
2910 2928
2911 // Check that instance descriptors are not empty so that we can 2929 bind(&start);
2912 // check for an enum cache. Leave the map in ebx for the subsequent
2913 // prototype load.
2914 mov(ebx, FieldOperand(ecx, HeapObject::kMapOffset));
2915 mov(edx, FieldOperand(ebx, Map::kTransitionsOrBackPointerOffset));
2916 CheckMap(edx,
2917 isolate()->factory()->fixed_array_map(),
2918 call_runtime,
2919 DONT_DO_SMI_CHECK);
2920 2930
2921 mov(edx, FieldOperand(edx, TransitionArray::kDescriptorsOffset)); 2931 // Check that there are no elements. Register rcx contains the current JS
2922 cmp(edx, isolate()->factory()->empty_descriptor_array()); 2932 // object we've reached through the prototype chain.
2923 j(equal, call_runtime); 2933 mov(ecx, FieldOperand(ecx, JSObject::kElementsOffset));
2924 2934 cmp(ecx, isolate()->factory()->empty_fixed_array());
2925 // Check that there is an enum cache in the non-empty instance
2926 // descriptors (edx). This is the case if the next enumeration
2927 // index field does not contain a smi.
2928 mov(edx, FieldOperand(edx, DescriptorArray::kEnumCacheOffset));
2929 JumpIfSmi(edx, call_runtime);
2930
2931 // For all objects but the receiver, check that the cache is empty.
2932 Label check_prototype;
2933 cmp(ecx, eax);
2934 j(equal, &check_prototype, Label::kNear);
2935 mov(edx, FieldOperand(edx, DescriptorArray::kEnumCacheBridgeCacheOffset));
2936 cmp(edx, isolate()->factory()->empty_fixed_array());
2937 j(not_equal, call_runtime); 2935 j(not_equal, call_runtime);
2938 2936
2939 // Load the prototype from the map and loop if non-null.
2940 bind(&check_prototype);
2941 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); 2937 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset));
2942 cmp(ecx, isolate()->factory()->null_value()); 2938 cmp(ecx, isolate()->factory()->null_value());
2943 j(not_equal, &next); 2939 j(not_equal, &next);
2944 } 2940 }
2945 2941
2946 } } // namespace v8::internal 2942 } } // namespace v8::internal
2947 2943
2948 #endif // V8_TARGET_ARCH_IA32 2944 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698