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

Side by Side Diff: src/ic/ia32/handler-compiler-ia32.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/handler-compiler.h ('k') | src/ic/ic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 __ push(scratch2()); // restore old return address 678 __ push(scratch2()); // restore old return address
679 679
680 ExternalReference ref = ExternalReference( 680 ExternalReference ref = ExternalReference(
681 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); 681 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate());
682 __ TailCallExternalReference( 682 __ TailCallExternalReference(
683 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); 683 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
684 } 684 }
685 685
686 686
687 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( 687 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
688 Handle<JSObject> object, Handle<Name> name, int accessor_index) { 688 Handle<JSObject> object, Handle<Name> name,
689 Handle<ExecutableAccessorInfo> callback) {
689 Register holder_reg = Frontend(name); 690 Register holder_reg = Frontend(name);
690 691
691 __ pop(scratch1()); // remove the return address 692 __ pop(scratch1()); // remove the return address
692 __ push(receiver()); 693 __ push(receiver());
693 __ push(holder_reg); 694 __ push(holder_reg);
694 __ Push(Smi::FromInt(accessor_index)); 695 // If the callback cannot leak, then push the callback directly,
696 // otherwise wrap it in a weak cell.
697 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) {
698 __ Push(callback);
699 } else {
700 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback);
701 __ Push(cell);
702 }
695 __ Push(name); 703 __ Push(name);
696 __ push(value()); 704 __ push(value());
697 __ push(scratch1()); // restore return address 705 __ push(scratch1()); // restore return address
698 706
699 // Do tail-call to the runtime system. 707 // Do tail-call to the runtime system.
700 ExternalReference store_callback_property = 708 ExternalReference store_callback_property =
701 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); 709 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
702 __ TailCallExternalReference(store_callback_property, 5, 1); 710 __ TailCallExternalReference(store_callback_property, 5, 1);
703 711
704 // Return the generated code. 712 // Return the generated code.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 // Return the generated code. 772 // Return the generated code.
765 return GetCode(kind(), Code::NORMAL, name); 773 return GetCode(kind(), Code::NORMAL, name);
766 } 774 }
767 775
768 776
769 #undef __ 777 #undef __
770 } 778 }
771 } // namespace v8::internal 779 } // namespace v8::internal
772 780
773 #endif // V8_TARGET_ARCH_IA32 781 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ic/handler-compiler.h ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698