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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 int argc) { | 442 int argc) { |
443 // ----------- S t a t e ------------- | 443 // ----------- S t a t e ------------- |
444 // -- rsp[0] : return address | 444 // -- rsp[0] : return address |
445 // -- rsp[8] : object passing the type check | 445 // -- rsp[8] : object passing the type check |
446 // (last fast api call extra argument, | 446 // (last fast api call extra argument, |
447 // set by CheckPrototypes) | 447 // set by CheckPrototypes) |
448 // -- rsp[16] : api function | 448 // -- rsp[16] : api function |
449 // (first fast api call extra argument) | 449 // (first fast api call extra argument) |
450 // -- rsp[24] : api call data | 450 // -- rsp[24] : api call data |
451 // -- rsp[32] : isolate | 451 // -- rsp[32] : isolate |
452 // -- rsp[40] : ReturnValue | 452 // -- rsp[40] : ReturnValue default value |
| 453 // -- rsp[48] : ReturnValue |
453 // | 454 // |
454 // -- rsp[48] : last argument | 455 // -- rsp[56] : last argument |
455 // -- ... | 456 // -- ... |
456 // -- rsp[(argc + 5) * 8] : first argument | 457 // -- rsp[(argc + 6) * 8] : first argument |
457 // -- rsp[(argc + 6) * 8] : receiver | 458 // -- rsp[(argc + 7) * 8] : receiver |
458 // ----------------------------------- | 459 // ----------------------------------- |
459 // Get the function and setup the context. | 460 // Get the function and setup the context. |
460 Handle<JSFunction> function = optimization.constant_function(); | 461 Handle<JSFunction> function = optimization.constant_function(); |
461 __ LoadHeapObject(rdi, function); | 462 __ LoadHeapObject(rdi, function); |
462 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 463 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
463 | 464 |
464 // Pass the additional arguments. | 465 // Pass the additional arguments. |
465 __ movq(Operand(rsp, 2 * kPointerSize), rdi); | 466 __ movq(Operand(rsp, 2 * kPointerSize), rdi); |
466 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 467 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
467 Handle<Object> call_data(api_call_info->data(), masm->isolate()); | 468 Handle<Object> call_data(api_call_info->data(), masm->isolate()); |
468 if (masm->isolate()->heap()->InNewSpace(*call_data)) { | 469 if (masm->isolate()->heap()->InNewSpace(*call_data)) { |
469 __ Move(rcx, api_call_info); | 470 __ Move(rcx, api_call_info); |
470 __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); | 471 __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); |
471 __ movq(Operand(rsp, 3 * kPointerSize), rbx); | 472 __ movq(Operand(rsp, 3 * kPointerSize), rbx); |
472 } else { | 473 } else { |
473 __ Move(Operand(rsp, 3 * kPointerSize), call_data); | 474 __ Move(Operand(rsp, 3 * kPointerSize), call_data); |
474 } | 475 } |
475 __ movq(kScratchRegister, | 476 __ movq(kScratchRegister, |
476 ExternalReference::isolate_address(masm->isolate())); | 477 ExternalReference::isolate_address(masm->isolate())); |
477 __ movq(Operand(rsp, 4 * kPointerSize), kScratchRegister); | 478 __ movq(Operand(rsp, 4 * kPointerSize), kScratchRegister); |
478 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 479 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
479 __ movq(Operand(rsp, 5 * kPointerSize), kScratchRegister); | 480 __ movq(Operand(rsp, 5 * kPointerSize), kScratchRegister); |
| 481 __ movq(Operand(rsp, 6 * kPointerSize), kScratchRegister); |
480 | 482 |
481 // Prepare arguments. | 483 // Prepare arguments. |
482 STATIC_ASSERT(kFastApiCallArguments == 5); | 484 STATIC_ASSERT(kFastApiCallArguments == 6); |
483 __ lea(rbx, Operand(rsp, kFastApiCallArguments * kPointerSize)); | 485 __ lea(rbx, Operand(rsp, kFastApiCallArguments * kPointerSize)); |
484 | 486 |
485 // Function address is a foreign pointer outside V8's heap. | 487 // Function address is a foreign pointer outside V8's heap. |
486 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 488 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
487 bool returns_handle = | 489 bool returns_handle = |
488 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); | 490 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); |
489 | 491 |
490 #if defined(__MINGW64__) | 492 #if defined(__MINGW64__) |
491 Register arguments_arg = rcx; | 493 Register arguments_arg = rcx; |
492 #elif defined(_WIN64) | 494 #elif defined(_WIN64) |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 __ push(reg); // holder | 1300 __ push(reg); // holder |
1299 if (heap()->InNewSpace(callback->data())) { | 1301 if (heap()->InNewSpace(callback->data())) { |
1300 __ Move(scratch1(), callback); | 1302 __ Move(scratch1(), callback); |
1301 __ push(FieldOperand(scratch1(), | 1303 __ push(FieldOperand(scratch1(), |
1302 ExecutableAccessorInfo::kDataOffset)); // data | 1304 ExecutableAccessorInfo::kDataOffset)); // data |
1303 } else { | 1305 } else { |
1304 __ Push(Handle<Object>(callback->data(), isolate())); | 1306 __ Push(Handle<Object>(callback->data(), isolate())); |
1305 } | 1307 } |
1306 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 1308 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
1307 __ push(kScratchRegister); // return value | 1309 __ push(kScratchRegister); // return value |
| 1310 __ push(kScratchRegister); // return value default |
1308 __ PushAddress(ExternalReference::isolate_address(isolate())); | 1311 __ PushAddress(ExternalReference::isolate_address(isolate())); |
1309 __ push(name()); // name | 1312 __ push(name()); // name |
1310 // Save a pointer to where we pushed the arguments pointer. This will be | 1313 // Save a pointer to where we pushed the arguments pointer. This will be |
1311 // passed as the const ExecutableAccessorInfo& to the C++ callback. | 1314 // passed as the const ExecutableAccessorInfo& to the C++ callback. |
1312 | 1315 |
1313 Address getter_address = v8::ToCData<Address>(callback->getter()); | 1316 Address getter_address = v8::ToCData<Address>(callback->getter()); |
1314 bool returns_handle = | 1317 bool returns_handle = |
1315 !CallbackTable::ReturnsVoid(isolate(), getter_address); | 1318 !CallbackTable::ReturnsVoid(isolate(), getter_address); |
1316 | 1319 |
1317 #if defined(__MINGW64__) | 1320 #if defined(__MINGW64__) |
(...skipping 12 matching lines...) Expand all Loading... |
1330 __ movq(name_arg, rsp); | 1333 __ movq(name_arg, rsp); |
1331 __ push(scratch2()); // Restore return address. | 1334 __ push(scratch2()); // Restore return address. |
1332 | 1335 |
1333 // v8::Arguments::values_ and handler for name. | 1336 // v8::Arguments::values_ and handler for name. |
1334 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1; | 1337 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1; |
1335 | 1338 |
1336 // Allocate v8::AccessorInfo in non-GCed stack space. | 1339 // Allocate v8::AccessorInfo in non-GCed stack space. |
1337 const int kArgStackSpace = 1; | 1340 const int kArgStackSpace = 1; |
1338 | 1341 |
1339 __ PrepareCallApiFunction(kArgStackSpace, returns_handle); | 1342 __ PrepareCallApiFunction(kArgStackSpace, returns_handle); |
1340 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 5); | 1343 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); |
1341 __ lea(rax, Operand(name_arg, 5 * kPointerSize)); | 1344 __ lea(rax, Operand(name_arg, 6 * kPointerSize)); |
1342 | 1345 |
1343 // v8::AccessorInfo::args_. | 1346 // v8::AccessorInfo::args_. |
1344 __ movq(StackSpaceOperand(0), rax); | 1347 __ movq(StackSpaceOperand(0), rax); |
1345 | 1348 |
1346 // The context register (rsi) has been saved in PrepareCallApiFunction and | 1349 // The context register (rsi) has been saved in PrepareCallApiFunction and |
1347 // could be used to pass arguments. | 1350 // could be used to pass arguments. |
1348 __ lea(accessor_info_arg, StackSpaceOperand(0)); | 1351 __ lea(accessor_info_arg, StackSpaceOperand(0)); |
1349 | 1352 |
1350 __ CallApiFunctionAndReturn(getter_address, | 1353 __ CallApiFunctionAndReturn(getter_address, |
1351 kStackSpace, | 1354 kStackSpace, |
1352 returns_handle, | 1355 returns_handle, |
1353 4); | 1356 5); |
1354 } | 1357 } |
1355 | 1358 |
1356 | 1359 |
1357 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<JSFunction> value) { | 1360 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<JSFunction> value) { |
1358 // Return the constant value. | 1361 // Return the constant value. |
1359 __ LoadHeapObject(rax, value); | 1362 __ LoadHeapObject(rax, value); |
1360 __ ret(0); | 1363 __ ret(0); |
1361 } | 1364 } |
1362 | 1365 |
1363 | 1366 |
(...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3483 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3486 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
3484 } | 3487 } |
3485 } | 3488 } |
3486 | 3489 |
3487 | 3490 |
3488 #undef __ | 3491 #undef __ |
3489 | 3492 |
3490 } } // namespace v8::internal | 3493 } } // namespace v8::internal |
3491 | 3494 |
3492 #endif // V8_TARGET_ARCH_X64 | 3495 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |