OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 __ j(less, &arguments_loop, Label::kNear); | 1166 __ j(less, &arguments_loop, Label::kNear); |
1167 | 1167 |
1168 // Return and remove the on-stack parameters. | 1168 // Return and remove the on-stack parameters. |
1169 __ ret(3 * kPointerSize); | 1169 __ ret(3 * kPointerSize); |
1170 | 1170 |
1171 // Do the runtime call to allocate the arguments object. | 1171 // Do the runtime call to allocate the arguments object. |
1172 // rcx = argument count (untagged) | 1172 // rcx = argument count (untagged) |
1173 __ bind(&runtime); | 1173 __ bind(&runtime); |
1174 __ Integer32ToSmi(rcx, rcx); | 1174 __ Integer32ToSmi(rcx, rcx); |
1175 __ movp(args.GetArgumentOperand(2), rcx); // Patch argument count. | 1175 __ movp(args.GetArgumentOperand(2), rcx); // Patch argument count. |
1176 __ TailCallRuntime(Runtime::kHiddenNewArgumentsFast, 3, 1); | 1176 __ TailCallRuntime(Runtime::kHiddenNewSloppyArguments, 3, 1); |
1177 } | 1177 } |
1178 | 1178 |
1179 | 1179 |
1180 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { | 1180 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { |
1181 // rsp[0] : return address | 1181 // rsp[0] : return address |
1182 // rsp[8] : number of parameters | 1182 // rsp[8] : number of parameters |
1183 // rsp[16] : receiver displacement | 1183 // rsp[16] : receiver displacement |
1184 // rsp[24] : function | 1184 // rsp[24] : function |
1185 | 1185 |
1186 // Check if the calling frame is an arguments adaptor frame. | 1186 // Check if the calling frame is an arguments adaptor frame. |
1187 Label runtime; | 1187 Label runtime; |
1188 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 1188 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
1189 __ movp(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); | 1189 __ movp(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); |
1190 __ Cmp(rcx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 1190 __ Cmp(rcx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
1191 __ j(not_equal, &runtime); | 1191 __ j(not_equal, &runtime); |
1192 | 1192 |
1193 // Patch the arguments.length and the parameters pointer. | 1193 // Patch the arguments.length and the parameters pointer. |
1194 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER); | 1194 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER); |
1195 __ movp(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 1195 __ movp(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
1196 __ movp(args.GetArgumentOperand(2), rcx); | 1196 __ movp(args.GetArgumentOperand(2), rcx); |
1197 __ SmiToInteger64(rcx, rcx); | 1197 __ SmiToInteger64(rcx, rcx); |
1198 __ leap(rdx, Operand(rdx, rcx, times_pointer_size, | 1198 __ leap(rdx, Operand(rdx, rcx, times_pointer_size, |
1199 StandardFrameConstants::kCallerSPOffset)); | 1199 StandardFrameConstants::kCallerSPOffset)); |
1200 __ movp(args.GetArgumentOperand(1), rdx); | 1200 __ movp(args.GetArgumentOperand(1), rdx); |
1201 | 1201 |
1202 __ bind(&runtime); | 1202 __ bind(&runtime); |
1203 __ TailCallRuntime(Runtime::kHiddenNewArgumentsFast, 3, 1); | 1203 __ TailCallRuntime(Runtime::kHiddenNewSloppyArguments, 3, 1); |
1204 } | 1204 } |
1205 | 1205 |
1206 | 1206 |
1207 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { | 1207 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
1208 // rsp[0] : return address | 1208 // rsp[0] : return address |
1209 // rsp[8] : number of parameters | 1209 // rsp[8] : number of parameters |
1210 // rsp[16] : receiver displacement | 1210 // rsp[16] : receiver displacement |
1211 // rsp[24] : function | 1211 // rsp[24] : function |
1212 | 1212 |
1213 // Check if the calling frame is an arguments adaptor frame. | 1213 // Check if the calling frame is an arguments adaptor frame. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 __ subp(rdx, Immediate(kPointerSize)); | 1294 __ subp(rdx, Immediate(kPointerSize)); |
1295 __ decp(rcx); | 1295 __ decp(rcx); |
1296 __ j(not_zero, &loop); | 1296 __ j(not_zero, &loop); |
1297 | 1297 |
1298 // Return and remove the on-stack parameters. | 1298 // Return and remove the on-stack parameters. |
1299 __ bind(&done); | 1299 __ bind(&done); |
1300 __ ret(3 * kPointerSize); | 1300 __ ret(3 * kPointerSize); |
1301 | 1301 |
1302 // Do the runtime call to allocate the arguments object. | 1302 // Do the runtime call to allocate the arguments object. |
1303 __ bind(&runtime); | 1303 __ bind(&runtime); |
1304 __ TailCallRuntime(Runtime::kHiddenNewStrictArgumentsFast, 3, 1); | 1304 __ TailCallRuntime(Runtime::kHiddenNewStrictArguments, 3, 1); |
1305 } | 1305 } |
1306 | 1306 |
1307 | 1307 |
1308 void RegExpExecStub::Generate(MacroAssembler* masm) { | 1308 void RegExpExecStub::Generate(MacroAssembler* masm) { |
1309 // Just jump directly to runtime if native RegExp is not selected at compile | 1309 // Just jump directly to runtime if native RegExp is not selected at compile |
1310 // time or if regexp entry in generated code is turned off runtime switch or | 1310 // time or if regexp entry in generated code is turned off runtime switch or |
1311 // at compilation. | 1311 // at compilation. |
1312 #ifdef V8_INTERPRETED_REGEXP | 1312 #ifdef V8_INTERPRETED_REGEXP |
1313 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1); | 1313 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1); |
1314 #else // V8_INTERPRETED_REGEXP | 1314 #else // V8_INTERPRETED_REGEXP |
(...skipping 3731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5046 return_value_operand, | 5046 return_value_operand, |
5047 NULL); | 5047 NULL); |
5048 } | 5048 } |
5049 | 5049 |
5050 | 5050 |
5051 #undef __ | 5051 #undef __ |
5052 | 5052 |
5053 } } // namespace v8::internal | 5053 } } // namespace v8::internal |
5054 | 5054 |
5055 #endif // V8_TARGET_ARCH_X64 | 5055 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |