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 5531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5542 __ Push(instr->hydrogen()->shared_info()); | 5542 __ Push(instr->hydrogen()->shared_info()); |
5543 __ PushRoot(pretenure ? Heap::kTrueValueRootIndex : | 5543 __ PushRoot(pretenure ? Heap::kTrueValueRootIndex : |
5544 Heap::kFalseValueRootIndex); | 5544 Heap::kFalseValueRootIndex); |
5545 CallRuntime(Runtime::kNewClosure, 3, instr); | 5545 CallRuntime(Runtime::kNewClosure, 3, instr); |
5546 } | 5546 } |
5547 } | 5547 } |
5548 | 5548 |
5549 | 5549 |
5550 void LCodeGen::DoTypeof(LTypeof* instr) { | 5550 void LCodeGen::DoTypeof(LTypeof* instr) { |
5551 DCHECK(ToRegister(instr->context()).is(rsi)); | 5551 DCHECK(ToRegister(instr->context()).is(rsi)); |
5552 LOperand* input = instr->value(); | 5552 DCHECK(ToRegister(instr->value()).is(rbx)); |
5553 EmitPushTaggedOperand(input); | 5553 Label end, do_call; |
5554 CallRuntime(Runtime::kTypeof, 1, instr); | 5554 Register value_register = ToRegister(instr->value()); |
| 5555 __ JumpIfNotSmi(value_register, &do_call); |
| 5556 __ Move(rax, isolate()->factory()->number_string()); |
| 5557 __ jmp(&end); |
| 5558 __ bind(&do_call); |
| 5559 TypeofStub stub(isolate()); |
| 5560 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 5561 __ bind(&end); |
5555 } | 5562 } |
5556 | 5563 |
5557 | 5564 |
5558 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { | 5565 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { |
5559 DCHECK(!operand->IsDoubleRegister()); | 5566 DCHECK(!operand->IsDoubleRegister()); |
5560 if (operand->IsConstantOperand()) { | 5567 if (operand->IsConstantOperand()) { |
5561 __ Push(ToHandle(LConstantOperand::cast(operand))); | 5568 __ Push(ToHandle(LConstantOperand::cast(operand))); |
5562 } else if (operand->IsRegister()) { | 5569 } else if (operand->IsRegister()) { |
5563 __ Push(ToRegister(operand)); | 5570 __ Push(ToRegister(operand)); |
5564 } else { | 5571 } else { |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5945 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5952 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5946 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5953 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5947 } | 5954 } |
5948 | 5955 |
5949 | 5956 |
5950 #undef __ | 5957 #undef __ |
5951 | 5958 |
5952 } } // namespace v8::internal | 5959 } } // namespace v8::internal |
5953 | 5960 |
5954 #endif // V8_TARGET_ARCH_X64 | 5961 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |