| 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 #if V8_TARGET_ARCH_S390 | 5 #if V8_TARGET_ARCH_S390 |
| 6 | 6 |
| 7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.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 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2190 | 2190 |
| 2191 // Dispatch to Call or Construct depending on whether new.target is undefined. | 2191 // Dispatch to Call or Construct depending on whether new.target is undefined. |
| 2192 { | 2192 { |
| 2193 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex); | 2193 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex); |
| 2194 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET, eq); | 2194 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET, eq); |
| 2195 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 2195 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
| 2196 } | 2196 } |
| 2197 } | 2197 } |
| 2198 | 2198 |
| 2199 // static | 2199 // static |
| 2200 void Builtins::Generate_CallForwardVarargs(MacroAssembler* masm, | 2200 void Builtins::Generate_ForwardVarargs(MacroAssembler* masm, |
| 2201 Handle<Code> code) { | 2201 Handle<Code> code) { |
| 2202 // ----------- S t a t e ------------- | 2202 // ----------- S t a t e ------------- |
| 2203 // -- r3 : the target to call (can be any Object) | 2203 // -- r2 : the number of arguments (not including the receiver) |
| 2204 // -- r4 : start index (to support rest parameters) | 2204 // -- r5 : the new.target (for [[Construct]] calls) |
| 2205 // -- lr : return address. | 2205 // -- r3 : the target to call (can be any Object) |
| 2206 // -- sp[0] : thisArgument | 2206 // -- r4 : start index (to support rest parameters) |
| 2207 // ----------------------------------- | 2207 // ----------------------------------- |
| 2208 | 2208 |
| 2209 // Check if we have an arguments adaptor frame below the function frame. | 2209 // Check if we have an arguments adaptor frame below the function frame. |
| 2210 Label arguments_adaptor, arguments_done; | 2210 Label arguments_adaptor, arguments_done; |
| 2211 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 2211 __ LoadP(r6, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 2212 __ LoadP(ip, MemOperand(r5, CommonFrameConstants::kContextOrFrameTypeOffset)); | 2212 __ LoadP(ip, MemOperand(r6, CommonFrameConstants::kContextOrFrameTypeOffset)); |
| 2213 __ CmpP(ip, Operand(StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR))); | 2213 __ CmpP(ip, Operand(StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR))); |
| 2214 __ beq(&arguments_adaptor); | 2214 __ beq(&arguments_adaptor); |
| 2215 { | 2215 { |
| 2216 __ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2216 __ LoadP(r7, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 2217 __ LoadP(r2, FieldMemOperand(r2, JSFunction::kSharedFunctionInfoOffset)); | 2217 __ LoadP(r7, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset)); |
| 2218 __ LoadW(r2, FieldMemOperand( | 2218 __ LoadW(r7, FieldMemOperand( |
| 2219 r2, SharedFunctionInfo::kFormalParameterCountOffset)); | 2219 r7, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 2220 __ LoadRR(r5, fp); | 2220 __ LoadRR(r6, fp); |
| 2221 } | 2221 } |
| 2222 __ b(&arguments_done); | 2222 __ b(&arguments_done); |
| 2223 __ bind(&arguments_adaptor); | 2223 __ bind(&arguments_adaptor); |
| 2224 { | 2224 { |
| 2225 // Load the length from the ArgumentsAdaptorFrame. | 2225 // Load the length from the ArgumentsAdaptorFrame. |
| 2226 __ LoadP(r2, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2226 __ LoadP(r7, MemOperand(r6, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 2227 #if V8_TARGET_ARCH_S390X | 2227 #if V8_TARGET_ARCH_S390X |
| 2228 __ SmiUntag(r2); | 2228 __ SmiUntag(r7); |
| 2229 #endif | 2229 #endif |
| 2230 } | 2230 } |
| 2231 __ bind(&arguments_done); | 2231 __ bind(&arguments_done); |
| 2232 | 2232 |
| 2233 Label stack_empty, stack_done, stack_overflow; | 2233 Label stack_done, stack_overflow; |
| 2234 #if !V8_TARGET_ARCH_S390X | 2234 #if !V8_TARGET_ARCH_S390X |
| 2235 __ SmiUntag(r2); | 2235 __ SmiUntag(r7); |
| 2236 #endif | 2236 #endif |
| 2237 __ SubP(r2, r2, r4); | 2237 __ SubP(r7, r7, r4); |
| 2238 __ CmpP(r2, Operand::Zero()); | 2238 __ CmpP(r7, Operand::Zero()); |
| 2239 __ ble(&stack_empty); | 2239 __ ble(&stack_done); |
| 2240 { | 2240 { |
| 2241 // Check for stack overflow. | 2241 // Check for stack overflow. |
| 2242 Generate_StackOverflowCheck(masm, r2, r4, &stack_overflow); | 2242 Generate_StackOverflowCheck(masm, r7, r4, &stack_overflow); |
| 2243 | 2243 |
| 2244 // Forward the arguments from the caller frame. | 2244 // Forward the arguments from the caller frame. |
| 2245 { | 2245 { |
| 2246 Label loop; | 2246 Label loop; |
| 2247 __ AddP(r5, r5, Operand(kPointerSize)); | 2247 __ AddP(r6, r6, Operand(kPointerSize)); |
| 2248 __ LoadRR(r4, r2); | 2248 __ AddP(r2, r2, r7); |
| 2249 __ bind(&loop); | 2249 __ bind(&loop); |
| 2250 { | 2250 { |
| 2251 __ ShiftLeftP(ip, r4, Operand(kPointerSizeLog2)); | 2251 __ ShiftLeftP(ip, r7, Operand(kPointerSizeLog2)); |
| 2252 __ LoadP(ip, MemOperand(r5, ip)); | 2252 __ LoadP(ip, MemOperand(r6, ip)); |
| 2253 __ push(ip); | 2253 __ push(ip); |
| 2254 __ SubP(r4, r4, Operand(1)); | 2254 __ SubP(r7, r7, Operand(1)); |
| 2255 __ CmpP(r4, Operand::Zero()); | 2255 __ CmpP(r7, Operand::Zero()); |
| 2256 __ bne(&loop); | 2256 __ bne(&loop); |
| 2257 } | 2257 } |
| 2258 } | 2258 } |
| 2259 } | 2259 } |
| 2260 __ b(&stack_done); | 2260 __ b(&stack_done); |
| 2261 __ bind(&stack_overflow); | 2261 __ bind(&stack_overflow); |
| 2262 __ TailCallRuntime(Runtime::kThrowStackOverflow); | 2262 __ TailCallRuntime(Runtime::kThrowStackOverflow); |
| 2263 __ bind(&stack_empty); | |
| 2264 { | |
| 2265 // We just pass the receiver, which is already on the stack. | |
| 2266 __ mov(r2, Operand::Zero()); | |
| 2267 } | |
| 2268 __ bind(&stack_done); | 2263 __ bind(&stack_done); |
| 2269 | 2264 |
| 2265 // Tail-call to the {code} handler. |
| 2270 __ Jump(code, RelocInfo::CODE_TARGET); | 2266 __ Jump(code, RelocInfo::CODE_TARGET); |
| 2271 } | 2267 } |
| 2272 | 2268 |
| 2273 namespace { | 2269 namespace { |
| 2274 | 2270 |
| 2275 // Drops top JavaScript frame and an arguments adaptor frame below it (if | 2271 // Drops top JavaScript frame and an arguments adaptor frame below it (if |
| 2276 // present) preserving all the arguments prepared for current call. | 2272 // present) preserving all the arguments prepared for current call. |
| 2277 // Does nothing if debugger is currently active. | 2273 // Does nothing if debugger is currently active. |
| 2278 // ES6 14.6.3. PrepareForTailCall | 2274 // ES6 14.6.3. PrepareForTailCall |
| 2279 // | 2275 // |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3137 // Now jump to the instructions of the returned code object. | 3133 // Now jump to the instructions of the returned code object. |
| 3138 __ Jump(ip); | 3134 __ Jump(ip); |
| 3139 } | 3135 } |
| 3140 | 3136 |
| 3141 #undef __ | 3137 #undef __ |
| 3142 | 3138 |
| 3143 } // namespace internal | 3139 } // namespace internal |
| 3144 } // namespace v8 | 3140 } // namespace v8 |
| 3145 | 3141 |
| 3146 #endif // V8_TARGET_ARCH_S390 | 3142 #endif // V8_TARGET_ARCH_S390 |
| OLD | NEW |