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 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
(...skipping 5597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5608 __ li(a2, Operand(instr->hydrogen()->shared_info())); | 5608 __ li(a2, Operand(instr->hydrogen()->shared_info())); |
5609 __ li(a1, Operand(pretenure ? factory()->true_value() | 5609 __ li(a1, Operand(pretenure ? factory()->true_value() |
5610 : factory()->false_value())); | 5610 : factory()->false_value())); |
5611 __ Push(cp, a2, a1); | 5611 __ Push(cp, a2, a1); |
5612 CallRuntime(Runtime::kNewClosure, 3, instr); | 5612 CallRuntime(Runtime::kNewClosure, 3, instr); |
5613 } | 5613 } |
5614 } | 5614 } |
5615 | 5615 |
5616 | 5616 |
5617 void LCodeGen::DoTypeof(LTypeof* instr) { | 5617 void LCodeGen::DoTypeof(LTypeof* instr) { |
| 5618 DCHECK(ToRegister(instr->value()).is(a3)); |
5618 DCHECK(ToRegister(instr->result()).is(v0)); | 5619 DCHECK(ToRegister(instr->result()).is(v0)); |
5619 Register input = ToRegister(instr->value()); | 5620 Label end, do_call; |
5620 __ push(input); | 5621 Register value_register = ToRegister(instr->value()); |
5621 CallRuntime(Runtime::kTypeof, 1, instr); | 5622 __ JumpIfNotSmi(value_register, &do_call); |
| 5623 __ li(v0, Operand(isolate()->factory()->number_string())); |
| 5624 __ jmp(&end); |
| 5625 __ bind(&do_call); |
| 5626 TypeofStub stub(isolate()); |
| 5627 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 5628 __ bind(&end); |
5622 } | 5629 } |
5623 | 5630 |
5624 | 5631 |
5625 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { | 5632 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { |
5626 Register input = ToRegister(instr->value()); | 5633 Register input = ToRegister(instr->value()); |
5627 | 5634 |
5628 Register cmp1 = no_reg; | 5635 Register cmp1 = no_reg; |
5629 Operand cmp2 = Operand(no_reg); | 5636 Operand cmp2 = Operand(no_reg); |
5630 | 5637 |
5631 Condition final_branch_condition = EmitTypeofIs(instr->TrueLabel(chunk_), | 5638 Condition final_branch_condition = EmitTypeofIs(instr->TrueLabel(chunk_), |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6042 __ li(at, scope_info); | 6049 __ li(at, scope_info); |
6043 __ Push(at, ToRegister(instr->function())); | 6050 __ Push(at, ToRegister(instr->function())); |
6044 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6051 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6045 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6052 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6046 } | 6053 } |
6047 | 6054 |
6048 | 6055 |
6049 #undef __ | 6056 #undef __ |
6050 | 6057 |
6051 } } // namespace v8::internal | 6058 } } // namespace v8::internal |
OLD | NEW |