| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
| 10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 DCHECK(!scratch4().is(reg)); | 501 DCHECK(!scratch4().is(reg)); |
| 502 __ PopReturnAddressTo(scratch4()); | 502 __ PopReturnAddressTo(scratch4()); |
| 503 | 503 |
| 504 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); | 504 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); |
| 505 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 505 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
| 506 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 506 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
| 507 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 507 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
| 508 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); | 508 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); |
| 509 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); | 509 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); |
| 510 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); | 510 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); |
| 511 |
| 512 bool fast_call = callback->can_fast_call(); |
| 511 __ Push(receiver()); // receiver | 513 __ Push(receiver()); // receiver |
| 512 if (heap()->InNewSpace(callback->data())) { | 514 if (heap()->InNewSpace(callback->data())) { |
| 513 DCHECK(!scratch2().is(reg)); | 515 DCHECK(!scratch2().is(reg)); |
| 514 __ Move(scratch2(), callback); | 516 __ Move(scratch2(), callback); |
| 515 __ Push(FieldOperand(scratch2(), | 517 __ Push(FieldOperand(scratch2(), |
| 516 ExecutableAccessorInfo::kDataOffset)); // data | 518 ExecutableAccessorInfo::kDataOffset)); // data |
| 517 } else { | 519 } else { |
| 518 __ Push(Handle<Object>(callback->data(), isolate())); | 520 __ Push(Handle<Object>(callback->data(), isolate())); |
| 519 } | 521 } |
| 520 DCHECK(!kScratchRegister.is(reg)); | 522 DCHECK(!kScratchRegister.is(reg)); |
| 521 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 523 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
| 522 __ Push(kScratchRegister); // return value | 524 __ Push(kScratchRegister); // return value |
| 523 __ Push(kScratchRegister); // return value default | 525 __ Push(kScratchRegister); // return value default |
| 524 __ PushAddress(ExternalReference::isolate_address(isolate())); | 526 __ PushAddress(ExternalReference::isolate_address(isolate())); |
| 525 __ Push(reg); // holder | 527 __ Push(reg); // holder |
| 528 if (fast_call) { |
| 529 // the address of PropertyCallbackInfo |
| 530 __ leap(kScratchRegister, Operand(rsp, 0)); |
| 531 __ Push(kScratchRegister); |
| 532 } |
| 526 __ Push(name()); // name | 533 __ Push(name()); // name |
| 527 // Save a pointer to where we pushed the arguments pointer. This will be | 534 // Save a pointer to where we pushed the arguments pointer. This will be |
| 528 // passed as the const PropertyAccessorInfo& to the C++ callback. | 535 // passed as the const PropertyAccessorInfo& to the C++ callback. |
| 529 | 536 |
| 530 __ PushReturnAddressFrom(scratch4()); | 537 __ PushReturnAddressFrom(scratch4()); |
| 531 | 538 |
| 532 // Abi for CallApiGetter | 539 // Abi for CallApiGetter |
| 533 Register api_function_address = ApiGetterDescriptor::function_address(); | 540 Register api_function_address = ApiGetterDescriptor::function_address(); |
| 534 Address getter_address = v8::ToCData<Address>(callback->getter()); | 541 Address getter_address = v8::ToCData<Address>(callback->getter()); |
| 535 __ Move(api_function_address, getter_address, RelocInfo::EXTERNAL_REFERENCE); | 542 __ Move(api_function_address, getter_address, RelocInfo::EXTERNAL_REFERENCE); |
| 543 if (fast_call) { |
| 544 CallFastApiGetterStub stub(isolate()); |
| 545 __ TailCallStub(&stub); |
| 546 return; |
| 547 } |
| 536 | 548 |
| 537 CallApiGetterStub stub(isolate()); | 549 CallApiGetterStub stub(isolate()); |
| 538 __ TailCallStub(&stub); | 550 __ TailCallStub(&stub); |
| 539 } | 551 } |
| 540 | 552 |
| 541 | 553 |
| 542 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | 554 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 543 // Return the constant value. | 555 // Return the constant value. |
| 544 __ Move(rax, value); | 556 __ Move(rax, value); |
| 545 __ ret(0); | 557 __ ret(0); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 // Return the generated code. | 708 // Return the generated code. |
| 697 return GetCode(kind(), Code::NORMAL, name); | 709 return GetCode(kind(), Code::NORMAL, name); |
| 698 } | 710 } |
| 699 | 711 |
| 700 | 712 |
| 701 #undef __ | 713 #undef __ |
| 702 } | 714 } |
| 703 } // namespace v8::internal | 715 } // namespace v8::internal |
| 704 | 716 |
| 705 #endif // V8_TARGET_ARCH_X64 | 717 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |