OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 // Slow-case: Handle non-smi or out-of-bounds access to arguments | 1055 // Slow-case: Handle non-smi or out-of-bounds access to arguments |
1056 // by calling the runtime system. | 1056 // by calling the runtime system. |
1057 __ bind(&slow); | 1057 __ bind(&slow); |
1058 __ PopReturnAddressTo(rbx); | 1058 __ PopReturnAddressTo(rbx); |
1059 __ push(rdx); | 1059 __ push(rdx); |
1060 __ PushReturnAddressFrom(rbx); | 1060 __ PushReturnAddressFrom(rbx); |
1061 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); | 1061 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); |
1062 } | 1062 } |
1063 | 1063 |
1064 | 1064 |
1065 void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) { | 1065 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
1066 // Stack layout: | 1066 // Stack layout: |
1067 // rsp[0] : return address | 1067 // rsp[0] : return address |
1068 // rsp[8] : number of parameters (tagged) | 1068 // rsp[8] : number of parameters (tagged) |
1069 // rsp[16] : receiver displacement | 1069 // rsp[16] : receiver displacement |
1070 // rsp[24] : function | 1070 // rsp[24] : function |
1071 // Registers used over the whole function: | 1071 // Registers used over the whole function: |
1072 // rbx: the mapped parameter count (untagged) | 1072 // rbx: the mapped parameter count (untagged) |
1073 // rax: the allocated object (tagged). | 1073 // rax: the allocated object (tagged). |
1074 | 1074 |
1075 Factory* factory = masm->isolate()->factory(); | 1075 Factory* factory = masm->isolate()->factory(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 // rax = address of new object (tagged) | 1180 // rax = address of new object (tagged) |
1181 // rbx = mapped parameter count (untagged) | 1181 // rbx = mapped parameter count (untagged) |
1182 // rcx = argument count (tagged) | 1182 // rcx = argument count (tagged) |
1183 // rdi = address of parameter map or backing store (tagged) | 1183 // rdi = address of parameter map or backing store (tagged) |
1184 | 1184 |
1185 // Initialize parameter map. If there are no mapped arguments, we're done. | 1185 // Initialize parameter map. If there are no mapped arguments, we're done. |
1186 Label skip_parameter_map; | 1186 Label skip_parameter_map; |
1187 __ testq(rbx, rbx); | 1187 __ testq(rbx, rbx); |
1188 __ j(zero, &skip_parameter_map); | 1188 __ j(zero, &skip_parameter_map); |
1189 | 1189 |
1190 __ LoadRoot(kScratchRegister, Heap::kNonStrictArgumentsElementsMapRootIndex); | 1190 __ LoadRoot(kScratchRegister, Heap::kSloppyArgumentsElementsMapRootIndex); |
1191 // rbx contains the untagged argument count. Add 2 and tag to write. | 1191 // rbx contains the untagged argument count. Add 2 and tag to write. |
1192 __ movp(FieldOperand(rdi, FixedArray::kMapOffset), kScratchRegister); | 1192 __ movp(FieldOperand(rdi, FixedArray::kMapOffset), kScratchRegister); |
1193 __ Integer64PlusConstantToSmi(r9, rbx, 2); | 1193 __ Integer64PlusConstantToSmi(r9, rbx, 2); |
1194 __ movp(FieldOperand(rdi, FixedArray::kLengthOffset), r9); | 1194 __ movp(FieldOperand(rdi, FixedArray::kLengthOffset), r9); |
1195 __ movp(FieldOperand(rdi, FixedArray::kHeaderSize + 0 * kPointerSize), rsi); | 1195 __ movp(FieldOperand(rdi, FixedArray::kHeaderSize + 0 * kPointerSize), rsi); |
1196 __ lea(r9, Operand(rdi, rbx, times_pointer_size, kParameterMapHeaderSize)); | 1196 __ lea(r9, Operand(rdi, rbx, times_pointer_size, kParameterMapHeaderSize)); |
1197 __ movp(FieldOperand(rdi, FixedArray::kHeaderSize + 1 * kPointerSize), r9); | 1197 __ movp(FieldOperand(rdi, FixedArray::kHeaderSize + 1 * kPointerSize), r9); |
1198 | 1198 |
1199 // Copy the parameter slots and the holes in the arguments. | 1199 // Copy the parameter slots and the holes in the arguments. |
1200 // We need to fill in mapped_parameter_count slots. They index the context, | 1200 // We need to fill in mapped_parameter_count slots. They index the context, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 | 1273 |
1274 // Do the runtime call to allocate the arguments object. | 1274 // Do the runtime call to allocate the arguments object. |
1275 // rcx = argument count (untagged) | 1275 // rcx = argument count (untagged) |
1276 __ bind(&runtime); | 1276 __ bind(&runtime); |
1277 __ Integer32ToSmi(rcx, rcx); | 1277 __ Integer32ToSmi(rcx, rcx); |
1278 __ movp(args.GetArgumentOperand(2), rcx); // Patch argument count. | 1278 __ movp(args.GetArgumentOperand(2), rcx); // Patch argument count. |
1279 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); | 1279 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); |
1280 } | 1280 } |
1281 | 1281 |
1282 | 1282 |
1283 void ArgumentsAccessStub::GenerateNewNonStrictSlow(MacroAssembler* masm) { | 1283 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { |
1284 // rsp[0] : return address | 1284 // rsp[0] : return address |
1285 // rsp[8] : number of parameters | 1285 // rsp[8] : number of parameters |
1286 // rsp[16] : receiver displacement | 1286 // rsp[16] : receiver displacement |
1287 // rsp[24] : function | 1287 // rsp[24] : function |
1288 | 1288 |
1289 // Check if the calling frame is an arguments adaptor frame. | 1289 // Check if the calling frame is an arguments adaptor frame. |
1290 Label runtime; | 1290 Label runtime; |
1291 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 1291 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
1292 __ movp(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); | 1292 __ movp(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); |
1293 __ Cmp(rcx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 1293 __ Cmp(rcx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
(...skipping 4035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5329 return_value_operand, | 5329 return_value_operand, |
5330 NULL); | 5330 NULL); |
5331 } | 5331 } |
5332 | 5332 |
5333 | 5333 |
5334 #undef __ | 5334 #undef __ |
5335 | 5335 |
5336 } } // namespace v8::internal | 5336 } } // namespace v8::internal |
5337 | 5337 |
5338 #endif // V8_TARGET_ARCH_X64 | 5338 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |