| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); | 138 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); |
| 139 } | 139 } |
| 140 | 140 |
| 141 | 141 |
| 142 void FastNewClosureStub::Generate(MacroAssembler* masm) { | 142 void FastNewClosureStub::Generate(MacroAssembler* masm) { |
| 143 // Create a new closure from the given function info in new | 143 // Create a new closure from the given function info in new |
| 144 // space. Set the context to the current context in esi. | 144 // space. Set the context to the current context in esi. |
| 145 Counters* counters = masm->isolate()->counters(); | 145 Counters* counters = masm->isolate()->counters(); |
| 146 | 146 |
| 147 Label gc; | 147 Label gc; |
| 148 __ AllocateInNewSpace(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); | 148 __ Allocate(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); |
| 149 | 149 |
| 150 __ IncrementCounter(counters->fast_new_closure_total(), 1); | 150 __ IncrementCounter(counters->fast_new_closure_total(), 1); |
| 151 | 151 |
| 152 // Get the function info from the stack. | 152 // Get the function info from the stack. |
| 153 __ mov(edx, Operand(esp, 1 * kPointerSize)); | 153 __ mov(edx, Operand(esp, 1 * kPointerSize)); |
| 154 | 154 |
| 155 int map_index = (language_mode_ == CLASSIC_MODE) | 155 int map_index = (language_mode_ == CLASSIC_MODE) |
| 156 ? Context::FUNCTION_MAP_INDEX | 156 ? Context::FUNCTION_MAP_INDEX |
| 157 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; | 157 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; |
| 158 | 158 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 __ push(Immediate(factory->false_value())); | 266 __ push(Immediate(factory->false_value())); |
| 267 __ push(ecx); // Restore return address. | 267 __ push(ecx); // Restore return address. |
| 268 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); | 268 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); |
| 269 } | 269 } |
| 270 | 270 |
| 271 | 271 |
| 272 void FastNewContextStub::Generate(MacroAssembler* masm) { | 272 void FastNewContextStub::Generate(MacroAssembler* masm) { |
| 273 // Try to allocate the context in new space. | 273 // Try to allocate the context in new space. |
| 274 Label gc; | 274 Label gc; |
| 275 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | 275 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
| 276 __ AllocateInNewSpace((length * kPointerSize) + FixedArray::kHeaderSize, | 276 __ Allocate((length * kPointerSize) + FixedArray::kHeaderSize, |
| 277 eax, ebx, ecx, &gc, TAG_OBJECT); | 277 eax, ebx, ecx, &gc, TAG_OBJECT); |
| 278 | 278 |
| 279 // Get the function from the stack. | 279 // Get the function from the stack. |
| 280 __ mov(ecx, Operand(esp, 1 * kPointerSize)); | 280 __ mov(ecx, Operand(esp, 1 * kPointerSize)); |
| 281 | 281 |
| 282 // Set up the object header. | 282 // Set up the object header. |
| 283 Factory* factory = masm->isolate()->factory(); | 283 Factory* factory = masm->isolate()->factory(); |
| 284 __ mov(FieldOperand(eax, HeapObject::kMapOffset), | 284 __ mov(FieldOperand(eax, HeapObject::kMapOffset), |
| 285 factory->function_context_map()); | 285 factory->function_context_map()); |
| 286 __ mov(FieldOperand(eax, Context::kLengthOffset), | 286 __ mov(FieldOperand(eax, Context::kLengthOffset), |
| 287 Immediate(Smi::FromInt(length))); | 287 Immediate(Smi::FromInt(length))); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 314 | 314 |
| 315 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { | 315 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { |
| 316 // Stack layout on entry: | 316 // Stack layout on entry: |
| 317 // | 317 // |
| 318 // [esp + (1 * kPointerSize)]: function | 318 // [esp + (1 * kPointerSize)]: function |
| 319 // [esp + (2 * kPointerSize)]: serialized scope info | 319 // [esp + (2 * kPointerSize)]: serialized scope info |
| 320 | 320 |
| 321 // Try to allocate the context in new space. | 321 // Try to allocate the context in new space. |
| 322 Label gc; | 322 Label gc; |
| 323 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | 323 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
| 324 __ AllocateInNewSpace(FixedArray::SizeFor(length), | 324 __ Allocate(FixedArray::SizeFor(length), eax, ebx, ecx, &gc, TAG_OBJECT); |
| 325 eax, ebx, ecx, &gc, TAG_OBJECT); | |
| 326 | 325 |
| 327 // Get the function or sentinel from the stack. | 326 // Get the function or sentinel from the stack. |
| 328 __ mov(ecx, Operand(esp, 1 * kPointerSize)); | 327 __ mov(ecx, Operand(esp, 1 * kPointerSize)); |
| 329 | 328 |
| 330 // Get the serialized scope info from the stack. | 329 // Get the serialized scope info from the stack. |
| 331 __ mov(ebx, Operand(esp, 2 * kPointerSize)); | 330 __ mov(ebx, Operand(esp, 2 * kPointerSize)); |
| 332 | 331 |
| 333 // Set up the object header. | 332 // Set up the object header. |
| 334 Factory* factory = masm->isolate()->factory(); | 333 Factory* factory = masm->isolate()->factory(); |
| 335 __ mov(FieldOperand(eax, HeapObject::kMapOffset), | 334 __ mov(FieldOperand(eax, HeapObject::kMapOffset), |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 size += AllocationSiteInfo::kSize; | 406 size += AllocationSiteInfo::kSize; |
| 408 } | 407 } |
| 409 size += elements_size; | 408 size += elements_size; |
| 410 | 409 |
| 411 // Allocate both the JS array and the elements array in one big | 410 // Allocate both the JS array and the elements array in one big |
| 412 // allocation. This avoids multiple limit checks. | 411 // allocation. This avoids multiple limit checks. |
| 413 AllocationFlags flags = TAG_OBJECT; | 412 AllocationFlags flags = TAG_OBJECT; |
| 414 if (mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS) { | 413 if (mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS) { |
| 415 flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT | flags); | 414 flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT | flags); |
| 416 } | 415 } |
| 417 __ AllocateInNewSpace(size, eax, ebx, edx, fail, flags); | 416 __ Allocate(size, eax, ebx, edx, fail, flags); |
| 418 | 417 |
| 419 if (allocation_site_mode == TRACK_ALLOCATION_SITE) { | 418 if (allocation_site_mode == TRACK_ALLOCATION_SITE) { |
| 420 __ mov(FieldOperand(eax, allocation_info_start), | 419 __ mov(FieldOperand(eax, allocation_info_start), |
| 421 Immediate(Handle<Map>(masm->isolate()->heap()-> | 420 Immediate(Handle<Map>(masm->isolate()->heap()-> |
| 422 allocation_site_info_map()))); | 421 allocation_site_info_map()))); |
| 423 __ mov(FieldOperand(eax, allocation_info_start + kPointerSize), ecx); | 422 __ mov(FieldOperand(eax, allocation_info_start + kPointerSize), ecx); |
| 424 } | 423 } |
| 425 | 424 |
| 426 // Copy the JS array part. | 425 // Copy the JS array part. |
| 427 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { | 426 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { |
| (...skipping 7443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7871 // Restore ecx. | 7870 // Restore ecx. |
| 7872 __ pop(ecx); | 7871 __ pop(ecx); |
| 7873 __ ret(0); | 7872 __ ret(0); |
| 7874 } | 7873 } |
| 7875 | 7874 |
| 7876 #undef __ | 7875 #undef __ |
| 7877 | 7876 |
| 7878 } } // namespace v8::internal | 7877 } } // namespace v8::internal |
| 7879 | 7878 |
| 7880 #endif // V8_TARGET_ARCH_IA32 | 7879 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |