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 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
| 1931 switch (expr->yield_kind()) { |
| 1932 case Yield::INITIAL: |
| 1933 case Yield::SUSPEND: { |
| 1934 VisitForStackValue(expr->generator_object()); |
| 1935 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
| 1936 __ ldr(context_register(), |
| 1937 MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1938 |
| 1939 Label resume; |
| 1940 __ CompareRoot(result_register(), Heap::kTheHoleValueRootIndex); |
| 1941 __ b(ne, &resume); |
| 1942 __ pop(result_register()); |
| 1943 if (expr->yield_kind() == Yield::SUSPEND) { |
| 1944 // TODO(wingo): Box into { value: VALUE, done: false }. |
| 1945 } |
| 1946 EmitReturnSequence(); |
| 1947 |
| 1948 __ bind(&resume); |
| 1949 context()->Plug(result_register()); |
| 1950 break; |
| 1951 } |
| 1952 |
| 1953 case Yield::FINAL: { |
| 1954 VisitForAccumulatorValue(expr->generator_object()); |
| 1955 __ mov(r1, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); |
| 1956 __ str(r1, FieldMemOperand(result_register(), |
| 1957 JSGeneratorObject::kContinuationOffset)); |
| 1958 __ pop(result_register()); |
| 1959 // TODO(wingo): Box into { value: VALUE, done: true }. |
| 1960 |
| 1961 // Exit all nested statements. |
| 1962 NestedStatement* current = nesting_stack_; |
| 1963 int stack_depth = 0; |
| 1964 int context_length = 0; |
| 1965 while (current != NULL) { |
| 1966 current = current->Exit(&stack_depth, &context_length); |
| 1967 } |
| 1968 __ Drop(stack_depth); |
| 1969 EmitReturnSequence(); |
| 1970 break; |
| 1971 } |
| 1972 |
| 1973 case Yield::DELEGATING: |
| 1974 UNIMPLEMENTED(); |
| 1975 } |
| 1976 } |
| 1977 |
| 1978 |
1925 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 1979 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
1926 SetSourcePosition(prop->position()); | 1980 SetSourcePosition(prop->position()); |
1927 Literal* key = prop->key()->AsLiteral(); | 1981 Literal* key = prop->key()->AsLiteral(); |
1928 __ mov(r2, Operand(key->handle())); | 1982 __ mov(r2, Operand(key->handle())); |
1929 // Call load IC. It has arguments receiver and property name r0 and r2. | 1983 // Call load IC. It has arguments receiver and property name r0 and r2. |
1930 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 1984 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
1931 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); | 1985 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); |
1932 } | 1986 } |
1933 | 1987 |
1934 | 1988 |
(...skipping 2633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4568 *context_length = 0; | 4622 *context_length = 0; |
4569 return previous_; | 4623 return previous_; |
4570 } | 4624 } |
4571 | 4625 |
4572 | 4626 |
4573 #undef __ | 4627 #undef __ |
4574 | 4628 |
4575 } } // namespace v8::internal | 4629 } } // namespace v8::internal |
4576 | 4630 |
4577 #endif // V8_TARGET_ARCH_ARM | 4631 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |