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

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

Issue 13704010: Generator objects can suspend (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Tighten typing on generator object contexts Created 7 years, 8 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
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 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 case NAMED_PROPERTY: 1876 case NAMED_PROPERTY:
1877 EmitNamedPropertyAssignment(expr); 1877 EmitNamedPropertyAssignment(expr);
1878 break; 1878 break;
1879 case KEYED_PROPERTY: 1879 case KEYED_PROPERTY:
1880 EmitKeyedPropertyAssignment(expr); 1880 EmitKeyedPropertyAssignment(expr);
1881 break; 1881 break;
1882 } 1882 }
1883 } 1883 }
1884 1884
1885 1885
1886 void FullCodeGenerator::VisitYield(Yield* expr) {
1887 Comment cmnt(masm_, "[ Yield");
1888 // Evaluate yielded value first; the initial iterator definition depends on
1889 // this. It stays on the stack while we update the iterator.
1890 VisitForStackValue(expr->expression());
1891 VisitForStackValue(expr->generator_object());
1892
1893 if (expr->kind() == Yield::FINAL) {
Michael Starzinger 2013/04/17 13:43:48 For the record: I think it will be best to just pa
1894 // TODO(wingo): Mark the iterator as closed.
1895 } else {
1896 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
1897 __ mov(context_register(),
1898 Operand(ebp, StandardFrameConstants::kContextOffset));
1899 }
1900
1901 Label resume;
1902 __ CompareRoot(result_register(), Heap::kTheHoleValueRootIndex);
1903 __ j(not_equal, &resume);
1904 switch (expr->kind()) {
1905 case Yield::INITIAL:
1906 __ pop(result_register());
1907 break;
1908 case Yield::SUSPEND:
1909 // TODO(wingo): Box into { value: VALUE, done: false }.
1910 __ pop(result_register());
1911 break;
1912 case Yield::FINAL:
1913 // TODO(wingo): Box into { value: VALUE, done: true }.
1914 __ pop(result_register());
1915 break;
1916 case Yield::DELEGATING:
1917 UNIMPLEMENTED();
1918 }
1919 EmitReturnSequence();
1920
1921 __ bind(&resume);
1922 context()->Plug(result_register());
1923 }
1924
1925
1886 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 1926 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
1887 SetSourcePosition(prop->position()); 1927 SetSourcePosition(prop->position());
1888 Literal* key = prop->key()->AsLiteral(); 1928 Literal* key = prop->key()->AsLiteral();
1889 ASSERT(!key->handle()->IsSmi()); 1929 ASSERT(!key->handle()->IsSmi());
1890 __ mov(ecx, Immediate(key->handle())); 1930 __ mov(ecx, Immediate(key->handle()));
1891 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 1931 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
1892 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); 1932 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId());
1893 } 1933 }
1894 1934
1895 1935
(...skipping 2662 matching lines...) Expand 10 before | Expand all | Expand 10 after
4558 *stack_depth = 0; 4598 *stack_depth = 0;
4559 *context_length = 0; 4599 *context_length = 0;
4560 return previous_; 4600 return previous_;
4561 } 4601 }
4562 4602
4563 #undef __ 4603 #undef __
4564 4604
4565 } } // namespace v8::internal 4605 } } // namespace v8::internal
4566 4606
4567 #endif // V8_TARGET_ARCH_IA32 4607 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698