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-stubs.h" | 10 #include "src/code-stubs.h" |
11 #include "src/codegen.h" | 11 #include "src/codegen.h" |
12 #include "src/deoptimizer.h" | 12 #include "src/deoptimizer.h" |
13 #include "src/hydrogen-osr.h" | 13 #include "src/hydrogen-osr.h" |
| 14 #include "src/ic/stub-cache.h" |
14 #include "src/x87/lithium-codegen-x87.h" | 15 #include "src/x87/lithium-codegen-x87.h" |
15 | 16 |
16 namespace v8 { | 17 namespace v8 { |
17 namespace internal { | 18 namespace internal { |
18 | 19 |
19 | 20 |
20 // When invoking builtins, we need to record the safepoint in the middle of | 21 // When invoking builtins, we need to record the safepoint in the middle of |
21 // the invoke instruction sequence generated by the macro assembler. | 22 // the invoke instruction sequence generated by the macro assembler. |
22 class SafepointGenerator FINAL : public CallWrapper { | 23 class SafepointGenerator FINAL : public CallWrapper { |
23 public: | 24 public: |
(...skipping 3246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3270 instr->base_offset()); | 3271 instr->base_offset()); |
3271 X87Mov(ToX87Register(instr->result()), double_load_operand); | 3272 X87Mov(ToX87Register(instr->result()), double_load_operand); |
3272 } | 3273 } |
3273 | 3274 |
3274 | 3275 |
3275 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { | 3276 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { |
3276 Register result = ToRegister(instr->result()); | 3277 Register result = ToRegister(instr->result()); |
3277 | 3278 |
3278 // Load the result. | 3279 // Load the result. |
3279 __ mov(result, | 3280 __ mov(result, |
3280 BuildFastArrayOperand(instr->elements(), | 3281 BuildFastArrayOperand(instr->elements(), instr->key(), |
3281 instr->key(), | |
3282 instr->hydrogen()->key()->representation(), | 3282 instr->hydrogen()->key()->representation(), |
3283 FAST_ELEMENTS, | 3283 FAST_ELEMENTS, instr->base_offset())); |
3284 instr->base_offset())); | |
3285 | 3284 |
3286 // Check for the hole value. | 3285 // Check for the hole value. |
3287 if (instr->hydrogen()->RequiresHoleCheck()) { | 3286 if (instr->hydrogen()->RequiresHoleCheck()) { |
3288 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { | 3287 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { |
3289 __ test(result, Immediate(kSmiTagMask)); | 3288 __ test(result, Immediate(kSmiTagMask)); |
3290 DeoptimizeIf(not_equal, instr->environment()); | 3289 DeoptimizeIf(not_equal, instr->environment()); |
3291 } else { | 3290 } else { |
3292 __ cmp(result, factory()->the_hole_value()); | 3291 __ cmp(result, factory()->the_hole_value()); |
3293 DeoptimizeIf(equal, instr->environment()); | 3292 DeoptimizeIf(equal, instr->environment()); |
3294 } | 3293 } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3570 LPointerMap* pointers = instr->pointer_map(); | 3569 LPointerMap* pointers = instr->pointer_map(); |
3571 SafepointGenerator generator( | 3570 SafepointGenerator generator( |
3572 this, pointers, Safepoint::kLazyDeopt); | 3571 this, pointers, Safepoint::kLazyDeopt); |
3573 ParameterCount count(arity); | 3572 ParameterCount count(arity); |
3574 ParameterCount expected(formal_parameter_count); | 3573 ParameterCount expected(formal_parameter_count); |
3575 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); | 3574 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); |
3576 } | 3575 } |
3577 } | 3576 } |
3578 | 3577 |
3579 | 3578 |
| 3579 void LCodeGen::DoTailCallThroughMegamorphicCache( |
| 3580 LTailCallThroughMegamorphicCache* instr) { |
| 3581 Register receiver = ToRegister(instr->receiver()); |
| 3582 Register name = ToRegister(instr->name()); |
| 3583 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister())); |
| 3584 DCHECK(name.is(LoadDescriptor::NameRegister())); |
| 3585 |
| 3586 Register scratch = ebx; |
| 3587 Register extra = eax; |
| 3588 DCHECK(!scratch.is(receiver) && !scratch.is(name)); |
| 3589 DCHECK(!extra.is(receiver) && !extra.is(name)); |
| 3590 |
| 3591 // Important for the tail-call. |
| 3592 bool must_teardown_frame = NeedsEagerFrame(); |
| 3593 |
| 3594 // The probe will tail call to a handler if found. |
| 3595 isolate()->stub_cache()->GenerateProbe(masm(), instr->hydrogen()->flags(), |
| 3596 must_teardown_frame, receiver, name, |
| 3597 scratch, extra); |
| 3598 |
| 3599 // Tail call to miss if we ended up here. |
| 3600 if (must_teardown_frame) __ leave(); |
| 3601 LoadIC::GenerateMiss(masm()); |
| 3602 } |
| 3603 |
| 3604 |
3580 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { | 3605 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { |
3581 DCHECK(ToRegister(instr->result()).is(eax)); | 3606 DCHECK(ToRegister(instr->result()).is(eax)); |
3582 | 3607 |
3583 LPointerMap* pointers = instr->pointer_map(); | 3608 LPointerMap* pointers = instr->pointer_map(); |
3584 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3609 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
3585 | 3610 |
3586 if (instr->target()->IsConstantOperand()) { | 3611 if (instr->target()->IsConstantOperand()) { |
3587 LConstantOperand* target = LConstantOperand::cast(instr->target()); | 3612 LConstantOperand* target = LConstantOperand::cast(instr->target()); |
3588 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); | 3613 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); |
3589 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET)); | 3614 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET)); |
(...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5702 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5727 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5703 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5728 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5704 } | 5729 } |
5705 | 5730 |
5706 | 5731 |
5707 #undef __ | 5732 #undef __ |
5708 | 5733 |
5709 } } // namespace v8::internal | 5734 } } // namespace v8::internal |
5710 | 5735 |
5711 #endif // V8_TARGET_ARCH_X87 | 5736 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |