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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 5356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5367 __ push(Immediate(instr->hydrogen()->shared_info())); | 5367 __ push(Immediate(instr->hydrogen()->shared_info())); |
5368 __ push(Immediate(pretenure ? factory()->true_value() | 5368 __ push(Immediate(pretenure ? factory()->true_value() |
5369 : factory()->false_value())); | 5369 : factory()->false_value())); |
5370 CallRuntime(Runtime::kNewClosure, 3, instr); | 5370 CallRuntime(Runtime::kNewClosure, 3, instr); |
5371 } | 5371 } |
5372 } | 5372 } |
5373 | 5373 |
5374 | 5374 |
5375 void LCodeGen::DoTypeof(LTypeof* instr) { | 5375 void LCodeGen::DoTypeof(LTypeof* instr) { |
5376 DCHECK(ToRegister(instr->context()).is(esi)); | 5376 DCHECK(ToRegister(instr->context()).is(esi)); |
5377 LOperand* input = instr->value(); | 5377 DCHECK(ToRegister(instr->value()).is(ebx)); |
5378 EmitPushTaggedOperand(input); | 5378 Label end, do_call; |
5379 CallRuntime(Runtime::kTypeof, 1, instr); | 5379 Register value_register = ToRegister(instr->value()); |
| 5380 __ JumpIfNotSmi(value_register, &do_call); |
| 5381 __ mov(eax, Immediate(isolate()->factory()->number_string())); |
| 5382 __ jmp(&end); |
| 5383 __ bind(&do_call); |
| 5384 TypeofStub stub(isolate()); |
| 5385 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 5386 __ bind(&end); |
5380 } | 5387 } |
5381 | 5388 |
5382 | 5389 |
5383 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { | 5390 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { |
5384 Register input = ToRegister(instr->value()); | 5391 Register input = ToRegister(instr->value()); |
5385 Condition final_branch_condition = EmitTypeofIs(instr, input); | 5392 Condition final_branch_condition = EmitTypeofIs(instr, input); |
5386 if (final_branch_condition != no_condition) { | 5393 if (final_branch_condition != no_condition) { |
5387 EmitBranch(instr, final_branch_condition); | 5394 EmitBranch(instr, final_branch_condition); |
5388 } | 5395 } |
5389 } | 5396 } |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5755 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5762 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5756 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5763 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5757 } | 5764 } |
5758 | 5765 |
5759 | 5766 |
5760 #undef __ | 5767 #undef __ |
5761 | 5768 |
5762 } } // namespace v8::internal | 5769 } } // namespace v8::internal |
5763 | 5770 |
5764 #endif // V8_TARGET_ARCH_IA32 | 5771 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |