OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 5519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5530 __ Push(instr->hydrogen()->shared_info()); | 5530 __ Push(instr->hydrogen()->shared_info()); |
5531 __ PushRoot(pretenure ? Heap::kTrueValueRootIndex : | 5531 __ PushRoot(pretenure ? Heap::kTrueValueRootIndex : |
5532 Heap::kFalseValueRootIndex); | 5532 Heap::kFalseValueRootIndex); |
5533 CallRuntime(Runtime::kNewClosure, 3, instr); | 5533 CallRuntime(Runtime::kNewClosure, 3, instr); |
5534 } | 5534 } |
5535 } | 5535 } |
5536 | 5536 |
5537 | 5537 |
5538 void LCodeGen::DoTypeof(LTypeof* instr) { | 5538 void LCodeGen::DoTypeof(LTypeof* instr) { |
5539 DCHECK(ToRegister(instr->context()).is(rsi)); | 5539 DCHECK(ToRegister(instr->context()).is(rsi)); |
5540 LOperand* input = instr->value(); | 5540 DCHECK(ToRegister(instr->value()).is(rbx)); |
5541 EmitPushTaggedOperand(input); | 5541 Label end, do_call; |
5542 CallRuntime(Runtime::kTypeof, 1, instr); | 5542 Register value_register = ToRegister(instr->value()); |
| 5543 __ JumpIfNotSmi(value_register, &do_call); |
| 5544 __ Move(rax, isolate()->factory()->number_string()); |
| 5545 __ jmp(&end); |
| 5546 __ bind(&do_call); |
| 5547 TypeofStub stub(isolate()); |
| 5548 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 5549 __ bind(&end); |
5543 } | 5550 } |
5544 | 5551 |
5545 | 5552 |
5546 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { | 5553 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { |
5547 DCHECK(!operand->IsDoubleRegister()); | 5554 DCHECK(!operand->IsDoubleRegister()); |
5548 if (operand->IsConstantOperand()) { | 5555 if (operand->IsConstantOperand()) { |
5549 __ Push(ToHandle(LConstantOperand::cast(operand))); | 5556 __ Push(ToHandle(LConstantOperand::cast(operand))); |
5550 } else if (operand->IsRegister()) { | 5557 } else if (operand->IsRegister()) { |
5551 __ Push(ToRegister(operand)); | 5558 __ Push(ToRegister(operand)); |
5552 } else { | 5559 } else { |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5933 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5940 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5934 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5941 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5935 } | 5942 } |
5936 | 5943 |
5937 | 5944 |
5938 #undef __ | 5945 #undef __ |
5939 | 5946 |
5940 } } // namespace v8::internal | 5947 } } // namespace v8::internal |
5941 | 5948 |
5942 #endif // V8_TARGET_ARCH_X64 | 5949 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |