OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 4361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4372 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); | 4372 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); |
4373 } | 4373 } |
4374 | 4374 |
4375 | 4375 |
4376 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 4376 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
4377 DCHECK(ToRegister(instr->context()).is(esi)); | 4377 DCHECK(ToRegister(instr->context()).is(esi)); |
4378 DCHECK(ToRegister(instr->constructor()).is(edi)); | 4378 DCHECK(ToRegister(instr->constructor()).is(edi)); |
4379 DCHECK(ToRegister(instr->result()).is(eax)); | 4379 DCHECK(ToRegister(instr->result()).is(eax)); |
4380 | 4380 |
4381 __ Move(eax, Immediate(instr->arity())); | 4381 __ Move(eax, Immediate(instr->arity())); |
4382 __ mov(ebx, isolate()->factory()->undefined_value()); | 4382 if (instr->arity() == 1) { |
| 4383 // We only need the allocation site for the case we have a length argument. |
| 4384 // The case may bail out to the runtime, which will determine the correct |
| 4385 // elements kind with the site. |
| 4386 __ mov(ebx, instr->hydrogen()->site()); |
| 4387 } else { |
| 4388 __ mov(ebx, isolate()->factory()->undefined_value()); |
| 4389 } |
| 4390 |
4383 ElementsKind kind = instr->hydrogen()->elements_kind(); | 4391 ElementsKind kind = instr->hydrogen()->elements_kind(); |
4384 AllocationSiteOverrideMode override_mode = | 4392 AllocationSiteOverrideMode override_mode = |
4385 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) | 4393 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |
4386 ? DISABLE_ALLOCATION_SITES | 4394 ? DISABLE_ALLOCATION_SITES |
4387 : DONT_OVERRIDE; | 4395 : DONT_OVERRIDE; |
4388 | 4396 |
4389 if (instr->arity() == 0) { | 4397 if (instr->arity() == 0) { |
4390 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); | 4398 ArrayNoArgumentConstructorStub stub(isolate(), kind, override_mode); |
4391 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); | 4399 CallCode(stub.GetCode(), RelocInfo::CONSTRUCT_CALL, instr); |
4392 } else if (instr->arity() == 1) { | 4400 } else if (instr->arity() == 1) { |
(...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6344 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6352 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6345 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6353 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6346 } | 6354 } |
6347 | 6355 |
6348 | 6356 |
6349 #undef __ | 6357 #undef __ |
6350 | 6358 |
6351 } } // namespace v8::internal | 6359 } } // namespace v8::internal |
6352 | 6360 |
6353 #endif // V8_TARGET_ARCH_X87 | 6361 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |