| 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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 VisitForAccumulatorValue(function); | 774 VisitForAccumulatorValue(function); |
| 775 __ pop(r2); | 775 __ pop(r2); |
| 776 } else { | 776 } else { |
| 777 __ mov(r2, r0); | 777 __ mov(r2, r0); |
| 778 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex); | 778 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex); |
| 779 } | 779 } |
| 780 ASSERT(prop->key()->AsLiteral() != NULL && | 780 ASSERT(prop->key()->AsLiteral() != NULL && |
| 781 prop->key()->AsLiteral()->handle()->IsSmi()); | 781 prop->key()->AsLiteral()->handle()->IsSmi()); |
| 782 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); | 782 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); |
| 783 | 783 |
| 784 Handle<Code> ic(isolate()->builtins()->builtin(is_strict_mode() | 784 Builtins::Name builtin = is_strict_mode() |
| 785 ? Builtins::KeyedStoreIC_Initialize_Strict | 785 ? Builtins::KeyedStoreIC_Initialize_Strict |
| 786 : Builtins::KeyedStoreIC_Initialize)); | 786 : Builtins::KeyedStoreIC_Initialize; |
| 787 Handle<Code> ic = Builtins::builtin(builtin, isolate()); |
| 787 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 788 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 788 // Value in r0 is ignored (declarations are statements). | 789 // Value in r0 is ignored (declarations are statements). |
| 789 } | 790 } |
| 790 } | 791 } |
| 791 } | 792 } |
| 792 | 793 |
| 793 | 794 |
| 794 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 795 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
| 795 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); | 796 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); |
| 796 } | 797 } |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 key_literal != NULL && | 1180 key_literal != NULL && |
| 1180 obj_proxy->IsArguments() && | 1181 obj_proxy->IsArguments() && |
| 1181 key_literal->handle()->IsSmi()) { | 1182 key_literal->handle()->IsSmi()) { |
| 1182 // Load arguments object if there are no eval-introduced | 1183 // Load arguments object if there are no eval-introduced |
| 1183 // variables. Then load the argument from the arguments | 1184 // variables. Then load the argument from the arguments |
| 1184 // object using keyed load. | 1185 // object using keyed load. |
| 1185 __ ldr(r1, | 1186 __ ldr(r1, |
| 1186 ContextSlotOperandCheckExtensions(obj_proxy->var()->AsSlot(), | 1187 ContextSlotOperandCheckExtensions(obj_proxy->var()->AsSlot(), |
| 1187 slow)); | 1188 slow)); |
| 1188 __ mov(r0, Operand(key_literal->handle())); | 1189 __ mov(r0, Operand(key_literal->handle())); |
| 1189 Handle<Code> ic(isolate()->builtins()->builtin( | 1190 Handle<Code> ic = |
| 1190 Builtins::KeyedLoadIC_Initialize)); | 1191 Builtins::builtin(Builtins::KeyedLoadIC_Initialize, isolate()); |
| 1191 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 1192 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 1192 __ jmp(done); | 1193 __ jmp(done); |
| 1193 } | 1194 } |
| 1194 } | 1195 } |
| 1195 } | 1196 } |
| 1196 } | 1197 } |
| 1197 } | 1198 } |
| 1198 | 1199 |
| 1199 | 1200 |
| 1200 void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions( | 1201 void FullCodeGenerator::EmitLoadGlobalSlotCheckExtensions( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 __ ldr(next, FieldMemOperand(next, JSFunction::kContextOffset)); | 1247 __ ldr(next, FieldMemOperand(next, JSFunction::kContextOffset)); |
| 1247 __ b(&loop); | 1248 __ b(&loop); |
| 1248 __ bind(&fast); | 1249 __ bind(&fast); |
| 1249 } | 1250 } |
| 1250 | 1251 |
| 1251 __ ldr(r0, GlobalObjectOperand()); | 1252 __ ldr(r0, GlobalObjectOperand()); |
| 1252 __ mov(r2, Operand(slot->var()->name())); | 1253 __ mov(r2, Operand(slot->var()->name())); |
| 1253 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF) | 1254 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF) |
| 1254 ? RelocInfo::CODE_TARGET | 1255 ? RelocInfo::CODE_TARGET |
| 1255 : RelocInfo::CODE_TARGET_CONTEXT; | 1256 : RelocInfo::CODE_TARGET_CONTEXT; |
| 1256 Handle<Code> ic(isolate()->builtins()->builtin( | 1257 Handle<Code> ic = Builtins::builtin(Builtins::LoadIC_Initialize, isolate()); |
| 1257 Builtins::LoadIC_Initialize)); | |
| 1258 EmitCallIC(ic, mode); | 1258 EmitCallIC(ic, mode); |
| 1259 } | 1259 } |
| 1260 | 1260 |
| 1261 | 1261 |
| 1262 void FullCodeGenerator::EmitVariableLoad(Variable* var) { | 1262 void FullCodeGenerator::EmitVariableLoad(Variable* var) { |
| 1263 // Four cases: non-this global variables, lookup slots, all other | 1263 // Four cases: non-this global variables, lookup slots, all other |
| 1264 // types of slots, and parameters that rewrite to explicit property | 1264 // types of slots, and parameters that rewrite to explicit property |
| 1265 // accesses on the arguments object. | 1265 // accesses on the arguments object. |
| 1266 Slot* slot = var->AsSlot(); | 1266 Slot* slot = var->AsSlot(); |
| 1267 Property* property = var->AsProperty(); | 1267 Property* property = var->AsProperty(); |
| 1268 | 1268 |
| 1269 if (var->is_global() && !var->is_this()) { | 1269 if (var->is_global() && !var->is_this()) { |
| 1270 Comment cmnt(masm_, "Global variable"); | 1270 Comment cmnt(masm_, "Global variable"); |
| 1271 // Use inline caching. Variable name is passed in r2 and the global | 1271 // Use inline caching. Variable name is passed in r2 and the global |
| 1272 // object (receiver) in r0. | 1272 // object (receiver) in r0. |
| 1273 __ ldr(r0, GlobalObjectOperand()); | 1273 __ ldr(r0, GlobalObjectOperand()); |
| 1274 __ mov(r2, Operand(var->name())); | 1274 __ mov(r2, Operand(var->name())); |
| 1275 Handle<Code> ic(isolate()->builtins()->builtin( | 1275 Handle<Code> ic = Builtins::builtin(Builtins::LoadIC_Initialize, isolate()); |
| 1276 Builtins::LoadIC_Initialize)); | |
| 1277 EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT); | 1276 EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT); |
| 1278 context()->Plug(r0); | 1277 context()->Plug(r0); |
| 1279 | 1278 |
| 1280 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { | 1279 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { |
| 1281 Label done, slow; | 1280 Label done, slow; |
| 1282 | 1281 |
| 1283 // Generate code for loading from variables potentially shadowed | 1282 // Generate code for loading from variables potentially shadowed |
| 1284 // by eval-introduced variables. | 1283 // by eval-introduced variables. |
| 1285 EmitDynamicLoadFromSlotFastCase(slot, NOT_INSIDE_TYPEOF, &slow, &done); | 1284 EmitDynamicLoadFromSlotFastCase(slot, NOT_INSIDE_TYPEOF, &slow, &done); |
| 1286 | 1285 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 | 1324 |
| 1326 // Assert that the key is a smi. | 1325 // Assert that the key is a smi. |
| 1327 Literal* key_literal = property->key()->AsLiteral(); | 1326 Literal* key_literal = property->key()->AsLiteral(); |
| 1328 ASSERT_NOT_NULL(key_literal); | 1327 ASSERT_NOT_NULL(key_literal); |
| 1329 ASSERT(key_literal->handle()->IsSmi()); | 1328 ASSERT(key_literal->handle()->IsSmi()); |
| 1330 | 1329 |
| 1331 // Load the key. | 1330 // Load the key. |
| 1332 __ mov(r0, Operand(key_literal->handle())); | 1331 __ mov(r0, Operand(key_literal->handle())); |
| 1333 | 1332 |
| 1334 // Call keyed load IC. It has arguments key and receiver in r0 and r1. | 1333 // Call keyed load IC. It has arguments key and receiver in r0 and r1. |
| 1335 Handle<Code> ic(isolate()->builtins()->builtin( | 1334 Handle<Code> ic = |
| 1336 Builtins::KeyedLoadIC_Initialize)); | 1335 Builtins::builtin(Builtins::KeyedLoadIC_Initialize, isolate()); |
| 1337 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 1336 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 1338 context()->Plug(r0); | 1337 context()->Plug(r0); |
| 1339 } | 1338 } |
| 1340 } | 1339 } |
| 1341 | 1340 |
| 1342 | 1341 |
| 1343 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { | 1342 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
| 1344 Comment cmnt(masm_, "[ RegExpLiteral"); | 1343 Comment cmnt(masm_, "[ RegExpLiteral"); |
| 1345 Label materialized; | 1344 Label materialized; |
| 1346 // Registers will be used as follows: | 1345 // Registers will be used as follows: |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 UNREACHABLE(); | 1434 UNREACHABLE(); |
| 1436 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1435 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| 1437 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); | 1436 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); |
| 1438 // Fall through. | 1437 // Fall through. |
| 1439 case ObjectLiteral::Property::COMPUTED: | 1438 case ObjectLiteral::Property::COMPUTED: |
| 1440 if (key->handle()->IsSymbol()) { | 1439 if (key->handle()->IsSymbol()) { |
| 1441 if (property->emit_store()) { | 1440 if (property->emit_store()) { |
| 1442 VisitForAccumulatorValue(value); | 1441 VisitForAccumulatorValue(value); |
| 1443 __ mov(r2, Operand(key->handle())); | 1442 __ mov(r2, Operand(key->handle())); |
| 1444 __ ldr(r1, MemOperand(sp)); | 1443 __ ldr(r1, MemOperand(sp)); |
| 1445 Handle<Code> ic(isolate()->builtins()->builtin( | 1444 Handle<Code> ic = |
| 1446 Builtins::StoreIC_Initialize)); | 1445 Builtins::builtin(Builtins::StoreIC_Initialize, isolate()); |
| 1447 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 1446 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 1448 PrepareForBailoutForId(key->id(), NO_REGISTERS); | 1447 PrepareForBailoutForId(key->id(), NO_REGISTERS); |
| 1449 } else { | 1448 } else { |
| 1450 VisitForEffect(value); | 1449 VisitForEffect(value); |
| 1451 } | 1450 } |
| 1452 break; | 1451 break; |
| 1453 } | 1452 } |
| 1454 // Fall through. | 1453 // Fall through. |
| 1455 case ObjectLiteral::Property::PROTOTYPE: | 1454 case ObjectLiteral::Property::PROTOTYPE: |
| 1456 // Duplicate receiver on stack. | 1455 // Duplicate receiver on stack. |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1691 break; | 1690 break; |
| 1692 } | 1691 } |
| 1693 } | 1692 } |
| 1694 | 1693 |
| 1695 | 1694 |
| 1696 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 1695 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 1697 SetSourcePosition(prop->position()); | 1696 SetSourcePosition(prop->position()); |
| 1698 Literal* key = prop->key()->AsLiteral(); | 1697 Literal* key = prop->key()->AsLiteral(); |
| 1699 __ mov(r2, Operand(key->handle())); | 1698 __ mov(r2, Operand(key->handle())); |
| 1700 // Call load IC. It has arguments receiver and property name r0 and r2. | 1699 // Call load IC. It has arguments receiver and property name r0 and r2. |
| 1701 Handle<Code> ic(isolate()->builtins()->builtin( | 1700 Handle<Code> ic = Builtins::builtin(Builtins::LoadIC_Initialize, isolate()); |
| 1702 Builtins::LoadIC_Initialize)); | |
| 1703 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 1701 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 1704 } | 1702 } |
| 1705 | 1703 |
| 1706 | 1704 |
| 1707 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 1705 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 1708 SetSourcePosition(prop->position()); | 1706 SetSourcePosition(prop->position()); |
| 1709 // Call keyed load IC. It has arguments key and receiver in r0 and r1. | 1707 // Call keyed load IC. It has arguments key and receiver in r0 and r1. |
| 1710 Handle<Code> ic(isolate()->builtins()->builtin( | 1708 Handle<Code> ic = |
| 1711 Builtins::KeyedLoadIC_Initialize)); | 1709 Builtins::builtin(Builtins::KeyedLoadIC_Initialize, isolate()); |
| 1712 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 1710 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 1713 } | 1711 } |
| 1714 | 1712 |
| 1715 | 1713 |
| 1716 void FullCodeGenerator::EmitInlineSmiBinaryOp(Expression* expr, | 1714 void FullCodeGenerator::EmitInlineSmiBinaryOp(Expression* expr, |
| 1717 Token::Value op, | 1715 Token::Value op, |
| 1718 OverwriteMode mode, | 1716 OverwriteMode mode, |
| 1719 Expression* left_expr, | 1717 Expression* left_expr, |
| 1720 Expression* right_expr) { | 1718 Expression* right_expr) { |
| 1721 Label done, smi_case, stub_call; | 1719 Label done, smi_case, stub_call; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 EffectContext context(this); | 1844 EffectContext context(this); |
| 1847 EmitVariableAssignment(var, Token::ASSIGN); | 1845 EmitVariableAssignment(var, Token::ASSIGN); |
| 1848 break; | 1846 break; |
| 1849 } | 1847 } |
| 1850 case NAMED_PROPERTY: { | 1848 case NAMED_PROPERTY: { |
| 1851 __ push(r0); // Preserve value. | 1849 __ push(r0); // Preserve value. |
| 1852 VisitForAccumulatorValue(prop->obj()); | 1850 VisitForAccumulatorValue(prop->obj()); |
| 1853 __ mov(r1, r0); | 1851 __ mov(r1, r0); |
| 1854 __ pop(r0); // Restore value. | 1852 __ pop(r0); // Restore value. |
| 1855 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); | 1853 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); |
| 1856 Handle<Code> ic(isolate()->builtins()->builtin( | 1854 Builtins::Name builtin = is_strict_mode() |
| 1857 is_strict_mode() ? Builtins::StoreIC_Initialize_Strict | 1855 ? Builtins::StoreIC_Initialize_Strict |
| 1858 : Builtins::StoreIC_Initialize)); | 1856 : Builtins::StoreIC_Initialize; |
| 1857 Handle<Code> ic = Builtins::builtin(builtin, isolate()); |
| 1859 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 1858 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 1860 break; | 1859 break; |
| 1861 } | 1860 } |
| 1862 case KEYED_PROPERTY: { | 1861 case KEYED_PROPERTY: { |
| 1863 __ push(r0); // Preserve value. | 1862 __ push(r0); // Preserve value. |
| 1864 if (prop->is_synthetic()) { | 1863 if (prop->is_synthetic()) { |
| 1865 ASSERT(prop->obj()->AsVariableProxy() != NULL); | 1864 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
| 1866 ASSERT(prop->key()->AsLiteral() != NULL); | 1865 ASSERT(prop->key()->AsLiteral() != NULL); |
| 1867 { AccumulatorValueContext for_object(this); | 1866 { AccumulatorValueContext for_object(this); |
| 1868 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); | 1867 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); |
| 1869 } | 1868 } |
| 1870 __ mov(r2, r0); | 1869 __ mov(r2, r0); |
| 1871 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); | 1870 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); |
| 1872 } else { | 1871 } else { |
| 1873 VisitForStackValue(prop->obj()); | 1872 VisitForStackValue(prop->obj()); |
| 1874 VisitForAccumulatorValue(prop->key()); | 1873 VisitForAccumulatorValue(prop->key()); |
| 1875 __ mov(r1, r0); | 1874 __ mov(r1, r0); |
| 1876 __ pop(r2); | 1875 __ pop(r2); |
| 1877 } | 1876 } |
| 1878 __ pop(r0); // Restore value. | 1877 __ pop(r0); // Restore value. |
| 1879 Handle<Code> ic(isolate()->builtins()->builtin( | 1878 Builtins::Name builtin = is_strict_mode() |
| 1880 is_strict_mode() ? Builtins::KeyedStoreIC_Initialize_Strict | 1879 ? Builtins::KeyedStoreIC_Initialize_Strict |
| 1881 : Builtins::KeyedStoreIC_Initialize)); | 1880 : Builtins::KeyedStoreIC_Initialize; |
| 1881 Handle<Code> ic = Builtins::builtin(builtin, isolate()); |
| 1882 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 1882 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 1883 break; | 1883 break; |
| 1884 } | 1884 } |
| 1885 } | 1885 } |
| 1886 PrepareForBailoutForId(bailout_ast_id, TOS_REG); | 1886 PrepareForBailoutForId(bailout_ast_id, TOS_REG); |
| 1887 context()->Plug(r0); | 1887 context()->Plug(r0); |
| 1888 } | 1888 } |
| 1889 | 1889 |
| 1890 | 1890 |
| 1891 void FullCodeGenerator::EmitVariableAssignment(Variable* var, | 1891 void FullCodeGenerator::EmitVariableAssignment(Variable* var, |
| 1892 Token::Value op) { | 1892 Token::Value op) { |
| 1893 // Left-hand sides that rewrite to explicit property accesses do not reach | 1893 // Left-hand sides that rewrite to explicit property accesses do not reach |
| 1894 // here. | 1894 // here. |
| 1895 ASSERT(var != NULL); | 1895 ASSERT(var != NULL); |
| 1896 ASSERT(var->is_global() || var->AsSlot() != NULL); | 1896 ASSERT(var->is_global() || var->AsSlot() != NULL); |
| 1897 | 1897 |
| 1898 if (var->is_global()) { | 1898 if (var->is_global()) { |
| 1899 ASSERT(!var->is_this()); | 1899 ASSERT(!var->is_this()); |
| 1900 // Assignment to a global variable. Use inline caching for the | 1900 // Assignment to a global variable. Use inline caching for the |
| 1901 // assignment. Right-hand-side value is passed in r0, variable name in | 1901 // assignment. Right-hand-side value is passed in r0, variable name in |
| 1902 // r2, and the global object in r1. | 1902 // r2, and the global object in r1. |
| 1903 __ mov(r2, Operand(var->name())); | 1903 __ mov(r2, Operand(var->name())); |
| 1904 __ ldr(r1, GlobalObjectOperand()); | 1904 __ ldr(r1, GlobalObjectOperand()); |
| 1905 Handle<Code> ic(isolate()->builtins()->builtin( | 1905 Builtins::Name builtin = is_strict_mode() |
| 1906 is_strict_mode() ? Builtins::StoreIC_Initialize_Strict | 1906 ? Builtins::StoreIC_Initialize_Strict |
| 1907 : Builtins::StoreIC_Initialize)); | 1907 : Builtins::StoreIC_Initialize; |
| 1908 Handle<Code> ic = Builtins::builtin(builtin, isolate()); |
| 1908 EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT); | 1909 EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT); |
| 1909 | 1910 |
| 1910 } else if (op == Token::INIT_CONST) { | 1911 } else if (op == Token::INIT_CONST) { |
| 1911 // Like var declarations, const declarations are hoisted to function | 1912 // Like var declarations, const declarations are hoisted to function |
| 1912 // scope. However, unlike var initializers, const initializers are able | 1913 // scope. However, unlike var initializers, const initializers are able |
| 1913 // to drill a hole to that function context, even from inside a 'with' | 1914 // to drill a hole to that function context, even from inside a 'with' |
| 1914 // context. We thus bypass the normal static scope lookup. | 1915 // context. We thus bypass the normal static scope lookup. |
| 1915 Slot* slot = var->AsSlot(); | 1916 Slot* slot = var->AsSlot(); |
| 1916 Label skip; | 1917 Label skip; |
| 1917 switch (slot->type()) { | 1918 switch (slot->type()) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2004 SetSourcePosition(expr->position()); | 2005 SetSourcePosition(expr->position()); |
| 2005 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); | 2006 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); |
| 2006 // Load receiver to r1. Leave a copy in the stack if needed for turning the | 2007 // Load receiver to r1. Leave a copy in the stack if needed for turning the |
| 2007 // receiver into fast case. | 2008 // receiver into fast case. |
| 2008 if (expr->ends_initialization_block()) { | 2009 if (expr->ends_initialization_block()) { |
| 2009 __ ldr(r1, MemOperand(sp)); | 2010 __ ldr(r1, MemOperand(sp)); |
| 2010 } else { | 2011 } else { |
| 2011 __ pop(r1); | 2012 __ pop(r1); |
| 2012 } | 2013 } |
| 2013 | 2014 |
| 2014 Handle<Code> ic(isolate()->builtins()->builtin( | 2015 Builtins::Name builtin = is_strict_mode() |
| 2015 is_strict_mode() ? Builtins::StoreIC_Initialize_Strict | 2016 ? Builtins::StoreIC_Initialize_Strict |
| 2016 : Builtins::StoreIC_Initialize)); | 2017 : Builtins::StoreIC_Initialize; |
| 2018 Handle<Code> ic = Builtins::builtin(builtin, isolate()); |
| 2017 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 2019 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 2018 | 2020 |
| 2019 // If the assignment ends an initialization block, revert to fast case. | 2021 // If the assignment ends an initialization block, revert to fast case. |
| 2020 if (expr->ends_initialization_block()) { | 2022 if (expr->ends_initialization_block()) { |
| 2021 __ push(r0); // Result of assignment, saved even if not needed. | 2023 __ push(r0); // Result of assignment, saved even if not needed. |
| 2022 // Receiver is under the result value. | 2024 // Receiver is under the result value. |
| 2023 __ ldr(ip, MemOperand(sp, kPointerSize)); | 2025 __ ldr(ip, MemOperand(sp, kPointerSize)); |
| 2024 __ push(ip); | 2026 __ push(ip); |
| 2025 __ CallRuntime(Runtime::kToFastProperties, 1); | 2027 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2026 __ pop(r0); | 2028 __ pop(r0); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2050 SetSourcePosition(expr->position()); | 2052 SetSourcePosition(expr->position()); |
| 2051 __ pop(r1); // Key. | 2053 __ pop(r1); // Key. |
| 2052 // Load receiver to r2. Leave a copy in the stack if needed for turning the | 2054 // Load receiver to r2. Leave a copy in the stack if needed for turning the |
| 2053 // receiver into fast case. | 2055 // receiver into fast case. |
| 2054 if (expr->ends_initialization_block()) { | 2056 if (expr->ends_initialization_block()) { |
| 2055 __ ldr(r2, MemOperand(sp)); | 2057 __ ldr(r2, MemOperand(sp)); |
| 2056 } else { | 2058 } else { |
| 2057 __ pop(r2); | 2059 __ pop(r2); |
| 2058 } | 2060 } |
| 2059 | 2061 |
| 2060 Handle<Code> ic(isolate()->builtins()->builtin( | 2062 Builtins::Name builtin = is_strict_mode() |
| 2061 is_strict_mode() ? Builtins::KeyedStoreIC_Initialize_Strict | 2063 ? Builtins::KeyedStoreIC_Initialize_Strict |
| 2062 : Builtins::KeyedStoreIC_Initialize)); | 2064 : Builtins::KeyedStoreIC_Initialize; |
| 2065 Handle<Code> ic = Builtins::builtin(builtin, isolate()); |
| 2063 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 2066 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 2064 | 2067 |
| 2065 // If the assignment ends an initialization block, revert to fast case. | 2068 // If the assignment ends an initialization block, revert to fast case. |
| 2066 if (expr->ends_initialization_block()) { | 2069 if (expr->ends_initialization_block()) { |
| 2067 __ push(r0); // Result of assignment, saved even if not needed. | 2070 __ push(r0); // Result of assignment, saved even if not needed. |
| 2068 // Receiver is under the result value. | 2071 // Receiver is under the result value. |
| 2069 __ ldr(ip, MemOperand(sp, kPointerSize)); | 2072 __ ldr(ip, MemOperand(sp, kPointerSize)); |
| 2070 __ push(ip); | 2073 __ push(ip); |
| 2071 __ CallRuntime(Runtime::kToFastProperties, 1); | 2074 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2072 __ pop(r0); | 2075 __ pop(r0); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2337 MemOperand operand = EmitSlotSearch(slot, r1); | 2340 MemOperand operand = EmitSlotSearch(slot, r1); |
| 2338 __ ldr(r1, operand); | 2341 __ ldr(r1, operand); |
| 2339 | 2342 |
| 2340 ASSERT(prop->key()->AsLiteral() != NULL); | 2343 ASSERT(prop->key()->AsLiteral() != NULL); |
| 2341 ASSERT(prop->key()->AsLiteral()->handle()->IsSmi()); | 2344 ASSERT(prop->key()->AsLiteral()->handle()->IsSmi()); |
| 2342 __ mov(r0, Operand(prop->key()->AsLiteral()->handle())); | 2345 __ mov(r0, Operand(prop->key()->AsLiteral()->handle())); |
| 2343 | 2346 |
| 2344 // Record source code position for IC call. | 2347 // Record source code position for IC call. |
| 2345 SetSourcePosition(prop->position()); | 2348 SetSourcePosition(prop->position()); |
| 2346 | 2349 |
| 2347 Handle<Code> ic(isolate()->builtins()->builtin( | 2350 Handle<Code> ic = |
| 2348 Builtins::KeyedLoadIC_Initialize)); | 2351 Builtins::builtin(Builtins::KeyedLoadIC_Initialize, isolate()); |
| 2349 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 2352 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 2350 __ ldr(r1, GlobalObjectOperand()); | 2353 __ ldr(r1, GlobalObjectOperand()); |
| 2351 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); | 2354 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); |
| 2352 __ Push(r0, r1); // Function, receiver. | 2355 __ Push(r0, r1); // Function, receiver. |
| 2353 EmitCallWithStub(expr); | 2356 EmitCallWithStub(expr); |
| 2354 } else { | 2357 } else { |
| 2355 { PreservePositionScope scope(masm()->positions_recorder()); | 2358 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2356 VisitForStackValue(prop->obj()); | 2359 VisitForStackValue(prop->obj()); |
| 2357 } | 2360 } |
| 2358 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); | 2361 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 } | 2409 } |
| 2407 | 2410 |
| 2408 // Call the construct call builtin that handles allocation and | 2411 // Call the construct call builtin that handles allocation and |
| 2409 // constructor invocation. | 2412 // constructor invocation. |
| 2410 SetSourcePosition(expr->position()); | 2413 SetSourcePosition(expr->position()); |
| 2411 | 2414 |
| 2412 // Load function and argument count into r1 and r0. | 2415 // Load function and argument count into r1 and r0. |
| 2413 __ mov(r0, Operand(arg_count)); | 2416 __ mov(r0, Operand(arg_count)); |
| 2414 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 2417 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
| 2415 | 2418 |
| 2416 Handle<Code> construct_builtin(isolate()->builtins()->builtin( | 2419 Handle<Code> construct_builtin = |
| 2417 Builtins::JSConstructCall)); | 2420 Builtins::builtin(Builtins::JSConstructCall, isolate()); |
| 2418 __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL); | 2421 __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL); |
| 2419 context()->Plug(r0); | 2422 context()->Plug(r0); |
| 2420 } | 2423 } |
| 2421 | 2424 |
| 2422 | 2425 |
| 2423 void FullCodeGenerator::EmitIsSmi(ZoneList<Expression*>* args) { | 2426 void FullCodeGenerator::EmitIsSmi(ZoneList<Expression*>* args) { |
| 2424 ASSERT(args->length() == 1); | 2427 ASSERT(args->length() == 1); |
| 2425 | 2428 |
| 2426 VisitForAccumulatorValue(args->at(0)); | 2429 VisitForAccumulatorValue(args->at(0)); |
| 2427 | 2430 |
| (...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3907 } else { | 3910 } else { |
| 3908 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 3911 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
| 3909 Token::ASSIGN); | 3912 Token::ASSIGN); |
| 3910 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 3913 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 3911 context()->Plug(r0); | 3914 context()->Plug(r0); |
| 3912 } | 3915 } |
| 3913 break; | 3916 break; |
| 3914 case NAMED_PROPERTY: { | 3917 case NAMED_PROPERTY: { |
| 3915 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); | 3918 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); |
| 3916 __ pop(r1); | 3919 __ pop(r1); |
| 3917 Handle<Code> ic(isolate()->builtins()->builtin( | 3920 Builtins::Name builtin = is_strict_mode() |
| 3918 is_strict_mode() ? Builtins::StoreIC_Initialize_Strict | 3921 ? Builtins::StoreIC_Initialize_Strict |
| 3919 : Builtins::StoreIC_Initialize)); | 3922 : Builtins::StoreIC_Initialize; |
| 3923 Handle<Code> ic = Builtins::builtin(builtin, isolate()); |
| 3920 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 3924 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 3921 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 3925 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 3922 if (expr->is_postfix()) { | 3926 if (expr->is_postfix()) { |
| 3923 if (!context()->IsEffect()) { | 3927 if (!context()->IsEffect()) { |
| 3924 context()->PlugTOS(); | 3928 context()->PlugTOS(); |
| 3925 } | 3929 } |
| 3926 } else { | 3930 } else { |
| 3927 context()->Plug(r0); | 3931 context()->Plug(r0); |
| 3928 } | 3932 } |
| 3929 break; | 3933 break; |
| 3930 } | 3934 } |
| 3931 case KEYED_PROPERTY: { | 3935 case KEYED_PROPERTY: { |
| 3932 __ pop(r1); // Key. | 3936 __ pop(r1); // Key. |
| 3933 __ pop(r2); // Receiver. | 3937 __ pop(r2); // Receiver. |
| 3934 Handle<Code> ic(isolate()->builtins()->builtin( | 3938 Builtins::Name builtin = is_strict_mode() |
| 3935 is_strict_mode() ? Builtins::KeyedStoreIC_Initialize_Strict | 3939 ? Builtins::KeyedStoreIC_Initialize_Strict |
| 3936 : Builtins::KeyedStoreIC_Initialize)); | 3940 : Builtins::KeyedStoreIC_Initialize; |
| 3941 Handle<Code> ic = Builtins::builtin(builtin, isolate()); |
| 3937 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 3942 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 3938 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 3943 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 3939 if (expr->is_postfix()) { | 3944 if (expr->is_postfix()) { |
| 3940 if (!context()->IsEffect()) { | 3945 if (!context()->IsEffect()) { |
| 3941 context()->PlugTOS(); | 3946 context()->PlugTOS(); |
| 3942 } | 3947 } |
| 3943 } else { | 3948 } else { |
| 3944 context()->Plug(r0); | 3949 context()->Plug(r0); |
| 3945 } | 3950 } |
| 3946 break; | 3951 break; |
| 3947 } | 3952 } |
| 3948 } | 3953 } |
| 3949 } | 3954 } |
| 3950 | 3955 |
| 3951 | 3956 |
| 3952 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { | 3957 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
| 3953 ASSERT(!context()->IsEffect()); | 3958 ASSERT(!context()->IsEffect()); |
| 3954 ASSERT(!context()->IsTest()); | 3959 ASSERT(!context()->IsTest()); |
| 3955 VariableProxy* proxy = expr->AsVariableProxy(); | 3960 VariableProxy* proxy = expr->AsVariableProxy(); |
| 3956 if (proxy != NULL && !proxy->var()->is_this() && proxy->var()->is_global()) { | 3961 if (proxy != NULL && !proxy->var()->is_this() && proxy->var()->is_global()) { |
| 3957 Comment cmnt(masm_, "Global variable"); | 3962 Comment cmnt(masm_, "Global variable"); |
| 3958 __ ldr(r0, GlobalObjectOperand()); | 3963 __ ldr(r0, GlobalObjectOperand()); |
| 3959 __ mov(r2, Operand(proxy->name())); | 3964 __ mov(r2, Operand(proxy->name())); |
| 3960 Handle<Code> ic(isolate()->builtins()->builtin( | 3965 Handle<Code> ic = |
| 3961 Builtins::LoadIC_Initialize)); | 3966 Builtins::builtin(Builtins::LoadIC_Initialize, isolate()); |
| 3962 // Use a regular load, not a contextual load, to avoid a reference | 3967 // Use a regular load, not a contextual load, to avoid a reference |
| 3963 // error. | 3968 // error. |
| 3964 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 3969 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
| 3965 PrepareForBailout(expr, TOS_REG); | 3970 PrepareForBailout(expr, TOS_REG); |
| 3966 context()->Plug(r0); | 3971 context()->Plug(r0); |
| 3967 } else if (proxy != NULL && | 3972 } else if (proxy != NULL && |
| 3968 proxy->var()->AsSlot() != NULL && | 3973 proxy->var()->AsSlot() != NULL && |
| 3969 proxy->var()->AsSlot()->type() == Slot::LOOKUP) { | 3974 proxy->var()->AsSlot()->type() == Slot::LOOKUP) { |
| 3970 Label done, slow; | 3975 Label done, slow; |
| 3971 | 3976 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4312 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4317 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
| 4313 __ add(pc, r1, Operand(masm_->CodeObject())); | 4318 __ add(pc, r1, Operand(masm_->CodeObject())); |
| 4314 } | 4319 } |
| 4315 | 4320 |
| 4316 | 4321 |
| 4317 #undef __ | 4322 #undef __ |
| 4318 | 4323 |
| 4319 } } // namespace v8::internal | 4324 } } // namespace v8::internal |
| 4320 | 4325 |
| 4321 #endif // V8_TARGET_ARCH_ARM | 4326 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |