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 #include "src/arm64/lithium-codegen-arm64.h" | 7 #include "src/arm64/lithium-codegen-arm64.h" |
8 #include "src/arm64/lithium-gap-resolver-arm64.h" | 8 #include "src/arm64/lithium-gap-resolver-arm64.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 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2030 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 2031 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
2031 } else { | 2032 } else { |
2032 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 2033 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
2033 ParameterCount count(arity); | 2034 ParameterCount count(arity); |
2034 ParameterCount expected(formal_parameter_count); | 2035 ParameterCount expected(formal_parameter_count); |
2035 __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator); | 2036 __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator); |
2036 } | 2037 } |
2037 } | 2038 } |
2038 | 2039 |
2039 | 2040 |
| 2041 void LCodeGen::DoTailCallThroughMegamorphicCache( |
| 2042 LTailCallThroughMegamorphicCache* instr) { |
| 2043 Register receiver = ToRegister(instr->receiver()); |
| 2044 Register name = ToRegister(instr->name()); |
| 2045 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister())); |
| 2046 DCHECK(name.is(LoadDescriptor::NameRegister())); |
| 2047 DCHECK(receiver.is(x1)); |
| 2048 DCHECK(name.is(x2)); |
| 2049 |
| 2050 Register scratch = x3; |
| 2051 Register extra = x4; |
| 2052 Register extra2 = x5; |
| 2053 Register extra3 = x6; |
| 2054 |
| 2055 // Important for the tail-call. |
| 2056 bool must_teardown_frame = NeedsEagerFrame(); |
| 2057 |
| 2058 // The probe will tail call to a handler if found. |
| 2059 isolate()->stub_cache()->GenerateProbe(masm(), instr->hydrogen()->flags(), |
| 2060 must_teardown_frame, receiver, name, |
| 2061 scratch, extra, extra2, extra3); |
| 2062 |
| 2063 // Tail call to miss if we ended up here. |
| 2064 if (must_teardown_frame) __ LeaveFrame(StackFrame::INTERNAL); |
| 2065 LoadIC::GenerateMiss(masm()); |
| 2066 } |
| 2067 |
| 2068 |
2040 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { | 2069 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { |
2041 DCHECK(instr->IsMarkedAsCall()); | 2070 DCHECK(instr->IsMarkedAsCall()); |
2042 DCHECK(ToRegister(instr->result()).Is(x0)); | 2071 DCHECK(ToRegister(instr->result()).Is(x0)); |
2043 | 2072 |
2044 LPointerMap* pointers = instr->pointer_map(); | 2073 LPointerMap* pointers = instr->pointer_map(); |
2045 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 2074 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
2046 | 2075 |
2047 if (instr->target()->IsConstantOperand()) { | 2076 if (instr->target()->IsConstantOperand()) { |
2048 LConstantOperand* target = LConstantOperand::cast(instr->target()); | 2077 LConstantOperand* target = LConstantOperand::cast(instr->target()); |
2049 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); | 2078 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); |
(...skipping 3972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6022 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6051 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6023 __ Push(scope_info); | 6052 __ Push(scope_info); |
6024 __ Push(ToRegister(instr->function())); | 6053 __ Push(ToRegister(instr->function())); |
6025 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6054 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6026 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6055 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6027 } | 6056 } |
6028 | 6057 |
6029 | 6058 |
6030 | 6059 |
6031 } } // namespace v8::internal | 6060 } } // namespace v8::internal |
OLD | NEW |