| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // Restore the arguments count and leave the construct frame. | 372 // Restore the arguments count and leave the construct frame. |
| 373 __ bind(&exit); | 373 __ bind(&exit); |
| 374 __ movq(rbx, Operand(rsp, kPointerSize)); // get arguments count | 374 __ movq(rbx, Operand(rsp, kPointerSize)); // get arguments count |
| 375 __ LeaveConstructFrame(); | 375 __ LeaveConstructFrame(); |
| 376 | 376 |
| 377 // Remove caller arguments from the stack and return. | 377 // Remove caller arguments from the stack and return. |
| 378 __ pop(rcx); | 378 __ pop(rcx); |
| 379 SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2); | 379 SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2); |
| 380 __ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); | 380 __ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); |
| 381 __ push(rcx); | 381 __ push(rcx); |
| 382 __ IncrementCounter(COUNTERS->constructed_objects(), 1); | 382 Counters* counters = masm->isolate()->counters(); |
| 383 __ IncrementCounter(counters->constructed_objects(), 1); |
| 383 __ ret(0); | 384 __ ret(0); |
| 384 } | 385 } |
| 385 | 386 |
| 386 | 387 |
| 387 void Builtins::Generate_JSConstructStubCountdown(MacroAssembler* masm) { | 388 void Builtins::Generate_JSConstructStubCountdown(MacroAssembler* masm) { |
| 388 Generate_JSConstructStubHelper(masm, false, true); | 389 Generate_JSConstructStubHelper(masm, false, true); |
| 389 } | 390 } |
| 390 | 391 |
| 391 | 392 |
| 392 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 393 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 | 1132 |
| 1132 // Handle construction of an empty array. | 1133 // Handle construction of an empty array. |
| 1133 AllocateEmptyJSArray(masm, | 1134 AllocateEmptyJSArray(masm, |
| 1134 rdi, | 1135 rdi, |
| 1135 rbx, | 1136 rbx, |
| 1136 rcx, | 1137 rcx, |
| 1137 rdx, | 1138 rdx, |
| 1138 r8, | 1139 r8, |
| 1139 kPreallocatedArrayElements, | 1140 kPreallocatedArrayElements, |
| 1140 call_generic_code); | 1141 call_generic_code); |
| 1141 __ IncrementCounter(COUNTERS->array_function_native(), 1); | 1142 Counters* counters = masm->isolate()->counters(); |
| 1143 __ IncrementCounter(counters->array_function_native(), 1); |
| 1142 __ movq(rax, rbx); | 1144 __ movq(rax, rbx); |
| 1143 __ ret(kPointerSize); | 1145 __ ret(kPointerSize); |
| 1144 | 1146 |
| 1145 // Check for one argument. Bail out if argument is not smi or if it is | 1147 // Check for one argument. Bail out if argument is not smi or if it is |
| 1146 // negative. | 1148 // negative. |
| 1147 __ bind(&argc_one_or_more); | 1149 __ bind(&argc_one_or_more); |
| 1148 __ cmpq(rax, Immediate(1)); | 1150 __ cmpq(rax, Immediate(1)); |
| 1149 __ j(not_equal, &argc_two_or_more); | 1151 __ j(not_equal, &argc_two_or_more); |
| 1150 __ movq(rdx, Operand(rsp, kPointerSize)); // Get the argument from the stack. | 1152 __ movq(rdx, Operand(rsp, kPointerSize)); // Get the argument from the stack. |
| 1151 __ JumpUnlessNonNegativeSmi(rdx, call_generic_code); | 1153 __ JumpUnlessNonNegativeSmi(rdx, call_generic_code); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1162 // esp[8]: argument | 1164 // esp[8]: argument |
| 1163 AllocateJSArray(masm, | 1165 AllocateJSArray(masm, |
| 1164 rdi, | 1166 rdi, |
| 1165 rdx, | 1167 rdx, |
| 1166 rbx, | 1168 rbx, |
| 1167 rcx, | 1169 rcx, |
| 1168 r8, | 1170 r8, |
| 1169 r9, | 1171 r9, |
| 1170 true, | 1172 true, |
| 1171 call_generic_code); | 1173 call_generic_code); |
| 1172 __ IncrementCounter(COUNTERS->array_function_native(), 1); | 1174 __ IncrementCounter(counters->array_function_native(), 1); |
| 1173 __ movq(rax, rbx); | 1175 __ movq(rax, rbx); |
| 1174 __ ret(2 * kPointerSize); | 1176 __ ret(2 * kPointerSize); |
| 1175 | 1177 |
| 1176 // Handle construction of an array from a list of arguments. | 1178 // Handle construction of an array from a list of arguments. |
| 1177 __ bind(&argc_two_or_more); | 1179 __ bind(&argc_two_or_more); |
| 1178 __ movq(rdx, rax); | 1180 __ movq(rdx, rax); |
| 1179 __ Integer32ToSmi(rdx, rdx); // Convet argc to a smi. | 1181 __ Integer32ToSmi(rdx, rdx); // Convet argc to a smi. |
| 1180 // rax: argc | 1182 // rax: argc |
| 1181 // rdx: array_size (smi) | 1183 // rdx: array_size (smi) |
| 1182 // rdi: constructor | 1184 // rdi: constructor |
| 1183 // esp[0] : return address | 1185 // esp[0] : return address |
| 1184 // esp[8] : last argument | 1186 // esp[8] : last argument |
| 1185 AllocateJSArray(masm, | 1187 AllocateJSArray(masm, |
| 1186 rdi, | 1188 rdi, |
| 1187 rdx, | 1189 rdx, |
| 1188 rbx, | 1190 rbx, |
| 1189 rcx, | 1191 rcx, |
| 1190 r8, | 1192 r8, |
| 1191 r9, | 1193 r9, |
| 1192 false, | 1194 false, |
| 1193 call_generic_code); | 1195 call_generic_code); |
| 1194 __ IncrementCounter(COUNTERS->array_function_native(), 1); | 1196 __ IncrementCounter(counters->array_function_native(), 1); |
| 1195 | 1197 |
| 1196 // rax: argc | 1198 // rax: argc |
| 1197 // rbx: JSArray | 1199 // rbx: JSArray |
| 1198 // rcx: elements_array | 1200 // rcx: elements_array |
| 1199 // r8: elements_array_end (untagged) | 1201 // r8: elements_array_end (untagged) |
| 1200 // esp[0]: return address | 1202 // esp[0]: return address |
| 1201 // esp[8]: last argument | 1203 // esp[8]: last argument |
| 1202 | 1204 |
| 1203 // Location of the last argument | 1205 // Location of the last argument |
| 1204 __ lea(r9, Operand(rsp, kPointerSize)); | 1206 __ lea(r9, Operand(rsp, kPointerSize)); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 | 1351 |
| 1350 | 1352 |
| 1351 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1353 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 1352 // ----------- S t a t e ------------- | 1354 // ----------- S t a t e ------------- |
| 1353 // -- rax : actual number of arguments | 1355 // -- rax : actual number of arguments |
| 1354 // -- rbx : expected number of arguments | 1356 // -- rbx : expected number of arguments |
| 1355 // -- rdx : code entry to call | 1357 // -- rdx : code entry to call |
| 1356 // ----------------------------------- | 1358 // ----------------------------------- |
| 1357 | 1359 |
| 1358 Label invoke, dont_adapt_arguments; | 1360 Label invoke, dont_adapt_arguments; |
| 1359 __ IncrementCounter(COUNTERS->arguments_adaptors(), 1); | 1361 Counters* counters = masm->isolate()->counters(); |
| 1362 __ IncrementCounter(counters->arguments_adaptors(), 1); |
| 1360 | 1363 |
| 1361 Label enough, too_few; | 1364 Label enough, too_few; |
| 1362 __ cmpq(rax, rbx); | 1365 __ cmpq(rax, rbx); |
| 1363 __ j(less, &too_few); | 1366 __ j(less, &too_few); |
| 1364 __ cmpq(rbx, Immediate(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); | 1367 __ cmpq(rbx, Immediate(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); |
| 1365 __ j(equal, &dont_adapt_arguments); | 1368 __ j(equal, &dont_adapt_arguments); |
| 1366 | 1369 |
| 1367 { // Enough parameters: Actual >= expected. | 1370 { // Enough parameters: Actual >= expected. |
| 1368 __ bind(&enough); | 1371 __ bind(&enough); |
| 1369 EnterArgumentsAdaptorFrame(masm); | 1372 EnterArgumentsAdaptorFrame(masm); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1486 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1484 generator.Generate(); | 1487 generator.Generate(); |
| 1485 } | 1488 } |
| 1486 | 1489 |
| 1487 | 1490 |
| 1488 #undef __ | 1491 #undef __ |
| 1489 | 1492 |
| 1490 } } // namespace v8::internal | 1493 } } // namespace v8::internal |
| 1491 | 1494 |
| 1492 #endif // V8_TARGET_ARCH_X64 | 1495 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |