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

Side by Side Diff: src/x64/builtins-x64.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
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 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1411 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1412 1412
1413 // Pass the function to optimize as the argument to the on-stack 1413 // Pass the function to optimize as the argument to the on-stack
1414 // replacement runtime function. 1414 // replacement runtime function.
1415 { 1415 {
1416 FrameScope scope(masm, StackFrame::INTERNAL); 1416 FrameScope scope(masm, StackFrame::INTERNAL);
1417 __ push(rax); 1417 __ push(rax);
1418 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); 1418 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1);
1419 } 1419 }
1420 1420
1421 // If the result was -1 it means that we couldn't optimize the
1422 // function. Just return and continue in the unoptimized version.
1423 Label skip; 1421 Label skip;
1424 __ SmiCompare(rax, Smi::FromInt(-1)); 1422 // If the code object is null, just return to the unoptimized code.
1423 __ cmpq(rax, Immediate(0));
1425 __ j(not_equal, &skip, Label::kNear); 1424 __ j(not_equal, &skip, Label::kNear);
1426 __ ret(0); 1425 __ ret(0);
1427 1426
1428 __ bind(&skip); 1427 __ bind(&skip);
1429 // Untag the AST id and push it on the stack.
1430 __ SmiToInteger32(rax, rax);
1431 __ push(rax);
1432 1428
1433 // Generate the code for doing the frame-to-frame translation using 1429 // Load deoptimization data from the code object.
1434 // the deoptimizer infrastructure. 1430 __ movq(rbx, Operand(rax, Code::kDeoptimizationDataOffset - kHeapObjectTag));
1435 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1431
1436 generator.Generate(); 1432 // Load the OSR entrypoint offset from the deoptimization data.
1433 __ SmiToInteger32(rbx, Operand(rbx, FixedArray::OffsetOfElementAt(
1434 DeoptimizationInputData::kOsrPcOffsetIndex) - kHeapObjectTag));
1435
1436 // Compute the target address = code_obj + header_size + osr_offset
1437 __ lea(rax, Operand(rax, rbx, times_1, Code::kHeaderSize - kHeapObjectTag));
1438
1439 // Overwrite the return address on the stack.
1440 __ movq(Operand(rsp, 0), rax);
1441
1442 // And "return" to the OSR entry point of the function.
1443 __ ret(0);
1437 } 1444 }
1438 1445
1439 1446
1440 #undef __ 1447 #undef __
1441 1448
1442 } } // namespace v8::internal 1449 } } // namespace v8::internal
1443 1450
1444 #endif // V8_TARGET_ARCH_X64 1451 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/runtime.cc ('K') | « src/runtime.cc ('k') | src/x64/deoptimizer-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698