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

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

Issue 145583012: MIPS: stub fast api calls (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Optimize pushes. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/stub-cache-mips.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 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 3854 matching lines...) Expand 10 before | Expand all | Expand 10 after
3865 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond, r1, r2, bd); 3865 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond, r1, r2, bd);
3866 } 3866 }
3867 3867
3868 3868
3869 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { 3869 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
3870 return ref0.address() - ref1.address(); 3870 return ref0.address() - ref1.address();
3871 } 3871 }
3872 3872
3873 3873
3874 void MacroAssembler::CallApiFunctionAndReturn( 3874 void MacroAssembler::CallApiFunctionAndReturn(
3875 ExternalReference function, 3875 Register function_address,
3876 Address function_address,
3877 ExternalReference thunk_ref, 3876 ExternalReference thunk_ref,
3878 Register thunk_last_arg, 3877 Register thunk_last_arg,
3879 int stack_space, 3878 int stack_space,
3880 MemOperand return_value_operand, 3879 MemOperand return_value_operand,
3881 MemOperand* context_restore_operand) { 3880 MemOperand* context_restore_operand) {
3882 ExternalReference next_address = 3881 ExternalReference next_address =
3883 ExternalReference::handle_scope_next_address(isolate()); 3882 ExternalReference::handle_scope_next_address(isolate());
3884 const int kNextOffset = 0; 3883 const int kNextOffset = 0;
3885 const int kLimitOffset = AddressOffset( 3884 const int kLimitOffset = AddressOffset(
3886 ExternalReference::handle_scope_limit_address(isolate()), 3885 ExternalReference::handle_scope_limit_address(isolate()),
3887 next_address); 3886 next_address);
3888 const int kLevelOffset = AddressOffset( 3887 const int kLevelOffset = AddressOffset(
3889 ExternalReference::handle_scope_level_address(isolate()), 3888 ExternalReference::handle_scope_level_address(isolate()),
3890 next_address); 3889 next_address);
3891 3890
3891 ASSERT(function_address.is(a3));
3892 ASSERT(thunk_last_arg.is(a1) || thunk_last_arg.is(a2));
3893
3894 Label profiler_disabled;
3895 Label end_profiler_check;
3896 bool* is_profiling_flag =
3897 isolate()->cpu_profiler()->is_profiling_address();
3898 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1);
3899 li(t9, reinterpret_cast<int32_t>(is_profiling_flag));
3900 lb(t9, MemOperand(t9, 0));
3901 Branch(&profiler_disabled, eq, t9, Operand(zero_reg));
3902
3903 // Additional parameter is the address of the actual callback.
3904 li(t9, Operand(thunk_ref));
3905 jmp(&end_profiler_check);
3906
3907 bind(&profiler_disabled);
3908 mov(t9, function_address);
3909 bind(&end_profiler_check);
3910
3892 // Allocate HandleScope in callee-save registers. 3911 // Allocate HandleScope in callee-save registers.
3893 li(s3, Operand(next_address)); 3912 li(s3, Operand(next_address));
3894 lw(s0, MemOperand(s3, kNextOffset)); 3913 lw(s0, MemOperand(s3, kNextOffset));
3895 lw(s1, MemOperand(s3, kLimitOffset)); 3914 lw(s1, MemOperand(s3, kLimitOffset));
3896 lw(s2, MemOperand(s3, kLevelOffset)); 3915 lw(s2, MemOperand(s3, kLevelOffset));
3897 Addu(s2, s2, Operand(1)); 3916 Addu(s2, s2, Operand(1));
3898 sw(s2, MemOperand(s3, kLevelOffset)); 3917 sw(s2, MemOperand(s3, kLevelOffset));
3899 3918
3900 if (FLAG_log_timer_events) { 3919 if (FLAG_log_timer_events) {
3901 FrameScope frame(this, StackFrame::MANUAL); 3920 FrameScope frame(this, StackFrame::MANUAL);
3902 PushSafepointRegisters(); 3921 PushSafepointRegisters();
3903 PrepareCallCFunction(1, a0); 3922 PrepareCallCFunction(1, a0);
3904 li(a0, Operand(ExternalReference::isolate_address(isolate()))); 3923 li(a0, Operand(ExternalReference::isolate_address(isolate())));
3905 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); 3924 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1);
3906 PopSafepointRegisters(); 3925 PopSafepointRegisters();
3907 } 3926 }
3908 3927
3909 Label profiler_disabled;
3910 Label end_profiler_check;
3911 bool* is_profiling_flag =
3912 isolate()->cpu_profiler()->is_profiling_address();
3913 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1);
3914 li(t9, reinterpret_cast<int32_t>(is_profiling_flag));
3915 lb(t9, MemOperand(t9, 0));
3916 beq(t9, zero_reg, &profiler_disabled);
3917
3918 // Third parameter is the address of the actual getter function.
3919 li(thunk_last_arg, reinterpret_cast<int32_t>(function_address));
3920 li(t9, Operand(thunk_ref));
3921 jmp(&end_profiler_check);
3922
3923 bind(&profiler_disabled);
3924 li(t9, Operand(function));
3925
3926 bind(&end_profiler_check);
3927
3928 // Native call returns to the DirectCEntry stub which redirects to the 3928 // Native call returns to the DirectCEntry stub which redirects to the
3929 // return address pushed on stack (could have moved after GC). 3929 // return address pushed on stack (could have moved after GC).
3930 // DirectCEntry stub itself is generated early and never moves. 3930 // DirectCEntry stub itself is generated early and never moves.
3931 DirectCEntryStub stub; 3931 DirectCEntryStub stub;
3932 stub.GenerateCall(this, t9); 3932 stub.GenerateCall(this, t9);
3933 3933
3934 if (FLAG_log_timer_events) { 3934 if (FLAG_log_timer_events) {
3935 FrameScope frame(this, StackFrame::MANUAL); 3935 FrameScope frame(this, StackFrame::MANUAL);
3936 PushSafepointRegisters(); 3936 PushSafepointRegisters();
3937 PrepareCallCFunction(1, a0); 3937 PrepareCallCFunction(1, a0);
(...skipping 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after
5745 opcode == BGTZL); 5745 opcode == BGTZL);
5746 opcode = (cond == eq) ? BEQ : BNE; 5746 opcode = (cond == eq) ? BEQ : BNE;
5747 instr = (instr & ~kOpcodeMask) | opcode; 5747 instr = (instr & ~kOpcodeMask) | opcode;
5748 masm_.emit(instr); 5748 masm_.emit(instr);
5749 } 5749 }
5750 5750
5751 5751
5752 } } // namespace v8::internal 5752 } } // namespace v8::internal
5753 5753
5754 #endif // V8_TARGET_ARCH_MIPS 5754 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698