Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: src/ic/x87/handler-compiler-x87.cc

Issue 926293004: Embed store callback in handler via weak cell. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: typo Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/x64/handler-compiler-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 __ push(scratch2()); // restore old return address 680 __ push(scratch2()); // restore old return address
681 681
682 ExternalReference ref = ExternalReference( 682 ExternalReference ref = ExternalReference(
683 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); 683 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate());
684 __ TailCallExternalReference( 684 __ TailCallExternalReference(
685 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); 685 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
686 } 686 }
687 687
688 688
689 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( 689 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
690 Handle<JSObject> object, Handle<Name> name, int accessor_index) { 690 Handle<JSObject> object, Handle<Name> name,
691 Handle<ExecutableAccessorInfo> callback) {
691 Register holder_reg = Frontend(name); 692 Register holder_reg = Frontend(name);
692 693
693 __ pop(scratch1()); // remove the return address 694 __ pop(scratch1()); // remove the return address
694 __ push(receiver()); 695 __ push(receiver());
695 __ push(holder_reg); 696 __ push(holder_reg);
696 __ Push(Smi::FromInt(accessor_index)); 697 // If the callback cannot leak, then push the callback directly,
698 // otherwise wrap it in a weak cell.
699 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) {
700 __ Push(callback);
701 } else {
702 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback);
703 __ Push(cell);
704 }
697 __ Push(name); 705 __ Push(name);
698 __ push(value()); 706 __ push(value());
699 __ push(scratch1()); // restore return address 707 __ push(scratch1()); // restore return address
700 708
701 // Do tail-call to the runtime system. 709 // Do tail-call to the runtime system.
702 ExternalReference store_callback_property = 710 ExternalReference store_callback_property =
703 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); 711 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
704 __ TailCallExternalReference(store_callback_property, 5, 1); 712 __ TailCallExternalReference(store_callback_property, 5, 1);
705 713
706 // Return the generated code. 714 // Return the generated code.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 // Return the generated code. 774 // Return the generated code.
767 return GetCode(kind(), Code::NORMAL, name); 775 return GetCode(kind(), Code::NORMAL, name);
768 } 776 }
769 777
770 778
771 #undef __ 779 #undef __
772 } 780 }
773 } // namespace v8::internal 781 } // namespace v8::internal
774 782
775 #endif // V8_TARGET_ARCH_X87 783 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/ic/x64/handler-compiler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698