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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 697603002: Optimized nodeType dom binding by removing HandleScope and the preparation of ordinary c function c… (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@master
Patch Set: Created 6 years, 1 month 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/x64/macro-assembler-x64.h ('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_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/division-by-constant.h" 10 #include "src/base/division-by-constant.h"
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 movp(Operand(base_reg, kLimitOffset), prev_limit_reg); 853 movp(Operand(base_reg, kLimitOffset), prev_limit_reg);
854 movp(prev_limit_reg, rax); 854 movp(prev_limit_reg, rax);
855 LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate())); 855 LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate()));
856 LoadAddress(rax, 856 LoadAddress(rax,
857 ExternalReference::delete_handle_scope_extensions(isolate())); 857 ExternalReference::delete_handle_scope_extensions(isolate()));
858 call(rax); 858 call(rax);
859 movp(rax, prev_limit_reg); 859 movp(rax, prev_limit_reg);
860 jmp(&leave_exit_frame); 860 jmp(&leave_exit_frame);
861 } 861 }
862 862
863 void MacroAssembler::CallFastApiFunctionAndReturn(
864 Register function_address,
865 ExternalReference thunk_ref,
866 Register thunk_last_arg,
867 int stack_space,
868 Operand return_value_operand,
869 Operand* context_restore_operand) {
870 Label prologue;
871 Label promote_scheduled_exception;
872 Label exception_handled;
873 Label delete_allocated_handles;
874 Label leave_exit_frame;
875 Label write_back;
876
877 Factory* factory = isolate()->factory();
878 /*
879 ExternalReference next_address =
880 ExternalReference::handle_scope_next_address(isolate());
881 const int kNextOffset = 0;
882 const int kLimitOffset = Offset(
883 ExternalReference::handle_scope_limit_address(isolate()),
884 next_address);
885 const int kLevelOffset = Offset(
886 ExternalReference::handle_scope_level_address(isolate()),
887 next_address);
888 */
889 ExternalReference scheduled_exception_address =
890 ExternalReference::scheduled_exception_address(isolate());
891
892 DCHECK(rdx.is(function_address) || r8.is(function_address));
893 // Allocate HandleScope in callee-save registers.
894 /*Register prev_next_address_reg = r14;
895 Register prev_limit_reg = rbx;
896 Register base_reg = r15;
897 */
898 Label profiler_disabled;
899 Move(rax, function_address);
900
901 // Call the api function!
902 call(rax);
903 // Load the value from ReturnValue
904 movp(rax, return_value_operand);
905 bind(&prologue);
906
907 bind(&leave_exit_frame);
908
909 // Check if the function scheduled an exception.
910 Move(rsi, scheduled_exception_address);
911 Cmp(Operand(rsi, 0), factory->the_hole_value());
912 j(not_equal, &promote_scheduled_exception);
913 bind(&exception_handled);
914
915 // LeaveApiExitFrame(!restore_context);
916 ExternalReference context_address(Isolate::kContextAddress, isolate());
917 Operand context_operand = ExternalOperand(context_address);
918 movp(rsi, context_operand);
919 movp(context_operand, Immediate(0));
920 ret(stack_space * kPointerSize);
921
922 bind(&promote_scheduled_exception);
923 {
924 FrameScope frame(this, StackFrame::INTERNAL);
925 CallRuntime(Runtime::kPromoteScheduledException, 0);
926 }
927 jmp(&exception_handled);
928
929 // HandleScope limit has changed. Delete allocated extensions.
930 /*
931 bind(&delete_allocated_handles);
932 movp(Operand(base_reg, kLimitOffset), prev_limit_reg);
933 movp(prev_limit_reg, rax);
934 LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate()));
935 LoadAddress(rax,
936 ExternalReference::delete_handle_scope_extensions(isolate()));
937 call(rax);
938 movp(rax, prev_limit_reg);
939 jmp(&leave_exit_frame);
940 */
941 }
863 942
864 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext, 943 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext,
865 int result_size) { 944 int result_size) {
866 // Set the entry point and jump to the C entry runtime stub. 945 // Set the entry point and jump to the C entry runtime stub.
867 LoadAddress(rbx, ext); 946 LoadAddress(rbx, ext);
868 CEntryStub ces(isolate(), result_size); 947 CEntryStub ces(isolate(), result_size);
869 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); 948 jmp(ces.GetCode(), RelocInfo::CODE_TARGET);
870 } 949 }
871 950
872 951
(...skipping 4521 matching lines...) Expand 10 before | Expand all | Expand 10 after
5394 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); 5473 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift));
5395 movl(rax, dividend); 5474 movl(rax, dividend);
5396 shrl(rax, Immediate(31)); 5475 shrl(rax, Immediate(31));
5397 addl(rdx, rax); 5476 addl(rdx, rax);
5398 } 5477 }
5399 5478
5400 5479
5401 } } // namespace v8::internal 5480 } } // namespace v8::internal
5402 5481
5403 #endif // V8_TARGET_ARCH_X64 5482 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698