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 354 matching lines...) Loading... |
365 __ push(Operand(rbx, rcx, times_pointer_size, 0)); | 365 __ push(Operand(rbx, rcx, times_pointer_size, 0)); |
366 __ bind(&entry); | 366 __ bind(&entry); |
367 __ decq(rcx); | 367 __ decq(rcx); |
368 __ j(greater_equal, &loop); | 368 __ j(greater_equal, &loop); |
369 | 369 |
370 // Call the function. | 370 // Call the function. |
371 if (is_api_function) { | 371 if (is_api_function) { |
372 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 372 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
373 Handle<Code> code = | 373 Handle<Code> code = |
374 masm->isolate()->builtins()->HandleApiCallConstruct(); | 374 masm->isolate()->builtins()->HandleApiCallConstruct(); |
375 ParameterCount expected(0); | 375 __ SetCallKind(rcx, CALL_AS_METHOD); |
376 __ InvokeCode(code, expected, expected, RelocInfo::CODE_TARGET, | 376 __ Call(code, RelocInfo::CODE_TARGET); |
377 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | |
378 } else { | 377 } else { |
379 ParameterCount actual(rax); | 378 ParameterCount actual(rax); |
380 __ InvokeFunction(rdi, actual, CALL_FUNCTION, | 379 __ InvokeFunction(rdi, actual, CALL_FUNCTION, |
381 NullCallWrapper(), CALL_AS_METHOD); | 380 NullCallWrapper(), CALL_AS_METHOD); |
382 } | 381 } |
383 | 382 |
384 // Store offset of return address for deoptimizer. | 383 // Store offset of return address for deoptimizer. |
385 if (!is_api_function && !count_constructions) { | 384 if (!is_api_function && !count_constructions) { |
386 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); | 385 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
387 } | 386 } |
(...skipping 932 matching lines...) Loading... |
1320 __ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); | 1319 __ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); |
1321 __ PushReturnAddressFrom(rcx); | 1320 __ PushReturnAddressFrom(rcx); |
1322 } | 1321 } |
1323 | 1322 |
1324 | 1323 |
1325 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1324 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
1326 // ----------- S t a t e ------------- | 1325 // ----------- S t a t e ------------- |
1327 // -- rax : actual number of arguments | 1326 // -- rax : actual number of arguments |
1328 // -- rbx : expected number of arguments | 1327 // -- rbx : expected number of arguments |
1329 // -- rcx : call kind information | 1328 // -- rcx : call kind information |
1330 // -- rdx : code entry to call | 1329 // -- rdi: function (passed through to callee) |
1331 // ----------------------------------- | 1330 // ----------------------------------- |
1332 | 1331 |
1333 Label invoke, dont_adapt_arguments; | 1332 Label invoke, dont_adapt_arguments; |
1334 Counters* counters = masm->isolate()->counters(); | 1333 Counters* counters = masm->isolate()->counters(); |
1335 __ IncrementCounter(counters->arguments_adaptors(), 1); | 1334 __ IncrementCounter(counters->arguments_adaptors(), 1); |
1336 | 1335 |
1337 Label enough, too_few; | 1336 Label enough, too_few; |
| 1337 __ movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
1338 __ cmpq(rax, rbx); | 1338 __ cmpq(rax, rbx); |
1339 __ j(less, &too_few); | 1339 __ j(less, &too_few); |
1340 __ cmpq(rbx, Immediate(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); | 1340 __ cmpq(rbx, Immediate(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); |
1341 __ j(equal, &dont_adapt_arguments); | 1341 __ j(equal, &dont_adapt_arguments); |
1342 | 1342 |
1343 { // Enough parameters: Actual >= expected. | 1343 { // Enough parameters: Actual >= expected. |
1344 __ bind(&enough); | 1344 __ bind(&enough); |
1345 EnterArgumentsAdaptorFrame(masm); | 1345 EnterArgumentsAdaptorFrame(masm); |
1346 | 1346 |
1347 // Copy receiver and all expected arguments. | 1347 // Copy receiver and all expected arguments. |
(...skipping 111 matching lines...) Loading... |
1459 __ bind(&ok); | 1459 __ bind(&ok); |
1460 __ ret(0); | 1460 __ ret(0); |
1461 } | 1461 } |
1462 | 1462 |
1463 | 1463 |
1464 #undef __ | 1464 #undef __ |
1465 | 1465 |
1466 } } // namespace v8::internal | 1466 } } // namespace v8::internal |
1467 | 1467 |
1468 #endif // V8_TARGET_ARCH_X64 | 1468 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |