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

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: 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 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1410 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1411 1411
1412 // Pass the function to optimize as the argument to the on-stack 1412 // Pass the function to optimize as the argument to the on-stack
1413 // replacement runtime function. 1413 // replacement runtime function.
1414 { 1414 {
1415 FrameScope scope(masm, StackFrame::INTERNAL); 1415 FrameScope scope(masm, StackFrame::INTERNAL);
1416 __ push(rax); 1416 __ push(rax);
1417 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); 1417 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1);
1418 } 1418 }
1419 1419
1420 // If the result was -1 it means that we couldn't optimize the
1421 // function. Just return and continue in the unoptimized version.
1422 Label skip; 1420 Label skip;
1423 __ SmiCompare(rax, Smi::FromInt(-1)); 1421 // If the code object is null, just return to the unoptimized code.
1422 __ cmpq(rax, Immediate(0));
1424 __ j(not_equal, &skip, Label::kNear); 1423 __ j(not_equal, &skip, Label::kNear);
1425 __ ret(0); 1424 __ ret(0);
1426 1425
1427 __ bind(&skip); 1426 __ bind(&skip);
1428 // Untag the AST id and push it on the stack.
1429 __ SmiToInteger32(rax, rax);
1430 __ push(rax);
1431 1427
1432 // Generate the code for doing the frame-to-frame translation using 1428 // Load deoptimization data from the code object.
1433 // the deoptimizer infrastructure. 1429 __ movq(rbx, Operand(rax, Code::kDeoptimizationDataOffset - kHeapObjectTag));
1434 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1430
1435 generator.Generate(); 1431 // Load the OSR entrypoint offset from the deoptimization data.
1432 __ SmiToInteger32(rbx, Operand(rbx, FixedArray::kHeaderSize +
1433 DeoptimizationInputData::kOsrPcOffsetIndex * kPointerSize
1434 - 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);
1436 } 1444 }
1437 1445
1438 1446
1439 #undef __ 1447 #undef __
1440 1448
1441 } } // namespace v8::internal 1449 } } // namespace v8::internal
1442 1450
1443 #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