OLD | NEW |
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 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 | 1401 |
1402 // ------------------------------------------- | 1402 // ------------------------------------------- |
1403 // Dont adapt arguments. | 1403 // Dont adapt arguments. |
1404 // ------------------------------------------- | 1404 // ------------------------------------------- |
1405 __ bind(&dont_adapt_arguments); | 1405 __ bind(&dont_adapt_arguments); |
1406 __ jmp(rdx); | 1406 __ jmp(rdx); |
1407 } | 1407 } |
1408 | 1408 |
1409 | 1409 |
1410 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1410 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1411 // Lookup the function in the JavaScript frame. |
1411 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1412 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1412 | |
1413 // Pass the function to optimize as the argument to the on-stack | |
1414 // replacement runtime function. | |
1415 { | 1413 { |
1416 FrameScope scope(masm, StackFrame::INTERNAL); | 1414 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1415 // Lookup and calculate pc offset. |
| 1416 __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerPCOffset)); |
| 1417 __ movq(rbx, FieldOperand(rax, JSFunction::kSharedFunctionInfoOffset)); |
| 1418 __ subq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 1419 __ subq(rdx, FieldOperand(rbx, SharedFunctionInfo::kCodeOffset)); |
| 1420 __ Integer32ToSmi(rdx, rdx); |
| 1421 |
| 1422 // Pass both function and pc offset as arguments. |
1417 __ push(rax); | 1423 __ push(rax); |
1418 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); | 1424 __ push(rdx); |
| 1425 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 2); |
1419 } | 1426 } |
1420 | 1427 |
1421 Label skip; | 1428 Label skip; |
1422 // If the code object is null, just return to the unoptimized code. | 1429 // If the code object is null, just return to the unoptimized code. |
1423 __ cmpq(rax, Immediate(0)); | 1430 __ cmpq(rax, Immediate(0)); |
1424 __ j(not_equal, &skip, Label::kNear); | 1431 __ j(not_equal, &skip, Label::kNear); |
1425 __ ret(0); | 1432 __ ret(0); |
1426 | 1433 |
1427 __ bind(&skip); | 1434 __ bind(&skip); |
1428 | 1435 |
(...skipping 13 matching lines...) Expand all Loading... |
1442 // And "return" to the OSR entry point of the function. | 1449 // And "return" to the OSR entry point of the function. |
1443 __ ret(0); | 1450 __ ret(0); |
1444 } | 1451 } |
1445 | 1452 |
1446 | 1453 |
1447 #undef __ | 1454 #undef __ |
1448 | 1455 |
1449 } } // namespace v8::internal | 1456 } } // namespace v8::internal |
1450 | 1457 |
1451 #endif // V8_TARGET_ARCH_X64 | 1458 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |