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

Side by Side Diff: src/arm/full-codegen-arm.cc

Issue 16695006: Delegating yield does not re-box result objects (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 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 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 2039
2040 // catch (e) { receiver = iter; f = 'throw'; arg = e; goto l_call; } 2040 // catch (e) { receiver = iter; f = 'throw'; arg = e; goto l_call; }
2041 __ bind(&l_catch); 2041 __ bind(&l_catch);
2042 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); 2042 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos()));
2043 __ LoadRoot(r2, Heap::kthrow_stringRootIndex); // "throw" 2043 __ LoadRoot(r2, Heap::kthrow_stringRootIndex); // "throw"
2044 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter 2044 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter
2045 __ push(r3); // iter 2045 __ push(r3); // iter
2046 __ push(r0); // exception 2046 __ push(r0); // exception
2047 __ jmp(&l_call); 2047 __ jmp(&l_call);
2048 2048
2049 // try { received = yield result.value } 2049 // try { received = %yield result }
2050 // Shuffle the received result above a try handler and yield it without
2051 // re-boxing.
2050 __ bind(&l_try); 2052 __ bind(&l_try);
2051 EmitCreateIteratorResult(false); // pop and box to r0 2053 __ pop(r0); // result
2052 __ PushTryHandler(StackHandler::CATCH, expr->index()); 2054 __ PushTryHandler(StackHandler::CATCH, expr->index());
2053 const int handler_size = StackHandlerConstants::kSize; 2055 const int handler_size = StackHandlerConstants::kSize;
2054 __ push(r0); // result 2056 __ push(r0); // result
2055 __ ldr(r3, MemOperand(sp, (0 + 1) * kPointerSize + handler_size)); // g 2057 __ ldr(r3, MemOperand(sp, (0 + 1) * kPointerSize + handler_size)); // g
2056 __ push(r3); // g 2058 __ push(r3); // g
2057 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); 2059 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
2058 __ ldr(context_register(), 2060 __ ldr(context_register(),
2059 MemOperand(fp, StandardFrameConstants::kContextOffset)); 2061 MemOperand(fp, StandardFrameConstants::kContextOffset));
2060 __ CompareRoot(r0, Heap::kTheHoleValueRootIndex); 2062 __ CompareRoot(r0, Heap::kTheHoleValueRootIndex);
2061 __ b(ne, &l_resume); 2063 __ b(ne, &l_resume);
2062 __ pop(r0); // result 2064 __ pop(r0); // result
2063 EmitReturnSequence(); 2065 EmitReturnSequence();
2064 __ bind(&l_resume); // received in r0 2066 __ bind(&l_resume); // received in r0
2065 __ PopTryHandler(); 2067 __ PopTryHandler();
2066 2068
2067 // receiver = iter; f = 'next'; arg = received; 2069 // receiver = iter; f = 'next'; arg = received;
2068 __ bind(&l_next); 2070 __ bind(&l_next);
2069 __ LoadRoot(r2, Heap::knext_stringRootIndex); // "next" 2071 __ LoadRoot(r2, Heap::knext_stringRootIndex); // "next"
2070 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter 2072 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter
2071 __ push(r3); // iter 2073 __ push(r3); // iter
2072 __ push(r0); // received 2074 __ push(r0); // received
2073 2075
2074 // result = receiver[f](arg); 2076 // result = receiver[f](arg);
2075 __ bind(&l_call); 2077 __ bind(&l_call);
2076 Handle<Code> ic = isolate()->stub_cache()->ComputeKeyedCallInitialize(1); 2078 Handle<Code> ic = isolate()->stub_cache()->ComputeKeyedCallInitialize(1);
2077 CallIC(ic); 2079 CallIC(ic);
2078 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2080 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2079 2081
2080 // val = result.value; if (!result.done) goto l_try; 2082 // if (!result.done) goto l_try;
2081 __ bind(&l_loop); 2083 __ bind(&l_loop);
2082 // result.value
2083 __ push(r0); // save result 2084 __ push(r0); // save result
2084 __ LoadRoot(r2, Heap::kvalue_stringRootIndex); // "value"
2085 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize();
2086 CallIC(value_ic); // result.value in r0
2087 __ pop(r1); // result
2088 __ push(r0); // result.value
2089 __ mov(r0, r1); // result
2090 __ LoadRoot(r2, Heap::kdone_stringRootIndex); // "done" 2085 __ LoadRoot(r2, Heap::kdone_stringRootIndex); // "done"
2091 Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize(); 2086 Handle<Code> done_ic = isolate()->builtins()->LoadIC_Initialize();
2092 CallIC(done_ic); // result.done in r0 2087 CallIC(done_ic); // result.done in r0
2093 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); 2088 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate());
2094 CallIC(bool_ic); 2089 CallIC(bool_ic);
2095 __ cmp(r0, Operand(0)); 2090 __ cmp(r0, Operand(0));
2096 __ b(eq, &l_try); 2091 __ b(eq, &l_try);
2097 2092
2098 // result.value 2093 // result.value
2099 __ pop(r0); // result.value 2094 __ pop(r0); // result
2095 __ LoadRoot(r2, Heap::kvalue_stringRootIndex); // "value"
2096 Handle<Code> value_ic = isolate()->builtins()->LoadIC_Initialize();
2097 CallIC(value_ic); // result.value in r0
2100 context()->DropAndPlug(2, r0); // drop iter and g 2098 context()->DropAndPlug(2, r0); // drop iter and g
2101 break; 2099 break;
2102 } 2100 }
2103 } 2101 }
2104 } 2102 }
2105 2103
2106 2104
2107 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, 2105 void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
2108 Expression *value, 2106 Expression *value,
2109 JSGeneratorObject::ResumeMode resume_mode) { 2107 JSGeneratorObject::ResumeMode resume_mode) {
(...skipping 2790 matching lines...) Expand 10 before | Expand all | Expand 10 after
4900 *context_length = 0; 4898 *context_length = 0;
4901 return previous_; 4899 return previous_;
4902 } 4900 }
4903 4901
4904 4902
4905 #undef __ 4903 #undef __
4906 4904
4907 } } // namespace v8::internal 4905 } } // namespace v8::internal
4908 4906
4909 #endif // V8_TARGET_ARCH_ARM 4907 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/full-codegen-ia32.cc » ('j') | test/mjsunit/harmony/generators-iteration.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698