OLD | NEW |
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 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1919 case NAMED_PROPERTY: | 1919 case NAMED_PROPERTY: |
1920 EmitNamedPropertyAssignment(expr); | 1920 EmitNamedPropertyAssignment(expr); |
1921 break; | 1921 break; |
1922 case KEYED_PROPERTY: | 1922 case KEYED_PROPERTY: |
1923 EmitKeyedPropertyAssignment(expr); | 1923 EmitKeyedPropertyAssignment(expr); |
1924 break; | 1924 break; |
1925 } | 1925 } |
1926 } | 1926 } |
1927 | 1927 |
1928 | 1928 |
| 1929 void FullCodeGenerator::VisitYield(Yield* expr) { |
| 1930 Comment cmnt(masm_, "[ Yield"); |
| 1931 // Evaluate yielded value first; the initial iterator definition depends on |
| 1932 // this. It stays on the stack while we update the iterator. |
| 1933 VisitForStackValue(expr->expression()); |
| 1934 |
| 1935 switch (expr->yield_kind()) { |
| 1936 case Yield::INITIAL: |
| 1937 case Yield::SUSPEND: { |
| 1938 VisitForStackValue(expr->generator_object()); |
| 1939 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
| 1940 __ lw(context_register(), |
| 1941 MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1942 |
| 1943 Label resume; |
| 1944 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 1945 __ Branch(&resume, ne, result_register(), Operand(at)); |
| 1946 __ pop(result_register()); |
| 1947 if (expr->yield_kind() == Yield::SUSPEND) { |
| 1948 // TODO(wingo): Box into { value: VALUE, done: false }. |
| 1949 } |
| 1950 EmitReturnSequence(); |
| 1951 |
| 1952 __ bind(&resume); |
| 1953 context()->Plug(result_register()); |
| 1954 break; |
| 1955 } |
| 1956 |
| 1957 case Yield::FINAL: { |
| 1958 VisitForAccumulatorValue(expr->generator_object()); |
| 1959 __ li(a1, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); |
| 1960 __ sw(a1, FieldMemOperand(result_register(), |
| 1961 JSGeneratorObject::kContinuationOffset)); |
| 1962 __ pop(result_register()); |
| 1963 // TODO(wingo): Box into { value: VALUE, done: true }. |
| 1964 |
| 1965 // Exit all nested statements. |
| 1966 NestedStatement* current = nesting_stack_; |
| 1967 int stack_depth = 0; |
| 1968 int context_length = 0; |
| 1969 while (current != NULL) { |
| 1970 current = current->Exit(&stack_depth, &context_length); |
| 1971 } |
| 1972 __ Drop(stack_depth); |
| 1973 EmitReturnSequence(); |
| 1974 break; |
| 1975 } |
| 1976 |
| 1977 case Yield::DELEGATING: |
| 1978 UNIMPLEMENTED(); |
| 1979 } |
| 1980 } |
| 1981 |
| 1982 |
1929 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 1983 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
1930 SetSourcePosition(prop->position()); | 1984 SetSourcePosition(prop->position()); |
1931 Literal* key = prop->key()->AsLiteral(); | 1985 Literal* key = prop->key()->AsLiteral(); |
1932 __ mov(a0, result_register()); | 1986 __ mov(a0, result_register()); |
1933 __ li(a2, Operand(key->handle())); | 1987 __ li(a2, Operand(key->handle())); |
1934 // Call load IC. It has arguments receiver and property name a0 and a2. | 1988 // Call load IC. It has arguments receiver and property name a0 and a2. |
1935 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 1989 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
1936 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); | 1990 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); |
1937 } | 1991 } |
1938 | 1992 |
(...skipping 2631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4570 *context_length = 0; | 4624 *context_length = 0; |
4571 return previous_; | 4625 return previous_; |
4572 } | 4626 } |
4573 | 4627 |
4574 | 4628 |
4575 #undef __ | 4629 #undef __ |
4576 | 4630 |
4577 } } // namespace v8::internal | 4631 } } // namespace v8::internal |
4578 | 4632 |
4579 #endif // V8_TARGET_ARCH_MIPS | 4633 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |