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

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 82743003: Minor cleanup in calling interceptors for loading properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/stub-cache-ia32.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 __ push(receiver); 372 __ push(receiver);
373 __ push(holder); 373 __ push(holder);
374 } 374 }
375 375
376 376
377 static void CompileCallLoadPropertyWithInterceptor( 377 static void CompileCallLoadPropertyWithInterceptor(
378 MacroAssembler* masm, 378 MacroAssembler* masm,
379 Register receiver, 379 Register receiver,
380 Register holder, 380 Register holder,
381 Register name, 381 Register name,
382 Handle<JSObject> holder_obj) { 382 Handle<JSObject> holder_obj,
383 IC::UtilityId id) {
383 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 384 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
384 385 __ CallExternalReference(
385 ExternalReference ref = 386 ExternalReference(IC_Utility(id), masm->isolate()),
386 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), 387 StubCache::kInterceptorArgsLength);
387 masm->isolate());
388 __ Set(rax, StubCache::kInterceptorArgsLength);
389 __ LoadAddress(rbx, ref);
390
391 CEntryStub stub(1);
392 __ CallStub(&stub);
393 } 388 }
394 389
395 390
396 // Number of pointers to be reserved on stack for fast API call. 391 // Number of pointers to be reserved on stack for fast API call.
397 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; 392 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength;
398 393
399 394
400 // Reserves space for the extra arguments to API function in the 395 // Reserves space for the extra arguments to API function in the
401 // caller's frame. 396 // caller's frame.
402 // 397 //
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 Label* miss_label) { 782 Label* miss_label) {
788 Register holder = 783 Register holder =
789 stub_compiler_->CheckPrototypes( 784 stub_compiler_->CheckPrototypes(
790 IC::CurrentTypeOf(object, masm->isolate()), receiver, 785 IC::CurrentTypeOf(object, masm->isolate()), receiver,
791 interceptor_holder, scratch1, scratch2, scratch3, name, miss_label); 786 interceptor_holder, scratch1, scratch2, scratch3, name, miss_label);
792 787
793 FrameScope scope(masm, StackFrame::INTERNAL); 788 FrameScope scope(masm, StackFrame::INTERNAL);
794 // Save the name_ register across the call. 789 // Save the name_ register across the call.
795 __ push(name_); 790 __ push(name_);
796 791
797 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); 792 CompileCallLoadPropertyWithInterceptor(
798 793 masm, receiver, holder, name_, interceptor_holder,
799 __ CallExternalReference( 794 IC::kLoadPropertyWithInterceptorForCall);
800 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall),
801 masm->isolate()),
802 StubCache::kInterceptorArgsLength);
803 795
804 // Restore the name_ register. 796 // Restore the name_ register.
805 __ pop(name_); 797 __ pop(name_);
806 798
807 // Leave the internal frame. 799 // Leave the internal frame.
808 } 800 }
809 801
810 void LoadWithInterceptor(MacroAssembler* masm, 802 void LoadWithInterceptor(MacroAssembler* masm,
811 Register receiver, 803 Register receiver,
812 Register holder, 804 Register holder,
813 Handle<JSObject> holder_obj, 805 Handle<JSObject> holder_obj,
814 Label* interceptor_succeeded) { 806 Label* interceptor_succeeded) {
815 { 807 {
816 FrameScope scope(masm, StackFrame::INTERNAL); 808 FrameScope scope(masm, StackFrame::INTERNAL);
817 __ push(holder); // Save the holder. 809 __ push(holder); // Save the holder.
818 __ push(name_); // Save the name. 810 __ push(name_); // Save the name.
819 811
820 CompileCallLoadPropertyWithInterceptor(masm, 812 CompileCallLoadPropertyWithInterceptor(
821 receiver, 813 masm, receiver, holder, name_, holder_obj,
822 holder, 814 IC::kLoadPropertyWithInterceptorOnly);
823 name_,
824 holder_obj);
825 815
826 __ pop(name_); // Restore the name. 816 __ pop(name_); // Restore the name.
827 __ pop(receiver); // Restore the holder. 817 __ pop(receiver); // Restore the holder.
828 // Leave the internal frame. 818 // Leave the internal frame.
829 } 819 }
830 820
831 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); 821 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex);
832 __ j(not_equal, interceptor_succeeded); 822 __ j(not_equal, interceptor_succeeded);
833 } 823 }
834 824
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 1484
1495 if (must_preserve_receiver_reg) { 1485 if (must_preserve_receiver_reg) {
1496 __ push(receiver()); 1486 __ push(receiver());
1497 } 1487 }
1498 __ push(holder_reg); 1488 __ push(holder_reg);
1499 __ push(this->name()); 1489 __ push(this->name());
1500 1490
1501 // Invoke an interceptor. Note: map checks from receiver to 1491 // Invoke an interceptor. Note: map checks from receiver to
1502 // interceptor's holder has been compiled before (see a caller 1492 // interceptor's holder has been compiled before (see a caller
1503 // of this method.) 1493 // of this method.)
1504 CompileCallLoadPropertyWithInterceptor(masm(), 1494 CompileCallLoadPropertyWithInterceptor(
1505 receiver(), 1495 masm(), receiver(), holder_reg, this->name(), interceptor_holder,
1506 holder_reg, 1496 IC::kLoadPropertyWithInterceptorOnly);
1507 this->name(),
1508 interceptor_holder);
1509 1497
1510 // Check if interceptor provided a value for property. If it's 1498 // Check if interceptor provided a value for property. If it's
1511 // the case, return immediately. 1499 // the case, return immediately.
1512 Label interceptor_failed; 1500 Label interceptor_failed;
1513 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); 1501 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex);
1514 __ j(equal, &interceptor_failed); 1502 __ j(equal, &interceptor_failed);
1515 frame_scope.GenerateLeaveFrame(); 1503 frame_scope.GenerateLeaveFrame();
1516 __ ret(0); 1504 __ ret(0);
1517 1505
1518 __ bind(&interceptor_failed); 1506 __ bind(&interceptor_failed);
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
3003 // ----------------------------------- 2991 // -----------------------------------
3004 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 2992 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
3005 } 2993 }
3006 2994
3007 2995
3008 #undef __ 2996 #undef __
3009 2997
3010 } } // namespace v8::internal 2998 } } // namespace v8::internal
3011 2999
3012 #endif // V8_TARGET_ARCH_X64 3000 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698