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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 VisitForValue(prop->key(), kStack); | 855 VisitForValue(prop->key(), kStack); |
856 VisitForValue(function, kAccumulator); | 856 VisitForValue(function, kAccumulator); |
857 __ pop(rcx); | 857 __ pop(rcx); |
858 } else { | 858 } else { |
859 VisitForValue(prop->key(), kAccumulator); | 859 VisitForValue(prop->key(), kAccumulator); |
860 __ movq(rcx, result_register()); | 860 __ movq(rcx, result_register()); |
861 __ LoadRoot(result_register(), Heap::kTheHoleValueRootIndex); | 861 __ LoadRoot(result_register(), Heap::kTheHoleValueRootIndex); |
862 } | 862 } |
863 __ pop(rdx); | 863 __ pop(rdx); |
864 | 864 |
865 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 865 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 866 Builtins::KeyedStoreIC_Initialize)); |
866 __ call(ic, RelocInfo::CODE_TARGET); | 867 __ call(ic, RelocInfo::CODE_TARGET); |
867 // Absence of a test rax instruction following the call | 868 // Absence of a test rax instruction following the call |
868 // indicates that none of the load was inlined. | 869 // indicates that none of the load was inlined. |
869 __ nop(); | 870 __ nop(); |
870 } | 871 } |
871 } | 872 } |
872 } | 873 } |
873 | 874 |
874 | 875 |
875 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 876 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 // accesses on the arguments object. | 1123 // accesses on the arguments object. |
1123 Slot* slot = var->slot(); | 1124 Slot* slot = var->slot(); |
1124 Property* property = var->AsProperty(); | 1125 Property* property = var->AsProperty(); |
1125 | 1126 |
1126 if (var->is_global() && !var->is_this()) { | 1127 if (var->is_global() && !var->is_this()) { |
1127 Comment cmnt(masm_, "Global variable"); | 1128 Comment cmnt(masm_, "Global variable"); |
1128 // Use inline caching. Variable name is passed in rcx and the global | 1129 // Use inline caching. Variable name is passed in rcx and the global |
1129 // object on the stack. | 1130 // object on the stack. |
1130 __ Move(rcx, var->name()); | 1131 __ Move(rcx, var->name()); |
1131 __ movq(rax, CodeGenerator::GlobalObject()); | 1132 __ movq(rax, CodeGenerator::GlobalObject()); |
1132 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1133 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1134 Builtins::LoadIC_Initialize)); |
1133 __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT); | 1135 __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT); |
1134 // A test rax instruction following the call is used by the IC to | 1136 // A test rax instruction following the call is used by the IC to |
1135 // indicate that the inobject property case was inlined. Ensure there | 1137 // indicate that the inobject property case was inlined. Ensure there |
1136 // is no test rax instruction here. | 1138 // is no test rax instruction here. |
1137 __ nop(); | 1139 __ nop(); |
1138 Apply(context, rax); | 1140 Apply(context, rax); |
1139 | 1141 |
1140 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { | 1142 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { |
1141 Comment cmnt(masm_, "Lookup slot"); | 1143 Comment cmnt(masm_, "Lookup slot"); |
1142 __ push(rsi); // Context. | 1144 __ push(rsi); // Context. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 | 1182 |
1181 // Assert that the key is a smi. | 1183 // Assert that the key is a smi. |
1182 Literal* key_literal = property->key()->AsLiteral(); | 1184 Literal* key_literal = property->key()->AsLiteral(); |
1183 ASSERT_NOT_NULL(key_literal); | 1185 ASSERT_NOT_NULL(key_literal); |
1184 ASSERT(key_literal->handle()->IsSmi()); | 1186 ASSERT(key_literal->handle()->IsSmi()); |
1185 | 1187 |
1186 // Load the key. | 1188 // Load the key. |
1187 __ Move(rax, key_literal->handle()); | 1189 __ Move(rax, key_literal->handle()); |
1188 | 1190 |
1189 // Do a keyed property load. | 1191 // Do a keyed property load. |
1190 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1192 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1193 Builtins::KeyedLoadIC_Initialize)); |
1191 __ call(ic, RelocInfo::CODE_TARGET); | 1194 __ call(ic, RelocInfo::CODE_TARGET); |
1192 // Notice: We must not have a "test rax, ..." instruction after the | 1195 // Notice: We must not have a "test rax, ..." instruction after the |
1193 // call. It is treated specially by the LoadIC code. | 1196 // call. It is treated specially by the LoadIC code. |
1194 __ nop(); | 1197 __ nop(); |
1195 Apply(context, rax); | 1198 Apply(context, rax); |
1196 } | 1199 } |
1197 } | 1200 } |
1198 | 1201 |
1199 | 1202 |
1200 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { | 1203 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 case ObjectLiteral::Property::CONSTANT: | 1257 case ObjectLiteral::Property::CONSTANT: |
1255 UNREACHABLE(); | 1258 UNREACHABLE(); |
1256 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1259 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
1257 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); | 1260 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); |
1258 // Fall through. | 1261 // Fall through. |
1259 case ObjectLiteral::Property::COMPUTED: | 1262 case ObjectLiteral::Property::COMPUTED: |
1260 if (key->handle()->IsSymbol()) { | 1263 if (key->handle()->IsSymbol()) { |
1261 VisitForValue(value, kAccumulator); | 1264 VisitForValue(value, kAccumulator); |
1262 __ Move(rcx, key->handle()); | 1265 __ Move(rcx, key->handle()); |
1263 __ movq(rdx, Operand(rsp, 0)); | 1266 __ movq(rdx, Operand(rsp, 0)); |
1264 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1267 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1268 Builtins::StoreIC_Initialize)); |
1265 __ call(ic, RelocInfo::CODE_TARGET); | 1269 __ call(ic, RelocInfo::CODE_TARGET); |
1266 __ nop(); | 1270 __ nop(); |
1267 break; | 1271 break; |
1268 } | 1272 } |
1269 // Fall through. | 1273 // Fall through. |
1270 case ObjectLiteral::Property::PROTOTYPE: | 1274 case ObjectLiteral::Property::PROTOTYPE: |
1271 __ push(Operand(rsp, 0)); // Duplicate receiver. | 1275 __ push(Operand(rsp, 0)); // Duplicate receiver. |
1272 VisitForValue(key, kStack); | 1276 VisitForValue(key, kStack); |
1273 VisitForValue(value, kStack); | 1277 VisitForValue(value, kStack); |
1274 __ CallRuntime(Runtime::kSetProperty, 3); | 1278 __ CallRuntime(Runtime::kSetProperty, 3); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 EmitKeyedPropertyAssignment(expr); | 1451 EmitKeyedPropertyAssignment(expr); |
1448 break; | 1452 break; |
1449 } | 1453 } |
1450 } | 1454 } |
1451 | 1455 |
1452 | 1456 |
1453 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 1457 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
1454 SetSourcePosition(prop->position()); | 1458 SetSourcePosition(prop->position()); |
1455 Literal* key = prop->key()->AsLiteral(); | 1459 Literal* key = prop->key()->AsLiteral(); |
1456 __ Move(rcx, key->handle()); | 1460 __ Move(rcx, key->handle()); |
1457 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1461 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1462 Builtins::LoadIC_Initialize)); |
1458 __ Call(ic, RelocInfo::CODE_TARGET); | 1463 __ Call(ic, RelocInfo::CODE_TARGET); |
1459 __ nop(); | 1464 __ nop(); |
1460 } | 1465 } |
1461 | 1466 |
1462 | 1467 |
1463 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 1468 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
1464 SetSourcePosition(prop->position()); | 1469 SetSourcePosition(prop->position()); |
1465 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1470 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1471 Builtins::KeyedLoadIC_Initialize)); |
1466 __ Call(ic, RelocInfo::CODE_TARGET); | 1472 __ Call(ic, RelocInfo::CODE_TARGET); |
1467 __ nop(); | 1473 __ nop(); |
1468 } | 1474 } |
1469 | 1475 |
1470 | 1476 |
1471 void FullCodeGenerator::EmitBinaryOp(Token::Value op, | 1477 void FullCodeGenerator::EmitBinaryOp(Token::Value op, |
1472 Expression::Context context) { | 1478 Expression::Context context) { |
1473 __ push(result_register()); | 1479 __ push(result_register()); |
1474 GenericBinaryOpStub stub(op, | 1480 GenericBinaryOpStub stub(op, |
1475 NO_OVERWRITE, | 1481 NO_OVERWRITE, |
(...skipping 27 matching lines...) Expand all Loading... |
1503 Variable* var = expr->AsVariableProxy()->var(); | 1509 Variable* var = expr->AsVariableProxy()->var(); |
1504 EmitVariableAssignment(var, Token::ASSIGN, Expression::kEffect); | 1510 EmitVariableAssignment(var, Token::ASSIGN, Expression::kEffect); |
1505 break; | 1511 break; |
1506 } | 1512 } |
1507 case NAMED_PROPERTY: { | 1513 case NAMED_PROPERTY: { |
1508 __ push(rax); // Preserve value. | 1514 __ push(rax); // Preserve value. |
1509 VisitForValue(prop->obj(), kAccumulator); | 1515 VisitForValue(prop->obj(), kAccumulator); |
1510 __ movq(rdx, rax); | 1516 __ movq(rdx, rax); |
1511 __ pop(rax); // Restore value. | 1517 __ pop(rax); // Restore value. |
1512 __ Move(rcx, prop->key()->AsLiteral()->handle()); | 1518 __ Move(rcx, prop->key()->AsLiteral()->handle()); |
1513 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1519 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1520 Builtins::StoreIC_Initialize)); |
1514 __ call(ic, RelocInfo::CODE_TARGET); | 1521 __ call(ic, RelocInfo::CODE_TARGET); |
1515 __ nop(); // Signal no inlined code. | 1522 __ nop(); // Signal no inlined code. |
1516 break; | 1523 break; |
1517 } | 1524 } |
1518 case KEYED_PROPERTY: { | 1525 case KEYED_PROPERTY: { |
1519 __ push(rax); // Preserve value. | 1526 __ push(rax); // Preserve value. |
1520 VisitForValue(prop->obj(), kStack); | 1527 VisitForValue(prop->obj(), kStack); |
1521 VisitForValue(prop->key(), kStack); | 1528 VisitForValue(prop->key(), kStack); |
1522 __ movq(rax, Operand(rsp, 2 * kPointerSize)); | 1529 __ movq(rax, Operand(rsp, 2 * kPointerSize)); |
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 __ Drop(3); // Receiver, key, and extra copy of value. | 1534 __ Drop(3); // Receiver, key, and extra copy of value. |
1527 break; | 1535 break; |
1528 } | 1536 } |
1529 } | 1537 } |
1530 } | 1538 } |
1531 | 1539 |
1532 | 1540 |
1533 void FullCodeGenerator::EmitVariableAssignment(Variable* var, | 1541 void FullCodeGenerator::EmitVariableAssignment(Variable* var, |
1534 Token::Value op, | 1542 Token::Value op, |
1535 Expression::Context context) { | 1543 Expression::Context context) { |
1536 // Left-hand sides that rewrite to explicit property accesses do not reach | 1544 // Left-hand sides that rewrite to explicit property accesses do not reach |
1537 // here. | 1545 // here. |
1538 ASSERT(var != NULL); | 1546 ASSERT(var != NULL); |
1539 ASSERT(var->is_global() || var->slot() != NULL); | 1547 ASSERT(var->is_global() || var->slot() != NULL); |
1540 | 1548 |
1541 if (var->is_global()) { | 1549 if (var->is_global()) { |
1542 ASSERT(!var->is_this()); | 1550 ASSERT(!var->is_this()); |
1543 // Assignment to a global variable. Use inline caching for the | 1551 // Assignment to a global variable. Use inline caching for the |
1544 // assignment. Right-hand-side value is passed in rax, variable name in | 1552 // assignment. Right-hand-side value is passed in rax, variable name in |
1545 // rcx, and the global object on the stack. | 1553 // rcx, and the global object on the stack. |
1546 __ Move(rcx, var->name()); | 1554 __ Move(rcx, var->name()); |
1547 __ movq(rdx, CodeGenerator::GlobalObject()); | 1555 __ movq(rdx, CodeGenerator::GlobalObject()); |
1548 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1556 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1557 Builtins::StoreIC_Initialize)); |
1549 __ Call(ic, RelocInfo::CODE_TARGET); | 1558 __ Call(ic, RelocInfo::CODE_TARGET); |
1550 __ nop(); | 1559 __ nop(); |
1551 | 1560 |
1552 } else if (var->mode() != Variable::CONST || op == Token::INIT_CONST) { | 1561 } else if (var->mode() != Variable::CONST || op == Token::INIT_CONST) { |
1553 // Perform the assignment for non-const variables and for initialization | 1562 // Perform the assignment for non-const variables and for initialization |
1554 // of const variables. Const assignments are simply skipped. | 1563 // of const variables. Const assignments are simply skipped. |
1555 Label done; | 1564 Label done; |
1556 Slot* slot = var->slot(); | 1565 Slot* slot = var->slot(); |
1557 switch (slot->type()) { | 1566 switch (slot->type()) { |
1558 case Slot::PARAMETER: | 1567 case Slot::PARAMETER: |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1623 } | 1632 } |
1624 | 1633 |
1625 // Record source code position before IC call. | 1634 // Record source code position before IC call. |
1626 SetSourcePosition(expr->position()); | 1635 SetSourcePosition(expr->position()); |
1627 __ Move(rcx, prop->key()->AsLiteral()->handle()); | 1636 __ Move(rcx, prop->key()->AsLiteral()->handle()); |
1628 if (expr->ends_initialization_block()) { | 1637 if (expr->ends_initialization_block()) { |
1629 __ movq(rdx, Operand(rsp, 0)); | 1638 __ movq(rdx, Operand(rsp, 0)); |
1630 } else { | 1639 } else { |
1631 __ pop(rdx); | 1640 __ pop(rdx); |
1632 } | 1641 } |
1633 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 1642 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1643 Builtins::StoreIC_Initialize)); |
1634 __ Call(ic, RelocInfo::CODE_TARGET); | 1644 __ Call(ic, RelocInfo::CODE_TARGET); |
1635 __ nop(); | 1645 __ nop(); |
1636 | 1646 |
1637 // If the assignment ends an initialization block, revert to fast case. | 1647 // If the assignment ends an initialization block, revert to fast case. |
1638 if (expr->ends_initialization_block()) { | 1648 if (expr->ends_initialization_block()) { |
1639 __ push(rax); // Result of assignment, saved even if not needed. | 1649 __ push(rax); // Result of assignment, saved even if not needed. |
1640 __ push(Operand(rsp, kPointerSize)); // Receiver is under value. | 1650 __ push(Operand(rsp, kPointerSize)); // Receiver is under value. |
1641 __ CallRuntime(Runtime::kToFastProperties, 1); | 1651 __ CallRuntime(Runtime::kToFastProperties, 1); |
1642 __ pop(rax); | 1652 __ pop(rax); |
1643 DropAndApply(1, context_, rax); | 1653 DropAndApply(1, context_, rax); |
(...skipping 18 matching lines...) Expand all Loading... |
1662 } | 1672 } |
1663 | 1673 |
1664 __ pop(rcx); | 1674 __ pop(rcx); |
1665 if (expr->ends_initialization_block()) { | 1675 if (expr->ends_initialization_block()) { |
1666 __ movq(rdx, Operand(rsp, 0)); // Leave receiver on the stack for later. | 1676 __ movq(rdx, Operand(rsp, 0)); // Leave receiver on the stack for later. |
1667 } else { | 1677 } else { |
1668 __ pop(rdx); | 1678 __ pop(rdx); |
1669 } | 1679 } |
1670 // Record source code position before IC call. | 1680 // Record source code position before IC call. |
1671 SetSourcePosition(expr->position()); | 1681 SetSourcePosition(expr->position()); |
1672 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 1682 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1683 Builtins::KeyedStoreIC_Initialize)); |
1673 __ Call(ic, RelocInfo::CODE_TARGET); | 1684 __ Call(ic, RelocInfo::CODE_TARGET); |
1674 // This nop signals to the IC that there is no inlined code at the call | 1685 // This nop signals to the IC that there is no inlined code at the call |
1675 // site for it to patch. | 1686 // site for it to patch. |
1676 __ nop(); | 1687 __ nop(); |
1677 | 1688 |
1678 // If the assignment ends an initialization block, revert to fast case. | 1689 // If the assignment ends an initialization block, revert to fast case. |
1679 if (expr->ends_initialization_block()) { | 1690 if (expr->ends_initialization_block()) { |
1680 __ pop(rdx); | 1691 __ pop(rdx); |
1681 __ push(rax); // Result of assignment, saved even if not needed. | 1692 __ push(rax); // Result of assignment, saved even if not needed. |
1682 __ push(rdx); | 1693 __ push(rdx); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 } else { | 1857 } else { |
1847 // Call to a keyed property. | 1858 // Call to a keyed property. |
1848 // For a synthetic property use keyed load IC followed by function call, | 1859 // For a synthetic property use keyed load IC followed by function call, |
1849 // for a regular property use KeyedCallIC. | 1860 // for a regular property use KeyedCallIC. |
1850 VisitForValue(prop->obj(), kStack); | 1861 VisitForValue(prop->obj(), kStack); |
1851 if (prop->is_synthetic()) { | 1862 if (prop->is_synthetic()) { |
1852 VisitForValue(prop->key(), kAccumulator); | 1863 VisitForValue(prop->key(), kAccumulator); |
1853 __ movq(rdx, Operand(rsp, 0)); | 1864 __ movq(rdx, Operand(rsp, 0)); |
1854 // Record source code position for IC call. | 1865 // Record source code position for IC call. |
1855 SetSourcePosition(prop->position()); | 1866 SetSourcePosition(prop->position()); |
1856 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1867 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 1868 Builtins::KeyedLoadIC_Initialize)); |
1857 __ call(ic, RelocInfo::CODE_TARGET); | 1869 __ call(ic, RelocInfo::CODE_TARGET); |
1858 // By emitting a nop we make sure that we do not have a "test rax,..." | 1870 // By emitting a nop we make sure that we do not have a "test rax,..." |
1859 // instruction after the call as it is treated specially | 1871 // instruction after the call as it is treated specially |
1860 // by the LoadIC code. | 1872 // by the LoadIC code. |
1861 __ nop(); | 1873 __ nop(); |
1862 // Pop receiver. | 1874 // Pop receiver. |
1863 __ pop(rbx); | 1875 __ pop(rbx); |
1864 // Push result (function). | 1876 // Push result (function). |
1865 __ push(rax); | 1877 __ push(rax); |
1866 // Push receiver object on stack. | 1878 // Push receiver object on stack. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 | 1923 |
1912 // Call the construct call builtin that handles allocation and | 1924 // Call the construct call builtin that handles allocation and |
1913 // constructor invocation. | 1925 // constructor invocation. |
1914 SetSourcePosition(expr->position()); | 1926 SetSourcePosition(expr->position()); |
1915 | 1927 |
1916 // Load function, arg_count into rdi and rax. | 1928 // Load function, arg_count into rdi and rax. |
1917 __ Set(rax, arg_count); | 1929 __ Set(rax, arg_count); |
1918 // Function is in rsp[arg_count + 1]. | 1930 // Function is in rsp[arg_count + 1]. |
1919 __ movq(rdi, Operand(rsp, rax, times_pointer_size, kPointerSize)); | 1931 __ movq(rdi, Operand(rsp, rax, times_pointer_size, kPointerSize)); |
1920 | 1932 |
1921 Handle<Code> construct_builtin(Builtins::builtin(Builtins::JSConstructCall)); | 1933 Handle<Code> construct_builtin(Isolate::Current()->builtins()->builtin( |
| 1934 Builtins::JSConstructCall)); |
1922 __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL); | 1935 __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL); |
1923 | 1936 |
1924 // Replace function on TOS with result in rax, or pop it. | 1937 // Replace function on TOS with result in rax, or pop it. |
1925 DropAndApply(1, context_, rax); | 1938 DropAndApply(1, context_, rax); |
1926 } | 1939 } |
1927 | 1940 |
1928 | 1941 |
1929 void FullCodeGenerator::EmitIsSmi(ZoneList<Expression*>* args) { | 1942 void FullCodeGenerator::EmitIsSmi(ZoneList<Expression*>* args) { |
1930 ASSERT(args->length() == 1); | 1943 ASSERT(args->length() == 1); |
1931 | 1944 |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2762 | 2775 |
2763 case Token::TYPEOF: { | 2776 case Token::TYPEOF: { |
2764 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); | 2777 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); |
2765 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 2778 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
2766 if (proxy != NULL && | 2779 if (proxy != NULL && |
2767 !proxy->var()->is_this() && | 2780 !proxy->var()->is_this() && |
2768 proxy->var()->is_global()) { | 2781 proxy->var()->is_global()) { |
2769 Comment cmnt(masm_, "Global variable"); | 2782 Comment cmnt(masm_, "Global variable"); |
2770 __ Move(rcx, proxy->name()); | 2783 __ Move(rcx, proxy->name()); |
2771 __ movq(rax, CodeGenerator::GlobalObject()); | 2784 __ movq(rax, CodeGenerator::GlobalObject()); |
2772 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 2785 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 2786 Builtins::LoadIC_Initialize)); |
2773 // Use a regular load, not a contextual load, to avoid a reference | 2787 // Use a regular load, not a contextual load, to avoid a reference |
2774 // error. | 2788 // error. |
2775 __ Call(ic, RelocInfo::CODE_TARGET); | 2789 __ Call(ic, RelocInfo::CODE_TARGET); |
2776 __ push(rax); | 2790 __ push(rax); |
2777 } else if (proxy != NULL && | 2791 } else if (proxy != NULL && |
2778 proxy->var()->slot() != NULL && | 2792 proxy->var()->slot() != NULL && |
2779 proxy->var()->slot()->type() == Slot::LOOKUP) { | 2793 proxy->var()->slot()->type() == Slot::LOOKUP) { |
2780 __ push(rsi); | 2794 __ push(rsi); |
2781 __ Push(proxy->name()); | 2795 __ Push(proxy->name()); |
2782 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); | 2796 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2979 } else { | 2993 } else { |
2980 // Perform the assignment as if via '='. | 2994 // Perform the assignment as if via '='. |
2981 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 2995 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
2982 Token::ASSIGN, | 2996 Token::ASSIGN, |
2983 context_); | 2997 context_); |
2984 } | 2998 } |
2985 break; | 2999 break; |
2986 case NAMED_PROPERTY: { | 3000 case NAMED_PROPERTY: { |
2987 __ Move(rcx, prop->key()->AsLiteral()->handle()); | 3001 __ Move(rcx, prop->key()->AsLiteral()->handle()); |
2988 __ pop(rdx); | 3002 __ pop(rdx); |
2989 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 3003 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 3004 Builtins::StoreIC_Initialize)); |
2990 __ call(ic, RelocInfo::CODE_TARGET); | 3005 __ call(ic, RelocInfo::CODE_TARGET); |
2991 // This nop signals to the IC that there is no inlined code at the call | 3006 // This nop signals to the IC that there is no inlined code at the call |
2992 // site for it to patch. | 3007 // site for it to patch. |
2993 __ nop(); | 3008 __ nop(); |
2994 if (expr->is_postfix()) { | 3009 if (expr->is_postfix()) { |
2995 if (context_ != Expression::kEffect) { | 3010 if (context_ != Expression::kEffect) { |
2996 ApplyTOS(context_); | 3011 ApplyTOS(context_); |
2997 } | 3012 } |
2998 } else { | 3013 } else { |
2999 Apply(context_, rax); | 3014 Apply(context_, rax); |
3000 } | 3015 } |
3001 break; | 3016 break; |
3002 } | 3017 } |
3003 case KEYED_PROPERTY: { | 3018 case KEYED_PROPERTY: { |
3004 __ pop(rcx); | 3019 __ pop(rcx); |
3005 __ pop(rdx); | 3020 __ pop(rdx); |
3006 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 3021 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 3022 Builtins::KeyedStoreIC_Initialize)); |
3007 __ call(ic, RelocInfo::CODE_TARGET); | 3023 __ call(ic, RelocInfo::CODE_TARGET); |
3008 // This nop signals to the IC that there is no inlined code at the call | 3024 // This nop signals to the IC that there is no inlined code at the call |
3009 // site for it to patch. | 3025 // site for it to patch. |
3010 __ nop(); | 3026 __ nop(); |
3011 if (expr->is_postfix()) { | 3027 if (expr->is_postfix()) { |
3012 if (context_ != Expression::kEffect) { | 3028 if (context_ != Expression::kEffect) { |
3013 ApplyTOS(context_); | 3029 ApplyTOS(context_); |
3014 } | 3030 } |
3015 } else { | 3031 } else { |
3016 Apply(context_, rax); | 3032 Apply(context_, rax); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3240 __ ret(0); | 3256 __ ret(0); |
3241 } | 3257 } |
3242 | 3258 |
3243 | 3259 |
3244 #undef __ | 3260 #undef __ |
3245 | 3261 |
3246 | 3262 |
3247 } } // namespace v8::internal | 3263 } } // namespace v8::internal |
3248 | 3264 |
3249 #endif // V8_TARGET_ARCH_X64 | 3265 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |