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

Side by Side Diff: src/mips/builtins-mips.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: Created 7 years, 4 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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { 1002 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
1003 // Lookup the function in the JavaScript frame and push it as an 1003 // Lookup the function in the JavaScript frame and push it as an
1004 // argument to the on-stack replacement function. 1004 // argument to the on-stack replacement function.
1005 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1005 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1006 { 1006 {
1007 FrameScope scope(masm, StackFrame::INTERNAL); 1007 FrameScope scope(masm, StackFrame::INTERNAL);
1008 __ push(a0); 1008 __ push(a0);
1009 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); 1009 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1);
1010 } 1010 }
1011 1011
1012 // If the result was -1 it means that we couldn't optimize the 1012 // If the code object is null, just return to the unoptimized code.
1013 // function. Just return and continue in the unoptimized version. 1013 __ Ret(eq, v0, Operand(Smi::FromInt(0)));
1014 __ Ret(eq, v0, Operand(Smi::FromInt(-1)));
1015 1014
1016 // Untag the AST id and push it on the stack. 1015 // Load deoptimization data from the code object.
1017 __ SmiUntag(v0); 1016 // <deopt_data> = <code>[#deoptimization_data_offset]
1018 __ push(v0); 1017 __ lw(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag));
1019 1018
1020 // Generate the code for doing the frame-to-frame translation using 1019 // Load the OSR entrypoint offset from the deoptimization data.
1021 // the deoptimizer infrastructure. 1020 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset]
1022 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1021 __ lw(a1, MemOperand(a1, FixedArray::kHeaderSize +
1023 generator.Generate(); 1022 DeoptimizationInputData::kOsrPcOffsetIndex * kPointerSize
1023 - kHeapObjectTag));
1024 __ SmiUntag(a1);
1025
1026 // Compute the target address = code_obj + header_size + osr_offset
1027 // <entry_addr> = <code_obj> + #header_size + <osr_offset>
1028 __ addu(v0, v0, a1);
1029 __ addiu(v0, v0, Code::kHeaderSize - kHeapObjectTag);
1030
1031 // Overwrite the return address in the link register.
1032 __ Move(ra, v0);
1033
1034 // And "return" to the OSR entry point of the function.
1035 __ Ret();
1024 } 1036 }
1025 1037
1026 1038
1027 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { 1039 void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
1028 // 1. Make sure we have at least one argument. 1040 // 1. Make sure we have at least one argument.
1029 // a0: actual number of arguments 1041 // a0: actual number of arguments
1030 { Label done; 1042 { Label done;
1031 __ Branch(&done, ne, a0, Operand(zero_reg)); 1043 __ Branch(&done, ne, a0, Operand(zero_reg));
1032 __ LoadRoot(t2, Heap::kUndefinedValueRootIndex); 1044 __ LoadRoot(t2, Heap::kUndefinedValueRootIndex);
1033 __ push(t2); 1045 __ push(t2);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 __ bind(&dont_adapt_arguments); 1527 __ bind(&dont_adapt_arguments);
1516 __ Jump(a3); 1528 __ Jump(a3);
1517 } 1529 }
1518 1530
1519 1531
1520 #undef __ 1532 #undef __
1521 1533
1522 } } // namespace v8::internal 1534 } } // namespace v8::internal
1523 1535
1524 #endif // V8_TARGET_ARCH_MIPS 1536 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698