OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 isolate(), deoptimization_id, bailout_type); | 1641 isolate(), deoptimization_id, bailout_type); |
1642 // TODO(turbofan): We should be able to generate better code by sharing the | 1642 // TODO(turbofan): We should be able to generate better code by sharing the |
1643 // actual final call site and just bl'ing to it here, similar to what we do | 1643 // actual final call site and just bl'ing to it here, similar to what we do |
1644 // in the lithium backend. | 1644 // in the lithium backend. |
1645 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 1645 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
1646 } | 1646 } |
1647 | 1647 |
1648 | 1648 |
1649 void CodeGenerator::AssemblePrologue() { | 1649 void CodeGenerator::AssemblePrologue() { |
1650 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1650 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1651 if (descriptor->IsCFunctionCall()) { | 1651 if (frame()->needs_frame()) { |
1652 __ function_descriptor(); | 1652 if (descriptor->IsCFunctionCall()) { |
1653 __ mflr(r0); | 1653 __ function_descriptor(); |
1654 if (FLAG_enable_embedded_constant_pool) { | 1654 __ mflr(r0); |
1655 __ Push(r0, fp, kConstantPoolRegister); | 1655 if (FLAG_enable_embedded_constant_pool) { |
1656 // Adjust FP to point to saved FP. | 1656 __ Push(r0, fp, kConstantPoolRegister); |
1657 __ subi(fp, sp, Operand(StandardFrameConstants::kConstantPoolOffset)); | 1657 // Adjust FP to point to saved FP. |
| 1658 __ subi(fp, sp, Operand(StandardFrameConstants::kConstantPoolOffset)); |
| 1659 } else { |
| 1660 __ Push(r0, fp); |
| 1661 __ mr(fp, sp); |
| 1662 } |
| 1663 } else if (descriptor->IsJSFunctionCall()) { |
| 1664 __ Prologue(this->info()->GeneratePreagedPrologue(), ip); |
1658 } else { | 1665 } else { |
1659 __ Push(r0, fp); | 1666 StackFrame::Type type = info()->GetOutputStackFrameType(); |
1660 __ mr(fp, sp); | 1667 if (!ABI_CALL_VIA_IP && |
1661 } | 1668 info()->output_code_kind() == Code::WASM_FUNCTION) { |
1662 } else if (descriptor->IsJSFunctionCall()) { | 1669 // TODO(mbrandy): Restrict only to the wasm wrapper case. |
1663 __ Prologue(this->info()->GeneratePreagedPrologue(), ip); | 1670 __ StubPrologue(type); |
1664 } else if (frame()->needs_frame()) { | 1671 } else { |
1665 if (!ABI_CALL_VIA_IP && info()->output_code_kind() == Code::WASM_FUNCTION) { | 1672 __ StubPrologue(type, ip); |
1666 // TODO(mbrandy): Restrict only to the wasm wrapper case. | 1673 } |
1667 __ StubPrologue(); | |
1668 } else { | |
1669 __ StubPrologue(ip); | |
1670 } | 1674 } |
1671 } else { | 1675 } else { |
1672 frame()->SetElidedFrameSizeInSlots(0); | 1676 frame()->SetElidedFrameSizeInSlots(0); |
1673 } | 1677 } |
1674 frame_access_state()->SetFrameAccessToDefault(); | 1678 frame_access_state()->SetFrameAccessToDefault(); |
1675 | 1679 |
1676 int stack_shrink_slots = frame()->GetSpillSlotCount(); | 1680 int stack_shrink_slots = frame()->GetSpillSlotCount(); |
1677 if (info()->is_osr()) { | 1681 if (info()->is_osr()) { |
1678 // TurboFan OSR-compiled functions cannot be entered directly. | 1682 // TurboFan OSR-compiled functions cannot be entered directly. |
1679 __ Abort(kShouldNotDirectlyEnterOsrFunction); | 1683 __ Abort(kShouldNotDirectlyEnterOsrFunction); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 padding_size -= v8::internal::Assembler::kInstrSize; | 1964 padding_size -= v8::internal::Assembler::kInstrSize; |
1961 } | 1965 } |
1962 } | 1966 } |
1963 } | 1967 } |
1964 | 1968 |
1965 #undef __ | 1969 #undef __ |
1966 | 1970 |
1967 } // namespace compiler | 1971 } // namespace compiler |
1968 } // namespace internal | 1972 } // namespace internal |
1969 } // namespace v8 | 1973 } // namespace v8 |
OLD | NEW |