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 4198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4209 } | 4209 } |
4210 | 4210 |
4211 | 4211 |
4212 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 4212 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
4213 ASSERT(ToRegister(instr->context()).is(esi)); | 4213 ASSERT(ToRegister(instr->context()).is(esi)); |
4214 ASSERT(ToRegister(instr->constructor()).is(edi)); | 4214 ASSERT(ToRegister(instr->constructor()).is(edi)); |
4215 ASSERT(ToRegister(instr->result()).is(eax)); | 4215 ASSERT(ToRegister(instr->result()).is(eax)); |
4216 ASSERT(FLAG_optimize_constructed_arrays); | 4216 ASSERT(FLAG_optimize_constructed_arrays); |
4217 | 4217 |
4218 __ Set(eax, Immediate(instr->arity())); | 4218 __ Set(eax, Immediate(instr->arity())); |
4219 __ mov(ebx, instr->hydrogen()->property_cell()); | 4219 __ mov(ebx, instr->hydrogen()->property_cell()); |
Toon Verwaest
2013/06/12 17:26:01
ebx and ecx below should be TempRegisters I presum
mvstanton
2013/06/12 17:58:12
It's okay because the function is MarkAsCall(), so
| |
4220 ElementsKind kind = instr->hydrogen()->elements_kind(); | 4220 ElementsKind kind = instr->hydrogen()->elements_kind(); |
4221 bool disable_allocation_sites = | 4221 bool disable_allocation_sites = |
4222 (AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE); | 4222 (AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE); |
4223 | 4223 |
4224 if (instr->arity() == 0) { | 4224 if (instr->arity() == 0) { |
4225 ArrayNoArgumentConstructorStub stub(kind, disable_allocation_sites); | 4225 ArrayNoArgumentConstructorStub stub(kind, disable_allocation_sites); |
4226 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 4226 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
4227 } else if (instr->arity() == 1) { | 4227 } else if (instr->arity() == 1) { |
4228 Label done; | |
4229 if (IsFastPackedElementsKind(kind)) { | |
4230 Label packed_case; | |
4231 // We might need a change here | |
4232 // look at the first argument | |
4233 __ mov(ecx, Operand(esp, 0)); | |
4234 __ test(ecx, ecx); | |
4235 __ j(zero, &packed_case); | |
4236 | |
4237 ElementsKind holey_kind = GetHoleyElementsKind(kind); | |
4238 ArraySingleArgumentConstructorStub stub(holey_kind, | |
4239 disable_allocation_sites); | |
4240 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | |
4241 __ jmp(&done); | |
4242 __ bind(&packed_case); | |
4243 } | |
4244 | |
4228 ArraySingleArgumentConstructorStub stub(kind, disable_allocation_sites); | 4245 ArraySingleArgumentConstructorStub stub(kind, disable_allocation_sites); |
4229 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 4246 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
4247 __ bind(&done); | |
4230 } else { | 4248 } else { |
4231 ArrayNArgumentsConstructorStub stub(kind, disable_allocation_sites); | 4249 ArrayNArgumentsConstructorStub stub(kind, disable_allocation_sites); |
4232 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 4250 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
4233 } | 4251 } |
4234 } | 4252 } |
4235 | 4253 |
4236 | 4254 |
4237 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 4255 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
4238 CallRuntime(instr->function(), instr->arity(), instr); | 4256 CallRuntime(instr->function(), instr->arity(), instr); |
4239 } | 4257 } |
(...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6486 FixedArray::kHeaderSize - kPointerSize)); | 6504 FixedArray::kHeaderSize - kPointerSize)); |
6487 __ bind(&done); | 6505 __ bind(&done); |
6488 } | 6506 } |
6489 | 6507 |
6490 | 6508 |
6491 #undef __ | 6509 #undef __ |
6492 | 6510 |
6493 } } // namespace v8::internal | 6511 } } // namespace v8::internal |
6494 | 6512 |
6495 #endif // V8_TARGET_ARCH_IA32 | 6513 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |