Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: src/compiler/s390/code-generator-s390.cc

Issue 2713433003: PPC/s390: [wasm] Use builtins wrappers for traps (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/ppc/code-generator-ppc.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/compilation-info.h" 7 #include "src/compilation-info.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 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2400 public: 2400 public:
2401 OutOfLineTrap(CodeGenerator* gen, bool frame_elided, Instruction* instr) 2401 OutOfLineTrap(CodeGenerator* gen, bool frame_elided, Instruction* instr)
2402 : OutOfLineCode(gen), 2402 : OutOfLineCode(gen),
2403 frame_elided_(frame_elided), 2403 frame_elided_(frame_elided),
2404 instr_(instr), 2404 instr_(instr),
2405 gen_(gen) {} 2405 gen_(gen) {}
2406 2406
2407 void Generate() final { 2407 void Generate() final {
2408 S390OperandConverter i(gen_, instr_); 2408 S390OperandConverter i(gen_, instr_);
2409 2409
2410 Runtime::FunctionId trap_id = static_cast<Runtime::FunctionId>( 2410 Builtins::Name trap_id =
2411 i.InputInt32(instr_->InputCount() - 1)); 2411 static_cast<Builtins::Name>(i.InputInt32(instr_->InputCount() - 1));
2412 bool old_has_frame = __ has_frame(); 2412 bool old_has_frame = __ has_frame();
2413 if (frame_elided_) { 2413 if (frame_elided_) {
2414 __ set_has_frame(true); 2414 __ set_has_frame(true);
2415 __ EnterFrame(StackFrame::WASM_COMPILED); 2415 __ EnterFrame(StackFrame::WASM_COMPILED);
2416 } 2416 }
2417 GenerateCallToTrap(trap_id); 2417 GenerateCallToTrap(trap_id);
2418 if (frame_elided_) { 2418 if (frame_elided_) {
2419 __ set_has_frame(old_has_frame); 2419 __ set_has_frame(old_has_frame);
2420 } 2420 }
2421 } 2421 }
2422 2422
2423 private: 2423 private:
2424 void GenerateCallToTrap(Runtime::FunctionId trap_id) { 2424 void GenerateCallToTrap(Builtins::Name trap_id) {
2425 if (trap_id == Runtime::kNumFunctions) { 2425 if (trap_id == Builtins::builtin_count) {
2426 // We cannot test calls to the runtime in cctest/test-run-wasm. 2426 // We cannot test calls to the runtime in cctest/test-run-wasm.
2427 // Therefore we emit a call to C here instead of a call to the runtime. 2427 // Therefore we emit a call to C here instead of a call to the runtime.
2428 // We use the context register as the scratch register, because we do 2428 // We use the context register as the scratch register, because we do
2429 // not have a context here. 2429 // not have a context here.
2430 __ PrepareCallCFunction(0, 0, cp); 2430 __ PrepareCallCFunction(0, 0, cp);
2431 __ CallCFunction( 2431 __ CallCFunction(
2432 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), 2432 ExternalReference::wasm_call_trap_callback_for_testing(isolate()),
2433 0); 2433 0);
2434 __ LeaveFrame(StackFrame::WASM_COMPILED); 2434 __ LeaveFrame(StackFrame::WASM_COMPILED);
2435 __ Ret(); 2435 __ Ret();
2436 } else { 2436 } else {
2437 __ Move(cp, Smi::kZero);
2438 gen_->AssembleSourcePosition(instr_); 2437 gen_->AssembleSourcePosition(instr_);
2439 __ CallRuntime(trap_id); 2438 __ Call(handle(isolate()->builtins()->builtin(trap_id), isolate()),
2439 RelocInfo::CODE_TARGET);
2440 ReferenceMap* reference_map = 2440 ReferenceMap* reference_map =
2441 new (gen_->zone()) ReferenceMap(gen_->zone()); 2441 new (gen_->zone()) ReferenceMap(gen_->zone());
2442 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, 2442 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0,
2443 Safepoint::kNoLazyDeopt); 2443 Safepoint::kNoLazyDeopt);
2444 if (FLAG_debug_code) { 2444 if (FLAG_debug_code) {
2445 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap)); 2445 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap));
2446 } 2446 }
2447 } 2447 }
2448 } 2448 }
2449 2449
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2897 padding_size -= 2; 2897 padding_size -= 2;
2898 } 2898 }
2899 } 2899 }
2900 } 2900 }
2901 2901
2902 #undef __ 2902 #undef __
2903 2903
2904 } // namespace compiler 2904 } // namespace compiler
2905 } // namespace internal 2905 } // namespace internal
2906 } // namespace v8 2906 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ppc/code-generator-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698