Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/arm64/full-codegen-arm64.cc

Issue 1161623002: VectorICs: allocating slots for store ics in ast nodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ports. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/ast.h » ('j') | src/ast.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); 1241 PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
1242 __ Mov(x3, x0); 1242 __ Mov(x3, x0);
1243 __ Cbz(x0, loop_statement.continue_label()); 1243 __ Cbz(x0, loop_statement.continue_label());
1244 1244
1245 // Update the 'each' property or variable from the possibly filtered 1245 // Update the 'each' property or variable from the possibly filtered
1246 // entry in register x3. 1246 // entry in register x3.
1247 __ Bind(&update_each); 1247 __ Bind(&update_each);
1248 __ Mov(result_register(), x3); 1248 __ Mov(result_register(), x3);
1249 // Perform the assignment as if via '='. 1249 // Perform the assignment as if via '='.
1250 { EffectContext context(this); 1250 { EffectContext context(this);
1251 EmitAssignment(stmt->each()); 1251 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot());
1252 PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS); 1252 PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS);
1253 } 1253 }
1254 1254
1255 // Generate code for the body of the loop. 1255 // Generate code for the body of the loop.
1256 Visit(stmt->body()); 1256 Visit(stmt->body());
1257 1257
1258 // Generate code for going to the next element by incrementing 1258 // Generate code for going to the next element by incrementing
1259 // the index (smi) stored on top of the stack. 1259 // the index (smi) stored on top of the stack.
1260 __ Bind(loop_statement.continue_label()); 1260 __ Bind(loop_statement.continue_label());
1261 // TODO(all): We could use a callee saved register to avoid popping. 1261 // TODO(all): We could use a callee saved register to avoid popping.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 __ Mov(x10, Operand(isolate()->factory()->undefined_value())); 1326 __ Mov(x10, Operand(isolate()->factory()->undefined_value()));
1327 __ cmp(x0, x10); 1327 __ cmp(x0, x10);
1328 Label done; 1328 Label done;
1329 __ b(&done, ne); 1329 __ b(&done, ne);
1330 __ CallRuntime(Runtime::kThrowNonMethodError, 0); 1330 __ CallRuntime(Runtime::kThrowNonMethodError, 0);
1331 __ bind(&done); 1331 __ bind(&done);
1332 } 1332 }
1333 1333
1334 1334
1335 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer, 1335 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer,
1336 int offset) { 1336 int offset,
1337 FeedbackVectorICSlot slot) {
1337 if (NeedsHomeObject(initializer)) { 1338 if (NeedsHomeObject(initializer)) {
1338 __ Peek(StoreDescriptor::ReceiverRegister(), 0); 1339 __ Peek(StoreDescriptor::ReceiverRegister(), 0);
1339 __ Mov(StoreDescriptor::NameRegister(), 1340 __ Mov(StoreDescriptor::NameRegister(),
1340 Operand(isolate()->factory()->home_object_symbol())); 1341 Operand(isolate()->factory()->home_object_symbol()));
1341 __ Peek(StoreDescriptor::ValueRegister(), offset * kPointerSize); 1342 __ Peek(StoreDescriptor::ValueRegister(), offset * kPointerSize);
1343 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
1342 CallStoreIC(); 1344 CallStoreIC();
1343 } 1345 }
1344 } 1346 }
1345 1347
1346 1348
1347 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, 1349 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
1348 TypeofState typeof_state, 1350 TypeofState typeof_state,
1349 Label* slow) { 1351 Label* slow) {
1350 Register current = cp; 1352 Register current = cp;
1351 Register next = x10; 1353 Register next = x10;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 __ CallStub(&stub); 1649 __ CallStub(&stub);
1648 } 1650 }
1649 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); 1651 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
1650 1652
1651 // If result_saved is true the result is on top of the stack. If 1653 // If result_saved is true the result is on top of the stack. If
1652 // result_saved is false the result is in x0. 1654 // result_saved is false the result is in x0.
1653 bool result_saved = false; 1655 bool result_saved = false;
1654 1656
1655 AccessorTable accessor_table(zone()); 1657 AccessorTable accessor_table(zone());
1656 int property_index = 0; 1658 int property_index = 0;
1659 int store_slot_index = 0;
1657 for (; property_index < expr->properties()->length(); property_index++) { 1660 for (; property_index < expr->properties()->length(); property_index++) {
1658 ObjectLiteral::Property* property = expr->properties()->at(property_index); 1661 ObjectLiteral::Property* property = expr->properties()->at(property_index);
1659 if (property->is_computed_name()) break; 1662 if (property->is_computed_name()) break;
1660 if (property->IsCompileTimeValue()) continue; 1663 if (property->IsCompileTimeValue()) continue;
1661 1664
1662 Literal* key = property->key()->AsLiteral(); 1665 Literal* key = property->key()->AsLiteral();
1663 Expression* value = property->value(); 1666 Expression* value = property->value();
1664 if (!result_saved) { 1667 if (!result_saved) {
1665 __ Push(x0); // Save result on stack 1668 __ Push(x0); // Save result on stack
1666 result_saved = true; 1669 result_saved = true;
1667 } 1670 }
1668 switch (property->kind()) { 1671 switch (property->kind()) {
1669 case ObjectLiteral::Property::CONSTANT: 1672 case ObjectLiteral::Property::CONSTANT:
1670 UNREACHABLE(); 1673 UNREACHABLE();
1671 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 1674 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1672 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value())); 1675 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value()));
1673 // Fall through. 1676 // Fall through.
1674 case ObjectLiteral::Property::COMPUTED: 1677 case ObjectLiteral::Property::COMPUTED:
1675 // It is safe to use [[Put]] here because the boilerplate already 1678 // It is safe to use [[Put]] here because the boilerplate already
1676 // contains computed properties with an uninitialized value. 1679 // contains computed properties with an uninitialized value.
1677 if (key->value()->IsInternalizedString()) { 1680 if (key->value()->IsInternalizedString()) {
1678 if (property->emit_store()) { 1681 if (property->emit_store()) {
1679 VisitForAccumulatorValue(value); 1682 VisitForAccumulatorValue(value);
1680 DCHECK(StoreDescriptor::ValueRegister().is(x0)); 1683 DCHECK(StoreDescriptor::ValueRegister().is(x0));
1681 __ Mov(StoreDescriptor::NameRegister(), Operand(key->value())); 1684 __ Mov(StoreDescriptor::NameRegister(), Operand(key->value()));
1682 __ Peek(StoreDescriptor::ReceiverRegister(), 0); 1685 __ Peek(StoreDescriptor::ReceiverRegister(), 0);
1683 CallStoreIC(key->LiteralFeedbackId()); 1686 if (FLAG_vector_stores) {
1687 EmitLoadStoreICSlot(expr->GetNthSlot(store_slot_index++));
1688 CallStoreIC();
1689 } else {
1690 CallStoreIC(key->LiteralFeedbackId());
1691 }
1684 PrepareForBailoutForId(key->id(), NO_REGISTERS); 1692 PrepareForBailoutForId(key->id(), NO_REGISTERS);
1685 1693
1686 if (NeedsHomeObject(value)) { 1694 if (NeedsHomeObject(value)) {
1687 __ Mov(StoreDescriptor::ReceiverRegister(), x0); 1695 __ Mov(StoreDescriptor::ReceiverRegister(), x0);
1688 __ Mov(StoreDescriptor::NameRegister(), 1696 __ Mov(StoreDescriptor::NameRegister(),
1689 Operand(isolate()->factory()->home_object_symbol())); 1697 Operand(isolate()->factory()->home_object_symbol()));
1690 __ Peek(StoreDescriptor::ValueRegister(), 0); 1698 __ Peek(StoreDescriptor::ValueRegister(), 0);
1699 if (FLAG_vector_stores) {
1700 EmitLoadStoreICSlot(expr->GetNthSlot(store_slot_index++));
1701 }
1691 CallStoreIC(); 1702 CallStoreIC();
1692 } 1703 }
1693 } else { 1704 } else {
1694 VisitForEffect(value); 1705 VisitForEffect(value);
1695 } 1706 }
1696 break; 1707 break;
1697 } 1708 }
1698 __ Peek(x0, 0); 1709 __ Peek(x0, 0);
1699 __ Push(x0); 1710 __ Push(x0);
1700 VisitForStackValue(key); 1711 VisitForStackValue(key);
1701 VisitForStackValue(value); 1712 VisitForStackValue(value);
1702 if (property->emit_store()) { 1713 if (property->emit_store()) {
1703 EmitSetHomeObjectIfNeeded(value, 2); 1714 EmitSetHomeObjectIfNeeded(
1715 value, 2, expr->SlotForHomeObject(value, &store_slot_index));
1704 __ Mov(x0, Smi::FromInt(SLOPPY)); // Language mode 1716 __ Mov(x0, Smi::FromInt(SLOPPY)); // Language mode
1705 __ Push(x0); 1717 __ Push(x0);
1706 __ CallRuntime(Runtime::kSetProperty, 4); 1718 __ CallRuntime(Runtime::kSetProperty, 4);
1707 } else { 1719 } else {
1708 __ Drop(3); 1720 __ Drop(3);
1709 } 1721 }
1710 break; 1722 break;
1711 case ObjectLiteral::Property::PROTOTYPE: 1723 case ObjectLiteral::Property::PROTOTYPE:
1712 DCHECK(property->emit_store()); 1724 DCHECK(property->emit_store());
1713 // Duplicate receiver on stack. 1725 // Duplicate receiver on stack.
(...skipping 17 matching lines...) Expand all
1731 1743
1732 // Emit code to define accessors, using only a single call to the runtime for 1744 // Emit code to define accessors, using only a single call to the runtime for
1733 // each pair of corresponding getters and setters. 1745 // each pair of corresponding getters and setters.
1734 for (AccessorTable::Iterator it = accessor_table.begin(); 1746 for (AccessorTable::Iterator it = accessor_table.begin();
1735 it != accessor_table.end(); 1747 it != accessor_table.end();
1736 ++it) { 1748 ++it) {
1737 __ Peek(x10, 0); // Duplicate receiver. 1749 __ Peek(x10, 0); // Duplicate receiver.
1738 __ Push(x10); 1750 __ Push(x10);
1739 VisitForStackValue(it->first); 1751 VisitForStackValue(it->first);
1740 EmitAccessor(it->second->getter); 1752 EmitAccessor(it->second->getter);
1741 EmitSetHomeObjectIfNeeded(it->second->getter, 2); 1753 EmitSetHomeObjectIfNeeded(
1754 it->second->getter, 2,
1755 expr->SlotForHomeObject(it->second->getter, &store_slot_index));
1742 EmitAccessor(it->second->setter); 1756 EmitAccessor(it->second->setter);
1743 EmitSetHomeObjectIfNeeded(it->second->setter, 3); 1757 EmitSetHomeObjectIfNeeded(
1758 it->second->setter, 3,
1759 expr->SlotForHomeObject(it->second->setter, &store_slot_index));
1744 __ Mov(x10, Smi::FromInt(NONE)); 1760 __ Mov(x10, Smi::FromInt(NONE));
1745 __ Push(x10); 1761 __ Push(x10);
1746 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); 1762 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
1747 } 1763 }
1748 1764
1749 // Object literals have two parts. The "static" part on the left contains no 1765 // Object literals have two parts. The "static" part on the left contains no
1750 // computed property names, and so we can compute its map ahead of time; see 1766 // computed property names, and so we can compute its map ahead of time; see
1751 // runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part 1767 // runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part
1752 // starts with the first computed property name, and continues with all 1768 // starts with the first computed property name, and continues with all
1753 // properties to its right. All the code from above initializes the static 1769 // properties to its right. All the code from above initializes the static
(...skipping 14 matching lines...) Expand all
1768 __ Push(x10); 1784 __ Push(x10);
1769 1785
1770 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) { 1786 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) {
1771 DCHECK(!property->is_computed_name()); 1787 DCHECK(!property->is_computed_name());
1772 VisitForStackValue(value); 1788 VisitForStackValue(value);
1773 DCHECK(property->emit_store()); 1789 DCHECK(property->emit_store());
1774 __ CallRuntime(Runtime::kInternalSetPrototype, 2); 1790 __ CallRuntime(Runtime::kInternalSetPrototype, 2);
1775 } else { 1791 } else {
1776 EmitPropertyKey(property, expr->GetIdForProperty(property_index)); 1792 EmitPropertyKey(property, expr->GetIdForProperty(property_index));
1777 VisitForStackValue(value); 1793 VisitForStackValue(value);
1778 EmitSetHomeObjectIfNeeded(value, 2); 1794 EmitSetHomeObjectIfNeeded(
1795 value, 2, expr->SlotForHomeObject(value, &store_slot_index));
1779 1796
1780 switch (property->kind()) { 1797 switch (property->kind()) {
1781 case ObjectLiteral::Property::CONSTANT: 1798 case ObjectLiteral::Property::CONSTANT:
1782 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 1799 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1783 case ObjectLiteral::Property::COMPUTED: 1800 case ObjectLiteral::Property::COMPUTED:
1784 if (property->emit_store()) { 1801 if (property->emit_store()) {
1785 __ Mov(x0, Smi::FromInt(NONE)); 1802 __ Mov(x0, Smi::FromInt(NONE));
1786 __ Push(x0); 1803 __ Push(x0);
1787 __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4); 1804 __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4);
1788 } else { 1805 } else {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1926 } 1943 }
1927 } 1944 }
1928 1945
1929 1946
1930 void FullCodeGenerator::VisitAssignment(Assignment* expr) { 1947 void FullCodeGenerator::VisitAssignment(Assignment* expr) {
1931 DCHECK(expr->target()->IsValidReferenceExpression()); 1948 DCHECK(expr->target()->IsValidReferenceExpression());
1932 1949
1933 Comment cmnt(masm_, "[ Assignment"); 1950 Comment cmnt(masm_, "[ Assignment");
1934 1951
1935 Property* property = expr->target()->AsProperty(); 1952 Property* property = expr->target()->AsProperty();
1936 LhsKind assign_type = GetAssignType(property); 1953 LhsKind assign_type = Property::GetAssignType(property);
1937 1954
1938 // Evaluate LHS expression. 1955 // Evaluate LHS expression.
1939 switch (assign_type) { 1956 switch (assign_type) {
1940 case VARIABLE: 1957 case VARIABLE:
1941 // Nothing to do here. 1958 // Nothing to do here.
1942 break; 1959 break;
1943 case NAMED_PROPERTY: 1960 case NAMED_PROPERTY:
1944 if (expr->is_compound()) { 1961 if (expr->is_compound()) {
1945 // We need the receiver both on the stack and in the register. 1962 // We need the receiver both on the stack and in the register.
1946 VisitForStackValue(property->obj()); 1963 VisitForStackValue(property->obj());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 VisitForAccumulatorValue(expr->value()); 2052 VisitForAccumulatorValue(expr->value());
2036 } 2053 }
2037 2054
2038 // Record source position before possible IC call. 2055 // Record source position before possible IC call.
2039 SetSourcePosition(expr->position()); 2056 SetSourcePosition(expr->position());
2040 2057
2041 // Store the value. 2058 // Store the value.
2042 switch (assign_type) { 2059 switch (assign_type) {
2043 case VARIABLE: 2060 case VARIABLE:
2044 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(), 2061 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(),
2045 expr->op()); 2062 expr->op(), expr->AssignmentSlot());
2046 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2063 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2047 context()->Plug(x0); 2064 context()->Plug(x0);
2048 break; 2065 break;
2049 case NAMED_PROPERTY: 2066 case NAMED_PROPERTY:
2050 EmitNamedPropertyAssignment(expr); 2067 EmitNamedPropertyAssignment(expr);
2051 break; 2068 break;
2052 case NAMED_SUPER_PROPERTY: 2069 case NAMED_SUPER_PROPERTY:
2053 EmitNamedSuperPropertyStore(property); 2070 EmitNamedSuperPropertyStore(property);
2054 context()->Plug(x0); 2071 context()->Plug(x0);
2055 break; 2072 break;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2283 } 2300 }
2284 2301
2285 // prototype 2302 // prototype
2286 __ CallRuntime(Runtime::kToFastProperties, 1); 2303 __ CallRuntime(Runtime::kToFastProperties, 1);
2287 2304
2288 // constructor 2305 // constructor
2289 __ CallRuntime(Runtime::kToFastProperties, 1); 2306 __ CallRuntime(Runtime::kToFastProperties, 1);
2290 } 2307 }
2291 2308
2292 2309
2293 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2310 void FullCodeGenerator::EmitAssignment(Expression* expr,
2311 FeedbackVectorICSlot slot) {
2294 DCHECK(expr->IsValidReferenceExpression()); 2312 DCHECK(expr->IsValidReferenceExpression());
2295 2313
2296 Property* prop = expr->AsProperty(); 2314 Property* prop = expr->AsProperty();
2297 LhsKind assign_type = GetAssignType(prop); 2315 LhsKind assign_type = Property::GetAssignType(prop);
2298 2316
2299 switch (assign_type) { 2317 switch (assign_type) {
2300 case VARIABLE: { 2318 case VARIABLE: {
2301 Variable* var = expr->AsVariableProxy()->var(); 2319 Variable* var = expr->AsVariableProxy()->var();
2302 EffectContext context(this); 2320 EffectContext context(this);
2303 EmitVariableAssignment(var, Token::ASSIGN); 2321 EmitVariableAssignment(var, Token::ASSIGN, slot);
2304 break; 2322 break;
2305 } 2323 }
2306 case NAMED_PROPERTY: { 2324 case NAMED_PROPERTY: {
2307 __ Push(x0); // Preserve value. 2325 __ Push(x0); // Preserve value.
2308 VisitForAccumulatorValue(prop->obj()); 2326 VisitForAccumulatorValue(prop->obj());
2309 // TODO(all): We could introduce a VisitForRegValue(reg, expr) to avoid 2327 // TODO(all): We could introduce a VisitForRegValue(reg, expr) to avoid
2310 // this copy. 2328 // this copy.
2311 __ Mov(StoreDescriptor::ReceiverRegister(), x0); 2329 __ Mov(StoreDescriptor::ReceiverRegister(), x0);
2312 __ Pop(StoreDescriptor::ValueRegister()); // Restore value. 2330 __ Pop(StoreDescriptor::ValueRegister()); // Restore value.
2313 __ Mov(StoreDescriptor::NameRegister(), 2331 __ Mov(StoreDescriptor::NameRegister(),
2314 Operand(prop->key()->AsLiteral()->value())); 2332 Operand(prop->key()->AsLiteral()->value()));
2333 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2315 CallStoreIC(); 2334 CallStoreIC();
2316 break; 2335 break;
2317 } 2336 }
2318 case NAMED_SUPER_PROPERTY: { 2337 case NAMED_SUPER_PROPERTY: {
2319 __ Push(x0); 2338 __ Push(x0);
2320 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); 2339 VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
2321 EmitLoadHomeObject(prop->obj()->AsSuperReference()); 2340 EmitLoadHomeObject(prop->obj()->AsSuperReference());
2322 // stack: value, this; x0: home_object 2341 // stack: value, this; x0: home_object
2323 Register scratch = x10; 2342 Register scratch = x10;
2324 Register scratch2 = x11; 2343 Register scratch2 = x11;
(...skipping 26 matching lines...) Expand all
2351 EmitKeyedSuperPropertyStore(prop); 2370 EmitKeyedSuperPropertyStore(prop);
2352 break; 2371 break;
2353 } 2372 }
2354 case KEYED_PROPERTY: { 2373 case KEYED_PROPERTY: {
2355 __ Push(x0); // Preserve value. 2374 __ Push(x0); // Preserve value.
2356 VisitForStackValue(prop->obj()); 2375 VisitForStackValue(prop->obj());
2357 VisitForAccumulatorValue(prop->key()); 2376 VisitForAccumulatorValue(prop->key());
2358 __ Mov(StoreDescriptor::NameRegister(), x0); 2377 __ Mov(StoreDescriptor::NameRegister(), x0);
2359 __ Pop(StoreDescriptor::ReceiverRegister(), 2378 __ Pop(StoreDescriptor::ReceiverRegister(),
2360 StoreDescriptor::ValueRegister()); 2379 StoreDescriptor::ValueRegister());
2380 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2361 Handle<Code> ic = 2381 Handle<Code> ic =
2362 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); 2382 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
2363 CallIC(ic); 2383 CallIC(ic);
2364 break; 2384 break;
2365 } 2385 }
2366 } 2386 }
2367 context()->Plug(x0); 2387 context()->Plug(x0);
2368 } 2388 }
2369 2389
2370 2390
2371 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( 2391 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot(
2372 Variable* var, MemOperand location) { 2392 Variable* var, MemOperand location) {
2373 __ Str(result_register(), location); 2393 __ Str(result_register(), location);
2374 if (var->IsContextSlot()) { 2394 if (var->IsContextSlot()) {
2375 // RecordWrite may destroy all its register arguments. 2395 // RecordWrite may destroy all its register arguments.
2376 __ Mov(x10, result_register()); 2396 __ Mov(x10, result_register());
2377 int offset = Context::SlotOffset(var->index()); 2397 int offset = Context::SlotOffset(var->index());
2378 __ RecordWriteContextSlot( 2398 __ RecordWriteContextSlot(
2379 x1, offset, x10, x11, kLRHasBeenSaved, kDontSaveFPRegs); 2399 x1, offset, x10, x11, kLRHasBeenSaved, kDontSaveFPRegs);
2380 } 2400 }
2381 } 2401 }
2382 2402
2383 2403
2384 void FullCodeGenerator::EmitVariableAssignment(Variable* var, 2404 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
2385 Token::Value op) { 2405 FeedbackVectorICSlot slot) {
2386 ASM_LOCATION("FullCodeGenerator::EmitVariableAssignment"); 2406 ASM_LOCATION("FullCodeGenerator::EmitVariableAssignment");
2387 if (var->IsUnallocated()) { 2407 if (var->IsUnallocated()) {
2388 // Global var, const, or let. 2408 // Global var, const, or let.
2389 __ Mov(StoreDescriptor::NameRegister(), Operand(var->name())); 2409 __ Mov(StoreDescriptor::NameRegister(), Operand(var->name()));
2390 __ Ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); 2410 __ Ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectMemOperand());
2411 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2391 CallStoreIC(); 2412 CallStoreIC();
2392 2413
2393 } else if (var->mode() == LET && op != Token::INIT_LET) { 2414 } else if (var->mode() == LET && op != Token::INIT_LET) {
2394 // Non-initializing assignment to let variable needs a write barrier. 2415 // Non-initializing assignment to let variable needs a write barrier.
2395 DCHECK(!var->IsLookupSlot()); 2416 DCHECK(!var->IsLookupSlot());
2396 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2417 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2397 Label assign; 2418 Label assign;
2398 MemOperand location = VarOperand(var, x1); 2419 MemOperand location = VarOperand(var, x1);
2399 __ Ldr(x10, location); 2420 __ Ldr(x10, location);
2400 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign); 2421 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
2476 // Assignment to a property, using a named store IC. 2497 // Assignment to a property, using a named store IC.
2477 Property* prop = expr->target()->AsProperty(); 2498 Property* prop = expr->target()->AsProperty();
2478 DCHECK(prop != NULL); 2499 DCHECK(prop != NULL);
2479 DCHECK(prop->key()->IsLiteral()); 2500 DCHECK(prop->key()->IsLiteral());
2480 2501
2481 // Record source code position before IC call. 2502 // Record source code position before IC call.
2482 SetSourcePosition(expr->position()); 2503 SetSourcePosition(expr->position());
2483 __ Mov(StoreDescriptor::NameRegister(), 2504 __ Mov(StoreDescriptor::NameRegister(),
2484 Operand(prop->key()->AsLiteral()->value())); 2505 Operand(prop->key()->AsLiteral()->value()));
2485 __ Pop(StoreDescriptor::ReceiverRegister()); 2506 __ Pop(StoreDescriptor::ReceiverRegister());
2486 CallStoreIC(expr->AssignmentFeedbackId()); 2507 if (FLAG_vector_stores) {
2508 EmitLoadStoreICSlot(expr->AssignmentSlot());
2509 CallStoreIC();
2510 } else {
2511 CallStoreIC(expr->AssignmentFeedbackId());
2512 }
2487 2513
2488 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2514 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2489 context()->Plug(x0); 2515 context()->Plug(x0);
2490 } 2516 }
2491 2517
2492 2518
2493 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { 2519 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) {
2494 // Assignment to named property of super. 2520 // Assignment to named property of super.
2495 // x0 : value 2521 // x0 : value
2496 // stack : receiver ('this'), home_object 2522 // stack : receiver ('this'), home_object
(...skipping 28 matching lines...) Expand all
2525 // Assignment to a property, using a keyed store IC. 2551 // Assignment to a property, using a keyed store IC.
2526 2552
2527 // Record source code position before IC call. 2553 // Record source code position before IC call.
2528 SetSourcePosition(expr->position()); 2554 SetSourcePosition(expr->position());
2529 // TODO(all): Could we pass this in registers rather than on the stack? 2555 // TODO(all): Could we pass this in registers rather than on the stack?
2530 __ Pop(StoreDescriptor::NameRegister(), StoreDescriptor::ReceiverRegister()); 2556 __ Pop(StoreDescriptor::NameRegister(), StoreDescriptor::ReceiverRegister());
2531 DCHECK(StoreDescriptor::ValueRegister().is(x0)); 2557 DCHECK(StoreDescriptor::ValueRegister().is(x0));
2532 2558
2533 Handle<Code> ic = 2559 Handle<Code> ic =
2534 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); 2560 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
2535 CallIC(ic, expr->AssignmentFeedbackId()); 2561 if (FLAG_vector_stores) {
2562 EmitLoadStoreICSlot(expr->AssignmentSlot());
2563 CallIC(ic);
2564 } else {
2565 CallIC(ic, expr->AssignmentFeedbackId());
2566 }
2536 2567
2537 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2568 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2538 context()->Plug(x0); 2569 context()->Plug(x0);
2539 } 2570 }
2540 2571
2541 2572
2542 void FullCodeGenerator::VisitProperty(Property* expr) { 2573 void FullCodeGenerator::VisitProperty(Property* expr) {
2543 Comment cmnt(masm_, "[ Property"); 2574 Comment cmnt(masm_, "[ Property");
2544 Expression* key = expr->key(); 2575 Expression* key = expr->key();
2545 2576
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
2775 2806
2776 2807
2777 void FullCodeGenerator::EmitLoadSuperConstructor() { 2808 void FullCodeGenerator::EmitLoadSuperConstructor() {
2778 __ ldr(x0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 2809 __ ldr(x0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2779 __ Push(x0); 2810 __ Push(x0);
2780 __ CallRuntime(Runtime::kGetPrototype, 1); 2811 __ CallRuntime(Runtime::kGetPrototype, 1);
2781 } 2812 }
2782 2813
2783 2814
2784 void FullCodeGenerator::EmitInitializeThisAfterSuper( 2815 void FullCodeGenerator::EmitInitializeThisAfterSuper(
2785 SuperReference* super_ref) { 2816 SuperReference* super_ref, FeedbackVectorICSlot slot) {
2786 Variable* this_var = super_ref->this_var()->var(); 2817 Variable* this_var = super_ref->this_var()->var();
2787 GetVar(x1, this_var); 2818 GetVar(x1, this_var);
2788 Label uninitialized_this; 2819 Label uninitialized_this;
2789 __ JumpIfRoot(x1, Heap::kTheHoleValueRootIndex, &uninitialized_this); 2820 __ JumpIfRoot(x1, Heap::kTheHoleValueRootIndex, &uninitialized_this);
2790 __ Mov(x0, Operand(this_var->name())); 2821 __ Mov(x0, Operand(this_var->name()));
2791 __ Push(x0); 2822 __ Push(x0);
2792 __ CallRuntime(Runtime::kThrowReferenceError, 1); 2823 __ CallRuntime(Runtime::kThrowReferenceError, 1);
2793 __ bind(&uninitialized_this); 2824 __ bind(&uninitialized_this);
2794 2825
2795 EmitVariableAssignment(this_var, Token::INIT_CONST); 2826 EmitVariableAssignment(this_var, Token::INIT_CONST, slot);
2796 } 2827 }
2797 2828
2798 2829
2799 void FullCodeGenerator::VisitCall(Call* expr) { 2830 void FullCodeGenerator::VisitCall(Call* expr) {
2800 #ifdef DEBUG 2831 #ifdef DEBUG
2801 // We want to verify that RecordJSReturnSite gets called on all paths 2832 // We want to verify that RecordJSReturnSite gets called on all paths
2802 // through this function. Avoid early returns. 2833 // through this function. Avoid early returns.
2803 expr->return_is_recorded_ = false; 2834 expr->return_is_recorded_ = false;
2804 #endif 2835 #endif
2805 2836
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
3013 __ LoadObject(x2, FeedbackVector()); 3044 __ LoadObject(x2, FeedbackVector());
3014 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot())); 3045 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot()));
3015 3046
3016 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 3047 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3017 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3048 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3018 3049
3019 __ Drop(1); 3050 __ Drop(1);
3020 3051
3021 RecordJSReturnSite(expr); 3052 RecordJSReturnSite(expr);
3022 3053
3023 EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference()); 3054 EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference(),
3055 expr->CallFeedbackICSlot());
3024 context()->Plug(x0); 3056 context()->Plug(x0);
3025 } 3057 }
3026 3058
3027 3059
3028 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3060 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3029 ZoneList<Expression*>* args = expr->arguments(); 3061 ZoneList<Expression*>* args = expr->arguments();
3030 DCHECK(args->length() == 1); 3062 DCHECK(args->length() == 1);
3031 3063
3032 VisitForAccumulatorValue(args->at(0)); 3064 VisitForAccumulatorValue(args->at(0));
3033 3065
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
4300 // Push NewTarget 4332 // Push NewTarget
4301 DCHECK(args->at(2)->IsVariableProxy()); 4333 DCHECK(args->at(2)->IsVariableProxy());
4302 VisitForStackValue(args->at(2)); 4334 VisitForStackValue(args->at(2));
4303 4335
4304 EmitCallJSRuntimeFunction(call); 4336 EmitCallJSRuntimeFunction(call);
4305 4337
4306 // Restore context register. 4338 // Restore context register.
4307 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 4339 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4308 context()->DropAndPlug(1, x0); 4340 context()->DropAndPlug(1, x0);
4309 4341
4342 // TODO(mvstanton): with FLAG_vector_stores this needs a slot id.
4310 EmitInitializeThisAfterSuper(super_reference); 4343 EmitInitializeThisAfterSuper(super_reference);
4311 } 4344 }
4312 4345
4313 4346
4314 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 4347 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
4315 // Push the builtins object as the receiver. 4348 // Push the builtins object as the receiver.
4316 __ Ldr(x10, GlobalObjectMemOperand()); 4349 __ Ldr(x10, GlobalObjectMemOperand());
4317 __ Ldr(LoadDescriptor::ReceiverRegister(), 4350 __ Ldr(LoadDescriptor::ReceiverRegister(),
4318 FieldMemOperand(x10, GlobalObject::kBuiltinsOffset)); 4351 FieldMemOperand(x10, GlobalObject::kBuiltinsOffset));
4319 __ Push(LoadDescriptor::ReceiverRegister()); 4352 __ Push(LoadDescriptor::ReceiverRegister());
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
4500 } 4533 }
4501 4534
4502 4535
4503 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { 4536 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
4504 DCHECK(expr->expression()->IsValidReferenceExpression()); 4537 DCHECK(expr->expression()->IsValidReferenceExpression());
4505 4538
4506 Comment cmnt(masm_, "[ CountOperation"); 4539 Comment cmnt(masm_, "[ CountOperation");
4507 SetSourcePosition(expr->position()); 4540 SetSourcePosition(expr->position());
4508 4541
4509 Property* prop = expr->expression()->AsProperty(); 4542 Property* prop = expr->expression()->AsProperty();
4510 LhsKind assign_type = GetAssignType(prop); 4543 LhsKind assign_type = Property::GetAssignType(prop);
4511 4544
4512 // Evaluate expression and get value. 4545 // Evaluate expression and get value.
4513 if (assign_type == VARIABLE) { 4546 if (assign_type == VARIABLE) {
4514 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); 4547 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL);
4515 AccumulatorValueContext context(this); 4548 AccumulatorValueContext context(this);
4516 EmitVariableLoad(expr->expression()->AsVariableProxy()); 4549 EmitVariableLoad(expr->expression()->AsVariableProxy());
4517 } else { 4550 } else {
4518 // Reserve space for result of postfix operation. 4551 // Reserve space for result of postfix operation.
4519 if (expr->is_postfix() && !context()->IsEffect()) { 4552 if (expr->is_postfix() && !context()->IsEffect()) {
4520 __ Push(xzr); 4553 __ Push(xzr);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
4663 patch_site.EmitPatchInfo(); 4696 patch_site.EmitPatchInfo();
4664 } 4697 }
4665 __ Bind(&done); 4698 __ Bind(&done);
4666 4699
4667 // Store the value returned in x0. 4700 // Store the value returned in x0.
4668 switch (assign_type) { 4701 switch (assign_type) {
4669 case VARIABLE: 4702 case VARIABLE:
4670 if (expr->is_postfix()) { 4703 if (expr->is_postfix()) {
4671 { EffectContext context(this); 4704 { EffectContext context(this);
4672 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 4705 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
4673 Token::ASSIGN); 4706 Token::ASSIGN, expr->CountSlot());
4674 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4707 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4675 context.Plug(x0); 4708 context.Plug(x0);
4676 } 4709 }
4677 // For all contexts except EffectConstant We have the result on 4710 // For all contexts except EffectConstant We have the result on
4678 // top of the stack. 4711 // top of the stack.
4679 if (!context()->IsEffect()) { 4712 if (!context()->IsEffect()) {
4680 context()->PlugTOS(); 4713 context()->PlugTOS();
4681 } 4714 }
4682 } else { 4715 } else {
4683 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 4716 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
4684 Token::ASSIGN); 4717 Token::ASSIGN, expr->CountSlot());
4685 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4718 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4686 context()->Plug(x0); 4719 context()->Plug(x0);
4687 } 4720 }
4688 break; 4721 break;
4689 case NAMED_PROPERTY: { 4722 case NAMED_PROPERTY: {
4690 __ Mov(StoreDescriptor::NameRegister(), 4723 __ Mov(StoreDescriptor::NameRegister(),
4691 Operand(prop->key()->AsLiteral()->value())); 4724 Operand(prop->key()->AsLiteral()->value()));
4692 __ Pop(StoreDescriptor::ReceiverRegister()); 4725 __ Pop(StoreDescriptor::ReceiverRegister());
4693 CallStoreIC(expr->CountStoreFeedbackId()); 4726 if (FLAG_vector_stores) {
4727 EmitLoadStoreICSlot(expr->CountSlot());
4728 CallStoreIC();
4729 } else {
4730 CallStoreIC(expr->CountStoreFeedbackId());
4731 }
4694 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4732 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4695 if (expr->is_postfix()) { 4733 if (expr->is_postfix()) {
4696 if (!context()->IsEffect()) { 4734 if (!context()->IsEffect()) {
4697 context()->PlugTOS(); 4735 context()->PlugTOS();
4698 } 4736 }
4699 } else { 4737 } else {
4700 context()->Plug(x0); 4738 context()->Plug(x0);
4701 } 4739 }
4702 break; 4740 break;
4703 } 4741 }
(...skipping 17 matching lines...) Expand all
4721 } else { 4759 } else {
4722 context()->Plug(x0); 4760 context()->Plug(x0);
4723 } 4761 }
4724 break; 4762 break;
4725 } 4763 }
4726 case KEYED_PROPERTY: { 4764 case KEYED_PROPERTY: {
4727 __ Pop(StoreDescriptor::NameRegister()); 4765 __ Pop(StoreDescriptor::NameRegister());
4728 __ Pop(StoreDescriptor::ReceiverRegister()); 4766 __ Pop(StoreDescriptor::ReceiverRegister());
4729 Handle<Code> ic = 4767 Handle<Code> ic =
4730 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); 4768 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
4731 CallIC(ic, expr->CountStoreFeedbackId()); 4769 if (FLAG_vector_stores) {
4770 EmitLoadStoreICSlot(expr->CountSlot());
4771 CallIC(ic);
4772 } else {
4773 CallIC(ic, expr->CountStoreFeedbackId());
4774 }
4732 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4775 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4733 if (expr->is_postfix()) { 4776 if (expr->is_postfix()) {
4734 if (!context()->IsEffect()) { 4777 if (!context()->IsEffect()) {
4735 context()->PlugTOS(); 4778 context()->PlugTOS();
4736 } 4779 }
4737 } else { 4780 } else {
4738 context()->Plug(x0); 4781 context()->Plug(x0);
4739 } 4782 }
4740 break; 4783 break;
4741 } 4784 }
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
5387 void FullCodeGenerator::ClearPendingMessage() { 5430 void FullCodeGenerator::ClearPendingMessage() {
5388 DCHECK(!result_register().is(x10)); 5431 DCHECK(!result_register().is(x10));
5389 ExternalReference pending_message_obj = 5432 ExternalReference pending_message_obj =
5390 ExternalReference::address_of_pending_message_obj(isolate()); 5433 ExternalReference::address_of_pending_message_obj(isolate());
5391 __ LoadRoot(x10, Heap::kTheHoleValueRootIndex); 5434 __ LoadRoot(x10, Heap::kTheHoleValueRootIndex);
5392 __ Mov(x13, pending_message_obj); 5435 __ Mov(x13, pending_message_obj);
5393 __ Str(x10, MemOperand(x13)); 5436 __ Str(x10, MemOperand(x13));
5394 } 5437 }
5395 5438
5396 5439
5440 void FullCodeGenerator::EmitLoadStoreICSlot(FeedbackVectorICSlot slot) {
5441 DCHECK(FLAG_vector_stores && !slot.IsInvalid());
5442 __ Mov(VectorStoreICTrampolineDescriptor::SlotRegister(), SmiFromSlot(slot));
5443 }
5444
5445
5397 #undef __ 5446 #undef __
5398 5447
5399 5448
5400 void BackEdgeTable::PatchAt(Code* unoptimized_code, 5449 void BackEdgeTable::PatchAt(Code* unoptimized_code,
5401 Address pc, 5450 Address pc,
5402 BackEdgeState target_state, 5451 BackEdgeState target_state,
5403 Code* replacement_code) { 5452 Code* replacement_code) {
5404 // Turn the jump into a nop. 5453 // Turn the jump into a nop.
5405 Address branch_address = pc - 3 * kInstructionSize; 5454 Address branch_address = pc - 3 * kInstructionSize;
5406 PatchingAssembler patcher(branch_address, 1); 5455 PatchingAssembler patcher(branch_address, 1);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
5488 } 5537 }
5489 } 5538 }
5490 5539
5491 return INTERRUPT; 5540 return INTERRUPT;
5492 } 5541 }
5493 5542
5494 5543
5495 } } // namespace v8::internal 5544 } } // namespace v8::internal
5496 5545
5497 #endif // V8_TARGET_ARCH_ARM64 5546 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/ast.h » ('j') | src/ast.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698