| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 __ push(Operand(rbx, rcx, times_pointer_size, 0)); | 362 __ push(Operand(rbx, rcx, times_pointer_size, 0)); |
| 363 __ bind(&entry); | 363 __ bind(&entry); |
| 364 __ decq(rcx); | 364 __ decq(rcx); |
| 365 __ j(greater_equal, &loop); | 365 __ j(greater_equal, &loop); |
| 366 | 366 |
| 367 // Call the function. | 367 // Call the function. |
| 368 if (is_api_function) { | 368 if (is_api_function) { |
| 369 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 369 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 370 Handle<Code> code = | 370 Handle<Code> code = |
| 371 masm->isolate()->builtins()->HandleApiCallConstruct(); | 371 masm->isolate()->builtins()->HandleApiCallConstruct(); |
| 372 ParameterCount expected(0); | 372 __ Call(code, RelocInfo::CODE_TARGET); |
| 373 __ InvokeCode(code, expected, expected, RelocInfo::CODE_TARGET, | |
| 374 CALL_FUNCTION, NullCallWrapper()); | |
| 375 } else { | 373 } else { |
| 376 ParameterCount actual(rax); | 374 ParameterCount actual(rax); |
| 377 __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); | 375 __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); |
| 378 } | 376 } |
| 379 | 377 |
| 380 // Store offset of return address for deoptimizer. | 378 // Store offset of return address for deoptimizer. |
| 381 if (!is_api_function && !count_constructions) { | 379 if (!is_api_function && !count_constructions) { |
| 382 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); | 380 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
| 383 } | 381 } |
| 384 | 382 |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2); | 1294 SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2); |
| 1297 __ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); | 1295 __ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); |
| 1298 __ PushReturnAddressFrom(rcx); | 1296 __ PushReturnAddressFrom(rcx); |
| 1299 } | 1297 } |
| 1300 | 1298 |
| 1301 | 1299 |
| 1302 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1300 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 1303 // ----------- S t a t e ------------- | 1301 // ----------- S t a t e ------------- |
| 1304 // -- rax : actual number of arguments | 1302 // -- rax : actual number of arguments |
| 1305 // -- rbx : expected number of arguments | 1303 // -- rbx : expected number of arguments |
| 1306 // -- rdx : code entry to call | 1304 // -- rdi: function (passed through to callee) |
| 1307 // ----------------------------------- | 1305 // ----------------------------------- |
| 1308 | 1306 |
| 1309 Label invoke, dont_adapt_arguments; | 1307 Label invoke, dont_adapt_arguments; |
| 1310 Counters* counters = masm->isolate()->counters(); | 1308 Counters* counters = masm->isolate()->counters(); |
| 1311 __ IncrementCounter(counters->arguments_adaptors(), 1); | 1309 __ IncrementCounter(counters->arguments_adaptors(), 1); |
| 1312 | 1310 |
| 1313 Label enough, too_few; | 1311 Label enough, too_few; |
| 1312 __ movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
| 1314 __ cmpq(rax, rbx); | 1313 __ cmpq(rax, rbx); |
| 1315 __ j(less, &too_few); | 1314 __ j(less, &too_few); |
| 1316 __ cmpq(rbx, Immediate(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); | 1315 __ cmpq(rbx, Immediate(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); |
| 1317 __ j(equal, &dont_adapt_arguments); | 1316 __ j(equal, &dont_adapt_arguments); |
| 1318 | 1317 |
| 1319 { // Enough parameters: Actual >= expected. | 1318 { // Enough parameters: Actual >= expected. |
| 1320 __ bind(&enough); | 1319 __ bind(&enough); |
| 1321 EnterArgumentsAdaptorFrame(masm); | 1320 EnterArgumentsAdaptorFrame(masm); |
| 1322 | 1321 |
| 1323 // Copy receiver and all expected arguments. | 1322 // Copy receiver and all expected arguments. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 __ bind(&ok); | 1434 __ bind(&ok); |
| 1436 __ ret(0); | 1435 __ ret(0); |
| 1437 } | 1436 } |
| 1438 | 1437 |
| 1439 | 1438 |
| 1440 #undef __ | 1439 #undef __ |
| 1441 | 1440 |
| 1442 } } // namespace v8::internal | 1441 } } // namespace v8::internal |
| 1443 | 1442 |
| 1444 #endif // V8_TARGET_ARCH_X64 | 1443 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |