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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 __ pop(scratch3()); // Get return address to place it below. | 560 __ pop(scratch3()); // Get return address to place it below. |
561 | 561 |
562 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); | 562 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); |
563 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 563 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
564 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 564 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
565 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 565 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
566 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); | 566 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); |
567 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); | 567 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); |
568 __ push(receiver()); // receiver | 568 __ push(receiver()); // receiver |
569 // Push data from ExecutableAccessorInfo. | 569 // Push data from ExecutableAccessorInfo. |
570 if (isolate()->heap()->InNewSpace(callback->data())) { | 570 Handle<Object> data(callback->data(), isolate()); |
| 571 if (data->IsUndefined() || data->IsSmi()) { |
| 572 __ push(Immediate(data)); |
| 573 } else { |
571 DCHECK(!scratch2().is(reg)); | 574 DCHECK(!scratch2().is(reg)); |
572 __ mov(scratch2(), Immediate(callback)); | 575 Handle<WeakCell> cell = |
573 __ push(FieldOperand(scratch2(), ExecutableAccessorInfo::kDataOffset)); | 576 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |
574 } else { | 577 // The callback is alive if this instruction is executed, |
575 __ push(Immediate(Handle<Object>(callback->data(), isolate()))); | 578 // so the weak cell is not cleared and points to data. |
| 579 __ GetWeakValue(scratch2(), cell); |
| 580 __ push(scratch2()); |
576 } | 581 } |
577 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue | 582 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue |
578 // ReturnValue default value | 583 // ReturnValue default value |
579 __ push(Immediate(isolate()->factory()->undefined_value())); | 584 __ push(Immediate(isolate()->factory()->undefined_value())); |
580 __ push(Immediate(reinterpret_cast<int>(isolate()))); | 585 __ push(Immediate(reinterpret_cast<int>(isolate()))); |
581 __ push(reg); // holder | 586 __ push(reg); // holder |
582 | 587 |
583 // Save a pointer to where we pushed the arguments. This will be | 588 // Save a pointer to where we pushed the arguments. This will be |
584 // passed as the const PropertyAccessorInfo& to the C++ callback. | 589 // passed as the const PropertyAccessorInfo& to the C++ callback. |
585 __ push(esp); | 590 __ push(esp); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 // Return the generated code. | 775 // Return the generated code. |
771 return GetCode(kind(), Code::NORMAL, name); | 776 return GetCode(kind(), Code::NORMAL, name); |
772 } | 777 } |
773 | 778 |
774 | 779 |
775 #undef __ | 780 #undef __ |
776 } | 781 } |
777 } // namespace v8::internal | 782 } // namespace v8::internal |
778 | 783 |
779 #endif // V8_TARGET_ARCH_IA32 | 784 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |