OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 VisitForValue(prop->key(), kStack); | 851 VisitForValue(prop->key(), kStack); |
852 VisitForValue(function, kAccumulator); | 852 VisitForValue(function, kAccumulator); |
853 __ pop(ecx); | 853 __ pop(ecx); |
854 } else { | 854 } else { |
855 VisitForValue(prop->key(), kAccumulator); | 855 VisitForValue(prop->key(), kAccumulator); |
856 __ mov(ecx, result_register()); | 856 __ mov(ecx, result_register()); |
857 __ mov(result_register(), Factory::the_hole_value()); | 857 __ mov(result_register(), Factory::the_hole_value()); |
858 } | 858 } |
859 __ pop(edx); | 859 __ pop(edx); |
860 | 860 |
861 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 861 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 862 Builtins::KeyedStoreIC_Initialize)); |
862 __ call(ic, RelocInfo::CODE_TARGET); | 863 __ call(ic, RelocInfo::CODE_TARGET); |
863 // Absence of a test eax instruction following the call | 864 // Absence of a test eax instruction following the call |
864 // indicates that none of the load was inlined. | 865 // indicates that none of the load was inlined. |
865 __ nop(); | 866 __ nop(); |
866 } | 867 } |
867 } | 868 } |
868 } | 869 } |
869 | 870 |
870 | 871 |
871 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 872 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 // accesses on the arguments object. | 1118 // accesses on the arguments object. |
1118 Slot* slot = var->slot(); | 1119 Slot* slot = var->slot(); |
1119 Property* property = var->AsProperty(); | 1120 Property* property = var->AsProperty(); |
1120 | 1121 |
1121 if (var->is_global() && !var->is_this()) { | 1122 if (var->is_global() && !var->is_this()) { |
1122 Comment cmnt(masm_, "Global variable"); | 1123 Comment cmnt(masm_, "Global variable"); |
1123 // Use inline caching. Variable name is passed in ecx and the global | 1124 // Use inline caching. Variable name is passed in ecx and the global |
1124 // object on the stack. | 1125 // object on the stack. |
1125 __ mov(eax, CodeGenerator::GlobalObject()); | 1126 __ mov(eax, CodeGenerator::GlobalObject()); |
1126 __ mov(ecx, var->name()); | 1127 __ mov(ecx, var->name()); |
1127 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1128 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1129 Builtins::LoadIC_Initialize)); |
1128 __ call(ic, RelocInfo::CODE_TARGET_CONTEXT); | 1130 __ call(ic, RelocInfo::CODE_TARGET_CONTEXT); |
1129 // By emitting a nop we make sure that we do not have a test eax | 1131 // By emitting a nop we make sure that we do not have a test eax |
1130 // instruction after the call it is treated specially by the LoadIC code | 1132 // instruction after the call it is treated specially by the LoadIC code |
1131 // Remember that the assembler may choose to do peephole optimization | 1133 // Remember that the assembler may choose to do peephole optimization |
1132 // (eg, push/pop elimination). | 1134 // (eg, push/pop elimination). |
1133 __ nop(); | 1135 __ nop(); |
1134 Apply(context, eax); | 1136 Apply(context, eax); |
1135 | 1137 |
1136 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { | 1138 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { |
1137 Comment cmnt(masm_, "Lookup slot"); | 1139 Comment cmnt(masm_, "Lookup slot"); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 | 1178 |
1177 // Assert that the key is a smi. | 1179 // Assert that the key is a smi. |
1178 Literal* key_literal = property->key()->AsLiteral(); | 1180 Literal* key_literal = property->key()->AsLiteral(); |
1179 ASSERT_NOT_NULL(key_literal); | 1181 ASSERT_NOT_NULL(key_literal); |
1180 ASSERT(key_literal->handle()->IsSmi()); | 1182 ASSERT(key_literal->handle()->IsSmi()); |
1181 | 1183 |
1182 // Load the key. | 1184 // Load the key. |
1183 __ mov(eax, Immediate(key_literal->handle())); | 1185 __ mov(eax, Immediate(key_literal->handle())); |
1184 | 1186 |
1185 // Do a keyed property load. | 1187 // Do a keyed property load. |
1186 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1188 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1189 Builtins::KeyedLoadIC_Initialize)); |
1187 __ call(ic, RelocInfo::CODE_TARGET); | 1190 __ call(ic, RelocInfo::CODE_TARGET); |
1188 // Notice: We must not have a "test eax, ..." instruction after the | 1191 // Notice: We must not have a "test eax, ..." instruction after the |
1189 // call. It is treated specially by the LoadIC code. | 1192 // call. It is treated specially by the LoadIC code. |
1190 __ nop(); | 1193 __ nop(); |
1191 // Drop key and object left on the stack by IC. | 1194 // Drop key and object left on the stack by IC. |
1192 Apply(context, eax); | 1195 Apply(context, eax); |
1193 } | 1196 } |
1194 } | 1197 } |
1195 | 1198 |
1196 | 1199 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 } | 1253 } |
1251 switch (property->kind()) { | 1254 switch (property->kind()) { |
1252 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1255 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
1253 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); | 1256 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); |
1254 // Fall through. | 1257 // Fall through. |
1255 case ObjectLiteral::Property::COMPUTED: | 1258 case ObjectLiteral::Property::COMPUTED: |
1256 if (key->handle()->IsSymbol()) { | 1259 if (key->handle()->IsSymbol()) { |
1257 VisitForValue(value, kAccumulator); | 1260 VisitForValue(value, kAccumulator); |
1258 __ mov(ecx, Immediate(key->handle())); | 1261 __ mov(ecx, Immediate(key->handle())); |
1259 __ mov(edx, Operand(esp, 0)); | 1262 __ mov(edx, Operand(esp, 0)); |
1260 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1263 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1264 Builtins::StoreIC_Initialize)); |
1261 __ call(ic, RelocInfo::CODE_TARGET); | 1265 __ call(ic, RelocInfo::CODE_TARGET); |
1262 __ nop(); | 1266 __ nop(); |
1263 break; | 1267 break; |
1264 } | 1268 } |
1265 // Fall through. | 1269 // Fall through. |
1266 case ObjectLiteral::Property::PROTOTYPE: | 1270 case ObjectLiteral::Property::PROTOTYPE: |
1267 __ push(Operand(esp, 0)); // Duplicate receiver. | 1271 __ push(Operand(esp, 0)); // Duplicate receiver. |
1268 VisitForValue(key, kStack); | 1272 VisitForValue(key, kStack); |
1269 VisitForValue(value, kStack); | 1273 VisitForValue(value, kStack); |
1270 __ CallRuntime(Runtime::kSetProperty, 3); | 1274 __ CallRuntime(Runtime::kSetProperty, 3); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 EmitKeyedPropertyAssignment(expr); | 1448 EmitKeyedPropertyAssignment(expr); |
1445 break; | 1449 break; |
1446 } | 1450 } |
1447 } | 1451 } |
1448 | 1452 |
1449 | 1453 |
1450 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 1454 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
1451 SetSourcePosition(prop->position()); | 1455 SetSourcePosition(prop->position()); |
1452 Literal* key = prop->key()->AsLiteral(); | 1456 Literal* key = prop->key()->AsLiteral(); |
1453 __ mov(ecx, Immediate(key->handle())); | 1457 __ mov(ecx, Immediate(key->handle())); |
1454 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1458 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1459 Builtins::LoadIC_Initialize)); |
1455 __ call(ic, RelocInfo::CODE_TARGET); | 1460 __ call(ic, RelocInfo::CODE_TARGET); |
1456 __ nop(); | 1461 __ nop(); |
1457 } | 1462 } |
1458 | 1463 |
1459 | 1464 |
1460 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 1465 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
1461 SetSourcePosition(prop->position()); | 1466 SetSourcePosition(prop->position()); |
1462 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1467 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1468 Builtins::KeyedLoadIC_Initialize)); |
1463 __ call(ic, RelocInfo::CODE_TARGET); | 1469 __ call(ic, RelocInfo::CODE_TARGET); |
1464 __ nop(); | 1470 __ nop(); |
1465 } | 1471 } |
1466 | 1472 |
1467 | 1473 |
1468 void FullCodeGenerator::EmitBinaryOp(Token::Value op, | 1474 void FullCodeGenerator::EmitBinaryOp(Token::Value op, |
1469 Expression::Context context) { | 1475 Expression::Context context) { |
1470 __ push(result_register()); | 1476 __ push(result_register()); |
1471 GenericBinaryOpStub stub(op, | 1477 GenericBinaryOpStub stub(op, |
1472 NO_OVERWRITE, | 1478 NO_OVERWRITE, |
(...skipping 28 matching lines...) Expand all Loading... |
1501 Variable* var = expr->AsVariableProxy()->var(); | 1507 Variable* var = expr->AsVariableProxy()->var(); |
1502 EmitVariableAssignment(var, Token::ASSIGN, Expression::kEffect); | 1508 EmitVariableAssignment(var, Token::ASSIGN, Expression::kEffect); |
1503 break; | 1509 break; |
1504 } | 1510 } |
1505 case NAMED_PROPERTY: { | 1511 case NAMED_PROPERTY: { |
1506 __ push(eax); // Preserve value. | 1512 __ push(eax); // Preserve value. |
1507 VisitForValue(prop->obj(), kAccumulator); | 1513 VisitForValue(prop->obj(), kAccumulator); |
1508 __ mov(edx, eax); | 1514 __ mov(edx, eax); |
1509 __ pop(eax); // Restore value. | 1515 __ pop(eax); // Restore value. |
1510 __ mov(ecx, prop->key()->AsLiteral()->handle()); | 1516 __ mov(ecx, prop->key()->AsLiteral()->handle()); |
1511 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1517 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1518 Builtins::StoreIC_Initialize)); |
1512 __ call(ic, RelocInfo::CODE_TARGET); | 1519 __ call(ic, RelocInfo::CODE_TARGET); |
1513 __ nop(); // Signal no inlined code. | 1520 __ nop(); // Signal no inlined code. |
1514 break; | 1521 break; |
1515 } | 1522 } |
1516 case KEYED_PROPERTY: { | 1523 case KEYED_PROPERTY: { |
1517 __ push(eax); // Preserve value. | 1524 __ push(eax); // Preserve value. |
1518 VisitForValue(prop->obj(), kStack); | 1525 VisitForValue(prop->obj(), kStack); |
1519 VisitForValue(prop->key(), kAccumulator); | 1526 VisitForValue(prop->key(), kAccumulator); |
1520 __ mov(ecx, eax); | 1527 __ mov(ecx, eax); |
1521 __ pop(edx); | 1528 __ pop(edx); |
1522 __ pop(eax); // Restore value. | 1529 __ pop(eax); // Restore value. |
1523 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 1530 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1531 Builtins::KeyedStoreIC_Initialize)); |
1524 __ call(ic, RelocInfo::CODE_TARGET); | 1532 __ call(ic, RelocInfo::CODE_TARGET); |
1525 __ nop(); // Signal no inlined code. | 1533 __ nop(); // Signal no inlined code. |
1526 break; | 1534 break; |
1527 } | 1535 } |
1528 } | 1536 } |
1529 } | 1537 } |
1530 | 1538 |
1531 | 1539 |
1532 void FullCodeGenerator::EmitVariableAssignment(Variable* var, | 1540 void FullCodeGenerator::EmitVariableAssignment(Variable* var, |
1533 Token::Value op, | 1541 Token::Value op, |
1534 Expression::Context context) { | 1542 Expression::Context context) { |
1535 // Left-hand sides that rewrite to explicit property accesses do not reach | 1543 // Left-hand sides that rewrite to explicit property accesses do not reach |
1536 // here. | 1544 // here. |
1537 ASSERT(var != NULL); | 1545 ASSERT(var != NULL); |
1538 ASSERT(var->is_global() || var->slot() != NULL); | 1546 ASSERT(var->is_global() || var->slot() != NULL); |
1539 | 1547 |
1540 if (var->is_global()) { | 1548 if (var->is_global()) { |
1541 ASSERT(!var->is_this()); | 1549 ASSERT(!var->is_this()); |
1542 // Assignment to a global variable. Use inline caching for the | 1550 // Assignment to a global variable. Use inline caching for the |
1543 // assignment. Right-hand-side value is passed in eax, variable name in | 1551 // assignment. Right-hand-side value is passed in eax, variable name in |
1544 // ecx, and the global object on the stack. | 1552 // ecx, and the global object on the stack. |
1545 __ mov(ecx, var->name()); | 1553 __ mov(ecx, var->name()); |
1546 __ mov(edx, CodeGenerator::GlobalObject()); | 1554 __ mov(edx, CodeGenerator::GlobalObject()); |
1547 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1555 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1556 Builtins::StoreIC_Initialize)); |
1548 __ call(ic, RelocInfo::CODE_TARGET); | 1557 __ call(ic, RelocInfo::CODE_TARGET); |
1549 __ nop(); | 1558 __ nop(); |
1550 | 1559 |
1551 } else if (var->mode() != Variable::CONST || op == Token::INIT_CONST) { | 1560 } else if (var->mode() != Variable::CONST || op == Token::INIT_CONST) { |
1552 // Perform the assignment for non-const variables and for initialization | 1561 // Perform the assignment for non-const variables and for initialization |
1553 // of const variables. Const assignments are simply skipped. | 1562 // of const variables. Const assignments are simply skipped. |
1554 Label done; | 1563 Label done; |
1555 Slot* slot = var->slot(); | 1564 Slot* slot = var->slot(); |
1556 switch (slot->type()) { | 1565 switch (slot->type()) { |
1557 case Slot::PARAMETER: | 1566 case Slot::PARAMETER: |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 } | 1631 } |
1623 | 1632 |
1624 // Record source code position before IC call. | 1633 // Record source code position before IC call. |
1625 SetSourcePosition(expr->position()); | 1634 SetSourcePosition(expr->position()); |
1626 __ mov(ecx, prop->key()->AsLiteral()->handle()); | 1635 __ mov(ecx, prop->key()->AsLiteral()->handle()); |
1627 if (expr->ends_initialization_block()) { | 1636 if (expr->ends_initialization_block()) { |
1628 __ mov(edx, Operand(esp, 0)); | 1637 __ mov(edx, Operand(esp, 0)); |
1629 } else { | 1638 } else { |
1630 __ pop(edx); | 1639 __ pop(edx); |
1631 } | 1640 } |
1632 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1641 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1642 Builtins::StoreIC_Initialize)); |
1633 __ call(ic, RelocInfo::CODE_TARGET); | 1643 __ call(ic, RelocInfo::CODE_TARGET); |
1634 __ nop(); | 1644 __ nop(); |
1635 | 1645 |
1636 // If the assignment ends an initialization block, revert to fast case. | 1646 // If the assignment ends an initialization block, revert to fast case. |
1637 if (expr->ends_initialization_block()) { | 1647 if (expr->ends_initialization_block()) { |
1638 __ push(eax); // Result of assignment, saved even if not needed. | 1648 __ push(eax); // Result of assignment, saved even if not needed. |
1639 __ push(Operand(esp, kPointerSize)); // Receiver is under value. | 1649 __ push(Operand(esp, kPointerSize)); // Receiver is under value. |
1640 __ CallRuntime(Runtime::kToFastProperties, 1); | 1650 __ CallRuntime(Runtime::kToFastProperties, 1); |
1641 __ pop(eax); | 1651 __ pop(eax); |
1642 DropAndApply(1, context_, eax); | 1652 DropAndApply(1, context_, eax); |
(...skipping 18 matching lines...) Expand all Loading... |
1661 } | 1671 } |
1662 | 1672 |
1663 __ pop(ecx); | 1673 __ pop(ecx); |
1664 if (expr->ends_initialization_block()) { | 1674 if (expr->ends_initialization_block()) { |
1665 __ mov(edx, Operand(esp, 0)); // Leave receiver on the stack for later. | 1675 __ mov(edx, Operand(esp, 0)); // Leave receiver on the stack for later. |
1666 } else { | 1676 } else { |
1667 __ pop(edx); | 1677 __ pop(edx); |
1668 } | 1678 } |
1669 // Record source code position before IC call. | 1679 // Record source code position before IC call. |
1670 SetSourcePosition(expr->position()); | 1680 SetSourcePosition(expr->position()); |
1671 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 1681 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1682 Builtins::KeyedStoreIC_Initialize)); |
1672 __ call(ic, RelocInfo::CODE_TARGET); | 1683 __ call(ic, RelocInfo::CODE_TARGET); |
1673 // This nop signals to the IC that there is no inlined code at the call | 1684 // This nop signals to the IC that there is no inlined code at the call |
1674 // site for it to patch. | 1685 // site for it to patch. |
1675 __ nop(); | 1686 __ nop(); |
1676 | 1687 |
1677 // If the assignment ends an initialization block, revert to fast case. | 1688 // If the assignment ends an initialization block, revert to fast case. |
1678 if (expr->ends_initialization_block()) { | 1689 if (expr->ends_initialization_block()) { |
1679 __ pop(edx); | 1690 __ pop(edx); |
1680 __ push(eax); // Result of assignment, saved even if not needed. | 1691 __ push(eax); // Result of assignment, saved even if not needed. |
1681 __ push(edx); | 1692 __ push(edx); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1841 // Call to a keyed property. | 1852 // Call to a keyed property. |
1842 // For a synthetic property use keyed load IC followed by function call, | 1853 // For a synthetic property use keyed load IC followed by function call, |
1843 // for a regular property use keyed CallIC. | 1854 // for a regular property use keyed CallIC. |
1844 VisitForValue(prop->obj(), kStack); | 1855 VisitForValue(prop->obj(), kStack); |
1845 if (prop->is_synthetic()) { | 1856 if (prop->is_synthetic()) { |
1846 VisitForValue(prop->key(), kAccumulator); | 1857 VisitForValue(prop->key(), kAccumulator); |
1847 // Record source code position for IC call. | 1858 // Record source code position for IC call. |
1848 SetSourcePosition(prop->position()); | 1859 SetSourcePosition(prop->position()); |
1849 __ pop(edx); // We do not need to keep the receiver. | 1860 __ pop(edx); // We do not need to keep the receiver. |
1850 | 1861 |
1851 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1862 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1863 Builtins::KeyedLoadIC_Initialize)); |
1852 __ call(ic, RelocInfo::CODE_TARGET); | 1864 __ call(ic, RelocInfo::CODE_TARGET); |
1853 // By emitting a nop we make sure that we do not have a "test eax,..." | 1865 // By emitting a nop we make sure that we do not have a "test eax,..." |
1854 // instruction after the call as it is treated specially | 1866 // instruction after the call as it is treated specially |
1855 // by the LoadIC code. | 1867 // by the LoadIC code. |
1856 __ nop(); | 1868 __ nop(); |
1857 // Push result (function). | 1869 // Push result (function). |
1858 __ push(eax); | 1870 __ push(eax); |
1859 // Push Global receiver. | 1871 // Push Global receiver. |
1860 __ mov(ecx, CodeGenerator::GlobalObject()); | 1872 __ mov(ecx, CodeGenerator::GlobalObject()); |
1861 __ push(FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); | 1873 __ push(FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1904 | 1916 |
1905 // Call the construct call builtin that handles allocation and | 1917 // Call the construct call builtin that handles allocation and |
1906 // constructor invocation. | 1918 // constructor invocation. |
1907 SetSourcePosition(expr->position()); | 1919 SetSourcePosition(expr->position()); |
1908 | 1920 |
1909 // Load function, arg_count into edi and eax. | 1921 // Load function, arg_count into edi and eax. |
1910 __ Set(eax, Immediate(arg_count)); | 1922 __ Set(eax, Immediate(arg_count)); |
1911 // Function is in esp[arg_count + 1]. | 1923 // Function is in esp[arg_count + 1]. |
1912 __ mov(edi, Operand(esp, eax, times_pointer_size, kPointerSize)); | 1924 __ mov(edi, Operand(esp, eax, times_pointer_size, kPointerSize)); |
1913 | 1925 |
1914 Handle<Code> construct_builtin(Builtins::builtin(Builtins::JSConstructCall)); | 1926 Handle<Code> construct_builtin(Isolate::Current()->builtins()->builtin( |
| 1927 Builtins::JSConstructCall)); |
1915 __ call(construct_builtin, RelocInfo::CONSTRUCT_CALL); | 1928 __ call(construct_builtin, RelocInfo::CONSTRUCT_CALL); |
1916 | 1929 |
1917 // Replace function on TOS with result in eax, or pop it. | 1930 // Replace function on TOS with result in eax, or pop it. |
1918 DropAndApply(1, context_, eax); | 1931 DropAndApply(1, context_, eax); |
1919 } | 1932 } |
1920 | 1933 |
1921 | 1934 |
1922 void FullCodeGenerator::EmitIsSmi(ZoneList<Expression*>* args) { | 1935 void FullCodeGenerator::EmitIsSmi(ZoneList<Expression*>* args) { |
1923 ASSERT(args->length() == 1); | 1936 ASSERT(args->length() == 1); |
1924 | 1937 |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2769 | 2782 |
2770 case Token::TYPEOF: { | 2783 case Token::TYPEOF: { |
2771 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); | 2784 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); |
2772 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 2785 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
2773 if (proxy != NULL && | 2786 if (proxy != NULL && |
2774 !proxy->var()->is_this() && | 2787 !proxy->var()->is_this() && |
2775 proxy->var()->is_global()) { | 2788 proxy->var()->is_global()) { |
2776 Comment cmnt(masm_, "Global variable"); | 2789 Comment cmnt(masm_, "Global variable"); |
2777 __ mov(eax, CodeGenerator::GlobalObject()); | 2790 __ mov(eax, CodeGenerator::GlobalObject()); |
2778 __ mov(ecx, Immediate(proxy->name())); | 2791 __ mov(ecx, Immediate(proxy->name())); |
2779 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 2792 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 2793 Builtins::LoadIC_Initialize)); |
2780 // Use a regular load, not a contextual load, to avoid a reference | 2794 // Use a regular load, not a contextual load, to avoid a reference |
2781 // error. | 2795 // error. |
2782 __ call(ic, RelocInfo::CODE_TARGET); | 2796 __ call(ic, RelocInfo::CODE_TARGET); |
2783 __ push(eax); | 2797 __ push(eax); |
2784 } else if (proxy != NULL && | 2798 } else if (proxy != NULL && |
2785 proxy->var()->slot() != NULL && | 2799 proxy->var()->slot() != NULL && |
2786 proxy->var()->slot()->type() == Slot::LOOKUP) { | 2800 proxy->var()->slot()->type() == Slot::LOOKUP) { |
2787 __ push(esi); | 2801 __ push(esi); |
2788 __ push(Immediate(proxy->name())); | 2802 __ push(Immediate(proxy->name())); |
2789 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); | 2803 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2987 } else { | 3001 } else { |
2988 // Perform the assignment as if via '='. | 3002 // Perform the assignment as if via '='. |
2989 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 3003 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
2990 Token::ASSIGN, | 3004 Token::ASSIGN, |
2991 context_); | 3005 context_); |
2992 } | 3006 } |
2993 break; | 3007 break; |
2994 case NAMED_PROPERTY: { | 3008 case NAMED_PROPERTY: { |
2995 __ mov(ecx, prop->key()->AsLiteral()->handle()); | 3009 __ mov(ecx, prop->key()->AsLiteral()->handle()); |
2996 __ pop(edx); | 3010 __ pop(edx); |
2997 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 3011 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 3012 Builtins::StoreIC_Initialize)); |
2998 __ call(ic, RelocInfo::CODE_TARGET); | 3013 __ call(ic, RelocInfo::CODE_TARGET); |
2999 // This nop signals to the IC that there is no inlined code at the call | 3014 // This nop signals to the IC that there is no inlined code at the call |
3000 // site for it to patch. | 3015 // site for it to patch. |
3001 __ nop(); | 3016 __ nop(); |
3002 if (expr->is_postfix()) { | 3017 if (expr->is_postfix()) { |
3003 if (context_ != Expression::kEffect) { | 3018 if (context_ != Expression::kEffect) { |
3004 ApplyTOS(context_); | 3019 ApplyTOS(context_); |
3005 } | 3020 } |
3006 } else { | 3021 } else { |
3007 Apply(context_, eax); | 3022 Apply(context_, eax); |
3008 } | 3023 } |
3009 break; | 3024 break; |
3010 } | 3025 } |
3011 case KEYED_PROPERTY: { | 3026 case KEYED_PROPERTY: { |
3012 __ pop(ecx); | 3027 __ pop(ecx); |
3013 __ pop(edx); | 3028 __ pop(edx); |
3014 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 3029 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 3030 Builtins::KeyedStoreIC_Initialize)); |
3015 __ call(ic, RelocInfo::CODE_TARGET); | 3031 __ call(ic, RelocInfo::CODE_TARGET); |
3016 // This nop signals to the IC that there is no inlined code at the call | 3032 // This nop signals to the IC that there is no inlined code at the call |
3017 // site for it to patch. | 3033 // site for it to patch. |
3018 __ nop(); | 3034 __ nop(); |
3019 if (expr->is_postfix()) { | 3035 if (expr->is_postfix()) { |
3020 // Result is on the stack | 3036 // Result is on the stack |
3021 if (context_ != Expression::kEffect) { | 3037 if (context_ != Expression::kEffect) { |
3022 ApplyTOS(context_); | 3038 ApplyTOS(context_); |
3023 } | 3039 } |
3024 } else { | 3040 } else { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3251 // And return. | 3267 // And return. |
3252 __ ret(0); | 3268 __ ret(0); |
3253 } | 3269 } |
3254 | 3270 |
3255 | 3271 |
3256 #undef __ | 3272 #undef __ |
3257 | 3273 |
3258 } } // namespace v8::internal | 3274 } } // namespace v8::internal |
3259 | 3275 |
3260 #endif // V8_TARGET_ARCH_IA32 | 3276 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |