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

Side by Side Diff: src/ia32/builtins-ia32.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: Remerge with recent changes. Created 7 years, 3 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 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1330 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1331 1331
1332 // Pass the function to optimize as the argument to the on-stack 1332 // Pass the function to optimize as the argument to the on-stack
1333 // replacement runtime function. 1333 // replacement runtime function.
1334 { 1334 {
1335 FrameScope scope(masm, StackFrame::INTERNAL); 1335 FrameScope scope(masm, StackFrame::INTERNAL);
1336 __ push(eax); 1336 __ push(eax);
1337 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); 1337 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1);
1338 } 1338 }
1339 1339
1340 // If the result was -1 it means that we couldn't optimize the
1341 // function. Just return and continue in the unoptimized version.
1342 Label skip; 1340 Label skip;
1343 __ cmp(eax, Immediate(Smi::FromInt(-1))); 1341 // If the code object is null, just return to the unoptimized code.
1342 __ cmp(eax, Immediate(0));
1344 __ j(not_equal, &skip, Label::kNear); 1343 __ j(not_equal, &skip, Label::kNear);
1345 __ ret(0); 1344 __ ret(0);
1346 1345
1347 __ bind(&skip); 1346 __ bind(&skip);
1348 // Untag the AST id and push it on the stack.
1349 __ SmiUntag(eax);
1350 __ push(eax);
1351 1347
1352 // Generate the code for doing the frame-to-frame translation using 1348 // Load deoptimization data from the code object.
1353 // the deoptimizer infrastructure. 1349 __ mov(ebx, Operand(eax, Code::kDeoptimizationDataOffset - kHeapObjectTag));
1354 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1350
1355 generator.Generate(); 1351 // Load the OSR entrypoint offset from the deoptimization data.
1352 __ mov(ebx, Operand(ebx, FixedArray::OffsetOfElementAt(
1353 DeoptimizationInputData::kOsrPcOffsetIndex) - kHeapObjectTag));
1354 __ SmiUntag(ebx);
1355
1356 // Compute the target address = code_obj + header_size + osr_offset
1357 __ lea(eax, Operand(eax, ebx, times_1, Code::kHeaderSize - kHeapObjectTag));
1358
1359 // Overwrite the return address on the stack.
1360 __ mov(Operand(esp, 0), eax);
1361
1362 // And "return" to the OSR entry point of the function.
1363 __ ret(0);
1356 } 1364 }
1357 1365
1358 1366
1359 #undef __ 1367 #undef __
1360 } 1368 }
1361 } // namespace v8::internal 1369 } // namespace v8::internal
1362 1370
1363 #endif // V8_TARGET_ARCH_IA32 1371 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698