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