| 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 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 __ bind(&dont_adapt_arguments); | 1386 __ bind(&dont_adapt_arguments); |
| 1387 __ jmp(rdx); | 1387 __ jmp(rdx); |
| 1388 } | 1388 } |
| 1389 | 1389 |
| 1390 | 1390 |
| 1391 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1391 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1392 // Lookup the function in the JavaScript frame. | 1392 // Lookup the function in the JavaScript frame. |
| 1393 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1393 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1394 { | 1394 { |
| 1395 FrameScope scope(masm, StackFrame::INTERNAL); | 1395 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1396 // Lookup and calculate pc offset. | 1396 // Pass function as argument. |
| 1397 __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerPCOffset)); | |
| 1398 __ movq(rbx, FieldOperand(rax, JSFunction::kSharedFunctionInfoOffset)); | |
| 1399 __ subq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); | |
| 1400 __ subq(rdx, FieldOperand(rbx, SharedFunctionInfo::kCodeOffset)); | |
| 1401 __ Integer32ToSmi(rdx, rdx); | |
| 1402 | |
| 1403 // Pass both function and pc offset as arguments. | |
| 1404 __ push(rax); | 1397 __ push(rax); |
| 1405 __ push(rdx); | 1398 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); |
| 1406 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 2); | |
| 1407 } | 1399 } |
| 1408 | 1400 |
| 1409 Label skip; | 1401 Label skip; |
| 1410 // If the code object is null, just return to the unoptimized code. | 1402 // If the code object is null, just return to the unoptimized code. |
| 1411 __ cmpq(rax, Immediate(0)); | 1403 __ cmpq(rax, Immediate(0)); |
| 1412 __ j(not_equal, &skip, Label::kNear); | 1404 __ j(not_equal, &skip, Label::kNear); |
| 1413 __ ret(0); | 1405 __ ret(0); |
| 1414 | 1406 |
| 1415 __ bind(&skip); | 1407 __ bind(&skip); |
| 1416 | 1408 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1447 __ bind(&ok); | 1439 __ bind(&ok); |
| 1448 __ ret(0); | 1440 __ ret(0); |
| 1449 } | 1441 } |
| 1450 | 1442 |
| 1451 | 1443 |
| 1452 #undef __ | 1444 #undef __ |
| 1453 | 1445 |
| 1454 } } // namespace v8::internal | 1446 } } // namespace v8::internal |
| 1455 | 1447 |
| 1456 #endif // V8_TARGET_ARCH_X64 | 1448 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |