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

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: Added ARM port. 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
« 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 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 __ lea(ecx, Operand(ebx, JSObject::kHeaderSize));
208 // To allow for truncation. 208 __ mov(edx, factory->undefined_value());
209 if (count_constructions) { 209 if (count_constructions) {
210 __ mov(edx, factory->one_pointer_filler_map()); 210 __ movzx_b(esi,
211 } else { 211 FieldOperand(eax, Map::kPreAllocatedPropertyFieldsOffset));
212 __ mov(edx, factory->undefined_value()); 212 __ lea(esi,
213 Operand(ebx, esi, times_pointer_size, JSObject::kHeaderSize));
214 // esi: offset of first field after pre-allocated fields
215 if (FLAG_debug_code) {
216 __ cmp(esi, Operand(edi));
217 __ Assert(less_equal,
218 "Unexpected number of pre-allocated property fields.");
213 } 219 }
214 __ lea(ecx, Operand(ebx, JSObject::kHeaderSize)); 220 __ InitializeFieldsWithFiller(ecx, esi, edx);
215 __ jmp(&entry); 221 __ mov(edx, factory->one_pointer_filler_map());
216 __ bind(&loop);
217 __ mov(Operand(ecx, 0), edx);
218 __ add(Operand(ecx), Immediate(kPointerSize));
219 __ bind(&entry);
220 __ cmp(ecx, Operand(edi));
221 __ j(less, &loop);
222 } 222 }
223 __ InitializeFieldsWithFiller(ecx, edi, edx);
223 224
224 // Add the object tag to make the JSObject real, so that we can continue 225 // 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 226 // 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 227 // failures need to undo the allocation, so that the heap is in a
227 // consistent state and verifiable. 228 // consistent state and verifiable.
228 // eax: initial map 229 // eax: initial map
229 // ebx: JSObject 230 // ebx: JSObject
230 // edi: start of next object 231 // edi: start of next object
231 __ or_(Operand(ebx), Immediate(kHeapObjectTag)); 232 __ or_(Operand(ebx), Immediate(kHeapObjectTag));
232 233
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1679 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1679 generator.Generate(); 1680 generator.Generate();
1680 } 1681 }
1681 1682
1682 1683
1683 #undef __ 1684 #undef __
1684 } 1685 }
1685 } // namespace v8::internal 1686 } // namespace v8::internal
1686 1687
1687 #endif // V8_TARGET_ARCH_IA32 1688 #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