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 5973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5984 __ push(Immediate(instr->hydrogen()->shared_info())); | 5984 __ push(Immediate(instr->hydrogen()->shared_info())); |
5985 __ push(Immediate(pretenure ? factory()->true_value() | 5985 __ push(Immediate(pretenure ? factory()->true_value() |
5986 : factory()->false_value())); | 5986 : factory()->false_value())); |
5987 CallRuntime(Runtime::kNewClosure, 3, instr); | 5987 CallRuntime(Runtime::kNewClosure, 3, instr); |
5988 } | 5988 } |
5989 } | 5989 } |
5990 | 5990 |
5991 | 5991 |
5992 void LCodeGen::DoTypeof(LTypeof* instr) { | 5992 void LCodeGen::DoTypeof(LTypeof* instr) { |
5993 DCHECK(ToRegister(instr->context()).is(esi)); | 5993 DCHECK(ToRegister(instr->context()).is(esi)); |
5994 LOperand* input = instr->value(); | 5994 DCHECK(ToRegister(instr->value()).is(ebx)); |
5995 EmitPushTaggedOperand(input); | 5995 Label end, do_call; |
5996 CallRuntime(Runtime::kTypeof, 1, instr); | 5996 Register value_register = ToRegister(instr->value()); |
| 5997 __ JumpIfNotSmi(value_register, &do_call); |
| 5998 __ mov(eax, Immediate(isolate()->factory()->number_string())); |
| 5999 __ jmp(&end); |
| 6000 __ bind(&do_call); |
| 6001 TypeofStub stub(isolate()); |
| 6002 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 6003 __ bind(&end); |
5997 } | 6004 } |
5998 | 6005 |
5999 | 6006 |
6000 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { | 6007 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { |
6001 Register input = ToRegister(instr->value()); | 6008 Register input = ToRegister(instr->value()); |
6002 Condition final_branch_condition = EmitTypeofIs(instr, input); | 6009 Condition final_branch_condition = EmitTypeofIs(instr, input); |
6003 if (final_branch_condition != no_condition) { | 6010 if (final_branch_condition != no_condition) { |
6004 EmitBranch(instr, final_branch_condition); | 6011 EmitBranch(instr, final_branch_condition); |
6005 } | 6012 } |
6006 } | 6013 } |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6375 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6382 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6376 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6383 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6377 } | 6384 } |
6378 | 6385 |
6379 | 6386 |
6380 #undef __ | 6387 #undef __ |
6381 | 6388 |
6382 } } // namespace v8::internal | 6389 } } // namespace v8::internal |
6383 | 6390 |
6384 #endif // V8_TARGET_ARCH_X87 | 6391 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |