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/arm/macro-assembler-arm.h" | 7 #include "src/arm/macro-assembler-arm.h" |
8 #include "src/compilation-info.h" | 8 #include "src/compilation-info.h" |
9 #include "src/compiler/code-generator-impl.h" | 9 #include "src/compiler/code-generator-impl.h" |
10 #include "src/compiler/gap-resolver.h" | 10 #include "src/compiler/gap-resolver.h" |
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 i.InputInt32(instr_->InputCount() - 1)); | 1906 i.InputInt32(instr_->InputCount() - 1)); |
1907 bool old_has_frame = __ has_frame(); | 1907 bool old_has_frame = __ has_frame(); |
1908 if (frame_elided_) { | 1908 if (frame_elided_) { |
1909 __ set_has_frame(true); | 1909 __ set_has_frame(true); |
1910 __ EnterFrame(StackFrame::WASM_COMPILED); | 1910 __ EnterFrame(StackFrame::WASM_COMPILED); |
1911 } | 1911 } |
1912 GenerateCallToTrap(trap_id); | 1912 GenerateCallToTrap(trap_id); |
1913 if (frame_elided_) { | 1913 if (frame_elided_) { |
1914 __ set_has_frame(old_has_frame); | 1914 __ set_has_frame(old_has_frame); |
1915 } | 1915 } |
1916 if (FLAG_debug_code) { | |
1917 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap)); | |
1918 } | |
1919 } | 1916 } |
1920 | 1917 |
1921 private: | 1918 private: |
1922 void GenerateCallToTrap(Runtime::FunctionId trap_id) { | 1919 void GenerateCallToTrap(Runtime::FunctionId trap_id) { |
1923 if (trap_id == Runtime::kNumFunctions) { | 1920 if (trap_id == Runtime::kNumFunctions) { |
1924 // We cannot test calls to the runtime in cctest/test-run-wasm. | 1921 // We cannot test calls to the runtime in cctest/test-run-wasm. |
1925 // Therefore we emit a call to C here instead of a call to the runtime. | 1922 // Therefore we emit a call to C here instead of a call to the runtime. |
1926 // We use the context register as the scratch register, because we do | 1923 // We use the context register as the scratch register, because we do |
1927 // not have a context here. | 1924 // not have a context here. |
1928 __ PrepareCallCFunction(0, 0, cp); | 1925 __ PrepareCallCFunction(0, 0, cp); |
1929 __ CallCFunction( | 1926 __ CallCFunction( |
1930 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), | 1927 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), |
1931 0); | 1928 0); |
| 1929 __ LeaveFrame(StackFrame::WASM_COMPILED); |
| 1930 __ Ret(); |
1932 } else { | 1931 } else { |
1933 __ Move(cp, Smi::kZero); | 1932 __ Move(cp, Smi::kZero); |
1934 gen_->AssembleSourcePosition(instr_); | 1933 gen_->AssembleSourcePosition(instr_); |
1935 __ CallRuntime(trap_id); | 1934 __ CallRuntime(trap_id); |
| 1935 ReferenceMap* reference_map = |
| 1936 new (gen_->zone()) ReferenceMap(gen_->zone()); |
| 1937 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, |
| 1938 Safepoint::kNoLazyDeopt); |
| 1939 if (FLAG_debug_code) { |
| 1940 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap)); |
| 1941 } |
1936 } | 1942 } |
1937 ReferenceMap* reference_map = | |
1938 new (gen_->zone()) ReferenceMap(gen_->zone()); | |
1939 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, | |
1940 Safepoint::kNoLazyDeopt); | |
1941 } | 1943 } |
1942 | 1944 |
1943 bool frame_elided_; | 1945 bool frame_elided_; |
1944 Instruction* instr_; | 1946 Instruction* instr_; |
1945 CodeGenerator* gen_; | 1947 CodeGenerator* gen_; |
1946 }; | 1948 }; |
1947 bool frame_elided = !frame_access_state()->has_frame(); | 1949 bool frame_elided = !frame_access_state()->has_frame(); |
1948 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); | 1950 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); |
1949 Label* tlabel = ool->entry(); | 1951 Label* tlabel = ool->entry(); |
1950 Condition cc = FlagsConditionToCondition(condition); | 1952 Condition cc = FlagsConditionToCondition(condition); |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2461 padding_size -= v8::internal::Assembler::kInstrSize; | 2463 padding_size -= v8::internal::Assembler::kInstrSize; |
2462 } | 2464 } |
2463 } | 2465 } |
2464 } | 2466 } |
2465 | 2467 |
2466 #undef __ | 2468 #undef __ |
2467 | 2469 |
2468 } // namespace compiler | 2470 } // namespace compiler |
2469 } // namespace internal | 2471 } // namespace internal |
2470 } // namespace v8 | 2472 } // namespace v8 |
OLD | NEW |