| 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 __ PopReturnAddressTo(scratch4()); | 555 __ PopReturnAddressTo(scratch4()); |
| 556 | 556 |
| 557 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); | 557 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); |
| 558 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 558 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
| 559 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 559 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
| 560 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 560 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
| 561 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); | 561 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); |
| 562 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); | 562 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); |
| 563 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); | 563 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); |
| 564 __ Push(receiver()); // receiver | 564 __ Push(receiver()); // receiver |
| 565 if (heap()->InNewSpace(callback->data())) { | 565 Handle<Object> data(callback->data(), isolate()); |
| 566 if (data->IsUndefined() || data->IsSmi()) { |
| 567 __ Push(data); |
| 568 } else { |
| 566 DCHECK(!scratch2().is(reg)); | 569 DCHECK(!scratch2().is(reg)); |
| 567 __ Move(scratch2(), callback); | 570 Handle<WeakCell> cell = |
| 568 __ Push(FieldOperand(scratch2(), | 571 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |
| 569 ExecutableAccessorInfo::kDataOffset)); // data | 572 // The callback is alive if this instruction is executed, |
| 570 } else { | 573 // so the weak cell is not cleared and points to data. |
| 571 __ Push(Handle<Object>(callback->data(), isolate())); | 574 __ GetWeakValue(scratch2(), cell); |
| 575 __ Push(scratch2()); |
| 572 } | 576 } |
| 573 DCHECK(!kScratchRegister.is(reg)); | 577 DCHECK(!kScratchRegister.is(reg)); |
| 574 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 578 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
| 575 __ Push(kScratchRegister); // return value | 579 __ Push(kScratchRegister); // return value |
| 576 __ Push(kScratchRegister); // return value default | 580 __ Push(kScratchRegister); // return value default |
| 577 __ PushAddress(ExternalReference::isolate_address(isolate())); | 581 __ PushAddress(ExternalReference::isolate_address(isolate())); |
| 578 __ Push(reg); // holder | 582 __ Push(reg); // holder |
| 579 __ Push(name()); // name | 583 __ Push(name()); // name |
| 580 // Save a pointer to where we pushed the arguments pointer. This will be | 584 // Save a pointer to where we pushed the arguments pointer. This will be |
| 581 // passed as the const PropertyAccessorInfo& to the C++ callback. | 585 // passed as the const PropertyAccessorInfo& to the C++ callback. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 // Return the generated code. | 762 // Return the generated code. |
| 759 return GetCode(kind(), Code::NORMAL, name); | 763 return GetCode(kind(), Code::NORMAL, name); |
| 760 } | 764 } |
| 761 | 765 |
| 762 | 766 |
| 763 #undef __ | 767 #undef __ |
| 764 } | 768 } |
| 765 } // namespace v8::internal | 769 } // namespace v8::internal |
| 766 | 770 |
| 767 #endif // V8_TARGET_ARCH_X64 | 771 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |