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

Side by Side Diff: src/arm/builtins-arm.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
« no previous file with comments | « no previous file | src/builtins.h » ('j') | src/execution.cc » ('J')
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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 __ IncrementCounter(counters->string_ctor_gc_required(), 1, r3, r4); 284 __ IncrementCounter(counters->string_ctor_gc_required(), 1, r3, r4);
285 { 285 {
286 FrameScope scope(masm, StackFrame::INTERNAL); 286 FrameScope scope(masm, StackFrame::INTERNAL);
287 __ push(argument); 287 __ push(argument);
288 __ CallRuntime(Runtime::kNewStringWrapper, 1); 288 __ CallRuntime(Runtime::kNewStringWrapper, 1);
289 } 289 }
290 __ Ret(); 290 __ Ret();
291 } 291 }
292 292
293 293
294 static void CallRuntimePassFunction(MacroAssembler* masm,
295 Runtime::FunctionId function_id) {
296 FrameScope scope(masm, StackFrame::INTERNAL);
297 // Push a copy of the function onto the stack.
298 __ push(r1);
299 // Push call kind information.
300 __ push(r5);
301 // Function is also the parameter to the runtime call.
302 __ push(r1);
303
304 __ CallRuntime(function_id, 1);
305 // Restore call kind information.
306 __ pop(r5);
307 // Restore receiver.
308 __ pop(r1);
309 }
310
311
294 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { 312 static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
295 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 313 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
296 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset)); 314 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset));
297 __ add(r2, r2, Operand(Code::kHeaderSize - kHeapObjectTag)); 315 __ add(r2, r2, Operand(Code::kHeaderSize - kHeapObjectTag));
298 __ mov(pc, r2); 316 __ Jump(r2);
299 } 317 }
300 318
301 319
302 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { 320 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) {
321 Label ok;
322 // Check stack limit for signal to install code.
323 __ LoadRoot(ip, Heap::kStackLimitRootIndex);
324 __ cmp(sp, Operand(ip));
325 __ b(hs, &ok);
326
327 CallRuntimePassFunction(masm, Runtime::kTryInstallRecompiledCode);
328 // Tail call to returned code.
329 __ add(r0, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
330 __ Jump(r0);
331
332 __ bind(&ok);
303 GenerateTailCallToSharedCode(masm); 333 GenerateTailCallToSharedCode(masm);
304 } 334 }
305 335
306 336
307 void Builtins::Generate_InstallRecompiledCode(MacroAssembler* masm) {
308 // Enter an internal frame.
309 {
310 FrameScope scope(masm, StackFrame::INTERNAL);
311
312 // Preserve the function.
313 __ push(r1);
314 // Push call kind information.
315 __ push(r5);
316
317 // Push the function on the stack as the argument to the runtime function.
318 __ push(r1);
319 __ CallRuntime(Runtime::kInstallRecompiledCode, 1);
320 // Calculate the entry point.
321 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
322
323 // Restore call kind information.
324 __ pop(r5);
325 // Restore saved function.
326 __ pop(r1);
327
328 // Tear down internal frame.
329 }
330
331 // Do a tail-call of the compiled function.
332 __ Jump(r2);
333 }
334
335
336 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) { 337 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) {
337 { 338 CallRuntimePassFunction(masm, Runtime::kConcurrentRecompile);
338 FrameScope scope(masm, StackFrame::INTERNAL);
339
340 // Push a copy of the function onto the stack.
341 __ push(r1);
342 // Push call kind information.
343 __ push(r5);
344
345 __ push(r1); // Function is also the parameter to the runtime call.
346 __ CallRuntime(Runtime::kConcurrentRecompile, 1);
347
348 // Restore call kind information.
349 __ pop(r5);
350 // Restore receiver.
351 __ pop(r1);
352
353 // Tear down internal frame.
354 }
355
356 GenerateTailCallToSharedCode(masm); 339 GenerateTailCallToSharedCode(masm);
357 } 340 }
358 341
359 342
360 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 343 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
361 bool is_api_function, 344 bool is_api_function,
362 bool count_constructions) { 345 bool count_constructions) {
363 // ----------- S t a t e ------------- 346 // ----------- S t a t e -------------
364 // -- r0 : number of arguments 347 // -- r0 : number of arguments
365 // -- r1 : constructor function 348 // -- r1 : constructor function
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 Generate_JSEntryTrampolineHelper(masm, false); 771 Generate_JSEntryTrampolineHelper(masm, false);
789 } 772 }
790 773
791 774
792 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { 775 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
793 Generate_JSEntryTrampolineHelper(masm, true); 776 Generate_JSEntryTrampolineHelper(masm, true);
794 } 777 }
795 778
796 779
797 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { 780 void Builtins::Generate_LazyCompile(MacroAssembler* masm) {
798 // Enter an internal frame. 781 CallRuntimePassFunction(masm, Runtime::kLazyCompile);
799 {
800 FrameScope scope(masm, StackFrame::INTERNAL);
801
802 // Preserve the function.
803 __ push(r1);
804 // Push call kind information.
805 __ push(r5);
806
807 // Push the function on the stack as the argument to the runtime function.
808 __ push(r1);
809 __ CallRuntime(Runtime::kLazyCompile, 1);
810 // Calculate the entry point.
811 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
812
813 // Restore call kind information.
814 __ pop(r5);
815 // Restore saved function.
816 __ pop(r1);
817
818 // Tear down internal frame.
819 }
820
821 // Do a tail-call of the compiled function. 782 // Do a tail-call of the compiled function.
783 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
822 __ Jump(r2); 784 __ Jump(r2);
823 } 785 }
824 786
825 787
826 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { 788 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) {
827 // Enter an internal frame. 789 CallRuntimePassFunction(masm, Runtime::kLazyRecompile);
828 {
829 FrameScope scope(masm, StackFrame::INTERNAL);
830
831 // Preserve the function.
832 __ push(r1);
833 // Push call kind information.
834 __ push(r5);
835
836 // Push the function on the stack as the argument to the runtime function.
837 __ push(r1);
838 __ CallRuntime(Runtime::kLazyRecompile, 1);
839 // Calculate the entry point.
840 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
841
842 // Restore call kind information.
843 __ pop(r5);
844 // Restore saved function.
845 __ pop(r1);
846
847 // Tear down internal frame.
848 }
849
850 // Do a tail-call of the compiled function. 790 // Do a tail-call of the compiled function.
791 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
851 __ Jump(r2); 792 __ Jump(r2);
852 } 793 }
853 794
854 795
855 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { 796 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
856 // For now, we are relying on the fact that make_code_young doesn't do any 797 // For now, we are relying on the fact that make_code_young doesn't do any
857 // garbage collection which allows us to save/restore the registers without 798 // garbage collection which allows us to save/restore the registers without
858 // worrying about which of them contain pointers. We also don't build an 799 // worrying about which of them contain pointers. We also don't build an
859 // internal frame to make the code faster, since we shouldn't have to do stack 800 // internal frame to make the code faster, since we shouldn't have to do stack
860 // crawls in MakeCodeYoung. This seems a bit fragile. 801 // crawls in MakeCodeYoung. This seems a bit fragile.
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 __ bind(&dont_adapt_arguments); 1433 __ bind(&dont_adapt_arguments);
1493 __ Jump(r3); 1434 __ Jump(r3);
1494 } 1435 }
1495 1436
1496 1437
1497 #undef __ 1438 #undef __
1498 1439
1499 } } // namespace v8::internal 1440 } } // namespace v8::internal
1500 1441
1501 #endif // V8_TARGET_ARCH_ARM 1442 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/builtins.h » ('j') | src/execution.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698