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

Side by Side Diff: src/builtins-ia32.cc

Issue 7341: Allocate room for expected number of properties based on the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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/bootstrapper.cc ('k') | src/heap.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // edi: constructor 104 // edi: constructor
105 // eax: initial map 105 // eax: initial map
106 __ movzx_b(ebx, FieldOperand(eax, Map::kInstanceTypeOffset)); 106 __ movzx_b(ebx, FieldOperand(eax, Map::kInstanceTypeOffset));
107 __ cmp(ebx, JS_FUNCTION_TYPE); 107 __ cmp(ebx, JS_FUNCTION_TYPE);
108 __ j(equal, &rt_call); 108 __ j(equal, &rt_call);
109 109
110 // Now allocate the JSObject on the heap. 110 // Now allocate the JSObject on the heap.
111 // edi: constructor 111 // edi: constructor
112 // eax: initial map 112 // eax: initial map
113 __ movzx_b(edi, FieldOperand(eax, Map::kInstanceSizeOffset)); 113 __ movzx_b(edi, FieldOperand(eax, Map::kInstanceSizeOffset));
114 __ shl(edi, kPointerSizeLog2);
114 // Make sure that the maximum heap object size will never cause us 115 // Make sure that the maximum heap object size will never cause us
115 // problem here, because it is always greater than the maximum 116 // problem here, because it is always greater than the maximum
116 // instance size that can be represented in a byte. 117 // instance size that can be represented in a byte.
117 ASSERT(Heap::MaxHeapObjectSize() >= (1 << kBitsPerByte)); 118 ASSERT(Heap::MaxHeapObjectSize() >= (1 << kBitsPerByte));
118 ExternalReference new_space_allocation_top = 119 ExternalReference new_space_allocation_top =
119 ExternalReference::new_space_allocation_top_address(); 120 ExternalReference::new_space_allocation_top_address();
120 __ mov(ebx, Operand::StaticVariable(new_space_allocation_top)); 121 __ mov(ebx, Operand::StaticVariable(new_space_allocation_top));
121 __ add(edi, Operand(ebx)); // Calculate new top 122 __ add(edi, Operand(ebx)); // Calculate new top
122 ExternalReference new_space_allocation_limit = 123 ExternalReference new_space_allocation_limit =
123 ExternalReference::new_space_allocation_limit_address(); 124 ExternalReference::new_space_allocation_limit_address();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // edi: start of next object 157 // edi: start of next object
157 __ or_(Operand(ebx), Immediate(kHeapObjectTag)); 158 __ or_(Operand(ebx), Immediate(kHeapObjectTag));
158 __ mov(Operand::StaticVariable(new_space_allocation_top), edi); 159 __ mov(Operand::StaticVariable(new_space_allocation_top), edi);
159 160
160 // Check if a properties array should be setup and allocate one if needed. 161 // Check if a properties array should be setup and allocate one if needed.
161 // Otherwise initialize the properties to the empty_fixed_array as well. 162 // Otherwise initialize the properties to the empty_fixed_array as well.
162 // eax: initial map 163 // eax: initial map
163 // ebx: JSObject 164 // ebx: JSObject
164 // edi: start of next object 165 // edi: start of next object
165 __ movzx_b(edx, FieldOperand(eax, Map::kUnusedPropertyFieldsOffset)); 166 __ movzx_b(edx, FieldOperand(eax, Map::kUnusedPropertyFieldsOffset));
167 __ movzx_b(ecx, FieldOperand(eax, Map::kInObjectPropertiesOffset));
168 // Calculate unused properties past the end of the in-object properties.
169 __ sub(edx, Operand(ecx));
166 __ test(edx, Operand(edx)); 170 __ test(edx, Operand(edx));
167 // Done if no unused properties are to be allocated. 171 // Done if no extra properties are to be allocated.
168 __ j(zero, &allocated); 172 __ j(zero, &allocated);
169 173
170 // Scale the number of elements by pointer size and add the header for 174 // Scale the number of elements by pointer size and add the header for
171 // FixedArrays to the start of the next object calculation from above. 175 // FixedArrays to the start of the next object calculation from above.
172 // eax: initial map 176 // eax: initial map
173 // ebx: JSObject 177 // ebx: JSObject
174 // edi: start of next object (will be start of FixedArray) 178 // edi: start of next object (will be start of FixedArray)
175 // edx: number of elements in properties array 179 // edx: number of elements in properties array
176 ASSERT(Heap::MaxHeapObjectSize() > 180 ASSERT(Heap::MaxHeapObjectSize() >
177 (FixedArray::kHeaderSize + 255*kPointerSize)); 181 (FixedArray::kHeaderSize + 255*kPointerSize));
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 // Register state for stub CallFunction (from CallFunctionStub in ic-ia32.cc). 891 // Register state for stub CallFunction (from CallFunctionStub in ic-ia32.cc).
888 // ----------- S t a t e ------------- 892 // ----------- S t a t e -------------
889 // No registers used on entry. 893 // No registers used on entry.
890 // ----------------------------------- 894 // -----------------------------------
891 Generate_DebugBreakCallHelper(masm, 0, false); 895 Generate_DebugBreakCallHelper(masm, 0, false);
892 } 896 }
893 897
894 #undef __ 898 #undef __
895 899
896 } } // namespace v8::internal 900 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698