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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 12314155: Allow direct allocation in old pointer space. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); 98 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION);
99 } 99 }
100 100
101 101
102 void FastNewClosureStub::Generate(MacroAssembler* masm) { 102 void FastNewClosureStub::Generate(MacroAssembler* masm) {
103 // Create a new closure from the given function info in new 103 // Create a new closure from the given function info in new
104 // space. Set the context to the current context in esi. 104 // space. Set the context to the current context in esi.
105 Counters* counters = masm->isolate()->counters(); 105 Counters* counters = masm->isolate()->counters();
106 106
107 Label gc; 107 Label gc;
108 __ AllocateInNewSpace(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); 108 __ Allocate(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT,
109 MacroAssembler::NEW_SPACE);
109 110
110 __ IncrementCounter(counters->fast_new_closure_total(), 1); 111 __ IncrementCounter(counters->fast_new_closure_total(), 1);
111 112
112 // Get the function info from the stack. 113 // Get the function info from the stack.
113 __ mov(edx, Operand(esp, 1 * kPointerSize)); 114 __ mov(edx, Operand(esp, 1 * kPointerSize));
114 115
115 int map_index = (language_mode_ == CLASSIC_MODE) 116 int map_index = (language_mode_ == CLASSIC_MODE)
116 ? Context::FUNCTION_MAP_INDEX 117 ? Context::FUNCTION_MAP_INDEX
117 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; 118 : Context::STRICT_MODE_FUNCTION_MAP_INDEX;
118 119
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 __ push(Immediate(factory->false_value())); 227 __ push(Immediate(factory->false_value()));
227 __ push(ecx); // Restore return address. 228 __ push(ecx); // Restore return address.
228 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); 229 __ TailCallRuntime(Runtime::kNewClosure, 3, 1);
229 } 230 }
230 231
231 232
232 void FastNewContextStub::Generate(MacroAssembler* masm) { 233 void FastNewContextStub::Generate(MacroAssembler* masm) {
233 // Try to allocate the context in new space. 234 // Try to allocate the context in new space.
234 Label gc; 235 Label gc;
235 int length = slots_ + Context::MIN_CONTEXT_SLOTS; 236 int length = slots_ + Context::MIN_CONTEXT_SLOTS;
236 __ AllocateInNewSpace((length * kPointerSize) + FixedArray::kHeaderSize, 237 __ Allocate((length * kPointerSize) + FixedArray::kHeaderSize,
237 eax, ebx, ecx, &gc, TAG_OBJECT); 238 eax, ebx, ecx, &gc, TAG_OBJECT, MacroAssembler::NEW_SPACE);
238 239
239 // Get the function from the stack. 240 // Get the function from the stack.
240 __ mov(ecx, Operand(esp, 1 * kPointerSize)); 241 __ mov(ecx, Operand(esp, 1 * kPointerSize));
241 242
242 // Set up the object header. 243 // Set up the object header.
243 Factory* factory = masm->isolate()->factory(); 244 Factory* factory = masm->isolate()->factory();
244 __ mov(FieldOperand(eax, HeapObject::kMapOffset), 245 __ mov(FieldOperand(eax, HeapObject::kMapOffset),
245 factory->function_context_map()); 246 factory->function_context_map());
246 __ mov(FieldOperand(eax, Context::kLengthOffset), 247 __ mov(FieldOperand(eax, Context::kLengthOffset),
247 Immediate(Smi::FromInt(length))); 248 Immediate(Smi::FromInt(length)));
(...skipping 26 matching lines...) Expand all
274 275
275 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { 276 void FastNewBlockContextStub::Generate(MacroAssembler* masm) {
276 // Stack layout on entry: 277 // Stack layout on entry:
277 // 278 //
278 // [esp + (1 * kPointerSize)]: function 279 // [esp + (1 * kPointerSize)]: function
279 // [esp + (2 * kPointerSize)]: serialized scope info 280 // [esp + (2 * kPointerSize)]: serialized scope info
280 281
281 // Try to allocate the context in new space. 282 // Try to allocate the context in new space.
282 Label gc; 283 Label gc;
283 int length = slots_ + Context::MIN_CONTEXT_SLOTS; 284 int length = slots_ + Context::MIN_CONTEXT_SLOTS;
284 __ AllocateInNewSpace(FixedArray::SizeFor(length), 285 __ Allocate(FixedArray::SizeFor(length),
285 eax, ebx, ecx, &gc, TAG_OBJECT); 286 eax, ebx, ecx, &gc, TAG_OBJECT, MacroAssembler::NEW_SPACE);
286 287
287 // Get the function or sentinel from the stack. 288 // Get the function or sentinel from the stack.
288 __ mov(ecx, Operand(esp, 1 * kPointerSize)); 289 __ mov(ecx, Operand(esp, 1 * kPointerSize));
289 290
290 // Get the serialized scope info from the stack. 291 // Get the serialized scope info from the stack.
291 __ mov(ebx, Operand(esp, 2 * kPointerSize)); 292 __ mov(ebx, Operand(esp, 2 * kPointerSize));
292 293
293 // Set up the object header. 294 // Set up the object header.
294 Factory* factory = masm->isolate()->factory(); 295 Factory* factory = masm->isolate()->factory();
295 __ mov(FieldOperand(eax, HeapObject::kMapOffset), 296 __ mov(FieldOperand(eax, HeapObject::kMapOffset),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 size += AllocationSiteInfo::kSize; 368 size += AllocationSiteInfo::kSize;
368 } 369 }
369 size += elements_size; 370 size += elements_size;
370 371
371 // Allocate both the JS array and the elements array in one big 372 // Allocate both the JS array and the elements array in one big
372 // allocation. This avoids multiple limit checks. 373 // allocation. This avoids multiple limit checks.
373 AllocationFlags flags = TAG_OBJECT; 374 AllocationFlags flags = TAG_OBJECT;
374 if (mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS) { 375 if (mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS) {
375 flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT | flags); 376 flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT | flags);
376 } 377 }
377 __ AllocateInNewSpace(size, eax, ebx, edx, fail, flags); 378 __ Allocate(size, eax, ebx, edx, fail, flags, MacroAssembler::NEW_SPACE);
378 379
379 if (allocation_site_mode == TRACK_ALLOCATION_SITE) { 380 if (allocation_site_mode == TRACK_ALLOCATION_SITE) {
380 __ mov(FieldOperand(eax, allocation_info_start), 381 __ mov(FieldOperand(eax, allocation_info_start),
381 Immediate(Handle<Map>(masm->isolate()->heap()-> 382 Immediate(Handle<Map>(masm->isolate()->heap()->
382 allocation_site_info_map()))); 383 allocation_site_info_map())));
383 __ mov(FieldOperand(eax, allocation_info_start + kPointerSize), ecx); 384 __ mov(FieldOperand(eax, allocation_info_start + kPointerSize), ecx);
384 } 385 }
385 386
386 // Copy the JS array part. 387 // Copy the JS array part.
387 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { 388 for (int i = 0; i < JSArray::kSize; i += kPointerSize) {
(...skipping 7293 matching lines...) Expand 10 before | Expand all | Expand 10 after
7681 // Restore ecx. 7682 // Restore ecx.
7682 __ pop(ecx); 7683 __ pop(ecx);
7683 __ ret(0); 7684 __ ret(0);
7684 } 7685 }
7685 7686
7686 #undef __ 7687 #undef __
7687 7688
7688 } } // namespace v8::internal 7689 } } // namespace v8::internal
7689 7690
7690 #endif // V8_TARGET_ARCH_IA32 7691 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698