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

Unified Diff: src/x64/full-codegen-x64.cc

Issue 16695006: Delegating yield does not re-box result objects (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase; make test pretty. Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | test/mjsunit/harmony/generators-iteration.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/full-codegen-x64.cc
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
index 36f707f6b2a13b4d4f335a47ac9f4cd18ae9dcbd..4afcadbd2d7479990d5594b0c52c641aa1e20128 100644
--- a/src/x64/full-codegen-x64.cc
+++ b/src/x64/full-codegen-x64.cc
@@ -2026,9 +2026,11 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
__ push(rax); // exception
__ jmp(&l_call);
- // try { received = yield result.value }
+ // try { received = %yield result }
+ // Shuffle the received result above a try handler and yield it without
+ // re-boxing.
__ bind(&l_try);
- EmitCreateIteratorResult(false); // pop and box to rax
+ __ pop(rax); // result
__ PushTryHandler(StackHandler::CATCH, expr->index());
const int handler_size = StackHandlerConstants::kSize;
__ push(rax); // result
@@ -2057,16 +2059,9 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
__ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
__ Drop(1); // The key is still on the stack; drop it.
- // val = result.value; if (!result.done) goto l_try;
+ // if (!result.done) goto l_try;
__ bind(&l_loop);
- // result.value
__ push(rax); // save result
- __ LoadRoot(rcx, Heap::kvalue_stringRootIndex); // "value"
- Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize();
- CallIC(value_ic); // result.value in rax
- __ pop(rbx); // result
- __ push(rax); // result.value
- __ movq(rax, rbx); // result
__ LoadRoot(rcx, Heap::kdone_stringRootIndex); // "done"
Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize();
CallIC(done_ic); // result.done in rax
@@ -2076,7 +2071,10 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
__ j(zero, &l_try);
// result.value
- __ pop(rax); // result.value
+ __ pop(rax); // result
+ __ LoadRoot(rcx, Heap::kvalue_stringRootIndex); // "value"
+ Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize();
+ CallIC(value_ic); // result.value in rax
context()->DropAndPlug(2, rax); // drop iter and g
break;
}
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | test/mjsunit/harmony/generators-iteration.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698