Chromium Code Reviews| 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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 968 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 968 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 969 // Lookup the function in the JavaScript frame and push it as an | 969 // Lookup the function in the JavaScript frame and push it as an |
| 970 // argument to the on-stack replacement function. | 970 // argument to the on-stack replacement function. |
| 971 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 971 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 972 { | 972 { |
| 973 FrameScope scope(masm, StackFrame::INTERNAL); | 973 FrameScope scope(masm, StackFrame::INTERNAL); |
| 974 __ push(r0); | 974 __ push(r0); |
| 975 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); | 975 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); |
| 976 } | 976 } |
| 977 | 977 |
| 978 // If the result was -1 it means that we couldn't optimize the | 978 // If the code object is null, just return to the unoptimized code. |
| 979 // function. Just return and continue in the unoptimized version. | |
| 980 Label skip; | 979 Label skip; |
| 981 __ cmp(r0, Operand(Smi::FromInt(-1))); | 980 __ cmp(r0, Operand(Smi::FromInt(0))); |
| 982 __ b(ne, &skip); | 981 __ b(ne, &skip); |
| 983 __ Ret(); | 982 __ Ret(); |
| 984 | 983 |
| 985 __ bind(&skip); | 984 __ bind(&skip); |
| 986 // Untag the AST id and push it on the stack. | |
| 987 __ SmiUntag(r0); | |
| 988 __ push(r0); | |
| 989 | 985 |
| 990 // Generate the code for doing the frame-to-frame translation using | 986 // Load deoptimization data from the code object. |
| 991 // the deoptimizer infrastructure. | 987 // <deopt_data> = <code>[#deoptimization_data_offset] |
| 992 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 988 __ ldr(r1, MemOperand(r0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); |
| 993 generator.Generate(); | 989 |
| 990 // Load the OSR entrypoint offset from the deoptimization data. | |
| 991 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] | |
| 992 __ ldr(r1, MemOperand(r1, FixedArray::kHeaderSize + | |
| 993 DeoptimizationInputData::kOsrPcOffsetIndex * kPointerSize | |
| 994 - kHeapObjectTag)); | |
| 995 __ SmiUntag(r1); | |
| 996 | |
| 997 // Compute the target address = code_obj + header_size + osr_offset | |
| 998 // <entry_addr> = <code_obj> + #header_size + <osr_offset> | |
| 999 __ add(r0, r0, r1); | |
|
vincent.belliard.fr
2013/07/31 15:07:44
You can do the SmiUntag and the add in one instruc
| |
| 1000 __ add(r0, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
|
vincent.belliard.fr
2013/07/31 15:07:44
the result of add can be directly stored in lr. It
| |
| 1001 | |
| 1002 // Overwrite the return address in the link register. | |
| 1003 __ mov(lr, r0); | |
| 1004 | |
| 1005 // And "return" to the OSR entry point of the function. | |
| 1006 __ Ret(); | |
| 994 } | 1007 } |
| 995 | 1008 |
| 996 | 1009 |
| 997 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { | 1010 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
| 998 // 1. Make sure we have at least one argument. | 1011 // 1. Make sure we have at least one argument. |
| 999 // r0: actual number of arguments | 1012 // r0: actual number of arguments |
| 1000 { Label done; | 1013 { Label done; |
| 1001 __ cmp(r0, Operand::Zero()); | 1014 __ cmp(r0, Operand::Zero()); |
| 1002 __ b(ne, &done); | 1015 __ b(ne, &done); |
| 1003 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 1016 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1475 __ bind(&dont_adapt_arguments); | 1488 __ bind(&dont_adapt_arguments); |
| 1476 __ Jump(r3); | 1489 __ Jump(r3); |
| 1477 } | 1490 } |
| 1478 | 1491 |
| 1479 | 1492 |
| 1480 #undef __ | 1493 #undef __ |
| 1481 | 1494 |
| 1482 } } // namespace v8::internal | 1495 } } // namespace v8::internal |
| 1483 | 1496 |
| 1484 #endif // V8_TARGET_ARCH_ARM | 1497 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |