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

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

Issue 7929001: Initialize pre-allocated fields of JSObject with undefined. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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
« src/heap.cc ('K') | « src/heap.cc ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // edi: start of next object 197 // edi: start of next object
198 __ mov(Operand(ebx, JSObject::kMapOffset), eax); 198 __ mov(Operand(ebx, JSObject::kMapOffset), eax);
199 Factory* factory = masm->isolate()->factory(); 199 Factory* factory = masm->isolate()->factory();
200 __ mov(ecx, factory->empty_fixed_array()); 200 __ mov(ecx, factory->empty_fixed_array());
201 __ mov(Operand(ebx, JSObject::kPropertiesOffset), ecx); 201 __ mov(Operand(ebx, JSObject::kPropertiesOffset), ecx);
202 __ mov(Operand(ebx, JSObject::kElementsOffset), ecx); 202 __ mov(Operand(ebx, JSObject::kElementsOffset), ecx);
203 // Set extra fields in the newly allocated object. 203 // Set extra fields in the newly allocated object.
204 // eax: initial map 204 // eax: initial map
205 // ebx: JSObject 205 // ebx: JSObject
206 // edi: start of next object 206 // edi: start of next object
207 { Label loop, entry; 207 { Label loop, entry, load_one_pointer_filler, continue_loop;
208 // To allow for truncation. 208 // To allow for truncation.
209 __ lea(ecx, Operand(ebx, JSObject::kHeaderSize));
210 __ mov(edx, factory->undefined_value());
209 if (count_constructions) { 211 if (count_constructions) {
212 __ movzx_b(esi,
213 FieldOperand(eax, Map::kPreAllocatedPropertyFieldsOffset));
214 __ inc(esi);
215 __ jmp(&entry);
216 __ bind(&load_one_pointer_filler);
210 __ mov(edx, factory->one_pointer_filler_map()); 217 __ mov(edx, factory->one_pointer_filler_map());
211 } else { 218 __ jmp(&continue_loop);
212 __ mov(edx, factory->undefined_value());
213 } 219 }
214 __ lea(ecx, Operand(ebx, JSObject::kHeaderSize));
215 __ jmp(&entry); 220 __ jmp(&entry);
216 __ bind(&loop); 221 __ bind(&loop);
217 __ mov(Operand(ecx, 0), edx); 222 __ mov(Operand(ecx, 0), edx);
218 __ add(Operand(ecx), Immediate(kPointerSize)); 223 __ add(Operand(ecx), Immediate(kPointerSize));
219 __ bind(&entry); 224 __ bind(&entry);
225 if (count_constructions) {
226 __ dec(esi);
227 __ j(zero, &load_one_pointer_filler);
228 __ bind(&continue_loop);
229 }
Vyacheslav Egorov (Chromium) 2011/09/16 15:33:05 The control flow here looks too complicated. Cons
220 __ cmp(ecx, Operand(edi)); 230 __ cmp(ecx, Operand(edi));
221 __ j(less, &loop); 231 __ j(less, &loop);
222 } 232 }
223 233
224 // Add the object tag to make the JSObject real, so that we can continue 234 // Add the object tag to make the JSObject real, so that we can continue
225 // and jump into the continuation code at any time from now on. Any 235 // and jump into the continuation code at any time from now on. Any
226 // failures need to undo the allocation, so that the heap is in a 236 // failures need to undo the allocation, so that the heap is in a
227 // consistent state and verifiable. 237 // consistent state and verifiable.
228 // eax: initial map 238 // eax: initial map
229 // ebx: JSObject 239 // ebx: JSObject
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1688 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1679 generator.Generate(); 1689 generator.Generate();
1680 } 1690 }
1681 1691
1682 1692
1683 #undef __ 1693 #undef __
1684 } 1694 }
1685 } // namespace v8::internal 1695 } // namespace v8::internal
1686 1696
1687 #endif // V8_TARGET_ARCH_IA32 1697 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« src/heap.cc ('K') | « src/heap.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698