| 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 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1932     case Yield::INITIAL: | 1932     case Yield::INITIAL: | 
| 1933     case Yield::SUSPEND: { | 1933     case Yield::SUSPEND: { | 
| 1934       VisitForStackValue(expr->generator_object()); | 1934       VisitForStackValue(expr->generator_object()); | 
| 1935       __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 1935       __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 
| 1936       __ ldr(context_register(), | 1936       __ ldr(context_register(), | 
| 1937              MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1937              MemOperand(fp, StandardFrameConstants::kContextOffset)); | 
| 1938 | 1938 | 
| 1939       Label resume; | 1939       Label resume; | 
| 1940       __ CompareRoot(result_register(), Heap::kTheHoleValueRootIndex); | 1940       __ CompareRoot(result_register(), Heap::kTheHoleValueRootIndex); | 
| 1941       __ b(ne, &resume); | 1941       __ b(ne, &resume); | 
| 1942       __ pop(result_register()); |  | 
| 1943       if (expr->yield_kind() == Yield::SUSPEND) { | 1942       if (expr->yield_kind() == Yield::SUSPEND) { | 
| 1944         // TODO(wingo): Box into { value: VALUE, done: false }. | 1943         EmitReturnIteratorResult(false); | 
|  | 1944       } else { | 
|  | 1945         __ pop(result_register()); | 
|  | 1946         EmitReturnSequence(); | 
| 1945       } | 1947       } | 
| 1946       EmitReturnSequence(); |  | 
| 1947 | 1948 | 
| 1948       __ bind(&resume); | 1949       __ bind(&resume); | 
| 1949       context()->Plug(result_register()); | 1950       context()->Plug(result_register()); | 
| 1950       break; | 1951       break; | 
| 1951     } | 1952     } | 
| 1952 | 1953 | 
| 1953     case Yield::FINAL: { | 1954     case Yield::FINAL: { | 
| 1954       VisitForAccumulatorValue(expr->generator_object()); | 1955       VisitForAccumulatorValue(expr->generator_object()); | 
| 1955       __ mov(r1, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); | 1956       __ mov(r1, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); | 
| 1956       __ str(r1, FieldMemOperand(result_register(), | 1957       __ str(r1, FieldMemOperand(result_register(), | 
| 1957                                  JSGeneratorObject::kContinuationOffset)); | 1958                                  JSGeneratorObject::kContinuationOffset)); | 
| 1958       __ pop(result_register()); | 1959       EmitReturnIteratorResult(true); | 
| 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; | 1960       break; | 
| 1971     } | 1961     } | 
| 1972 | 1962 | 
| 1973     case Yield::DELEGATING: | 1963     case Yield::DELEGATING: | 
| 1974       UNIMPLEMENTED(); | 1964       UNIMPLEMENTED(); | 
| 1975   } | 1965   } | 
| 1976 } | 1966 } | 
| 1977 | 1967 | 
| 1978 | 1968 | 
| 1979 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 1969 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2067   // Throw error if we attempt to operate on a running generator. | 2057   // Throw error if we attempt to operate on a running generator. | 
| 2068   __ bind(&wrong_state); | 2058   __ bind(&wrong_state); | 
| 2069   __ push(r1); | 2059   __ push(r1); | 
| 2070   __ CallRuntime(Runtime::kThrowGeneratorStateError, 1); | 2060   __ CallRuntime(Runtime::kThrowGeneratorStateError, 1); | 
| 2071 | 2061 | 
| 2072   __ bind(&done); | 2062   __ bind(&done); | 
| 2073   context()->Plug(result_register()); | 2063   context()->Plug(result_register()); | 
| 2074 } | 2064 } | 
| 2075 | 2065 | 
| 2076 | 2066 | 
|  | 2067 void FullCodeGenerator::EmitReturnIteratorResult(bool done) { | 
|  | 2068   Label gc_required; | 
|  | 2069   Label allocated; | 
|  | 2070 | 
|  | 2071   STATIC_ASSERT(HeapObject::kMapOffset == 0); | 
|  | 2072   STATIC_ASSERT(JSObject::kPropertiesOffset == kPointerSize); | 
|  | 2073   STATIC_ASSERT(JSObject::kElementsOffset == 2 * kPointerSize); | 
|  | 2074   STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); | 
|  | 2075   STATIC_ASSERT(JSGeneratorObject::kResultValuePropertyIndex == 0); | 
|  | 2076   STATIC_ASSERT(JSGeneratorObject::kResultDonePropertyIndex == 1); | 
|  | 2077 | 
|  | 2078   const int size = 5 * kPointerSize; | 
|  | 2079   __ Allocate(size, r0, r2, r3, &gc_required, TAG_OBJECT); | 
|  | 2080 | 
|  | 2081   __ bind(&allocated); | 
|  | 2082   // The object is now in r0.  Initialize its map, value, and done fields. | 
|  | 2083   Handle<Map> map(isolate()->native_context()->iterator_result_map()); | 
|  | 2084   __ mov(r1, Operand(map)); | 
|  | 2085   __ pop(r2); | 
|  | 2086   __ mov(r3, | 
|  | 2087          done | 
|  | 2088          ? Operand(isolate()->factory()->true_value()) | 
|  | 2089          : Operand(isolate()->factory()->false_value())); | 
|  | 2090   __ mov(r4, Operand(isolate()->factory()->empty_fixed_array())); | 
|  | 2091   __ str(r1, FieldMemOperand(r0, 0 * kPointerSize));  // map | 
|  | 2092   __ str(r4, FieldMemOperand(r0, 1 * kPointerSize));  // properties | 
|  | 2093   __ str(r4, FieldMemOperand(r0, 2 * kPointerSize));  // elements | 
|  | 2094   __ str(r2, FieldMemOperand(r0, 3 * kPointerSize));  // value | 
|  | 2095   __ str(r3, FieldMemOperand(r0, 4 * kPointerSize));  // done? | 
|  | 2096 | 
|  | 2097   // Only the value field needs a write barrier, as the other values are in the | 
|  | 2098   // root set. | 
|  | 2099   __ RecordWriteField(r0, 3 * kPointerSize, r2, r3, | 
|  | 2100                       kLRHasBeenSaved, kDontSaveFPRegs); | 
|  | 2101 | 
|  | 2102   if (done) { | 
|  | 2103     // Exit all nested statements. | 
|  | 2104     NestedStatement* current = nesting_stack_; | 
|  | 2105     int stack_depth = 0; | 
|  | 2106     int context_length = 0; | 
|  | 2107     while (current != NULL) { | 
|  | 2108       current = current->Exit(&stack_depth, &context_length); | 
|  | 2109     } | 
|  | 2110     __ Drop(stack_depth); | 
|  | 2111   } | 
|  | 2112 | 
|  | 2113   EmitReturnSequence(); | 
|  | 2114 | 
|  | 2115   __ bind(&gc_required); | 
|  | 2116   __ Push(Smi::FromInt(size)); | 
|  | 2117   __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | 
|  | 2118   __ ldr(context_register(), | 
|  | 2119          MemOperand(fp, StandardFrameConstants::kContextOffset)); | 
|  | 2120   __ jmp(&allocated); | 
|  | 2121 } | 
|  | 2122 | 
|  | 2123 | 
| 2077 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2124 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 
| 2078   SetSourcePosition(prop->position()); | 2125   SetSourcePosition(prop->position()); | 
| 2079   Literal* key = prop->key()->AsLiteral(); | 2126   Literal* key = prop->key()->AsLiteral(); | 
| 2080   __ mov(r2, Operand(key->handle())); | 2127   __ mov(r2, Operand(key->handle())); | 
| 2081   // Call load IC. It has arguments receiver and property name r0 and r2. | 2128   // Call load IC. It has arguments receiver and property name r0 and r2. | 
| 2082   Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2129   Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 
| 2083   CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); | 2130   CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); | 
| 2084 } | 2131 } | 
| 2085 | 2132 | 
| 2086 | 2133 | 
| (...skipping 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4702   *context_length = 0; | 4749   *context_length = 0; | 
| 4703   return previous_; | 4750   return previous_; | 
| 4704 } | 4751 } | 
| 4705 | 4752 | 
| 4706 | 4753 | 
| 4707 #undef __ | 4754 #undef __ | 
| 4708 | 4755 | 
| 4709 } }  // namespace v8::internal | 4756 } }  // namespace v8::internal | 
| 4710 | 4757 | 
| 4711 #endif  // V8_TARGET_ARCH_ARM | 4758 #endif  // V8_TARGET_ARCH_ARM | 
| OLD | NEW | 
|---|