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

Side by Side Diff: src/ia32/full-codegen-ia32.cc

Issue 10909007: Sharing of descriptor arrays. (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/heap.cc ('k') | src/ia32/macro-assembler-ia32.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 2651 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 1 << Map::kStringWrapperSafeForDefaultValueOf); 2662 1 << Map::kStringWrapperSafeForDefaultValueOf);
2663 __ j(not_zero, if_true); 2663 __ j(not_zero, if_true);
2664 2664
2665 // Check for fast case object. Return false for slow case objects. 2665 // Check for fast case object. Return false for slow case objects.
2666 __ mov(ecx, FieldOperand(eax, JSObject::kPropertiesOffset)); 2666 __ mov(ecx, FieldOperand(eax, JSObject::kPropertiesOffset));
2667 __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset)); 2667 __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset));
2668 __ cmp(ecx, FACTORY->hash_table_map()); 2668 __ cmp(ecx, FACTORY->hash_table_map());
2669 __ j(equal, if_false); 2669 __ j(equal, if_false);
2670 2670
2671 // Look for valueOf symbol in the descriptor array, and indicate false if 2671 // Look for valueOf symbol in the descriptor array, and indicate false if
2672 // found. The type is not checked, so if it is a transition it is a false 2672 // found. Since we omit an enumeration index check, if it is added via a
2673 // negative. 2673 // transition that shares its descriptor array, this is a false positive.
2674 Label entry, loop, done;
2675
2676 // Skip loop if no descriptors are valid.
2677 __ NumberOfOwnDescriptors(ecx, ebx);
2678 __ cmp(ecx, 0);
2679 __ j(equal, &done);
2680
2674 __ LoadInstanceDescriptors(ebx, ebx); 2681 __ LoadInstanceDescriptors(ebx, ebx);
2675 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); 2682 // ebx: descriptor array.
2676 // ebx: descriptor array 2683 // ecx: valid entries in the descriptor array.
2677 // ecx: length of descriptor array
2678 // Calculate the end of the descriptor array. 2684 // Calculate the end of the descriptor array.
2679 STATIC_ASSERT(kSmiTag == 0); 2685 STATIC_ASSERT(kSmiTag == 0);
2680 STATIC_ASSERT(kSmiTagSize == 1); 2686 STATIC_ASSERT(kSmiTagSize == 1);
2681 STATIC_ASSERT(kPointerSize == 4); 2687 STATIC_ASSERT(kPointerSize == 4);
2682 __ lea(ecx, Operand(ebx, ecx, times_2, FixedArray::kHeaderSize)); 2688 __ imul(ecx, ecx, DescriptorArray::kDescriptorSize);
2689 __ lea(ecx, Operand(ebx, ecx, times_2, DescriptorArray::kFirstOffset));
2683 // Calculate location of the first key name. 2690 // Calculate location of the first key name.
2684 __ add(ebx, Immediate(DescriptorArray::kFirstOffset)); 2691 __ add(ebx, Immediate(DescriptorArray::kFirstOffset));
2685 // Loop through all the keys in the descriptor array. If one of these is the 2692 // Loop through all the keys in the descriptor array. If one of these is the
2686 // symbol valueOf the result is false. 2693 // symbol valueOf the result is false.
2687 Label entry, loop;
2688 __ jmp(&entry); 2694 __ jmp(&entry);
2689 __ bind(&loop); 2695 __ bind(&loop);
2690 __ mov(edx, FieldOperand(ebx, 0)); 2696 __ mov(edx, FieldOperand(ebx, 0));
2691 __ cmp(edx, FACTORY->value_of_symbol()); 2697 __ cmp(edx, FACTORY->value_of_symbol());
2692 __ j(equal, if_false); 2698 __ j(equal, if_false);
2693 __ add(ebx, Immediate(DescriptorArray::kDescriptorSize * kPointerSize)); 2699 __ add(ebx, Immediate(DescriptorArray::kDescriptorSize * kPointerSize));
2694 __ bind(&entry); 2700 __ bind(&entry);
2695 __ cmp(ebx, ecx); 2701 __ cmp(ebx, ecx);
2696 __ j(not_equal, &loop); 2702 __ j(not_equal, &loop);
2697 2703
2704 __ bind(&done);
2705
2698 // Reload map as register ebx was used as temporary above. 2706 // Reload map as register ebx was used as temporary above.
2699 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); 2707 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
2700 2708
2701 // If a valueOf property is not found on the object check that it's 2709 // If a valueOf property is not found on the object check that its
2702 // prototype is the un-modified String prototype. If not result is false. 2710 // prototype is the un-modified String prototype. If not result is false.
2703 __ mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); 2711 __ mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset));
2704 __ JumpIfSmi(ecx, if_false); 2712 __ JumpIfSmi(ecx, if_false);
2705 __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset)); 2713 __ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset));
2706 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 2714 __ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
2707 __ mov(edx, 2715 __ mov(edx,
2708 FieldOperand(edx, GlobalObject::kNativeContextOffset)); 2716 FieldOperand(edx, GlobalObject::kNativeContextOffset));
2709 __ cmp(ecx, 2717 __ cmp(ecx,
2710 ContextOperand(edx, 2718 ContextOperand(edx,
2711 Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); 2719 Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
(...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after
4554 *stack_depth = 0; 4562 *stack_depth = 0;
4555 *context_length = 0; 4563 *context_length = 0;
4556 return previous_; 4564 return previous_;
4557 } 4565 }
4558 4566
4559 #undef __ 4567 #undef __
4560 4568
4561 } } // namespace v8::internal 4569 } } // namespace v8::internal
4562 4570
4563 #endif // V8_TARGET_ARCH_IA32 4571 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698