OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 VisitForValue(prop->key(), kStack); | 759 VisitForValue(prop->key(), kStack); |
760 VisitForValue(function, kAccumulator); | 760 VisitForValue(function, kAccumulator); |
761 __ pop(r1); // Key. | 761 __ pop(r1); // Key. |
762 } else { | 762 } else { |
763 VisitForValue(prop->key(), kAccumulator); | 763 VisitForValue(prop->key(), kAccumulator); |
764 __ mov(r1, result_register()); // Key. | 764 __ mov(r1, result_register()); // Key. |
765 __ LoadRoot(result_register(), Heap::kTheHoleValueRootIndex); | 765 __ LoadRoot(result_register(), Heap::kTheHoleValueRootIndex); |
766 } | 766 } |
767 __ pop(r2); // Receiver. | 767 __ pop(r2); // Receiver. |
768 | 768 |
769 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 769 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 770 Builtins::KeyedStoreIC_Initialize)); |
770 __ Call(ic, RelocInfo::CODE_TARGET); | 771 __ Call(ic, RelocInfo::CODE_TARGET); |
771 // Value in r0 is ignored (declarations are statements). | 772 // Value in r0 is ignored (declarations are statements). |
772 } | 773 } |
773 } | 774 } |
774 } | 775 } |
775 | 776 |
776 | 777 |
777 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 778 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
778 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); | 779 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); |
779 } | 780 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 // accesses on the arguments object. | 1036 // accesses on the arguments object. |
1036 Slot* slot = var->slot(); | 1037 Slot* slot = var->slot(); |
1037 Property* property = var->AsProperty(); | 1038 Property* property = var->AsProperty(); |
1038 | 1039 |
1039 if (var->is_global() && !var->is_this()) { | 1040 if (var->is_global() && !var->is_this()) { |
1040 Comment cmnt(masm_, "Global variable"); | 1041 Comment cmnt(masm_, "Global variable"); |
1041 // Use inline caching. Variable name is passed in r2 and the global | 1042 // Use inline caching. Variable name is passed in r2 and the global |
1042 // object (receiver) in r0. | 1043 // object (receiver) in r0. |
1043 __ ldr(r0, CodeGenerator::GlobalObject()); | 1044 __ ldr(r0, CodeGenerator::GlobalObject()); |
1044 __ mov(r2, Operand(var->name())); | 1045 __ mov(r2, Operand(var->name())); |
1045 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1046 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1047 Builtins::LoadIC_Initialize)); |
1046 __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT); | 1048 __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT); |
1047 Apply(context, r0); | 1049 Apply(context, r0); |
1048 | 1050 |
1049 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { | 1051 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { |
1050 Comment cmnt(masm_, "Lookup slot"); | 1052 Comment cmnt(masm_, "Lookup slot"); |
1051 __ mov(r1, Operand(var->name())); | 1053 __ mov(r1, Operand(var->name())); |
1052 __ Push(cp, r1); // Context and name. | 1054 __ Push(cp, r1); // Context and name. |
1053 __ CallRuntime(Runtime::kLoadContextSlot, 2); | 1055 __ CallRuntime(Runtime::kLoadContextSlot, 2); |
1054 Apply(context, r0); | 1056 Apply(context, r0); |
1055 | 1057 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 | 1090 |
1089 // Assert that the key is a smi. | 1091 // Assert that the key is a smi. |
1090 Literal* key_literal = property->key()->AsLiteral(); | 1092 Literal* key_literal = property->key()->AsLiteral(); |
1091 ASSERT_NOT_NULL(key_literal); | 1093 ASSERT_NOT_NULL(key_literal); |
1092 ASSERT(key_literal->handle()->IsSmi()); | 1094 ASSERT(key_literal->handle()->IsSmi()); |
1093 | 1095 |
1094 // Load the key. | 1096 // Load the key. |
1095 __ mov(r0, Operand(key_literal->handle())); | 1097 __ mov(r0, Operand(key_literal->handle())); |
1096 | 1098 |
1097 // Call keyed load IC. It has arguments key and receiver in r0 and r1. | 1099 // Call keyed load IC. It has arguments key and receiver in r0 and r1. |
1098 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1100 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1101 Builtins::KeyedLoadIC_Initialize)); |
1099 __ Call(ic, RelocInfo::CODE_TARGET); | 1102 __ Call(ic, RelocInfo::CODE_TARGET); |
1100 Apply(context, r0); | 1103 Apply(context, r0); |
1101 } | 1104 } |
1102 } | 1105 } |
1103 | 1106 |
1104 | 1107 |
1105 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { | 1108 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
1106 Comment cmnt(masm_, "[ RegExpLiteral"); | 1109 Comment cmnt(masm_, "[ RegExpLiteral"); |
1107 Label done; | 1110 Label done; |
1108 // Registers will be used as follows: | 1111 // Registers will be used as follows: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 case ObjectLiteral::Property::CONSTANT: | 1164 case ObjectLiteral::Property::CONSTANT: |
1162 UNREACHABLE(); | 1165 UNREACHABLE(); |
1163 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1166 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
1164 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); | 1167 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); |
1165 // Fall through. | 1168 // Fall through. |
1166 case ObjectLiteral::Property::COMPUTED: | 1169 case ObjectLiteral::Property::COMPUTED: |
1167 if (key->handle()->IsSymbol()) { | 1170 if (key->handle()->IsSymbol()) { |
1168 VisitForValue(value, kAccumulator); | 1171 VisitForValue(value, kAccumulator); |
1169 __ mov(r2, Operand(key->handle())); | 1172 __ mov(r2, Operand(key->handle())); |
1170 __ ldr(r1, MemOperand(sp)); | 1173 __ ldr(r1, MemOperand(sp)); |
1171 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1174 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1175 Builtins::StoreIC_Initialize)); |
1172 __ Call(ic, RelocInfo::CODE_TARGET); | 1176 __ Call(ic, RelocInfo::CODE_TARGET); |
1173 break; | 1177 break; |
1174 } | 1178 } |
1175 // Fall through. | 1179 // Fall through. |
1176 case ObjectLiteral::Property::PROTOTYPE: | 1180 case ObjectLiteral::Property::PROTOTYPE: |
1177 // Duplicate receiver on stack. | 1181 // Duplicate receiver on stack. |
1178 __ ldr(r0, MemOperand(sp)); | 1182 __ ldr(r0, MemOperand(sp)); |
1179 __ push(r0); | 1183 __ push(r0); |
1180 VisitForValue(key, kStack); | 1184 VisitForValue(key, kStack); |
1181 VisitForValue(value, kStack); | 1185 VisitForValue(value, kStack); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 break; | 1367 break; |
1364 } | 1368 } |
1365 } | 1369 } |
1366 | 1370 |
1367 | 1371 |
1368 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 1372 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
1369 SetSourcePosition(prop->position()); | 1373 SetSourcePosition(prop->position()); |
1370 Literal* key = prop->key()->AsLiteral(); | 1374 Literal* key = prop->key()->AsLiteral(); |
1371 __ mov(r2, Operand(key->handle())); | 1375 __ mov(r2, Operand(key->handle())); |
1372 // Call load IC. It has arguments receiver and property name r0 and r2. | 1376 // Call load IC. It has arguments receiver and property name r0 and r2. |
1373 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1377 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1378 Builtins::LoadIC_Initialize)); |
1374 __ Call(ic, RelocInfo::CODE_TARGET); | 1379 __ Call(ic, RelocInfo::CODE_TARGET); |
1375 } | 1380 } |
1376 | 1381 |
1377 | 1382 |
1378 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 1383 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
1379 SetSourcePosition(prop->position()); | 1384 SetSourcePosition(prop->position()); |
1380 // Call keyed load IC. It has arguments key and receiver in r0 and r1. | 1385 // Call keyed load IC. It has arguments key and receiver in r0 and r1. |
1381 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1386 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1387 Builtins::KeyedLoadIC_Initialize)); |
1382 __ Call(ic, RelocInfo::CODE_TARGET); | 1388 __ Call(ic, RelocInfo::CODE_TARGET); |
1383 } | 1389 } |
1384 | 1390 |
1385 | 1391 |
1386 void FullCodeGenerator::EmitBinaryOp(Token::Value op, | 1392 void FullCodeGenerator::EmitBinaryOp(Token::Value op, |
1387 Expression::Context context) { | 1393 Expression::Context context) { |
1388 __ pop(r1); | 1394 __ pop(r1); |
1389 GenericBinaryOpStub stub(op, NO_OVERWRITE, r1, r0); | 1395 GenericBinaryOpStub stub(op, NO_OVERWRITE, r1, r0); |
1390 __ CallStub(&stub); | 1396 __ CallStub(&stub); |
1391 Apply(context, r0); | 1397 Apply(context, r0); |
(...skipping 24 matching lines...) Expand all Loading... |
1416 Variable* var = expr->AsVariableProxy()->var(); | 1422 Variable* var = expr->AsVariableProxy()->var(); |
1417 EmitVariableAssignment(var, Token::ASSIGN, Expression::kEffect); | 1423 EmitVariableAssignment(var, Token::ASSIGN, Expression::kEffect); |
1418 break; | 1424 break; |
1419 } | 1425 } |
1420 case NAMED_PROPERTY: { | 1426 case NAMED_PROPERTY: { |
1421 __ push(r0); // Preserve value. | 1427 __ push(r0); // Preserve value. |
1422 VisitForValue(prop->obj(), kAccumulator); | 1428 VisitForValue(prop->obj(), kAccumulator); |
1423 __ mov(r1, r0); | 1429 __ mov(r1, r0); |
1424 __ pop(r0); // Restore value. | 1430 __ pop(r0); // Restore value. |
1425 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); | 1431 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); |
1426 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1432 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1433 Builtins::StoreIC_Initialize)); |
1427 __ Call(ic, RelocInfo::CODE_TARGET); | 1434 __ Call(ic, RelocInfo::CODE_TARGET); |
1428 break; | 1435 break; |
1429 } | 1436 } |
1430 case KEYED_PROPERTY: { | 1437 case KEYED_PROPERTY: { |
1431 __ push(r0); // Preserve value. | 1438 __ push(r0); // Preserve value. |
1432 VisitForValue(prop->obj(), kStack); | 1439 VisitForValue(prop->obj(), kStack); |
1433 VisitForValue(prop->key(), kAccumulator); | 1440 VisitForValue(prop->key(), kAccumulator); |
1434 __ mov(r1, r0); | 1441 __ mov(r1, r0); |
1435 __ pop(r2); | 1442 __ pop(r2); |
1436 __ pop(r0); // Restore value. | 1443 __ pop(r0); // Restore value. |
1437 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 1444 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1445 Builtins::KeyedStoreIC_Initialize)); |
1438 __ Call(ic, RelocInfo::CODE_TARGET); | 1446 __ Call(ic, RelocInfo::CODE_TARGET); |
1439 break; | 1447 break; |
1440 } | 1448 } |
1441 } | 1449 } |
1442 } | 1450 } |
1443 | 1451 |
1444 | 1452 |
1445 void FullCodeGenerator::EmitVariableAssignment(Variable* var, | 1453 void FullCodeGenerator::EmitVariableAssignment(Variable* var, |
1446 Token::Value op, | 1454 Token::Value op, |
1447 Expression::Context context) { | 1455 Expression::Context context) { |
1448 // Left-hand sides that rewrite to explicit property accesses do not reach | 1456 // Left-hand sides that rewrite to explicit property accesses do not reach |
1449 // here. | 1457 // here. |
1450 ASSERT(var != NULL); | 1458 ASSERT(var != NULL); |
1451 ASSERT(var->is_global() || var->slot() != NULL); | 1459 ASSERT(var->is_global() || var->slot() != NULL); |
1452 | 1460 |
1453 if (var->is_global()) { | 1461 if (var->is_global()) { |
1454 ASSERT(!var->is_this()); | 1462 ASSERT(!var->is_this()); |
1455 // Assignment to a global variable. Use inline caching for the | 1463 // Assignment to a global variable. Use inline caching for the |
1456 // assignment. Right-hand-side value is passed in r0, variable name in | 1464 // assignment. Right-hand-side value is passed in r0, variable name in |
1457 // r2, and the global object in r1. | 1465 // r2, and the global object in r1. |
1458 __ mov(r2, Operand(var->name())); | 1466 __ mov(r2, Operand(var->name())); |
1459 __ ldr(r1, CodeGenerator::GlobalObject()); | 1467 __ ldr(r1, CodeGenerator::GlobalObject()); |
1460 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1468 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1469 Builtins::StoreIC_Initialize)); |
1461 __ Call(ic, RelocInfo::CODE_TARGET); | 1470 __ Call(ic, RelocInfo::CODE_TARGET); |
1462 | 1471 |
1463 } else if (var->mode() != Variable::CONST || op == Token::INIT_CONST) { | 1472 } else if (var->mode() != Variable::CONST || op == Token::INIT_CONST) { |
1464 // Perform the assignment for non-const variables and for initialization | 1473 // Perform the assignment for non-const variables and for initialization |
1465 // of const variables. Const assignments are simply skipped. | 1474 // of const variables. Const assignments are simply skipped. |
1466 Label done; | 1475 Label done; |
1467 Slot* slot = var->slot(); | 1476 Slot* slot = var->slot(); |
1468 switch (slot->type()) { | 1477 switch (slot->type()) { |
1469 case Slot::PARAMETER: | 1478 case Slot::PARAMETER: |
1470 case Slot::LOCAL: | 1479 case Slot::LOCAL: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 SetSourcePosition(expr->position()); | 1549 SetSourcePosition(expr->position()); |
1541 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); | 1550 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); |
1542 // Load receiver to r1. Leave a copy in the stack if needed for turning the | 1551 // Load receiver to r1. Leave a copy in the stack if needed for turning the |
1543 // receiver into fast case. | 1552 // receiver into fast case. |
1544 if (expr->ends_initialization_block()) { | 1553 if (expr->ends_initialization_block()) { |
1545 __ ldr(r1, MemOperand(sp)); | 1554 __ ldr(r1, MemOperand(sp)); |
1546 } else { | 1555 } else { |
1547 __ pop(r1); | 1556 __ pop(r1); |
1548 } | 1557 } |
1549 | 1558 |
1550 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1559 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1560 Builtins::StoreIC_Initialize)); |
1551 __ Call(ic, RelocInfo::CODE_TARGET); | 1561 __ Call(ic, RelocInfo::CODE_TARGET); |
1552 | 1562 |
1553 // If the assignment ends an initialization block, revert to fast case. | 1563 // If the assignment ends an initialization block, revert to fast case. |
1554 if (expr->ends_initialization_block()) { | 1564 if (expr->ends_initialization_block()) { |
1555 __ push(r0); // Result of assignment, saved even if not needed. | 1565 __ push(r0); // Result of assignment, saved even if not needed. |
1556 // Receiver is under the result value. | 1566 // Receiver is under the result value. |
1557 __ ldr(ip, MemOperand(sp, kPointerSize)); | 1567 __ ldr(ip, MemOperand(sp, kPointerSize)); |
1558 __ push(ip); | 1568 __ push(ip); |
1559 __ CallRuntime(Runtime::kToFastProperties, 1); | 1569 __ CallRuntime(Runtime::kToFastProperties, 1); |
1560 __ pop(r0); | 1570 __ pop(r0); |
(...skipping 23 matching lines...) Expand all Loading... |
1584 SetSourcePosition(expr->position()); | 1594 SetSourcePosition(expr->position()); |
1585 __ pop(r1); // Key. | 1595 __ pop(r1); // Key. |
1586 // Load receiver to r2. Leave a copy in the stack if needed for turning the | 1596 // Load receiver to r2. Leave a copy in the stack if needed for turning the |
1587 // receiver into fast case. | 1597 // receiver into fast case. |
1588 if (expr->ends_initialization_block()) { | 1598 if (expr->ends_initialization_block()) { |
1589 __ ldr(r2, MemOperand(sp)); | 1599 __ ldr(r2, MemOperand(sp)); |
1590 } else { | 1600 } else { |
1591 __ pop(r2); | 1601 __ pop(r2); |
1592 } | 1602 } |
1593 | 1603 |
1594 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 1604 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1605 Builtins::KeyedStoreIC_Initialize)); |
1595 __ Call(ic, RelocInfo::CODE_TARGET); | 1606 __ Call(ic, RelocInfo::CODE_TARGET); |
1596 | 1607 |
1597 // If the assignment ends an initialization block, revert to fast case. | 1608 // If the assignment ends an initialization block, revert to fast case. |
1598 if (expr->ends_initialization_block()) { | 1609 if (expr->ends_initialization_block()) { |
1599 __ push(r0); // Result of assignment, saved even if not needed. | 1610 __ push(r0); // Result of assignment, saved even if not needed. |
1600 // Receiver is under the result value. | 1611 // Receiver is under the result value. |
1601 __ ldr(ip, MemOperand(sp, kPointerSize)); | 1612 __ ldr(ip, MemOperand(sp, kPointerSize)); |
1602 __ push(ip); | 1613 __ push(ip); |
1603 __ CallRuntime(Runtime::kToFastProperties, 1); | 1614 __ CallRuntime(Runtime::kToFastProperties, 1); |
1604 __ pop(r0); | 1615 __ pop(r0); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 // Call to a keyed property. | 1781 // Call to a keyed property. |
1771 // For a synthetic property use keyed load IC followed by function call, | 1782 // For a synthetic property use keyed load IC followed by function call, |
1772 // for a regular property use keyed CallIC. | 1783 // for a regular property use keyed CallIC. |
1773 VisitForValue(prop->obj(), kStack); | 1784 VisitForValue(prop->obj(), kStack); |
1774 if (prop->is_synthetic()) { | 1785 if (prop->is_synthetic()) { |
1775 VisitForValue(prop->key(), kAccumulator); | 1786 VisitForValue(prop->key(), kAccumulator); |
1776 // Record source code position for IC call. | 1787 // Record source code position for IC call. |
1777 SetSourcePosition(prop->position()); | 1788 SetSourcePosition(prop->position()); |
1778 __ pop(r1); // We do not need to keep the receiver. | 1789 __ pop(r1); // We do not need to keep the receiver. |
1779 | 1790 |
1780 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1791 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1792 Builtins::KeyedLoadIC_Initialize)); |
1781 __ Call(ic, RelocInfo::CODE_TARGET); | 1793 __ Call(ic, RelocInfo::CODE_TARGET); |
1782 // Push result (function). | 1794 // Push result (function). |
1783 __ push(r0); | 1795 __ push(r0); |
1784 // Push Global receiver. | 1796 // Push Global receiver. |
1785 __ ldr(r1, CodeGenerator::GlobalObject()); | 1797 __ ldr(r1, CodeGenerator::GlobalObject()); |
1786 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); | 1798 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); |
1787 __ push(r1); | 1799 __ push(r1); |
1788 EmitCallWithStub(expr); | 1800 EmitCallWithStub(expr); |
1789 } else { | 1801 } else { |
1790 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); | 1802 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1831 | 1843 |
1832 // Call the construct call builtin that handles allocation and | 1844 // Call the construct call builtin that handles allocation and |
1833 // constructor invocation. | 1845 // constructor invocation. |
1834 SetSourcePosition(expr->position()); | 1846 SetSourcePosition(expr->position()); |
1835 | 1847 |
1836 // Load function, arg_count into r1 and r0. | 1848 // Load function, arg_count into r1 and r0. |
1837 __ mov(r0, Operand(arg_count)); | 1849 __ mov(r0, Operand(arg_count)); |
1838 // Function is in sp[arg_count + 1]. | 1850 // Function is in sp[arg_count + 1]. |
1839 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 1851 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
1840 | 1852 |
1841 Handle<Code> construct_builtin(Builtins::builtin(Builtins::JSConstructCall)); | 1853 Handle<Code> construct_builtin(Isolate::Current()->builtins()->builtin( |
| 1854 Builtins::JSConstructCall)); |
1842 __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL); | 1855 __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL); |
1843 | 1856 |
1844 // Replace function on TOS with result in r0, or pop it. | 1857 // Replace function on TOS with result in r0, or pop it. |
1845 DropAndApply(1, context_, r0); | 1858 DropAndApply(1, context_, r0); |
1846 } | 1859 } |
1847 | 1860 |
1848 | 1861 |
1849 void FullCodeGenerator::EmitIsSmi(ZoneList<Expression*>* args) { | 1862 void FullCodeGenerator::EmitIsSmi(ZoneList<Expression*>* args) { |
1850 ASSERT(args->length() == 1); | 1863 ASSERT(args->length() == 1); |
1851 | 1864 |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2693 | 2706 |
2694 case Token::TYPEOF: { | 2707 case Token::TYPEOF: { |
2695 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); | 2708 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); |
2696 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 2709 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
2697 if (proxy != NULL && | 2710 if (proxy != NULL && |
2698 !proxy->var()->is_this() && | 2711 !proxy->var()->is_this() && |
2699 proxy->var()->is_global()) { | 2712 proxy->var()->is_global()) { |
2700 Comment cmnt(masm_, "Global variable"); | 2713 Comment cmnt(masm_, "Global variable"); |
2701 __ ldr(r0, CodeGenerator::GlobalObject()); | 2714 __ ldr(r0, CodeGenerator::GlobalObject()); |
2702 __ mov(r2, Operand(proxy->name())); | 2715 __ mov(r2, Operand(proxy->name())); |
2703 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 2716 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 2717 Builtins::LoadIC_Initialize)); |
2704 // Use a regular load, not a contextual load, to avoid a reference | 2718 // Use a regular load, not a contextual load, to avoid a reference |
2705 // error. | 2719 // error. |
2706 __ Call(ic, RelocInfo::CODE_TARGET); | 2720 __ Call(ic, RelocInfo::CODE_TARGET); |
2707 __ push(r0); | 2721 __ push(r0); |
2708 } else if (proxy != NULL && | 2722 } else if (proxy != NULL && |
2709 proxy->var()->slot() != NULL && | 2723 proxy->var()->slot() != NULL && |
2710 proxy->var()->slot()->type() == Slot::LOOKUP) { | 2724 proxy->var()->slot()->type() == Slot::LOOKUP) { |
2711 __ mov(r0, Operand(proxy->name())); | 2725 __ mov(r0, Operand(proxy->name())); |
2712 __ Push(cp, r0); | 2726 __ Push(cp, r0); |
2713 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); | 2727 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2899 } | 2913 } |
2900 } else { | 2914 } else { |
2901 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 2915 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
2902 Token::ASSIGN, | 2916 Token::ASSIGN, |
2903 context_); | 2917 context_); |
2904 } | 2918 } |
2905 break; | 2919 break; |
2906 case NAMED_PROPERTY: { | 2920 case NAMED_PROPERTY: { |
2907 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); | 2921 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); |
2908 __ pop(r1); | 2922 __ pop(r1); |
2909 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 2923 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 2924 Builtins::StoreIC_Initialize)); |
2910 __ Call(ic, RelocInfo::CODE_TARGET); | 2925 __ Call(ic, RelocInfo::CODE_TARGET); |
2911 if (expr->is_postfix()) { | 2926 if (expr->is_postfix()) { |
2912 if (context_ != Expression::kEffect) { | 2927 if (context_ != Expression::kEffect) { |
2913 ApplyTOS(context_); | 2928 ApplyTOS(context_); |
2914 } | 2929 } |
2915 } else { | 2930 } else { |
2916 Apply(context_, r0); | 2931 Apply(context_, r0); |
2917 } | 2932 } |
2918 break; | 2933 break; |
2919 } | 2934 } |
2920 case KEYED_PROPERTY: { | 2935 case KEYED_PROPERTY: { |
2921 __ pop(r1); // Key. | 2936 __ pop(r1); // Key. |
2922 __ pop(r2); // Receiver. | 2937 __ pop(r2); // Receiver. |
2923 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 2938 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 2939 Builtins::KeyedStoreIC_Initialize)); |
2924 __ Call(ic, RelocInfo::CODE_TARGET); | 2940 __ Call(ic, RelocInfo::CODE_TARGET); |
2925 if (expr->is_postfix()) { | 2941 if (expr->is_postfix()) { |
2926 if (context_ != Expression::kEffect) { | 2942 if (context_ != Expression::kEffect) { |
2927 ApplyTOS(context_); | 2943 ApplyTOS(context_); |
2928 } | 2944 } |
2929 } else { | 2945 } else { |
2930 Apply(context_, r0); | 2946 Apply(context_, r0); |
2931 } | 2947 } |
2932 break; | 2948 break; |
2933 } | 2949 } |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3152 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 3168 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
3153 __ add(pc, r1, Operand(masm_->CodeObject())); | 3169 __ add(pc, r1, Operand(masm_->CodeObject())); |
3154 } | 3170 } |
3155 | 3171 |
3156 | 3172 |
3157 #undef __ | 3173 #undef __ |
3158 | 3174 |
3159 } } // namespace v8::internal | 3175 } } // namespace v8::internal |
3160 | 3176 |
3161 #endif // V8_TARGET_ARCH_ARM | 3177 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |