| 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 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1687 __ push(v0); // Save result on stack. | 1687 __ push(v0); // Save result on stack. |
| 1688 result_saved = true; | 1688 result_saved = true; |
| 1689 } | 1689 } |
| 1690 switch (property->kind()) { | 1690 switch (property->kind()) { |
| 1691 case ObjectLiteral::Property::CONSTANT: | 1691 case ObjectLiteral::Property::CONSTANT: |
| 1692 UNREACHABLE(); | 1692 UNREACHABLE(); |
| 1693 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1693 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| 1694 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); | 1694 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); |
| 1695 // Fall through. | 1695 // Fall through. |
| 1696 case ObjectLiteral::Property::COMPUTED: | 1696 case ObjectLiteral::Property::COMPUTED: |
| 1697 if (key->handle()->IsInternalizedString()) { | 1697 if (key->value()->IsInternalizedString()) { |
| 1698 if (property->emit_store()) { | 1698 if (property->emit_store()) { |
| 1699 VisitForAccumulatorValue(value); | 1699 VisitForAccumulatorValue(value); |
| 1700 __ mov(a0, result_register()); | 1700 __ mov(a0, result_register()); |
| 1701 __ li(a2, Operand(key->handle())); | 1701 __ li(a2, Operand(key->value())); |
| 1702 __ lw(a1, MemOperand(sp)); | 1702 __ lw(a1, MemOperand(sp)); |
| 1703 Handle<Code> ic = is_classic_mode() | 1703 Handle<Code> ic = is_classic_mode() |
| 1704 ? isolate()->builtins()->StoreIC_Initialize() | 1704 ? isolate()->builtins()->StoreIC_Initialize() |
| 1705 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 1705 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
| 1706 CallIC(ic, RelocInfo::CODE_TARGET, key->LiteralFeedbackId()); | 1706 CallIC(ic, RelocInfo::CODE_TARGET, key->LiteralFeedbackId()); |
| 1707 PrepareForBailoutForId(key->id(), NO_REGISTERS); | 1707 PrepareForBailoutForId(key->id(), NO_REGISTERS); |
| 1708 } else { | 1708 } else { |
| 1709 VisitForEffect(value); | 1709 VisitForEffect(value); |
| 1710 } | 1710 } |
| 1711 break; | 1711 break; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 } | 1827 } |
| 1828 | 1828 |
| 1829 bool result_saved = false; // Is the result saved to the stack? | 1829 bool result_saved = false; // Is the result saved to the stack? |
| 1830 | 1830 |
| 1831 // Emit code to evaluate all the non-constant subexpressions and to store | 1831 // Emit code to evaluate all the non-constant subexpressions and to store |
| 1832 // them into the newly cloned array. | 1832 // them into the newly cloned array. |
| 1833 for (int i = 0; i < length; i++) { | 1833 for (int i = 0; i < length; i++) { |
| 1834 Expression* subexpr = subexprs->at(i); | 1834 Expression* subexpr = subexprs->at(i); |
| 1835 // If the subexpression is a literal or a simple materialized literal it | 1835 // If the subexpression is a literal or a simple materialized literal it |
| 1836 // is already set in the cloned array. | 1836 // is already set in the cloned array. |
| 1837 if (subexpr->AsLiteral() != NULL || | 1837 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
| 1838 CompileTimeValue::IsCompileTimeValue(subexpr)) { | |
| 1839 continue; | |
| 1840 } | |
| 1841 | 1838 |
| 1842 if (!result_saved) { | 1839 if (!result_saved) { |
| 1843 __ push(v0); // array literal | 1840 __ push(v0); // array literal |
| 1844 __ Push(Smi::FromInt(expr->literal_index())); | 1841 __ Push(Smi::FromInt(expr->literal_index())); |
| 1845 result_saved = true; | 1842 result_saved = true; |
| 1846 } | 1843 } |
| 1847 | 1844 |
| 1848 VisitForAccumulatorValue(subexpr); | 1845 VisitForAccumulatorValue(subexpr); |
| 1849 | 1846 |
| 1850 if (IsFastObjectElementsKind(constant_elements_kind)) { | 1847 if (IsFastObjectElementsKind(constant_elements_kind)) { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 // this. It stays on the stack while we update the iterator. | 1991 // this. It stays on the stack while we update the iterator. |
| 1995 VisitForStackValue(expr->expression()); | 1992 VisitForStackValue(expr->expression()); |
| 1996 | 1993 |
| 1997 switch (expr->yield_kind()) { | 1994 switch (expr->yield_kind()) { |
| 1998 case Yield::SUSPEND: | 1995 case Yield::SUSPEND: |
| 1999 // Pop value from top-of-stack slot; box result into result register. | 1996 // Pop value from top-of-stack slot; box result into result register. |
| 2000 EmitCreateIteratorResult(false); | 1997 EmitCreateIteratorResult(false); |
| 2001 __ push(result_register()); | 1998 __ push(result_register()); |
| 2002 // Fall through. | 1999 // Fall through. |
| 2003 case Yield::INITIAL: { | 2000 case Yield::INITIAL: { |
| 2004 VisitForStackValue(expr->generator_object()); | 2001 Label suspend, continuation, post_runtime, resume; |
| 2002 |
| 2003 __ jmp(&suspend); |
| 2004 |
| 2005 __ bind(&continuation); |
| 2006 __ jmp(&resume); |
| 2007 |
| 2008 __ bind(&suspend); |
| 2009 VisitForAccumulatorValue(expr->generator_object()); |
| 2010 ASSERT(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
| 2011 __ li(a1, Operand(Smi::FromInt(continuation.pos()))); |
| 2012 __ sw(a1, FieldMemOperand(v0, JSGeneratorObject::kContinuationOffset)); |
| 2013 __ sw(cp, FieldMemOperand(v0, JSGeneratorObject::kContextOffset)); |
| 2014 __ mov(a1, cp); |
| 2015 __ RecordWriteField(v0, JSGeneratorObject::kContextOffset, a1, a2, |
| 2016 kRAHasBeenSaved, kDontSaveFPRegs); |
| 2017 __ Addu(a1, fp, Operand(StandardFrameConstants::kExpressionsOffset)); |
| 2018 __ Branch(&post_runtime, eq, sp, Operand(a1)); |
| 2019 __ push(v0); // generator object |
| 2005 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 2020 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
| 2006 __ lw(context_register(), | 2021 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2007 MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2022 __ bind(&post_runtime); |
| 2008 | |
| 2009 Label resume; | |
| 2010 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | |
| 2011 __ Branch(&resume, ne, result_register(), Operand(at)); | |
| 2012 __ pop(result_register()); | 2023 __ pop(result_register()); |
| 2013 EmitReturnSequence(); | 2024 EmitReturnSequence(); |
| 2014 | 2025 |
| 2015 __ bind(&resume); | 2026 __ bind(&resume); |
| 2016 context()->Plug(result_register()); | 2027 context()->Plug(result_register()); |
| 2017 break; | 2028 break; |
| 2018 } | 2029 } |
| 2019 | 2030 |
| 2020 case Yield::FINAL: { | 2031 case Yield::FINAL: { |
| 2021 VisitForAccumulatorValue(expr->generator_object()); | 2032 VisitForAccumulatorValue(expr->generator_object()); |
| 2022 __ li(a1, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); | 2033 __ li(a1, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); |
| 2023 __ sw(a1, FieldMemOperand(result_register(), | 2034 __ sw(a1, FieldMemOperand(result_register(), |
| 2024 JSGeneratorObject::kContinuationOffset)); | 2035 JSGeneratorObject::kContinuationOffset)); |
| 2025 // Pop value from top-of-stack slot, box result into result register. | 2036 // Pop value from top-of-stack slot, box result into result register. |
| 2026 EmitCreateIteratorResult(true); | 2037 EmitCreateIteratorResult(true); |
| 2027 EmitUnwindBeforeReturn(); | 2038 EmitUnwindBeforeReturn(); |
| 2028 EmitReturnSequence(); | 2039 EmitReturnSequence(); |
| 2029 break; | 2040 break; |
| 2030 } | 2041 } |
| 2031 | 2042 |
| 2032 case Yield::DELEGATING: { | 2043 case Yield::DELEGATING: { |
| 2033 VisitForStackValue(expr->generator_object()); | 2044 VisitForStackValue(expr->generator_object()); |
| 2034 | 2045 |
| 2035 // Initial stack layout is as follows: | 2046 // Initial stack layout is as follows: |
| 2036 // [sp + 1 * kPointerSize] iter | 2047 // [sp + 1 * kPointerSize] iter |
| 2037 // [sp + 0 * kPointerSize] g | 2048 // [sp + 0 * kPointerSize] g |
| 2038 | 2049 |
| 2039 Label l_catch, l_try, l_resume, l_next, l_call, l_loop; | 2050 Label l_catch, l_try, l_suspend, l_continuation, l_resume; |
| 2051 Label l_next, l_call, l_loop; |
| 2040 // Initial send value is undefined. | 2052 // Initial send value is undefined. |
| 2041 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex); | 2053 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex); |
| 2042 __ Branch(&l_next); | 2054 __ Branch(&l_next); |
| 2043 | 2055 |
| 2044 // catch (e) { receiver = iter; f = 'throw'; arg = e; goto l_call; } | 2056 // catch (e) { receiver = iter; f = 'throw'; arg = e; goto l_call; } |
| 2045 __ bind(&l_catch); | 2057 __ bind(&l_catch); |
| 2046 __ mov(a0, v0); | 2058 __ mov(a0, v0); |
| 2047 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); | 2059 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); |
| 2048 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw" | 2060 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw" |
| 2049 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter | 2061 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter |
| 2050 __ push(a3); // iter | 2062 __ push(a3); // iter |
| 2051 __ push(a0); // exception | 2063 __ push(a0); // exception |
| 2052 __ jmp(&l_call); | 2064 __ jmp(&l_call); |
| 2053 | 2065 |
| 2054 // try { received = %yield result } | 2066 // try { received = %yield result } |
| 2055 // Shuffle the received result above a try handler and yield it without | 2067 // Shuffle the received result above a try handler and yield it without |
| 2056 // re-boxing. | 2068 // re-boxing. |
| 2057 __ bind(&l_try); | 2069 __ bind(&l_try); |
| 2058 __ pop(a0); // result | 2070 __ pop(a0); // result |
| 2059 __ PushTryHandler(StackHandler::CATCH, expr->index()); | 2071 __ PushTryHandler(StackHandler::CATCH, expr->index()); |
| 2060 const int handler_size = StackHandlerConstants::kSize; | 2072 const int handler_size = StackHandlerConstants::kSize; |
| 2061 __ push(a0); // result | 2073 __ push(a0); // result |
| 2062 __ lw(a3, MemOperand(sp, (0 + 1) * kPointerSize + handler_size)); // g | 2074 __ jmp(&l_suspend); |
| 2063 __ push(a3); // g | 2075 __ bind(&l_continuation); |
| 2076 __ mov(a0, v0); |
| 2077 __ jmp(&l_resume); |
| 2078 __ bind(&l_suspend); |
| 2079 const int generator_object_depth = kPointerSize + handler_size; |
| 2080 __ lw(a0, MemOperand(sp, generator_object_depth)); |
| 2081 __ push(a0); // g |
| 2082 ASSERT(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); |
| 2083 __ li(a1, Operand(Smi::FromInt(l_continuation.pos()))); |
| 2084 __ sw(a1, FieldMemOperand(a0, JSGeneratorObject::kContinuationOffset)); |
| 2085 __ sw(cp, FieldMemOperand(a0, JSGeneratorObject::kContextOffset)); |
| 2086 __ mov(a1, cp); |
| 2087 __ RecordWriteField(a0, JSGeneratorObject::kContextOffset, a1, a2, |
| 2088 kRAHasBeenSaved, kDontSaveFPRegs); |
| 2064 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 2089 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
| 2065 __ mov(a0, v0); | 2090 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2066 __ lw(context_register(), | |
| 2067 MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
| 2068 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | |
| 2069 __ Branch(&l_resume, ne, a0, Operand(at)); | |
| 2070 __ pop(v0); // result | 2091 __ pop(v0); // result |
| 2071 EmitReturnSequence(); | 2092 EmitReturnSequence(); |
| 2072 __ mov(a0, v0); | 2093 __ mov(a0, v0); |
| 2073 __ bind(&l_resume); // received in a0 | 2094 __ bind(&l_resume); // received in a0 |
| 2074 __ PopTryHandler(); | 2095 __ PopTryHandler(); |
| 2075 | 2096 |
| 2076 // receiver = iter; f = 'next'; arg = received; | 2097 // receiver = iter; f = 'next'; arg = received; |
| 2077 __ bind(&l_next); | 2098 __ bind(&l_next); |
| 2078 __ LoadRoot(a2, Heap::knext_stringRootIndex); // "next" | 2099 __ LoadRoot(a2, Heap::knext_stringRootIndex); // "next" |
| 2079 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter | 2100 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2135 __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kReceiverOffset)); | 2156 __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kReceiverOffset)); |
| 2136 __ push(a2); | 2157 __ push(a2); |
| 2137 | 2158 |
| 2138 // Push holes for the rest of the arguments to the generator function. | 2159 // Push holes for the rest of the arguments to the generator function. |
| 2139 __ lw(a3, FieldMemOperand(t0, JSFunction::kSharedFunctionInfoOffset)); | 2160 __ lw(a3, FieldMemOperand(t0, JSFunction::kSharedFunctionInfoOffset)); |
| 2140 __ lw(a3, | 2161 __ lw(a3, |
| 2141 FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset)); | 2162 FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 2142 __ LoadRoot(a2, Heap::kTheHoleValueRootIndex); | 2163 __ LoadRoot(a2, Heap::kTheHoleValueRootIndex); |
| 2143 Label push_argument_holes, push_frame; | 2164 Label push_argument_holes, push_frame; |
| 2144 __ bind(&push_argument_holes); | 2165 __ bind(&push_argument_holes); |
| 2145 __ Subu(a3, a3, Operand(1)); | 2166 __ Subu(a3, a3, Operand(Smi::FromInt(1))); |
| 2146 __ Branch(&push_frame, lt, a3, Operand(zero_reg)); | 2167 __ Branch(&push_frame, lt, a3, Operand(zero_reg)); |
| 2147 __ push(a2); | 2168 __ push(a2); |
| 2148 __ jmp(&push_argument_holes); | 2169 __ jmp(&push_argument_holes); |
| 2149 | 2170 |
| 2150 // Enter a new JavaScript frame, and initialize its slots as they were when | 2171 // Enter a new JavaScript frame, and initialize its slots as they were when |
| 2151 // the generator was suspended. | 2172 // the generator was suspended. |
| 2152 Label resume_frame; | 2173 Label resume_frame; |
| 2153 __ bind(&push_frame); | 2174 __ bind(&push_frame); |
| 2154 __ Call(&resume_frame); | 2175 __ Call(&resume_frame); |
| 2155 __ jmp(&done); | 2176 __ jmp(&done); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2240 __ RecordWriteField(a0, JSGeneratorObject::kResultValuePropertyOffset, | 2261 __ RecordWriteField(a0, JSGeneratorObject::kResultValuePropertyOffset, |
| 2241 a2, a3, kRAHasBeenSaved, kDontSaveFPRegs); | 2262 a2, a3, kRAHasBeenSaved, kDontSaveFPRegs); |
| 2242 __ mov(result_register(), a0); | 2263 __ mov(result_register(), a0); |
| 2243 } | 2264 } |
| 2244 | 2265 |
| 2245 | 2266 |
| 2246 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2267 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 2247 SetSourcePosition(prop->position()); | 2268 SetSourcePosition(prop->position()); |
| 2248 Literal* key = prop->key()->AsLiteral(); | 2269 Literal* key = prop->key()->AsLiteral(); |
| 2249 __ mov(a0, result_register()); | 2270 __ mov(a0, result_register()); |
| 2250 __ li(a2, Operand(key->handle())); | 2271 __ li(a2, Operand(key->value())); |
| 2251 // Call load IC. It has arguments receiver and property name a0 and a2. | 2272 // Call load IC. It has arguments receiver and property name a0 and a2. |
| 2252 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2273 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| 2253 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); | 2274 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); |
| 2254 } | 2275 } |
| 2255 | 2276 |
| 2256 | 2277 |
| 2257 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2278 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2258 SetSourcePosition(prop->position()); | 2279 SetSourcePosition(prop->position()); |
| 2259 __ mov(a0, result_register()); | 2280 __ mov(a0, result_register()); |
| 2260 // Call keyed load IC. It has arguments key and receiver in a0 and a1. | 2281 // Call keyed load IC. It has arguments key and receiver in a0 and a1. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2402 Variable* var = expr->AsVariableProxy()->var(); | 2423 Variable* var = expr->AsVariableProxy()->var(); |
| 2403 EffectContext context(this); | 2424 EffectContext context(this); |
| 2404 EmitVariableAssignment(var, Token::ASSIGN); | 2425 EmitVariableAssignment(var, Token::ASSIGN); |
| 2405 break; | 2426 break; |
| 2406 } | 2427 } |
| 2407 case NAMED_PROPERTY: { | 2428 case NAMED_PROPERTY: { |
| 2408 __ push(result_register()); // Preserve value. | 2429 __ push(result_register()); // Preserve value. |
| 2409 VisitForAccumulatorValue(prop->obj()); | 2430 VisitForAccumulatorValue(prop->obj()); |
| 2410 __ mov(a1, result_register()); | 2431 __ mov(a1, result_register()); |
| 2411 __ pop(a0); // Restore value. | 2432 __ pop(a0); // Restore value. |
| 2412 __ li(a2, Operand(prop->key()->AsLiteral()->handle())); | 2433 __ li(a2, Operand(prop->key()->AsLiteral()->value())); |
| 2413 Handle<Code> ic = is_classic_mode() | 2434 Handle<Code> ic = is_classic_mode() |
| 2414 ? isolate()->builtins()->StoreIC_Initialize() | 2435 ? isolate()->builtins()->StoreIC_Initialize() |
| 2415 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 2436 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
| 2416 CallIC(ic); | 2437 CallIC(ic); |
| 2417 break; | 2438 break; |
| 2418 } | 2439 } |
| 2419 case KEYED_PROPERTY: { | 2440 case KEYED_PROPERTY: { |
| 2420 __ push(result_register()); // Preserve value. | 2441 __ push(result_register()); // Preserve value. |
| 2421 VisitForStackValue(prop->obj()); | 2442 VisitForStackValue(prop->obj()); |
| 2422 VisitForAccumulatorValue(prop->key()); | 2443 VisitForAccumulatorValue(prop->key()); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2533 | 2554 |
| 2534 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2555 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
| 2535 // Assignment to a property, using a named store IC. | 2556 // Assignment to a property, using a named store IC. |
| 2536 Property* prop = expr->target()->AsProperty(); | 2557 Property* prop = expr->target()->AsProperty(); |
| 2537 ASSERT(prop != NULL); | 2558 ASSERT(prop != NULL); |
| 2538 ASSERT(prop->key()->AsLiteral() != NULL); | 2559 ASSERT(prop->key()->AsLiteral() != NULL); |
| 2539 | 2560 |
| 2540 // Record source code position before IC call. | 2561 // Record source code position before IC call. |
| 2541 SetSourcePosition(expr->position()); | 2562 SetSourcePosition(expr->position()); |
| 2542 __ mov(a0, result_register()); // Load the value. | 2563 __ mov(a0, result_register()); // Load the value. |
| 2543 __ li(a2, Operand(prop->key()->AsLiteral()->handle())); | 2564 __ li(a2, Operand(prop->key()->AsLiteral()->value())); |
| 2544 __ pop(a1); | 2565 __ pop(a1); |
| 2545 | 2566 |
| 2546 Handle<Code> ic = is_classic_mode() | 2567 Handle<Code> ic = is_classic_mode() |
| 2547 ? isolate()->builtins()->StoreIC_Initialize() | 2568 ? isolate()->builtins()->StoreIC_Initialize() |
| 2548 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 2569 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
| 2549 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); | 2570 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); |
| 2550 | 2571 |
| 2551 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2572 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 2552 context()->Plug(v0); | 2573 context()->Plug(v0); |
| 2553 } | 2574 } |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2811 // The receiver is either the global receiver or an object found | 2832 // The receiver is either the global receiver or an object found |
| 2812 // by LoadContextSlot. That object could be the hole if the | 2833 // by LoadContextSlot. That object could be the hole if the |
| 2813 // receiver is implicitly the global object. | 2834 // receiver is implicitly the global object. |
| 2814 EmitCallWithStub(expr, RECEIVER_MIGHT_BE_IMPLICIT); | 2835 EmitCallWithStub(expr, RECEIVER_MIGHT_BE_IMPLICIT); |
| 2815 } else if (property != NULL) { | 2836 } else if (property != NULL) { |
| 2816 { PreservePositionScope scope(masm()->positions_recorder()); | 2837 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2817 VisitForStackValue(property->obj()); | 2838 VisitForStackValue(property->obj()); |
| 2818 } | 2839 } |
| 2819 if (property->key()->IsPropertyName()) { | 2840 if (property->key()->IsPropertyName()) { |
| 2820 EmitCallWithIC(expr, | 2841 EmitCallWithIC(expr, |
| 2821 property->key()->AsLiteral()->handle(), | 2842 property->key()->AsLiteral()->value(), |
| 2822 RelocInfo::CODE_TARGET); | 2843 RelocInfo::CODE_TARGET); |
| 2823 } else { | 2844 } else { |
| 2824 EmitKeyedCallWithIC(expr, property->key()); | 2845 EmitKeyedCallWithIC(expr, property->key()); |
| 2825 } | 2846 } |
| 2826 } else { | 2847 } else { |
| 2827 // Call to an arbitrary expression not handled specially above. | 2848 // Call to an arbitrary expression not handled specially above. |
| 2828 { PreservePositionScope scope(masm()->positions_recorder()); | 2849 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2829 VisitForStackValue(callee); | 2850 VisitForStackValue(callee); |
| 2830 } | 2851 } |
| 2831 // Load global receiver object. | 2852 // Load global receiver object. |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3416 | 3437 |
| 3417 __ bind(&done); | 3438 __ bind(&done); |
| 3418 context()->Plug(v0); | 3439 context()->Plug(v0); |
| 3419 } | 3440 } |
| 3420 | 3441 |
| 3421 | 3442 |
| 3422 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { | 3443 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
| 3423 ZoneList<Expression*>* args = expr->arguments(); | 3444 ZoneList<Expression*>* args = expr->arguments(); |
| 3424 ASSERT(args->length() == 2); | 3445 ASSERT(args->length() == 2); |
| 3425 ASSERT_NE(NULL, args->at(1)->AsLiteral()); | 3446 ASSERT_NE(NULL, args->at(1)->AsLiteral()); |
| 3426 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle())); | 3447 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); |
| 3427 | 3448 |
| 3428 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3449 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 3429 | 3450 |
| 3430 Label runtime, done, not_date_object; | 3451 Label runtime, done, not_date_object; |
| 3431 Register object = v0; | 3452 Register object = v0; |
| 3432 Register result = v0; | 3453 Register result = v0; |
| 3433 Register scratch0 = t5; | 3454 Register scratch0 = t5; |
| 3434 Register scratch1 = a1; | 3455 Register scratch1 = a1; |
| 3435 | 3456 |
| 3436 __ JumpIfSmi(object, ¬_date_object); | 3457 __ JumpIfSmi(object, ¬_date_object); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3848 __ CallStub(&stub); | 3869 __ CallStub(&stub); |
| 3849 context()->Plug(v0); | 3870 context()->Plug(v0); |
| 3850 } | 3871 } |
| 3851 | 3872 |
| 3852 | 3873 |
| 3853 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { | 3874 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { |
| 3854 ZoneList<Expression*>* args = expr->arguments(); | 3875 ZoneList<Expression*>* args = expr->arguments(); |
| 3855 ASSERT_EQ(2, args->length()); | 3876 ASSERT_EQ(2, args->length()); |
| 3856 | 3877 |
| 3857 ASSERT_NE(NULL, args->at(0)->AsLiteral()); | 3878 ASSERT_NE(NULL, args->at(0)->AsLiteral()); |
| 3858 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value(); | 3879 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); |
| 3859 | 3880 |
| 3860 Handle<FixedArray> jsfunction_result_caches( | 3881 Handle<FixedArray> jsfunction_result_caches( |
| 3861 isolate()->native_context()->jsfunction_result_caches()); | 3882 isolate()->native_context()->jsfunction_result_caches()); |
| 3862 if (jsfunction_result_caches->length() <= cache_id) { | 3883 if (jsfunction_result_caches->length() <= cache_id) { |
| 3863 __ Abort("Attempt to use undefined cache."); | 3884 __ Abort("Attempt to use undefined cache."); |
| 3864 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | 3885 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
| 3865 context()->Plug(v0); | 3886 context()->Plug(v0); |
| 3866 return; | 3887 return; |
| 3867 } | 3888 } |
| 3868 | 3889 |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4523 } | 4544 } |
| 4524 } else { | 4545 } else { |
| 4525 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 4546 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
| 4526 Token::ASSIGN); | 4547 Token::ASSIGN); |
| 4527 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4548 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 4528 context()->Plug(v0); | 4549 context()->Plug(v0); |
| 4529 } | 4550 } |
| 4530 break; | 4551 break; |
| 4531 case NAMED_PROPERTY: { | 4552 case NAMED_PROPERTY: { |
| 4532 __ mov(a0, result_register()); // Value. | 4553 __ mov(a0, result_register()); // Value. |
| 4533 __ li(a2, Operand(prop->key()->AsLiteral()->handle())); // Name. | 4554 __ li(a2, Operand(prop->key()->AsLiteral()->value())); // Name. |
| 4534 __ pop(a1); // Receiver. | 4555 __ pop(a1); // Receiver. |
| 4535 Handle<Code> ic = is_classic_mode() | 4556 Handle<Code> ic = is_classic_mode() |
| 4536 ? isolate()->builtins()->StoreIC_Initialize() | 4557 ? isolate()->builtins()->StoreIC_Initialize() |
| 4537 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 4558 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
| 4538 CallIC(ic, RelocInfo::CODE_TARGET, expr->CountStoreFeedbackId()); | 4559 CallIC(ic, RelocInfo::CODE_TARGET, expr->CountStoreFeedbackId()); |
| 4539 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 4560 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 4540 if (expr->is_postfix()) { | 4561 if (expr->is_postfix()) { |
| 4541 if (!context()->IsEffect()) { | 4562 if (!context()->IsEffect()) { |
| 4542 context()->PlugTOS(); | 4563 context()->PlugTOS(); |
| 4543 } | 4564 } |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4927 *context_length = 0; | 4948 *context_length = 0; |
| 4928 return previous_; | 4949 return previous_; |
| 4929 } | 4950 } |
| 4930 | 4951 |
| 4931 | 4952 |
| 4932 #undef __ | 4953 #undef __ |
| 4933 | 4954 |
| 4934 } } // namespace v8::internal | 4955 } } // namespace v8::internal |
| 4935 | 4956 |
| 4936 #endif // V8_TARGET_ARCH_MIPS | 4957 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |