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/arm64/assembler-arm64-inl.h" | 7 #include "src/arm64/assembler-arm64-inl.h" |
8 #include "src/arm64/frames-arm64.h" | 8 #include "src/arm64/frames-arm64.h" |
9 #include "src/arm64/macro-assembler-arm64-inl.h" | 9 #include "src/arm64/macro-assembler-arm64-inl.h" |
10 #include "src/compilation-info.h" | 10 #include "src/compilation-info.h" |
(...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1950 // unoptimized | 1950 // unoptimized |
1951 // frame is still on the stack. Optimized code uses OSR values directly | 1951 // frame is still on the stack. Optimized code uses OSR values directly |
1952 // from | 1952 // from |
1953 // the unoptimized frame. Thus, all that needs to be done is to allocate | 1953 // the unoptimized frame. Thus, all that needs to be done is to allocate |
1954 // the | 1954 // the |
1955 // remaining stack slots. | 1955 // remaining stack slots. |
1956 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); | 1956 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); |
1957 osr_pc_offset_ = __ pc_offset(); | 1957 osr_pc_offset_ = __ pc_offset(); |
1958 shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots(); | 1958 shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots(); |
1959 } | 1959 } |
1960 | |
1961 if (info()->IsWasm() && shrink_slots > 128) { | |
1962 // For WebAssembly functions with big frames we have to do the stack | |
1963 // overflow check before we construct the frame. Otherwise we may not | |
1964 // have enough space on the stack to call the runtime for the stack | |
1965 // overflow. | |
1966 Label done; | |
1967 // If the frame is bigger than the stack, we throw the stack overflow | |
1968 // exception unconditionally. Thereby we can avoid the integer overflow | |
1969 // check in the condition code. | |
1970 if (shrink_slots * kPointerSize < FLAG_stack_size * 1024) { | |
1971 UseScratchRegisterScope scope(masm()); | |
1972 Register scratch = scope.AcquireX(); | |
1973 __ Mov( | |
1974 scratch, | |
1975 Operand(ExternalReference::address_of_real_stack_limit(isolate()))); | |
1976 __ Ldr(scratch, MemOperand(scratch)); | |
1977 __ Add(scratch, scratch, Operand(shrink_slots * kPointerSize)); | |
1978 __ Cmp(__ StackPointer(), scratch); | |
1979 __ B(cs, &done); | |
1980 } | |
1981 | |
1982 if (!frame_access_state()->has_frame()) { | |
1983 __ set_has_frame(true); | |
1984 // There is no need to leave the frame, we will not return from the | |
1985 // runtime call. | |
1986 __ EnterFrame(StackFrame::WASM_COMPILED); | |
1987 } | |
1988 // Initialize the jssp because it is required for the runtime call. | |
1989 __ Mov(jssp, csp); | |
Rodolph Perfetta
2017/04/05 15:13:35
You also need to set jssp as the stack pointer for
ahaas
2017/04/10 09:51:21
Done. I set the stack pointer to the jssp now, and
| |
1990 __ Move(cp, Smi::kZero); | |
1991 __ CallRuntime(Runtime::kThrowWasmStackOverflow); | |
1992 // We come from WebAssembly, there are no references for the GC. | |
1993 ReferenceMap* reference_map = new (zone()) ReferenceMap(zone()); | |
1994 RecordSafepoint(reference_map, Safepoint::kSimple, 0, | |
1995 Safepoint::kNoLazyDeopt); | |
1996 if (FLAG_debug_code) { | |
1997 __ Brk(0); | |
1998 } | |
1999 | |
2000 __ bind(&done); | |
2001 } | |
2002 | |
1960 // Build remainder of frame, including accounting for and filling-in | 2003 // Build remainder of frame, including accounting for and filling-in |
1961 // frame-specific header information, e.g. claiming the extra slot that | 2004 // frame-specific header information, e.g. claiming the extra slot that |
1962 // other platforms explicitly push for STUB frames and frames recording | 2005 // other platforms explicitly push for STUB frames and frames recording |
1963 // their argument count. | 2006 // their argument count. |
1964 __ Claim(shrink_slots + (fixed_frame_size & 1)); | 2007 __ Claim(shrink_slots + (fixed_frame_size & 1)); |
1965 if (descriptor->PushArgumentCount()) { | 2008 if (descriptor->PushArgumentCount()) { |
1966 __ Str(kJavaScriptCallArgCountRegister, | 2009 __ Str(kJavaScriptCallArgCountRegister, |
1967 MemOperand(fp, OptimizedBuiltinFrameConstants::kArgCOffset)); | 2010 MemOperand(fp, OptimizedBuiltinFrameConstants::kArgCOffset)); |
1968 } | 2011 } |
1969 bool is_stub_frame = | 2012 bool is_stub_frame = |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2245 padding_size -= kInstructionSize; | 2288 padding_size -= kInstructionSize; |
2246 } | 2289 } |
2247 } | 2290 } |
2248 } | 2291 } |
2249 | 2292 |
2250 #undef __ | 2293 #undef __ |
2251 | 2294 |
2252 } // namespace compiler | 2295 } // namespace compiler |
2253 } // namespace internal | 2296 } // namespace internal |
2254 } // namespace v8 | 2297 } // namespace v8 |
OLD | NEW |