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

Side by Side Diff: src/arm/full-codegen-arm.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
« no previous file with comments | « no previous file | src/ast.h » ('j') | src/ast.h » ('J')
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 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 case NAMED_PROPERTY: 1915 case NAMED_PROPERTY:
1916 EmitNamedPropertyAssignment(expr); 1916 EmitNamedPropertyAssignment(expr);
1917 break; 1917 break;
1918 case KEYED_PROPERTY: 1918 case KEYED_PROPERTY:
1919 EmitKeyedPropertyAssignment(expr); 1919 EmitKeyedPropertyAssignment(expr);
1920 break; 1920 break;
1921 } 1921 }
1922 } 1922 }
1923 1923
1924 1924
1925 void FullCodeGenerator::VisitYield(Yield* expr) {
1926 Comment cmnt(masm_, "[ Yield");
1927 // Evaluate yielded value first; the initial iterator definition depends on
1928 // this. It stays on the stack while we update the iterator.
1929 VisitForStackValue(expr->expression());
1930 VisitForStackValue(expr->generator_object());
1931
1932 if (expr->kind() == Yield::FINAL) {
1933 // TODO(wingo): Mark the iterator as closed.
1934 } else {
1935 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
1936 __ ldr(context_register(),
1937 MemOperand(fp, StandardFrameConstants::kContextOffset));
1938 }
1939
1940 Label resume;
1941 __ CompareRoot(result_register(), Heap::kTheHoleValueRootIndex);
1942 __ b(ne, &resume);
1943 switch (expr->kind()) {
1944 case Yield::INITIAL:
1945 __ pop(result_register());
1946 break;
1947 case Yield::SUSPEND:
1948 // TODO(wingo): Box into { value: VALUE, done: false }.
1949 __ pop(result_register());
1950 break;
1951 case Yield::FINAL:
1952 // TODO(wingo): Box into { value: VALUE, done: true }.
1953 __ pop(result_register());
1954 break;
1955 case Yield::DELEGATING:
1956 UNIMPLEMENTED();
1957 }
1958 EmitReturnSequence();
1959
1960 __ bind(&resume);
1961 context()->Plug(result_register());
1962 }
1963
1964
1925 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 1965 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
1926 SetSourcePosition(prop->position()); 1966 SetSourcePosition(prop->position());
1927 Literal* key = prop->key()->AsLiteral(); 1967 Literal* key = prop->key()->AsLiteral();
1928 __ mov(r2, Operand(key->handle())); 1968 __ mov(r2, Operand(key->handle()));
1929 // Call load IC. It has arguments receiver and property name r0 and r2. 1969 // Call load IC. It has arguments receiver and property name r0 and r2.
1930 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 1970 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
1931 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); 1971 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId());
1932 } 1972 }
1933 1973
1934 1974
(...skipping 2633 matching lines...) Expand 10 before | Expand all | Expand 10 after
4568 *context_length = 0; 4608 *context_length = 0;
4569 return previous_; 4609 return previous_;
4570 } 4610 }
4571 4611
4572 4612
4573 #undef __ 4613 #undef __
4574 4614
4575 } } // namespace v8::internal 4615 } } // namespace v8::internal
4576 4616
4577 #endif // V8_TARGET_ARCH_ARM 4617 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ast.h » ('j') | src/ast.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698