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