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

Side by Side Diff: src/mips/builtins-mips.cc

Issue 23542029: Simplify installing concurrently recompiled code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: add stack check when calling function that is in recompile queue. Created 7 years, 3 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
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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 __ IncrementCounter(counters->string_ctor_gc_required(), 1, a3, t0); 292 __ IncrementCounter(counters->string_ctor_gc_required(), 1, a3, t0);
293 { 293 {
294 FrameScope scope(masm, StackFrame::INTERNAL); 294 FrameScope scope(masm, StackFrame::INTERNAL);
295 __ push(argument); 295 __ push(argument);
296 __ CallRuntime(Runtime::kNewStringWrapper, 1); 296 __ CallRuntime(Runtime::kNewStringWrapper, 1);
297 } 297 }
298 __ Ret(); 298 __ Ret();
299 } 299 }
300 300
301 301
302 static void CallRuntimePassFunction(MacroAssembler* masm,
303 Runtime::FunctionId function_id) {
304 FrameScope scope(masm, StackFrame::INTERNAL);
305 // Push a copy of the function onto the stack.
306 __ push(a1);
307 // Push call kind information.
308 __ push(t1);
309 // Function is also the parameter to the runtime call.
310 __ push(a1);
311
312 __ CallRuntime(function_id, 1);
313 // Restore call kind information.
314 __ pop(t1);
315 // Restore receiver.
316 __ pop(a1);
317 }
318
319
302 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { 320 static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
303 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 321 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
304 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset)); 322 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset));
305 __ Addu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag)); 323 __ Addu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag));
306 __ Jump(at); 324 __ Jump(at);
307 } 325 }
308 326
309 327
310 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { 328 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) {
329 Label ok;
330 // Check stack limit for signal to install code.
331 __ LoadRoot(t0, Heap::kStackLimitRootIndex);
332 __ Branch(&ok, hs, sp, Operand(t0));
333
334 CallRuntimePassFunction(masm, Runtime::kTryInstallRecompiledCode);
335 // Tail call to returned code.
336 __ Addu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag));
337 __ Jump(at);
338
339 __ bind(&ok);
311 GenerateTailCallToSharedCode(masm); 340 GenerateTailCallToSharedCode(masm);
312 } 341 }
313 342
314 343
315 void Builtins::Generate_InstallRecompiledCode(MacroAssembler* masm) {
316 // Enter an internal frame.
317 {
318 FrameScope scope(masm, StackFrame::INTERNAL);
319
320 // Preserve the function.
321 __ push(a1);
322 // Push call kind information.
323 __ push(t1);
324
325 // Push the function on the stack as the argument to the runtime function.
326 __ push(a1);
327 __ CallRuntime(Runtime::kInstallRecompiledCode, 1);
328 // Calculate the entry point.
329 __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
330
331 // Restore call kind information.
332 __ pop(t1);
333 // Restore saved function.
334 __ pop(a1);
335
336 // Tear down temporary frame.
337 }
338
339 // Do a tail-call of the compiled function.
340 __ Jump(t9);
341 }
342
343
344 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) { 344 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) {
345 { 345 CallRuntimePassFunction(masm, Runtime::kConcurrentRecompile);
346 FrameScope scope(masm, StackFrame::INTERNAL);
347
348 // Push a copy of the function onto the stack.
349 __ push(a1);
350 // Push call kind information.
351 __ push(t1);
352
353 __ push(a1); // Function is also the parameter to the runtime call.
354 __ CallRuntime(Runtime::kConcurrentRecompile, 1);
355
356 // Restore call kind information.
357 __ pop(t1);
358 // Restore receiver.
359 __ pop(a1);
360
361 // Tear down internal frame.
362 }
363
364 GenerateTailCallToSharedCode(masm); 346 GenerateTailCallToSharedCode(masm);
365 } 347 }
366 348
367 349
368 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 350 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
369 bool is_api_function, 351 bool is_api_function,
370 bool count_constructions) { 352 bool count_constructions) {
371 // ----------- S t a t e ------------- 353 // ----------- S t a t e -------------
372 // -- a0 : number of arguments 354 // -- a0 : number of arguments
373 // -- a1 : constructor function 355 // -- a1 : constructor function
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 Generate_JSEntryTrampolineHelper(masm, false); 790 Generate_JSEntryTrampolineHelper(masm, false);
809 } 791 }
810 792
811 793
812 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { 794 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
813 Generate_JSEntryTrampolineHelper(masm, true); 795 Generate_JSEntryTrampolineHelper(masm, true);
814 } 796 }
815 797
816 798
817 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { 799 void Builtins::Generate_LazyCompile(MacroAssembler* masm) {
818 // Enter an internal frame. 800 CallRuntimePassFunction(masm, Runtime::kLazyCompile);
819 {
820 FrameScope scope(masm, StackFrame::INTERNAL);
821
822 // Preserve the function.
823 __ push(a1);
824 // Push call kind information.
825 __ push(t1);
826
827 // Push the function on the stack as the argument to the runtime function.
828 __ push(a1);
829 // Call the runtime function.
830 __ CallRuntime(Runtime::kLazyCompile, 1);
831 // Calculate the entry point.
832 __ addiu(t9, v0, Code::kHeaderSize - kHeapObjectTag);
833
834 // Restore call kind information.
835 __ pop(t1);
836 // Restore saved function.
837 __ pop(a1);
838
839 // Tear down temporary frame.
840 }
841
842 // Do a tail-call of the compiled function. 801 // Do a tail-call of the compiled function.
802 __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
843 __ Jump(t9); 803 __ Jump(t9);
844 } 804 }
845 805
846 806
847 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { 807 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) {
848 // Enter an internal frame. 808 CallRuntimePassFunction(masm, Runtime::kLazyRecompile);
849 {
850 FrameScope scope(masm, StackFrame::INTERNAL);
851
852 // Preserve the function.
853 __ push(a1);
854 // Push call kind information.
855 __ push(t1);
856
857 // Push the function on the stack as the argument to the runtime function.
858 __ push(a1);
859 __ CallRuntime(Runtime::kLazyRecompile, 1);
860 // Calculate the entry point.
861 __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
862
863 // Restore call kind information.
864 __ pop(t1);
865 // Restore saved function.
866 __ pop(a1);
867
868 // Tear down temporary frame.
869 }
870
871 // Do a tail-call of the compiled function. 809 // Do a tail-call of the compiled function.
810 __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
872 __ Jump(t9); 811 __ Jump(t9);
873 } 812 }
874 813
875 814
876 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { 815 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
877 // For now, we are relying on the fact that make_code_young doesn't do any 816 // For now, we are relying on the fact that make_code_young doesn't do any
878 // garbage collection which allows us to save/restore the registers without 817 // garbage collection which allows us to save/restore the registers without
879 // worrying about which of them contain pointers. We also don't build an 818 // worrying about which of them contain pointers. We also don't build an
880 // internal frame to make the code faster, since we shouldn't have to do stack 819 // internal frame to make the code faster, since we shouldn't have to do stack
881 // crawls in MakeCodeYoung. This seems a bit fragile. 820 // crawls in MakeCodeYoung. This seems a bit fragile.
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 __ bind(&dont_adapt_arguments); 1471 __ bind(&dont_adapt_arguments);
1533 __ Jump(a3); 1472 __ Jump(a3);
1534 } 1473 }
1535 1474
1536 1475
1537 #undef __ 1476 #undef __
1538 1477
1539 } } // namespace v8::internal 1478 } } // namespace v8::internal
1540 1479
1541 #endif // V8_TARGET_ARCH_MIPS 1480 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698