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

Side by Side Diff: src/x64/builtins-x64.cc

Issue 2057403003: Hooking up asm-wasm conversion. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 5 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/wasm/wasm-js.cc ('k') | src/x87/builtins-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Restore target function and new target. 85 // Restore target function and new target.
86 __ Pop(rdx); 86 __ Pop(rdx);
87 __ Pop(rdi); 87 __ Pop(rdi);
88 __ Pop(rax); 88 __ Pop(rax);
89 __ SmiToInteger32(rax, rax); 89 __ SmiToInteger32(rax, rax);
90 } 90 }
91 __ leap(rbx, FieldOperand(rbx, Code::kHeaderSize)); 91 __ leap(rbx, FieldOperand(rbx, Code::kHeaderSize));
92 __ jmp(rbx); 92 __ jmp(rbx);
93 } 93 }
94 94
95
96 void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) { 95 void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) {
97 // Checking whether the queued function is ready for install is optional, 96 // Checking whether the queued function is ready for install is optional,
98 // since we come across interrupts and stack checks elsewhere. However, 97 // since we come across interrupts and stack checks elsewhere. However,
99 // not checking may delay installing ready functions, and always checking 98 // not checking may delay installing ready functions, and always checking
100 // would be quite expensive. A good compromise is to first check against 99 // would be quite expensive. A good compromise is to first check against
101 // stack limit as a cue for an interrupt signal. 100 // stack limit as a cue for an interrupt signal.
102 Label ok; 101 Label ok;
103 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); 102 __ CompareRoot(rsp, Heap::kStackLimitRootIndex);
104 __ j(above_equal, &ok); 103 __ j(above_equal, &ok);
105 104
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { 1065 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) {
1067 GenerateTailCallToReturnedCode(masm, 1066 GenerateTailCallToReturnedCode(masm,
1068 Runtime::kCompileOptimized_NotConcurrent); 1067 Runtime::kCompileOptimized_NotConcurrent);
1069 } 1068 }
1070 1069
1071 1070
1072 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { 1071 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) {
1073 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); 1072 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent);
1074 } 1073 }
1075 1074
1075 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) {
1076 // ----------- S t a t e -------------
1077 // -- rax : argument count (preserved for callee)
1078 // -- rdx : new target (preserved for callee)
1079 // -- rdi : target function (preserved for callee)
1080 // -----------------------------------
1081 Label failed;
1082 {
1083 FrameScope scope(masm, StackFrame::INTERNAL);
1084 // Push the number of arguments to the callee.
1085 __ Integer32ToSmi(rax, rax);
1086 __ Push(rax);
1087 // Push a copy of the target function and the new target.
1088 __ Push(rdi);
1089 __ Push(rdx);
1090
1091 // The function.
1092 __ Push(rdi);
1093 // Copy arguments from caller (stdlib, foreign, heap).
1094 for (int i = 2; i >= 0; --i) {
1095 __ Push(Operand(
1096 rbp, StandardFrameConstants::kCallerSPOffset + i * kPointerSize));
1097 }
1098 // Call runtime, on success unwind frame, and parent frame.
1099 __ CallRuntime(Runtime::kInstantiateAsmJs, 4);
1100 // A smi 0 is returned on failure, an object on success.
1101 __ JumpIfSmi(rax, &failed, Label::kNear);
1102 scope.GenerateLeaveFrame();
1103 __ ret(4 * kPointerSize);
1104
1105 __ bind(&failed);
1106 // Restore target function and new target.
1107 __ Pop(rdx);
1108 __ Pop(rdi);
1109 __ Pop(rax);
1110 __ SmiToInteger32(rax, rax);
1111 }
1112 // On failure, tail call back to regular js.
1113 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy);
1114 }
1076 1115
1077 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { 1116 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
1078 // For now, we are relying on the fact that make_code_young doesn't do any 1117 // For now, we are relying on the fact that make_code_young doesn't do any
1079 // garbage collection which allows us to save/restore the registers without 1118 // garbage collection which allows us to save/restore the registers without
1080 // worrying about which of them contain pointers. We also don't build an 1119 // worrying about which of them contain pointers. We also don't build an
1081 // internal frame to make the code faster, since we shouldn't have to do stack 1120 // internal frame to make the code faster, since we shouldn't have to do stack
1082 // crawls in MakeCodeYoung. This seems a bit fragile. 1121 // crawls in MakeCodeYoung. This seems a bit fragile.
1083 1122
1084 // Re-execute the code that was patched back to the young age when 1123 // Re-execute the code that was patched back to the young age when
1085 // the stub returns. 1124 // the stub returns.
(...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after
3042 __ ret(0); 3081 __ ret(0);
3043 } 3082 }
3044 3083
3045 3084
3046 #undef __ 3085 #undef __
3047 3086
3048 } // namespace internal 3087 } // namespace internal
3049 } // namespace v8 3088 } // namespace v8
3050 3089
3051 #endif // V8_TARGET_ARCH_X64 3090 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/wasm/wasm-js.cc ('k') | src/x87/builtins-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698