OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 int offset = scope()->num_parameters() * kPointerSize; | 223 int offset = scope()->num_parameters() * kPointerSize; |
224 __ add(r2, fp, | 224 __ add(r2, fp, |
225 Operand(StandardFrameConstants::kCallerSPOffset + offset)); | 225 Operand(StandardFrameConstants::kCallerSPOffset + offset)); |
226 __ mov(r1, Operand(Smi::FromInt(scope()->num_parameters()))); | 226 __ mov(r1, Operand(Smi::FromInt(scope()->num_parameters()))); |
227 __ Push(r3, r2, r1); | 227 __ Push(r3, r2, r1); |
228 | 228 |
229 // Arguments to ArgumentsAccessStub: | 229 // Arguments to ArgumentsAccessStub: |
230 // function, receiver address, parameter count. | 230 // function, receiver address, parameter count. |
231 // The stub will rewrite receiever and parameter count if the previous | 231 // The stub will rewrite receiever and parameter count if the previous |
232 // stack frame was an arguments adapter frame. | 232 // stack frame was an arguments adapter frame. |
233 ArgumentsAccessStub stub( | 233 ArgumentsAccessStub::Type type; |
234 is_strict_mode() ? ArgumentsAccessStub::NEW_STRICT | 234 if (is_strict_mode()) { |
235 : ArgumentsAccessStub::NEW_NON_STRICT); | 235 type = ArgumentsAccessStub::NEW_STRICT; |
| 236 } else if (function()->has_duplicate_parameters()) { |
| 237 type = ArgumentsAccessStub::NEW_NON_STRICT_SLOW; |
| 238 } else { |
| 239 type = ArgumentsAccessStub::NEW_NON_STRICT_FAST; |
| 240 } |
| 241 ArgumentsAccessStub stub(type); |
236 __ CallStub(&stub); | 242 __ CallStub(&stub); |
237 | 243 |
238 Variable* arguments_shadow = scope()->arguments_shadow(); | |
239 if (arguments_shadow != NULL) { | |
240 // Duplicate the value; move-to-slot operation might clobber registers. | |
241 __ mov(r3, r0); | |
242 Move(arguments_shadow->AsSlot(), r3, r1, r2); | |
243 } | |
244 Move(arguments->AsSlot(), r0, r1, r2); | 244 Move(arguments->AsSlot(), r0, r1, r2); |
245 } | 245 } |
246 | 246 |
247 if (FLAG_trace) { | 247 if (FLAG_trace) { |
248 __ CallRuntime(Runtime::kTraceEnter, 0); | 248 __ CallRuntime(Runtime::kTraceEnter, 0); |
249 } | 249 } |
250 | 250 |
251 // Visit the declarations and body unless there is an illegal | 251 // Visit the declarations and body unless there is an illegal |
252 // redeclaration. | 252 // redeclaration. |
253 if (scope()->HasIllegalRedeclaration()) { | 253 if (scope()->HasIllegalRedeclaration()) { |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(property)); | 1249 EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(property)); |
1250 __ jmp(done); | 1250 __ jmp(done); |
1251 } | 1251 } |
1252 } | 1252 } |
1253 } | 1253 } |
1254 } | 1254 } |
1255 } | 1255 } |
1256 | 1256 |
1257 | 1257 |
1258 void FullCodeGenerator::EmitVariableLoad(Variable* var) { | 1258 void FullCodeGenerator::EmitVariableLoad(Variable* var) { |
1259 // Four cases: non-this global variables, lookup slots, all other | 1259 // Three cases: non-this global variables, lookup slots, and all other |
1260 // types of slots, and parameters that rewrite to explicit property | 1260 // types of slots. |
1261 // accesses on the arguments object. | |
1262 Slot* slot = var->AsSlot(); | 1261 Slot* slot = var->AsSlot(); |
1263 Property* property = var->AsProperty(); | 1262 ASSERT((var->is_global() && !var->is_this()) == (slot == NULL)); |
1264 | 1263 |
1265 if (var->is_global() && !var->is_this()) { | 1264 if (slot == NULL) { |
1266 Comment cmnt(masm_, "Global variable"); | 1265 Comment cmnt(masm_, "Global variable"); |
1267 // Use inline caching. Variable name is passed in r2 and the global | 1266 // Use inline caching. Variable name is passed in r2 and the global |
1268 // object (receiver) in r0. | 1267 // object (receiver) in r0. |
1269 __ ldr(r0, GlobalObjectOperand()); | 1268 __ ldr(r0, GlobalObjectOperand()); |
1270 __ mov(r2, Operand(var->name())); | 1269 __ mov(r2, Operand(var->name())); |
1271 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 1270 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
1272 EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT, AstNode::kNoNumber); | 1271 EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT, AstNode::kNoNumber); |
1273 context()->Plug(r0); | 1272 context()->Plug(r0); |
1274 | 1273 |
1275 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { | 1274 } else if (slot->type() == Slot::LOOKUP) { |
1276 Label done, slow; | 1275 Label done, slow; |
1277 | 1276 |
1278 // Generate code for loading from variables potentially shadowed | 1277 // Generate code for loading from variables potentially shadowed |
1279 // by eval-introduced variables. | 1278 // by eval-introduced variables. |
1280 EmitDynamicLoadFromSlotFastCase(slot, NOT_INSIDE_TYPEOF, &slow, &done); | 1279 EmitDynamicLoadFromSlotFastCase(slot, NOT_INSIDE_TYPEOF, &slow, &done); |
1281 | 1280 |
1282 __ bind(&slow); | 1281 __ bind(&slow); |
1283 Comment cmnt(masm_, "Lookup slot"); | 1282 Comment cmnt(masm_, "Lookup slot"); |
1284 __ mov(r1, Operand(var->name())); | 1283 __ mov(r1, Operand(var->name())); |
1285 __ Push(cp, r1); // Context and name. | 1284 __ Push(cp, r1); // Context and name. |
1286 __ CallRuntime(Runtime::kLoadContextSlot, 2); | 1285 __ CallRuntime(Runtime::kLoadContextSlot, 2); |
1287 __ bind(&done); | 1286 __ bind(&done); |
1288 | 1287 |
1289 context()->Plug(r0); | 1288 context()->Plug(r0); |
1290 | 1289 |
1291 } else if (slot != NULL) { | 1290 } else { |
1292 Comment cmnt(masm_, (slot->type() == Slot::CONTEXT) | 1291 Comment cmnt(masm_, (slot->type() == Slot::CONTEXT) |
1293 ? "Context slot" | 1292 ? "Context slot" |
1294 : "Stack slot"); | 1293 : "Stack slot"); |
1295 if (var->mode() == Variable::CONST) { | 1294 if (var->mode() == Variable::CONST) { |
1296 // Constants may be the hole value if they have not been initialized. | 1295 // Constants may be the hole value if they have not been initialized. |
1297 // Unhole them. | 1296 // Unhole them. |
1298 MemOperand slot_operand = EmitSlotSearch(slot, r0); | 1297 MemOperand slot_operand = EmitSlotSearch(slot, r0); |
1299 __ ldr(r0, slot_operand); | 1298 __ ldr(r0, slot_operand); |
1300 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 1299 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
1301 __ cmp(r0, ip); | 1300 __ cmp(r0, ip); |
1302 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex, eq); | 1301 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex, eq); |
1303 context()->Plug(r0); | 1302 context()->Plug(r0); |
1304 } else { | 1303 } else { |
1305 context()->Plug(slot); | 1304 context()->Plug(slot); |
1306 } | 1305 } |
1307 } else { | |
1308 Comment cmnt(masm_, "Rewritten parameter"); | |
1309 ASSERT_NOT_NULL(property); | |
1310 // Rewritten parameter accesses are of the form "slot[literal]". | |
1311 | |
1312 // Assert that the object is in a slot. | |
1313 Variable* object_var = property->obj()->AsVariableProxy()->AsVariable(); | |
1314 ASSERT_NOT_NULL(object_var); | |
1315 Slot* object_slot = object_var->AsSlot(); | |
1316 ASSERT_NOT_NULL(object_slot); | |
1317 | |
1318 // Load the object. | |
1319 Move(r1, object_slot); | |
1320 | |
1321 // Assert that the key is a smi. | |
1322 Literal* key_literal = property->key()->AsLiteral(); | |
1323 ASSERT_NOT_NULL(key_literal); | |
1324 ASSERT(key_literal->handle()->IsSmi()); | |
1325 | |
1326 // Load the key. | |
1327 __ mov(r0, Operand(key_literal->handle())); | |
1328 | |
1329 // Call keyed load IC. It has arguments key and receiver in r0 and r1. | |
1330 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | |
1331 EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(property)); | |
1332 context()->Plug(r0); | |
1333 } | 1306 } |
1334 } | 1307 } |
1335 | 1308 |
1336 | 1309 |
1337 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { | 1310 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
1338 Comment cmnt(masm_, "[ RegExpLiteral"); | 1311 Comment cmnt(masm_, "[ RegExpLiteral"); |
1339 Label materialized; | 1312 Label materialized; |
1340 // Registers will be used as follows: | 1313 // Registers will be used as follows: |
1341 // r5 = materialized value (RegExp literal) | 1314 // r5 = materialized value (RegExp literal) |
1342 // r4 = JS function, literals array | 1315 // r4 = JS function, literals array |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 1536 void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
1564 Comment cmnt(masm_, "[ Assignment"); | 1537 Comment cmnt(masm_, "[ Assignment"); |
1565 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' | 1538 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' |
1566 // on the left-hand side. | 1539 // on the left-hand side. |
1567 if (!expr->target()->IsValidLeftHandSide()) { | 1540 if (!expr->target()->IsValidLeftHandSide()) { |
1568 VisitForEffect(expr->target()); | 1541 VisitForEffect(expr->target()); |
1569 return; | 1542 return; |
1570 } | 1543 } |
1571 | 1544 |
1572 // Left-hand side can only be a property, a global or a (parameter or local) | 1545 // Left-hand side can only be a property, a global or a (parameter or local) |
1573 // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY. | 1546 // slot. |
1574 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 1547 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
1575 LhsKind assign_type = VARIABLE; | 1548 LhsKind assign_type = VARIABLE; |
1576 Property* property = expr->target()->AsProperty(); | 1549 Property* property = expr->target()->AsProperty(); |
1577 if (property != NULL) { | 1550 if (property != NULL) { |
1578 assign_type = (property->key()->IsPropertyName()) | 1551 assign_type = (property->key()->IsPropertyName()) |
1579 ? NAMED_PROPERTY | 1552 ? NAMED_PROPERTY |
1580 : KEYED_PROPERTY; | 1553 : KEYED_PROPERTY; |
1581 } | 1554 } |
1582 | 1555 |
1583 // Evaluate LHS expression. | 1556 // Evaluate LHS expression. |
1584 switch (assign_type) { | 1557 switch (assign_type) { |
1585 case VARIABLE: | 1558 case VARIABLE: |
1586 // Nothing to do here. | 1559 // Nothing to do here. |
1587 break; | 1560 break; |
1588 case NAMED_PROPERTY: | 1561 case NAMED_PROPERTY: |
1589 if (expr->is_compound()) { | 1562 if (expr->is_compound()) { |
1590 // We need the receiver both on the stack and in the accumulator. | 1563 // We need the receiver both on the stack and in the accumulator. |
1591 VisitForAccumulatorValue(property->obj()); | 1564 VisitForAccumulatorValue(property->obj()); |
1592 __ push(result_register()); | 1565 __ push(result_register()); |
1593 } else { | 1566 } else { |
1594 VisitForStackValue(property->obj()); | 1567 VisitForStackValue(property->obj()); |
1595 } | 1568 } |
1596 break; | 1569 break; |
1597 case KEYED_PROPERTY: | 1570 case KEYED_PROPERTY: |
1598 if (expr->is_compound()) { | 1571 if (expr->is_compound()) { |
1599 if (property->is_arguments_access()) { | 1572 VisitForStackValue(property->obj()); |
1600 VariableProxy* obj_proxy = property->obj()->AsVariableProxy(); | 1573 VisitForAccumulatorValue(property->key()); |
1601 __ ldr(r0, EmitSlotSearch(obj_proxy->var()->AsSlot(), r0)); | |
1602 __ push(r0); | |
1603 __ mov(r0, Operand(property->key()->AsLiteral()->handle())); | |
1604 } else { | |
1605 VisitForStackValue(property->obj()); | |
1606 VisitForAccumulatorValue(property->key()); | |
1607 } | |
1608 __ ldr(r1, MemOperand(sp, 0)); | 1574 __ ldr(r1, MemOperand(sp, 0)); |
1609 __ push(r0); | 1575 __ push(r0); |
1610 } else { | 1576 } else { |
1611 if (property->is_arguments_access()) { | 1577 VisitForStackValue(property->obj()); |
1612 VariableProxy* obj_proxy = property->obj()->AsVariableProxy(); | 1578 VisitForStackValue(property->key()); |
1613 __ ldr(r1, EmitSlotSearch(obj_proxy->var()->AsSlot(), r0)); | |
1614 __ mov(r0, Operand(property->key()->AsLiteral()->handle())); | |
1615 __ Push(r1, r0); | |
1616 } else { | |
1617 VisitForStackValue(property->obj()); | |
1618 VisitForStackValue(property->key()); | |
1619 } | |
1620 } | 1579 } |
1621 break; | 1580 break; |
1622 } | 1581 } |
1623 | 1582 |
1624 // For compound assignments we need another deoptimization point after the | 1583 // For compound assignments we need another deoptimization point after the |
1625 // variable/property load. | 1584 // variable/property load. |
1626 if (expr->is_compound()) { | 1585 if (expr->is_compound()) { |
1627 { AccumulatorValueContext context(this); | 1586 { AccumulatorValueContext context(this); |
1628 switch (assign_type) { | 1587 switch (assign_type) { |
1629 case VARIABLE: | 1588 case VARIABLE: |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 | 1775 |
1817 void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { | 1776 void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { |
1818 // Invalid left-hand sides are rewritten to have a 'throw | 1777 // Invalid left-hand sides are rewritten to have a 'throw |
1819 // ReferenceError' on the left-hand side. | 1778 // ReferenceError' on the left-hand side. |
1820 if (!expr->IsValidLeftHandSide()) { | 1779 if (!expr->IsValidLeftHandSide()) { |
1821 VisitForEffect(expr); | 1780 VisitForEffect(expr); |
1822 return; | 1781 return; |
1823 } | 1782 } |
1824 | 1783 |
1825 // Left-hand side can only be a property, a global or a (parameter or local) | 1784 // Left-hand side can only be a property, a global or a (parameter or local) |
1826 // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY. | 1785 // slot. |
1827 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 1786 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
1828 LhsKind assign_type = VARIABLE; | 1787 LhsKind assign_type = VARIABLE; |
1829 Property* prop = expr->AsProperty(); | 1788 Property* prop = expr->AsProperty(); |
1830 if (prop != NULL) { | 1789 if (prop != NULL) { |
1831 assign_type = (prop->key()->IsPropertyName()) | 1790 assign_type = (prop->key()->IsPropertyName()) |
1832 ? NAMED_PROPERTY | 1791 ? NAMED_PROPERTY |
1833 : KEYED_PROPERTY; | 1792 : KEYED_PROPERTY; |
1834 } | 1793 } |
1835 | 1794 |
1836 switch (assign_type) { | 1795 switch (assign_type) { |
(...skipping 10 matching lines...) Expand all Loading... |
1847 __ pop(r0); // Restore value. | 1806 __ pop(r0); // Restore value. |
1848 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); | 1807 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); |
1849 Handle<Code> ic = is_strict_mode() | 1808 Handle<Code> ic = is_strict_mode() |
1850 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 1809 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
1851 : isolate()->builtins()->StoreIC_Initialize(); | 1810 : isolate()->builtins()->StoreIC_Initialize(); |
1852 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); | 1811 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); |
1853 break; | 1812 break; |
1854 } | 1813 } |
1855 case KEYED_PROPERTY: { | 1814 case KEYED_PROPERTY: { |
1856 __ push(r0); // Preserve value. | 1815 __ push(r0); // Preserve value. |
1857 if (prop->is_synthetic()) { | 1816 VisitForStackValue(prop->obj()); |
1858 ASSERT(prop->obj()->AsVariableProxy() != NULL); | 1817 VisitForAccumulatorValue(prop->key()); |
1859 ASSERT(prop->key()->AsLiteral() != NULL); | 1818 __ mov(r1, r0); |
1860 { AccumulatorValueContext for_object(this); | 1819 __ pop(r2); |
1861 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); | |
1862 } | |
1863 __ mov(r2, r0); | |
1864 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); | |
1865 } else { | |
1866 VisitForStackValue(prop->obj()); | |
1867 VisitForAccumulatorValue(prop->key()); | |
1868 __ mov(r1, r0); | |
1869 __ pop(r2); | |
1870 } | |
1871 __ pop(r0); // Restore value. | 1820 __ pop(r0); // Restore value. |
1872 Handle<Code> ic = is_strict_mode() | 1821 Handle<Code> ic = is_strict_mode() |
1873 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 1822 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
1874 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 1823 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
1875 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); | 1824 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); |
1876 break; | 1825 break; |
1877 } | 1826 } |
1878 } | 1827 } |
1879 PrepareForBailoutForId(bailout_ast_id, TOS_REG); | 1828 PrepareForBailoutForId(bailout_ast_id, TOS_REG); |
1880 context()->Plug(r0); | 1829 context()->Plug(r0); |
1881 } | 1830 } |
1882 | 1831 |
1883 | 1832 |
1884 void FullCodeGenerator::EmitVariableAssignment(Variable* var, | 1833 void FullCodeGenerator::EmitVariableAssignment(Variable* var, |
1885 Token::Value op) { | 1834 Token::Value op) { |
1886 // Left-hand sides that rewrite to explicit property accesses do not reach | |
1887 // here. | |
1888 ASSERT(var != NULL); | 1835 ASSERT(var != NULL); |
1889 ASSERT(var->is_global() || var->AsSlot() != NULL); | 1836 ASSERT(var->is_global() || var->AsSlot() != NULL); |
1890 | 1837 |
1891 if (var->is_global()) { | 1838 if (var->is_global()) { |
1892 ASSERT(!var->is_this()); | 1839 ASSERT(!var->is_this()); |
1893 // Assignment to a global variable. Use inline caching for the | 1840 // Assignment to a global variable. Use inline caching for the |
1894 // assignment. Right-hand-side value is passed in r0, variable name in | 1841 // assignment. Right-hand-side value is passed in r0, variable name in |
1895 // r2, and the global object in r1. | 1842 // r2, and the global object in r1. |
1896 __ mov(r2, Operand(var->name())); | 1843 __ mov(r2, Operand(var->name())); |
1897 __ ldr(r1, GlobalObjectOperand()); | 1844 __ ldr(r1, GlobalObjectOperand()); |
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3817 SetSourcePosition(expr->position()); | 3764 SetSourcePosition(expr->position()); |
3818 | 3765 |
3819 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' | 3766 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' |
3820 // as the left-hand side. | 3767 // as the left-hand side. |
3821 if (!expr->expression()->IsValidLeftHandSide()) { | 3768 if (!expr->expression()->IsValidLeftHandSide()) { |
3822 VisitForEffect(expr->expression()); | 3769 VisitForEffect(expr->expression()); |
3823 return; | 3770 return; |
3824 } | 3771 } |
3825 | 3772 |
3826 // Expression can only be a property, a global or a (parameter or local) | 3773 // Expression can only be a property, a global or a (parameter or local) |
3827 // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY. | 3774 // slot. |
3828 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 3775 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
3829 LhsKind assign_type = VARIABLE; | 3776 LhsKind assign_type = VARIABLE; |
3830 Property* prop = expr->expression()->AsProperty(); | 3777 Property* prop = expr->expression()->AsProperty(); |
3831 // In case of a property we use the uninitialized expression context | 3778 // In case of a property we use the uninitialized expression context |
3832 // of the key to detect a named property. | 3779 // of the key to detect a named property. |
3833 if (prop != NULL) { | 3780 if (prop != NULL) { |
3834 assign_type = | 3781 assign_type = |
3835 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; | 3782 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; |
3836 } | 3783 } |
3837 | 3784 |
3838 // Evaluate expression and get value. | 3785 // Evaluate expression and get value. |
3839 if (assign_type == VARIABLE) { | 3786 if (assign_type == VARIABLE) { |
3840 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); | 3787 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); |
3841 AccumulatorValueContext context(this); | 3788 AccumulatorValueContext context(this); |
3842 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); | 3789 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); |
3843 } else { | 3790 } else { |
3844 // Reserve space for result of postfix operation. | 3791 // Reserve space for result of postfix operation. |
3845 if (expr->is_postfix() && !context()->IsEffect()) { | 3792 if (expr->is_postfix() && !context()->IsEffect()) { |
3846 __ mov(ip, Operand(Smi::FromInt(0))); | 3793 __ mov(ip, Operand(Smi::FromInt(0))); |
3847 __ push(ip); | 3794 __ push(ip); |
3848 } | 3795 } |
3849 if (assign_type == NAMED_PROPERTY) { | 3796 if (assign_type == NAMED_PROPERTY) { |
3850 // Put the object both on the stack and in the accumulator. | 3797 // Put the object both on the stack and in the accumulator. |
3851 VisitForAccumulatorValue(prop->obj()); | 3798 VisitForAccumulatorValue(prop->obj()); |
3852 __ push(r0); | 3799 __ push(r0); |
3853 EmitNamedPropertyLoad(prop); | 3800 EmitNamedPropertyLoad(prop); |
3854 } else { | 3801 } else { |
3855 if (prop->is_arguments_access()) { | 3802 VisitForStackValue(prop->obj()); |
3856 VariableProxy* obj_proxy = prop->obj()->AsVariableProxy(); | 3803 VisitForAccumulatorValue(prop->key()); |
3857 __ ldr(r0, EmitSlotSearch(obj_proxy->var()->AsSlot(), r0)); | |
3858 __ push(r0); | |
3859 __ mov(r0, Operand(prop->key()->AsLiteral()->handle())); | |
3860 } else { | |
3861 VisitForStackValue(prop->obj()); | |
3862 VisitForAccumulatorValue(prop->key()); | |
3863 } | |
3864 __ ldr(r1, MemOperand(sp, 0)); | 3804 __ ldr(r1, MemOperand(sp, 0)); |
3865 __ push(r0); | 3805 __ push(r0); |
3866 EmitKeyedPropertyLoad(prop); | 3806 EmitKeyedPropertyLoad(prop); |
3867 } | 3807 } |
3868 } | 3808 } |
3869 | 3809 |
3870 // We need a second deoptimization point after loading the value | 3810 // We need a second deoptimization point after loading the value |
3871 // in case evaluating the property load my have a side effect. | 3811 // in case evaluating the property load my have a side effect. |
3872 if (assign_type == VARIABLE) { | 3812 if (assign_type == VARIABLE) { |
3873 PrepareForBailout(expr->expression(), TOS_REG); | 3813 PrepareForBailout(expr->expression(), TOS_REG); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4365 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4305 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
4366 __ add(pc, r1, Operand(masm_->CodeObject())); | 4306 __ add(pc, r1, Operand(masm_->CodeObject())); |
4367 } | 4307 } |
4368 | 4308 |
4369 | 4309 |
4370 #undef __ | 4310 #undef __ |
4371 | 4311 |
4372 } } // namespace v8::internal | 4312 } } // namespace v8::internal |
4373 | 4313 |
4374 #endif // V8_TARGET_ARCH_ARM | 4314 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |