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