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

Side by Side Diff: src/x64/full-codegen-x64.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
« src/runtime.cc ('K') | « src/runtime.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 case NAMED_PROPERTY: 1900 case NAMED_PROPERTY:
1901 EmitNamedPropertyAssignment(expr); 1901 EmitNamedPropertyAssignment(expr);
1902 break; 1902 break;
1903 case KEYED_PROPERTY: 1903 case KEYED_PROPERTY:
1904 EmitKeyedPropertyAssignment(expr); 1904 EmitKeyedPropertyAssignment(expr);
1905 break; 1905 break;
1906 } 1906 }
1907 } 1907 }
1908 1908
1909 1909
1910 void FullCodeGenerator::VisitYield(Yield* expr) {
1911 Comment cmnt(masm_, "[ Yield");
1912 // Evaluate yielded value first; the initial iterator definition depends on
1913 // this. It stays on the stack while we update the iterator.
1914 VisitForStackValue(expr->expression());
1915 VisitForStackValue(expr->generator_object());
1916
1917 if (expr->kind() == Yield::FINAL) {
1918 // TODO(wingo): Mark the iterator as closed.
1919 } else {
1920 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
1921 __ movq(context_register(),
1922 Operand(rbp, StandardFrameConstants::kContextOffset));
1923 }
1924
1925 Label resume;
1926 __ CompareRoot(result_register(), Heap::kTheHoleValueRootIndex);
1927 __ j(not_equal, &resume);
1928 switch (expr->kind()) {
1929 case Yield::INITIAL:
1930 __ pop(result_register());
1931 break;
1932 case Yield::SUSPEND:
1933 // TODO(wingo): Box into { value: VALUE, done: false }.
1934 __ pop(result_register());
1935 break;
1936 case Yield::FINAL:
1937 // TODO(wingo): Box into { value: VALUE, done: true }.
1938 __ pop(result_register());
1939 break;
1940 case Yield::DELEGATING:
1941 UNIMPLEMENTED();
1942 }
1943 EmitReturnSequence();
1944
1945 __ bind(&resume);
1946 context()->Plug(result_register());
1947 }
1948
1949
1910 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 1950 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
1911 SetSourcePosition(prop->position()); 1951 SetSourcePosition(prop->position());
1912 Literal* key = prop->key()->AsLiteral(); 1952 Literal* key = prop->key()->AsLiteral();
1913 __ Move(rcx, key->handle()); 1953 __ Move(rcx, key->handle());
1914 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 1954 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
1915 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); 1955 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId());
1916 } 1956 }
1917 1957
1918 1958
1919 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 1959 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
(...skipping 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after
4559 *context_length = 0; 4599 *context_length = 0;
4560 return previous_; 4600 return previous_;
4561 } 4601 }
4562 4602
4563 4603
4564 #undef __ 4604 #undef __
4565 4605
4566 } } // namespace v8::internal 4606 } } // namespace v8::internal
4567 4607
4568 #endif // V8_TARGET_ARCH_X64 4608 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/runtime.cc ('K') | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698