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/arm/lithium-codegen-arm.h" | 7 #include "src/arm/lithium-codegen-arm.h" |
8 #include "src/arm/lithium-gap-resolver-arm.h" | 8 #include "src/arm/lithium-gap-resolver-arm.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
11 #include "src/hydrogen-osr.h" | 11 #include "src/hydrogen-osr.h" |
| 12 #include "src/ic/stub-cache.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 | 16 |
16 | 17 |
17 class SafepointGenerator FINAL : public CallWrapper { | 18 class SafepointGenerator FINAL : public CallWrapper { |
18 public: | 19 public: |
19 SafepointGenerator(LCodeGen* codegen, | 20 SafepointGenerator(LCodeGen* codegen, |
20 LPointerMap* pointers, | 21 LPointerMap* pointers, |
21 Safepoint::DeoptMode mode) | 22 Safepoint::DeoptMode mode) |
(...skipping 3940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3962 } else { | 3963 } else { |
3963 CallKnownFunction(known_function, | 3964 CallKnownFunction(known_function, |
3964 instr->hydrogen()->formal_parameter_count(), | 3965 instr->hydrogen()->formal_parameter_count(), |
3965 instr->arity(), | 3966 instr->arity(), |
3966 instr, | 3967 instr, |
3967 R1_CONTAINS_TARGET); | 3968 R1_CONTAINS_TARGET); |
3968 } | 3969 } |
3969 } | 3970 } |
3970 | 3971 |
3971 | 3972 |
| 3973 void LCodeGen::DoTailCallThroughMegamorphicCache( |
| 3974 LTailCallThroughMegamorphicCache* instr) { |
| 3975 Register receiver = ToRegister(instr->receiver()); |
| 3976 Register name = ToRegister(instr->name()); |
| 3977 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister())); |
| 3978 DCHECK(name.is(LoadDescriptor::NameRegister())); |
| 3979 DCHECK(receiver.is(r1)); |
| 3980 DCHECK(name.is(r2)); |
| 3981 |
| 3982 Register scratch = r3; |
| 3983 Register extra = r4; |
| 3984 Register extra2 = r5; |
| 3985 Register extra3 = r6; |
| 3986 |
| 3987 // Important for the tail-call. |
| 3988 bool must_teardown_frame = NeedsEagerFrame(); |
| 3989 |
| 3990 // The probe will tail call to a handler if found. |
| 3991 isolate()->stub_cache()->GenerateProbe(masm(), instr->hydrogen()->flags(), |
| 3992 must_teardown_frame, receiver, name, |
| 3993 scratch, extra, extra2, extra3); |
| 3994 |
| 3995 // Tail call to miss if we ended up here. |
| 3996 if (must_teardown_frame) __ LeaveFrame(StackFrame::INTERNAL); |
| 3997 LoadIC::GenerateMiss(masm()); |
| 3998 } |
| 3999 |
| 4000 |
3972 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { | 4001 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { |
3973 DCHECK(ToRegister(instr->result()).is(r0)); | 4002 DCHECK(ToRegister(instr->result()).is(r0)); |
3974 | 4003 |
3975 LPointerMap* pointers = instr->pointer_map(); | 4004 LPointerMap* pointers = instr->pointer_map(); |
3976 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 4005 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
3977 | 4006 |
3978 if (instr->target()->IsConstantOperand()) { | 4007 if (instr->target()->IsConstantOperand()) { |
3979 LConstantOperand* target = LConstantOperand::cast(instr->target()); | 4008 LConstantOperand* target = LConstantOperand::cast(instr->target()); |
3980 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); | 4009 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); |
3981 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET)); | 4010 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET)); |
(...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5880 __ Push(scope_info); | 5909 __ Push(scope_info); |
5881 __ push(ToRegister(instr->function())); | 5910 __ push(ToRegister(instr->function())); |
5882 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5911 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5883 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5912 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5884 } | 5913 } |
5885 | 5914 |
5886 | 5915 |
5887 #undef __ | 5916 #undef __ |
5888 | 5917 |
5889 } } // namespace v8::internal | 5918 } } // namespace v8::internal |
OLD | NEW |