| 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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 | 1320 |
| 1321 // ------------------------------------------- | 1321 // ------------------------------------------- |
| 1322 // Dont adapt arguments. | 1322 // Dont adapt arguments. |
| 1323 // ------------------------------------------- | 1323 // ------------------------------------------- |
| 1324 __ bind(&dont_adapt_arguments); | 1324 __ bind(&dont_adapt_arguments); |
| 1325 __ jmp(edx); | 1325 __ jmp(edx); |
| 1326 } | 1326 } |
| 1327 | 1327 |
| 1328 | 1328 |
| 1329 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1329 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1330 // Lookup the function in the JavaScript frame. |
| 1330 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1331 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1331 | |
| 1332 // Pass the function to optimize as the argument to the on-stack | |
| 1333 // replacement runtime function. | |
| 1334 { | 1332 { |
| 1335 FrameScope scope(masm, StackFrame::INTERNAL); | 1333 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1334 // Lookup and calculate pc offset. |
| 1335 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerPCOffset)); |
| 1336 __ mov(ebx, FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset)); |
| 1337 __ sub(edx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 1338 __ sub(edx, FieldOperand(ebx, SharedFunctionInfo::kCodeOffset)); |
| 1339 __ SmiTag(edx); |
| 1340 |
| 1341 // Pass both function and pc offset as arguments. |
| 1336 __ push(eax); | 1342 __ push(eax); |
| 1337 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); | 1343 __ push(edx); |
| 1344 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 2); |
| 1338 } | 1345 } |
| 1339 | 1346 |
| 1340 Label skip; | 1347 Label skip; |
| 1341 // If the code object is null, just return to the unoptimized code. | 1348 // If the code object is null, just return to the unoptimized code. |
| 1342 __ cmp(eax, Immediate(0)); | 1349 __ cmp(eax, Immediate(0)); |
| 1343 __ j(not_equal, &skip, Label::kNear); | 1350 __ j(not_equal, &skip, Label::kNear); |
| 1344 __ ret(0); | 1351 __ ret(0); |
| 1345 | 1352 |
| 1346 __ bind(&skip); | 1353 __ bind(&skip); |
| 1347 | 1354 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1362 // And "return" to the OSR entry point of the function. | 1369 // And "return" to the OSR entry point of the function. |
| 1363 __ ret(0); | 1370 __ ret(0); |
| 1364 } | 1371 } |
| 1365 | 1372 |
| 1366 | 1373 |
| 1367 #undef __ | 1374 #undef __ |
| 1368 } | 1375 } |
| 1369 } // namespace v8::internal | 1376 } // namespace v8::internal |
| 1370 | 1377 |
| 1371 #endif // V8_TARGET_ARCH_IA32 | 1378 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |