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

Unified 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, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/macro-assembler-x64.cc
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
index 21b0f9b19ca22fa9808d543c75ea73470f01c56a..39d79d157c213855e9a0f5b55b6929362a6cdf27 100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -860,6 +860,85 @@ void MacroAssembler::CallApiFunctionAndReturn(
jmp(&leave_exit_frame);
}
+void MacroAssembler::CallFastApiFunctionAndReturn(
+ Register function_address,
+ ExternalReference thunk_ref,
+ Register thunk_last_arg,
+ int stack_space,
+ Operand return_value_operand,
+ Operand* context_restore_operand) {
+ Label prologue;
+ Label promote_scheduled_exception;
+ Label exception_handled;
+ Label delete_allocated_handles;
+ Label leave_exit_frame;
+ Label write_back;
+
+ Factory* factory = isolate()->factory();
+ /*
+ ExternalReference next_address =
+ ExternalReference::handle_scope_next_address(isolate());
+ const int kNextOffset = 0;
+ const int kLimitOffset = Offset(
+ ExternalReference::handle_scope_limit_address(isolate()),
+ next_address);
+ const int kLevelOffset = Offset(
+ ExternalReference::handle_scope_level_address(isolate()),
+ next_address);
+ */
+ ExternalReference scheduled_exception_address =
+ ExternalReference::scheduled_exception_address(isolate());
+
+ DCHECK(rdx.is(function_address) || r8.is(function_address));
+ // Allocate HandleScope in callee-save registers.
+ /*Register prev_next_address_reg = r14;
+ Register prev_limit_reg = rbx;
+ Register base_reg = r15;
+ */
+ Label profiler_disabled;
+ Move(rax, function_address);
+
+ // Call the api function!
+ call(rax);
+ // Load the value from ReturnValue
+ movp(rax, return_value_operand);
+ bind(&prologue);
+
+ bind(&leave_exit_frame);
+
+ // Check if the function scheduled an exception.
+ Move(rsi, scheduled_exception_address);
+ Cmp(Operand(rsi, 0), factory->the_hole_value());
+ j(not_equal, &promote_scheduled_exception);
+ bind(&exception_handled);
+
+ // LeaveApiExitFrame(!restore_context);
+ ExternalReference context_address(Isolate::kContextAddress, isolate());
+ Operand context_operand = ExternalOperand(context_address);
+ movp(rsi, context_operand);
+ movp(context_operand, Immediate(0));
+ ret(stack_space * kPointerSize);
+
+ bind(&promote_scheduled_exception);
+ {
+ FrameScope frame(this, StackFrame::INTERNAL);
+ CallRuntime(Runtime::kPromoteScheduledException, 0);
+ }
+ jmp(&exception_handled);
+
+ // HandleScope limit has changed. Delete allocated extensions.
+ /*
+ bind(&delete_allocated_handles);
+ movp(Operand(base_reg, kLimitOffset), prev_limit_reg);
+ movp(prev_limit_reg, rax);
+ LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate()));
+ LoadAddress(rax,
+ ExternalReference::delete_handle_scope_extensions(isolate()));
+ call(rax);
+ movp(rax, prev_limit_reg);
+ jmp(&leave_exit_frame);
+ */
+}
void MacroAssembler::JumpToExternalReference(const ExternalReference& ext,
int result_size) {
« 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