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

Side by Side Diff: src/x64/builtins-x64.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/objects-inl.h ('k') | src/x64/macro-assembler-x64.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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // rbx: JSObject (not HeapObject tagged - the actual address). 200 // rbx: JSObject (not HeapObject tagged - the actual address).
201 // rdi: start of next object 201 // rdi: start of next object
202 __ movq(Operand(rbx, JSObject::kMapOffset), rax); 202 __ movq(Operand(rbx, JSObject::kMapOffset), rax);
203 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex); 203 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex);
204 __ movq(Operand(rbx, JSObject::kPropertiesOffset), rcx); 204 __ movq(Operand(rbx, JSObject::kPropertiesOffset), rcx);
205 __ movq(Operand(rbx, JSObject::kElementsOffset), rcx); 205 __ movq(Operand(rbx, JSObject::kElementsOffset), rcx);
206 // Set extra fields in the newly allocated object. 206 // Set extra fields in the newly allocated object.
207 // rax: initial map 207 // rax: initial map
208 // rbx: JSObject 208 // rbx: JSObject
209 // rdi: start of next object 209 // rdi: start of next object
210 { Label loop, entry; 210 __ lea(rcx, Operand(rbx, JSObject::kHeaderSize));
211 // To allow for truncation. 211 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex);
212 if (count_constructions) { 212 if (count_constructions) {
213 __ LoadRoot(rdx, Heap::kOnePointerFillerMapRootIndex); 213 __ movzxbq(rsi,
214 } else { 214 FieldOperand(rax, Map::kPreAllocatedPropertyFieldsOffset));
215 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); 215 __ lea(rsi,
216 Operand(rbx, rsi, times_pointer_size, JSObject::kHeaderSize));
217 // rsi: offset of first field after pre-allocated fields
218 if (FLAG_debug_code) {
219 __ cmpq(rsi, rdi);
220 __ Assert(less_equal,
221 "Unexpected number of pre-allocated property fields.");
216 } 222 }
217 __ lea(rcx, Operand(rbx, JSObject::kHeaderSize)); 223 __ InitializeFieldsWithFiller(rcx, rsi, rdx);
218 __ jmp(&entry); 224 __ LoadRoot(rdx, Heap::kOnePointerFillerMapRootIndex);
219 __ bind(&loop);
220 __ movq(Operand(rcx, 0), rdx);
221 __ addq(rcx, Immediate(kPointerSize));
222 __ bind(&entry);
223 __ cmpq(rcx, rdi);
224 __ j(less, &loop);
225 } 225 }
226 __ InitializeFieldsWithFiller(rcx, rdi, rdx);
226 227
227 // Add the object tag to make the JSObject real, so that we can continue 228 // Add the object tag to make the JSObject real, so that we can continue
228 // and jump into the continuation code at any time from now on. Any 229 // and jump into the continuation code at any time from now on. Any
229 // failures need to undo the allocation, so that the heap is in a 230 // failures need to undo the allocation, so that the heap is in a
230 // consistent state and verifiable. 231 // consistent state and verifiable.
231 // rax: initial map 232 // rax: initial map
232 // rbx: JSObject 233 // rbx: JSObject
233 // rdi: start of next object 234 // rdi: start of next object
234 __ or_(rbx, Immediate(kHeapObjectTag)); 235 __ or_(rbx, Immediate(kHeapObjectTag));
235 236
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1586 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1586 generator.Generate(); 1587 generator.Generate();
1587 } 1588 }
1588 1589
1589 1590
1590 #undef __ 1591 #undef __
1591 1592
1592 } } // namespace v8::internal 1593 } } // namespace v8::internal
1593 1594
1594 #endif // V8_TARGET_ARCH_X64 1595 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698