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

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

Issue 21340002: Generate a custom OSR entrypoint for OSR compiles on all platforms, and transition to optimized cod… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remerge with recent changes. 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/arm/deoptimizer-arm.cc » ('j') | src/compiler.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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { 968 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
969 // Lookup the function in the JavaScript frame and push it as an 969 // Lookup the function in the JavaScript frame and push it as an
970 // argument to the on-stack replacement function. 970 // argument to the on-stack replacement function.
971 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 971 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
972 { 972 {
973 FrameScope scope(masm, StackFrame::INTERNAL); 973 FrameScope scope(masm, StackFrame::INTERNAL);
974 __ push(r0); 974 __ push(r0);
975 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); 975 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1);
976 } 976 }
977 977
978 // If the result was -1 it means that we couldn't optimize the 978 // If the code object is null, just return to the unoptimized code.
979 // function. Just return and continue in the unoptimized version.
980 Label skip; 979 Label skip;
981 __ cmp(r0, Operand(Smi::FromInt(-1))); 980 __ cmp(r0, Operand(Smi::FromInt(0)));
982 __ b(ne, &skip); 981 __ b(ne, &skip);
983 __ Ret(); 982 __ Ret();
984 983
985 __ bind(&skip); 984 __ bind(&skip);
986 // Untag the AST id and push it on the stack.
987 __ SmiUntag(r0);
988 __ push(r0);
989 985
990 // Generate the code for doing the frame-to-frame translation using 986 // Load deoptimization data from the code object.
991 // the deoptimizer infrastructure. 987 // <deopt_data> = <code>[#deoptimization_data_offset]
992 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 988 __ ldr(r1, MemOperand(r0, Code::kDeoptimizationDataOffset - kHeapObjectTag));
993 generator.Generate(); 989
990 // Load the OSR entrypoint offset from the deoptimization data.
991 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset]
992 __ ldr(r1, MemOperand(r1, FixedArray::OffsetOfElementAt(
993 DeoptimizationInputData::kOsrPcOffsetIndex) - kHeapObjectTag));
994
995 // Compute the target address = code_obj + header_size + osr_offset
996 // <entry_addr> = <code_obj> + #header_size + <osr_offset>
997 __ add(r0, r0, Operand::SmiUntag(r1));
998 __ add(lr, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
999
1000 // And "return" to the OSR entry point of the function.
1001 __ Ret();
994 } 1002 }
995 1003
996 1004
997 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { 1005 void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
998 // 1. Make sure we have at least one argument. 1006 // 1. Make sure we have at least one argument.
999 // r0: actual number of arguments 1007 // r0: actual number of arguments
1000 { Label done; 1008 { Label done;
1001 __ cmp(r0, Operand::Zero()); 1009 __ cmp(r0, Operand::Zero());
1002 __ b(ne, &done); 1010 __ b(ne, &done);
1003 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); 1011 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 __ bind(&dont_adapt_arguments); 1483 __ bind(&dont_adapt_arguments);
1476 __ Jump(r3); 1484 __ Jump(r3);
1477 } 1485 }
1478 1486
1479 1487
1480 #undef __ 1488 #undef __
1481 1489
1482 } } // namespace v8::internal 1490 } } // namespace v8::internal
1483 1491
1484 #endif // V8_TARGET_ARCH_ARM 1492 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/deoptimizer-arm.cc » ('j') | src/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698