OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // Retrieve smi-tagged arguments count from the stack. | 330 // Retrieve smi-tagged arguments count from the stack. |
331 __ movq(rax, Operand(rsp, 0)); | 331 __ movq(rax, Operand(rsp, 0)); |
332 __ SmiToInteger32(rax, rax); | 332 __ SmiToInteger32(rax, rax); |
333 | 333 |
334 // Push the allocated receiver to the stack. We need two copies | 334 // Push the allocated receiver to the stack. We need two copies |
335 // because we may have to return the original one and the calling | 335 // because we may have to return the original one and the calling |
336 // conventions dictate that the called function pops the receiver. | 336 // conventions dictate that the called function pops the receiver. |
337 __ push(rbx); | 337 __ push(rbx); |
338 __ push(rbx); | 338 __ push(rbx); |
339 | 339 |
340 // Setup pointer to last argument. | 340 // Set up pointer to last argument. |
341 __ lea(rbx, Operand(rbp, StandardFrameConstants::kCallerSPOffset)); | 341 __ lea(rbx, Operand(rbp, StandardFrameConstants::kCallerSPOffset)); |
342 | 342 |
343 // Copy arguments and receiver to the expression stack. | 343 // Copy arguments and receiver to the expression stack. |
344 Label loop, entry; | 344 Label loop, entry; |
345 __ movq(rcx, rax); | 345 __ movq(rcx, rax); |
346 __ jmp(&entry); | 346 __ jmp(&entry); |
347 __ bind(&loop); | 347 __ bind(&loop); |
348 __ push(Operand(rbx, rcx, times_pointer_size, 0)); | 348 __ push(Operand(rbx, rcx, times_pointer_size, 0)); |
349 __ bind(&entry); | 349 __ bind(&entry); |
350 __ decq(rcx); | 350 __ decq(rcx); |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 // rax: argc | 1191 // rax: argc |
1192 // rsp[0]: return address | 1192 // rsp[0]: return address |
1193 // rsp[8]: last argument | 1193 // rsp[8]: last argument |
1194 // This function is used for both construct and normal calls of Array. The only | 1194 // This function is used for both construct and normal calls of Array. The only |
1195 // difference between handling a construct call and a normal call is that for a | 1195 // difference between handling a construct call and a normal call is that for a |
1196 // construct call the constructor function in rdi needs to be preserved for | 1196 // construct call the constructor function in rdi needs to be preserved for |
1197 // entering the generic code. In both cases argc in rax needs to be preserved. | 1197 // entering the generic code. In both cases argc in rax needs to be preserved. |
1198 // Both registers are preserved by this code so no need to differentiate between | 1198 // Both registers are preserved by this code so no need to differentiate between |
1199 // a construct call and a normal call. | 1199 // a construct call and a normal call. |
1200 static void ArrayNativeCode(MacroAssembler* masm, | 1200 static void ArrayNativeCode(MacroAssembler* masm, |
1201 Label *call_generic_code) { | 1201 Label* call_generic_code) { |
1202 Label argc_one_or_more, argc_two_or_more, empty_array, not_empty_array, | 1202 Label argc_one_or_more, argc_two_or_more, empty_array, not_empty_array, |
1203 has_non_smi_element; | 1203 has_non_smi_element; |
1204 | 1204 |
1205 // Check for array construction with zero arguments. | 1205 // Check for array construction with zero arguments. |
1206 __ testq(rax, rax); | 1206 __ testq(rax, rax); |
1207 __ j(not_zero, &argc_one_or_more); | 1207 __ j(not_zero, &argc_one_or_more); |
1208 | 1208 |
1209 __ bind(&empty_array); | 1209 __ bind(&empty_array); |
1210 // Handle construction of an empty array. | 1210 // Handle construction of an empty array. |
1211 AllocateEmptyJSArray(masm, | 1211 AllocateEmptyJSArray(masm, |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1616 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1617 generator.Generate(); | 1617 generator.Generate(); |
1618 } | 1618 } |
1619 | 1619 |
1620 | 1620 |
1621 #undef __ | 1621 #undef __ |
1622 | 1622 |
1623 } } // namespace v8::internal | 1623 } } // namespace v8::internal |
1624 | 1624 |
1625 #endif // V8_TARGET_ARCH_X64 | 1625 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |