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

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

Issue 486213003: Move register conventions out of the IC classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/arm64/debug-arm64.cc ('k') | src/arm64/lithium-arm64.cc » ('j') | no next file with comments »
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-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 __ JumpIfRoot(temp, Heap::kNativeContextMapRootIndex, &fast); 1376 __ JumpIfRoot(temp, Heap::kNativeContextMapRootIndex, &fast);
1377 // Check that extension is NULL. 1377 // Check that extension is NULL.
1378 __ Ldr(temp, ContextMemOperand(next, Context::EXTENSION_INDEX)); 1378 __ Ldr(temp, ContextMemOperand(next, Context::EXTENSION_INDEX));
1379 __ Cbnz(temp, slow); 1379 __ Cbnz(temp, slow);
1380 // Load next context in chain. 1380 // Load next context in chain.
1381 __ Ldr(next, ContextMemOperand(next, Context::PREVIOUS_INDEX)); 1381 __ Ldr(next, ContextMemOperand(next, Context::PREVIOUS_INDEX));
1382 __ B(&loop); 1382 __ B(&loop);
1383 __ Bind(&fast); 1383 __ Bind(&fast);
1384 } 1384 }
1385 1385
1386 __ Ldr(LoadIC::ReceiverRegister(), GlobalObjectMemOperand()); 1386 __ Ldr(LoadConvention::ReceiverRegister(), GlobalObjectMemOperand());
1387 __ Mov(LoadIC::NameRegister(), Operand(proxy->var()->name())); 1387 __ Mov(LoadConvention::NameRegister(), Operand(proxy->var()->name()));
1388 if (FLAG_vector_ics) { 1388 if (FLAG_vector_ics) {
1389 __ Mov(LoadIC::SlotRegister(), 1389 __ Mov(VectorLoadConvention::SlotRegister(),
1390 Smi::FromInt(proxy->VariableFeedbackSlot())); 1390 Smi::FromInt(proxy->VariableFeedbackSlot()));
1391 } 1391 }
1392 1392
1393 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) ? NOT_CONTEXTUAL 1393 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) ? NOT_CONTEXTUAL
1394 : CONTEXTUAL; 1394 : CONTEXTUAL;
1395 CallLoadIC(mode); 1395 CallLoadIC(mode);
1396 } 1396 }
1397 1397
1398 1398
1399 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, 1399 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { 1461 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
1462 // Record position before possible IC call. 1462 // Record position before possible IC call.
1463 SetSourcePosition(proxy->position()); 1463 SetSourcePosition(proxy->position());
1464 Variable* var = proxy->var(); 1464 Variable* var = proxy->var();
1465 1465
1466 // Three cases: global variables, lookup variables, and all other types of 1466 // Three cases: global variables, lookup variables, and all other types of
1467 // variables. 1467 // variables.
1468 switch (var->location()) { 1468 switch (var->location()) {
1469 case Variable::UNALLOCATED: { 1469 case Variable::UNALLOCATED: {
1470 Comment cmnt(masm_, "Global variable"); 1470 Comment cmnt(masm_, "Global variable");
1471 __ Ldr(LoadIC::ReceiverRegister(), GlobalObjectMemOperand()); 1471 __ Ldr(LoadConvention::ReceiverRegister(), GlobalObjectMemOperand());
1472 __ Mov(LoadIC::NameRegister(), Operand(var->name())); 1472 __ Mov(LoadConvention::NameRegister(), Operand(var->name()));
1473 if (FLAG_vector_ics) { 1473 if (FLAG_vector_ics) {
1474 __ Mov(LoadIC::SlotRegister(), 1474 __ Mov(VectorLoadConvention::SlotRegister(),
1475 Smi::FromInt(proxy->VariableFeedbackSlot())); 1475 Smi::FromInt(proxy->VariableFeedbackSlot()));
1476 } 1476 }
1477 CallLoadIC(CONTEXTUAL); 1477 CallLoadIC(CONTEXTUAL);
1478 context()->Plug(x0); 1478 context()->Plug(x0);
1479 break; 1479 break;
1480 } 1480 }
1481 1481
1482 case Variable::PARAMETER: 1482 case Variable::PARAMETER:
1483 case Variable::LOCAL: 1483 case Variable::LOCAL:
1484 case Variable::CONTEXT: { 1484 case Variable::CONTEXT: {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 switch (property->kind()) { 1674 switch (property->kind()) {
1675 case ObjectLiteral::Property::CONSTANT: 1675 case ObjectLiteral::Property::CONSTANT:
1676 UNREACHABLE(); 1676 UNREACHABLE();
1677 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 1677 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1678 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value())); 1678 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value()));
1679 // Fall through. 1679 // Fall through.
1680 case ObjectLiteral::Property::COMPUTED: 1680 case ObjectLiteral::Property::COMPUTED:
1681 if (key->value()->IsInternalizedString()) { 1681 if (key->value()->IsInternalizedString()) {
1682 if (property->emit_store()) { 1682 if (property->emit_store()) {
1683 VisitForAccumulatorValue(value); 1683 VisitForAccumulatorValue(value);
1684 DCHECK(StoreIC::ValueRegister().is(x0)); 1684 DCHECK(StoreConvention::ValueRegister().is(x0));
1685 __ Mov(StoreIC::NameRegister(), Operand(key->value())); 1685 __ Mov(StoreConvention::NameRegister(), Operand(key->value()));
1686 __ Peek(StoreIC::ReceiverRegister(), 0); 1686 __ Peek(StoreConvention::ReceiverRegister(), 0);
1687 CallStoreIC(key->LiteralFeedbackId()); 1687 CallStoreIC(key->LiteralFeedbackId());
1688 PrepareForBailoutForId(key->id(), NO_REGISTERS); 1688 PrepareForBailoutForId(key->id(), NO_REGISTERS);
1689 } else { 1689 } else {
1690 VisitForEffect(value); 1690 VisitForEffect(value);
1691 } 1691 }
1692 break; 1692 break;
1693 } 1693 }
1694 if (property->emit_store()) { 1694 if (property->emit_store()) {
1695 // Duplicate receiver on stack. 1695 // Duplicate receiver on stack.
1696 __ Peek(x0, 0); 1696 __ Peek(x0, 0);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 1854
1855 // Evaluate LHS expression. 1855 // Evaluate LHS expression.
1856 switch (assign_type) { 1856 switch (assign_type) {
1857 case VARIABLE: 1857 case VARIABLE:
1858 // Nothing to do here. 1858 // Nothing to do here.
1859 break; 1859 break;
1860 case NAMED_PROPERTY: 1860 case NAMED_PROPERTY:
1861 if (expr->is_compound()) { 1861 if (expr->is_compound()) {
1862 // We need the receiver both on the stack and in the register. 1862 // We need the receiver both on the stack and in the register.
1863 VisitForStackValue(property->obj()); 1863 VisitForStackValue(property->obj());
1864 __ Peek(LoadIC::ReceiverRegister(), 0); 1864 __ Peek(LoadConvention::ReceiverRegister(), 0);
1865 } else { 1865 } else {
1866 VisitForStackValue(property->obj()); 1866 VisitForStackValue(property->obj());
1867 } 1867 }
1868 break; 1868 break;
1869 case KEYED_PROPERTY: 1869 case KEYED_PROPERTY:
1870 if (expr->is_compound()) { 1870 if (expr->is_compound()) {
1871 VisitForStackValue(property->obj()); 1871 VisitForStackValue(property->obj());
1872 VisitForStackValue(property->key()); 1872 VisitForStackValue(property->key());
1873 __ Peek(LoadIC::ReceiverRegister(), 1 * kPointerSize); 1873 __ Peek(LoadConvention::ReceiverRegister(), 1 * kPointerSize);
1874 __ Peek(LoadIC::NameRegister(), 0); 1874 __ Peek(LoadConvention::NameRegister(), 0);
1875 } else { 1875 } else {
1876 VisitForStackValue(property->obj()); 1876 VisitForStackValue(property->obj());
1877 VisitForStackValue(property->key()); 1877 VisitForStackValue(property->key());
1878 } 1878 }
1879 break; 1879 break;
1880 } 1880 }
1881 1881
1882 // For compound assignments we need another deoptimization point after the 1882 // For compound assignments we need another deoptimization point after the
1883 // variable/property load. 1883 // variable/property load.
1884 if (expr->is_compound()) { 1884 if (expr->is_compound()) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 case KEYED_PROPERTY: 1941 case KEYED_PROPERTY:
1942 EmitKeyedPropertyAssignment(expr); 1942 EmitKeyedPropertyAssignment(expr);
1943 break; 1943 break;
1944 } 1944 }
1945 } 1945 }
1946 1946
1947 1947
1948 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 1948 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
1949 SetSourcePosition(prop->position()); 1949 SetSourcePosition(prop->position());
1950 Literal* key = prop->key()->AsLiteral(); 1950 Literal* key = prop->key()->AsLiteral();
1951 __ Mov(LoadIC::NameRegister(), Operand(key->value())); 1951 __ Mov(LoadConvention::NameRegister(), Operand(key->value()));
1952 if (FLAG_vector_ics) { 1952 if (FLAG_vector_ics) {
1953 __ Mov(LoadIC::SlotRegister(), 1953 __ Mov(VectorLoadConvention::SlotRegister(),
1954 Smi::FromInt(prop->PropertyFeedbackSlot())); 1954 Smi::FromInt(prop->PropertyFeedbackSlot()));
1955 CallLoadIC(NOT_CONTEXTUAL); 1955 CallLoadIC(NOT_CONTEXTUAL);
1956 } else { 1956 } else {
1957 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); 1957 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId());
1958 } 1958 }
1959 } 1959 }
1960 1960
1961 1961
1962 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 1962 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
1963 SetSourcePosition(prop->position()); 1963 SetSourcePosition(prop->position());
1964 // Call keyed load IC. It has arguments key and receiver in r0 and r1. 1964 // Call keyed load IC. It has arguments key and receiver in r0 and r1.
1965 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); 1965 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
1966 if (FLAG_vector_ics) { 1966 if (FLAG_vector_ics) {
1967 __ Mov(LoadIC::SlotRegister(), 1967 __ Mov(VectorLoadConvention::SlotRegister(),
1968 Smi::FromInt(prop->PropertyFeedbackSlot())); 1968 Smi::FromInt(prop->PropertyFeedbackSlot()));
1969 CallIC(ic); 1969 CallIC(ic);
1970 } else { 1970 } else {
1971 CallIC(ic, prop->PropertyFeedbackId()); 1971 CallIC(ic, prop->PropertyFeedbackId());
1972 } 1972 }
1973 } 1973 }
1974 1974
1975 1975
1976 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, 1976 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
1977 Token::Value op, 1977 Token::Value op,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 Variable* var = expr->AsVariableProxy()->var(); 2106 Variable* var = expr->AsVariableProxy()->var();
2107 EffectContext context(this); 2107 EffectContext context(this);
2108 EmitVariableAssignment(var, Token::ASSIGN); 2108 EmitVariableAssignment(var, Token::ASSIGN);
2109 break; 2109 break;
2110 } 2110 }
2111 case NAMED_PROPERTY: { 2111 case NAMED_PROPERTY: {
2112 __ Push(x0); // Preserve value. 2112 __ Push(x0); // Preserve value.
2113 VisitForAccumulatorValue(prop->obj()); 2113 VisitForAccumulatorValue(prop->obj());
2114 // TODO(all): We could introduce a VisitForRegValue(reg, expr) to avoid 2114 // TODO(all): We could introduce a VisitForRegValue(reg, expr) to avoid
2115 // this copy. 2115 // this copy.
2116 __ Mov(StoreIC::ReceiverRegister(), x0); 2116 __ Mov(StoreConvention::ReceiverRegister(), x0);
2117 __ Pop(StoreIC::ValueRegister()); // Restore value. 2117 __ Pop(StoreConvention::ValueRegister()); // Restore value.
2118 __ Mov(StoreIC::NameRegister(), 2118 __ Mov(StoreConvention::NameRegister(),
2119 Operand(prop->key()->AsLiteral()->value())); 2119 Operand(prop->key()->AsLiteral()->value()));
2120 CallStoreIC(); 2120 CallStoreIC();
2121 break; 2121 break;
2122 } 2122 }
2123 case KEYED_PROPERTY: { 2123 case KEYED_PROPERTY: {
2124 __ Push(x0); // Preserve value. 2124 __ Push(x0); // Preserve value.
2125 VisitForStackValue(prop->obj()); 2125 VisitForStackValue(prop->obj());
2126 VisitForAccumulatorValue(prop->key()); 2126 VisitForAccumulatorValue(prop->key());
2127 __ Mov(KeyedStoreIC::NameRegister(), x0); 2127 __ Mov(StoreConvention::NameRegister(), x0);
2128 __ Pop(KeyedStoreIC::ReceiverRegister(), KeyedStoreIC::ValueRegister()); 2128 __ Pop(StoreConvention::ReceiverRegister(),
2129 StoreConvention::ValueRegister());
2129 Handle<Code> ic = strict_mode() == SLOPPY 2130 Handle<Code> ic = strict_mode() == SLOPPY
2130 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2131 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2131 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2132 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2132 CallIC(ic); 2133 CallIC(ic);
2133 break; 2134 break;
2134 } 2135 }
2135 } 2136 }
2136 context()->Plug(x0); 2137 context()->Plug(x0);
2137 } 2138 }
2138 2139
2139 2140
2140 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( 2141 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot(
2141 Variable* var, MemOperand location) { 2142 Variable* var, MemOperand location) {
2142 __ Str(result_register(), location); 2143 __ Str(result_register(), location);
2143 if (var->IsContextSlot()) { 2144 if (var->IsContextSlot()) {
2144 // RecordWrite may destroy all its register arguments. 2145 // RecordWrite may destroy all its register arguments.
2145 __ Mov(x10, result_register()); 2146 __ Mov(x10, result_register());
2146 int offset = Context::SlotOffset(var->index()); 2147 int offset = Context::SlotOffset(var->index());
2147 __ RecordWriteContextSlot( 2148 __ RecordWriteContextSlot(
2148 x1, offset, x10, x11, kLRHasBeenSaved, kDontSaveFPRegs); 2149 x1, offset, x10, x11, kLRHasBeenSaved, kDontSaveFPRegs);
2149 } 2150 }
2150 } 2151 }
2151 2152
2152 2153
2153 void FullCodeGenerator::EmitVariableAssignment(Variable* var, 2154 void FullCodeGenerator::EmitVariableAssignment(Variable* var,
2154 Token::Value op) { 2155 Token::Value op) {
2155 ASM_LOCATION("FullCodeGenerator::EmitVariableAssignment"); 2156 ASM_LOCATION("FullCodeGenerator::EmitVariableAssignment");
2156 if (var->IsUnallocated()) { 2157 if (var->IsUnallocated()) {
2157 // Global var, const, or let. 2158 // Global var, const, or let.
2158 __ Mov(StoreIC::NameRegister(), Operand(var->name())); 2159 __ Mov(StoreConvention::NameRegister(), Operand(var->name()));
2159 __ Ldr(StoreIC::ReceiverRegister(), GlobalObjectMemOperand()); 2160 __ Ldr(StoreConvention::ReceiverRegister(), GlobalObjectMemOperand());
2160 CallStoreIC(); 2161 CallStoreIC();
2161 2162
2162 } else if (op == Token::INIT_CONST_LEGACY) { 2163 } else if (op == Token::INIT_CONST_LEGACY) {
2163 // Const initializers need a write barrier. 2164 // Const initializers need a write barrier.
2164 DCHECK(!var->IsParameter()); // No const parameters. 2165 DCHECK(!var->IsParameter()); // No const parameters.
2165 if (var->IsLookupSlot()) { 2166 if (var->IsLookupSlot()) {
2166 __ Mov(x1, Operand(var->name())); 2167 __ Mov(x1, Operand(var->name()));
2167 __ Push(x0, cp, x1); 2168 __ Push(x0, cp, x1);
2168 __ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, 3); 2169 __ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, 3);
2169 } else { 2170 } else {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 2222
2222 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2223 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2223 ASM_LOCATION("FullCodeGenerator::EmitNamedPropertyAssignment"); 2224 ASM_LOCATION("FullCodeGenerator::EmitNamedPropertyAssignment");
2224 // Assignment to a property, using a named store IC. 2225 // Assignment to a property, using a named store IC.
2225 Property* prop = expr->target()->AsProperty(); 2226 Property* prop = expr->target()->AsProperty();
2226 DCHECK(prop != NULL); 2227 DCHECK(prop != NULL);
2227 DCHECK(prop->key()->IsLiteral()); 2228 DCHECK(prop->key()->IsLiteral());
2228 2229
2229 // Record source code position before IC call. 2230 // Record source code position before IC call.
2230 SetSourcePosition(expr->position()); 2231 SetSourcePosition(expr->position());
2231 __ Mov(StoreIC::NameRegister(), Operand(prop->key()->AsLiteral()->value())); 2232 __ Mov(StoreConvention::NameRegister(),
2232 __ Pop(StoreIC::ReceiverRegister()); 2233 Operand(prop->key()->AsLiteral()->value()));
2234 __ Pop(StoreConvention::ReceiverRegister());
2233 CallStoreIC(expr->AssignmentFeedbackId()); 2235 CallStoreIC(expr->AssignmentFeedbackId());
2234 2236
2235 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2237 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2236 context()->Plug(x0); 2238 context()->Plug(x0);
2237 } 2239 }
2238 2240
2239 2241
2240 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 2242 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
2241 ASM_LOCATION("FullCodeGenerator::EmitKeyedPropertyAssignment"); 2243 ASM_LOCATION("FullCodeGenerator::EmitKeyedPropertyAssignment");
2242 // Assignment to a property, using a keyed store IC. 2244 // Assignment to a property, using a keyed store IC.
2243 2245
2244 // Record source code position before IC call. 2246 // Record source code position before IC call.
2245 SetSourcePosition(expr->position()); 2247 SetSourcePosition(expr->position());
2246 // TODO(all): Could we pass this in registers rather than on the stack? 2248 // TODO(all): Could we pass this in registers rather than on the stack?
2247 __ Pop(KeyedStoreIC::NameRegister(), KeyedStoreIC::ReceiverRegister()); 2249 __ Pop(StoreConvention::NameRegister(), StoreConvention::ReceiverRegister());
2248 DCHECK(KeyedStoreIC::ValueRegister().is(x0)); 2250 DCHECK(StoreConvention::ValueRegister().is(x0));
2249 2251
2250 Handle<Code> ic = strict_mode() == SLOPPY 2252 Handle<Code> ic = strict_mode() == SLOPPY
2251 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2253 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2252 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2254 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2253 CallIC(ic, expr->AssignmentFeedbackId()); 2255 CallIC(ic, expr->AssignmentFeedbackId());
2254 2256
2255 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2257 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2256 context()->Plug(x0); 2258 context()->Plug(x0);
2257 } 2259 }
2258 2260
2259 2261
2260 void FullCodeGenerator::VisitProperty(Property* expr) { 2262 void FullCodeGenerator::VisitProperty(Property* expr) {
2261 Comment cmnt(masm_, "[ Property"); 2263 Comment cmnt(masm_, "[ Property");
2262 Expression* key = expr->key(); 2264 Expression* key = expr->key();
2263 2265
2264 if (key->IsPropertyName()) { 2266 if (key->IsPropertyName()) {
2265 VisitForAccumulatorValue(expr->obj()); 2267 VisitForAccumulatorValue(expr->obj());
2266 __ Move(LoadIC::ReceiverRegister(), x0); 2268 __ Move(LoadConvention::ReceiverRegister(), x0);
2267 EmitNamedPropertyLoad(expr); 2269 EmitNamedPropertyLoad(expr);
2268 PrepareForBailoutForId(expr->LoadId(), TOS_REG); 2270 PrepareForBailoutForId(expr->LoadId(), TOS_REG);
2269 context()->Plug(x0); 2271 context()->Plug(x0);
2270 } else { 2272 } else {
2271 VisitForStackValue(expr->obj()); 2273 VisitForStackValue(expr->obj());
2272 VisitForAccumulatorValue(expr->key()); 2274 VisitForAccumulatorValue(expr->key());
2273 __ Move(LoadIC::NameRegister(), x0); 2275 __ Move(LoadConvention::NameRegister(), x0);
2274 __ Pop(LoadIC::ReceiverRegister()); 2276 __ Pop(LoadConvention::ReceiverRegister());
2275 EmitKeyedPropertyLoad(expr); 2277 EmitKeyedPropertyLoad(expr);
2276 context()->Plug(x0); 2278 context()->Plug(x0);
2277 } 2279 }
2278 } 2280 }
2279 2281
2280 2282
2281 void FullCodeGenerator::CallIC(Handle<Code> code, 2283 void FullCodeGenerator::CallIC(Handle<Code> code,
2282 TypeFeedbackId ast_id) { 2284 TypeFeedbackId ast_id) {
2283 ic_total_count_++; 2285 ic_total_count_++;
2284 // All calls must have a predictable size in full-codegen code to ensure that 2286 // All calls must have a predictable size in full-codegen code to ensure that
(...skipping 15 matching lines...) Expand all
2300 { StackValueContext context(this); 2302 { StackValueContext context(this);
2301 EmitVariableLoad(callee->AsVariableProxy()); 2303 EmitVariableLoad(callee->AsVariableProxy());
2302 PrepareForBailout(callee, NO_REGISTERS); 2304 PrepareForBailout(callee, NO_REGISTERS);
2303 } 2305 }
2304 // Push undefined as receiver. This is patched in the method prologue if it 2306 // Push undefined as receiver. This is patched in the method prologue if it
2305 // is a sloppy mode method. 2307 // is a sloppy mode method.
2306 __ Push(isolate()->factory()->undefined_value()); 2308 __ Push(isolate()->factory()->undefined_value());
2307 } else { 2309 } else {
2308 // Load the function from the receiver. 2310 // Load the function from the receiver.
2309 DCHECK(callee->IsProperty()); 2311 DCHECK(callee->IsProperty());
2310 __ Peek(LoadIC::ReceiverRegister(), 0); 2312 __ Peek(LoadConvention::ReceiverRegister(), 0);
2311 EmitNamedPropertyLoad(callee->AsProperty()); 2313 EmitNamedPropertyLoad(callee->AsProperty());
2312 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2314 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2313 // Push the target function under the receiver. 2315 // Push the target function under the receiver.
2314 __ Pop(x10); 2316 __ Pop(x10);
2315 __ Push(x0, x10); 2317 __ Push(x0, x10);
2316 } 2318 }
2317 2319
2318 EmitCall(expr, call_type); 2320 EmitCall(expr, call_type);
2319 } 2321 }
2320 2322
2321 2323
2322 // Code common for calls using the IC. 2324 // Code common for calls using the IC.
2323 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, 2325 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr,
2324 Expression* key) { 2326 Expression* key) {
2325 // Load the key. 2327 // Load the key.
2326 VisitForAccumulatorValue(key); 2328 VisitForAccumulatorValue(key);
2327 2329
2328 Expression* callee = expr->expression(); 2330 Expression* callee = expr->expression();
2329 2331
2330 // Load the function from the receiver. 2332 // Load the function from the receiver.
2331 DCHECK(callee->IsProperty()); 2333 DCHECK(callee->IsProperty());
2332 __ Peek(LoadIC::ReceiverRegister(), 0); 2334 __ Peek(LoadConvention::ReceiverRegister(), 0);
2333 __ Move(LoadIC::NameRegister(), x0); 2335 __ Move(LoadConvention::NameRegister(), x0);
2334 EmitKeyedPropertyLoad(callee->AsProperty()); 2336 EmitKeyedPropertyLoad(callee->AsProperty());
2335 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2337 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2336 2338
2337 // Push the target function under the receiver. 2339 // Push the target function under the receiver.
2338 __ Pop(x10); 2340 __ Pop(x10);
2339 __ Push(x0, x10); 2341 __ Push(x0, x10);
2340 2342
2341 EmitCall(expr, CallIC::METHOD); 2343 EmitCall(expr, CallIC::METHOD);
2342 } 2344 }
2343 2345
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
3739 return; 3741 return;
3740 } 3742 }
3741 3743
3742 Comment cmnt(masm_, "[ CallRunTime"); 3744 Comment cmnt(masm_, "[ CallRunTime");
3743 ZoneList<Expression*>* args = expr->arguments(); 3745 ZoneList<Expression*>* args = expr->arguments();
3744 int arg_count = args->length(); 3746 int arg_count = args->length();
3745 3747
3746 if (expr->is_jsruntime()) { 3748 if (expr->is_jsruntime()) {
3747 // Push the builtins object as the receiver. 3749 // Push the builtins object as the receiver.
3748 __ Ldr(x10, GlobalObjectMemOperand()); 3750 __ Ldr(x10, GlobalObjectMemOperand());
3749 __ Ldr(LoadIC::ReceiverRegister(), 3751 __ Ldr(LoadConvention::ReceiverRegister(),
3750 FieldMemOperand(x10, GlobalObject::kBuiltinsOffset)); 3752 FieldMemOperand(x10, GlobalObject::kBuiltinsOffset));
3751 __ Push(LoadIC::ReceiverRegister()); 3753 __ Push(LoadConvention::ReceiverRegister());
3752 3754
3753 // Load the function from the receiver. 3755 // Load the function from the receiver.
3754 Handle<String> name = expr->name(); 3756 Handle<String> name = expr->name();
3755 __ Mov(LoadIC::NameRegister(), Operand(name)); 3757 __ Mov(LoadConvention::NameRegister(), Operand(name));
3756 if (FLAG_vector_ics) { 3758 if (FLAG_vector_ics) {
3757 __ Mov(LoadIC::SlotRegister(), 3759 __ Mov(VectorLoadConvention::SlotRegister(),
3758 Smi::FromInt(expr->CallRuntimeFeedbackSlot())); 3760 Smi::FromInt(expr->CallRuntimeFeedbackSlot()));
3759 CallLoadIC(NOT_CONTEXTUAL); 3761 CallLoadIC(NOT_CONTEXTUAL);
3760 } else { 3762 } else {
3761 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); 3763 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
3762 } 3764 }
3763 3765
3764 // Push the target function under the receiver. 3766 // Push the target function under the receiver.
3765 __ Pop(x10); 3767 __ Pop(x10);
3766 __ Push(x0, x10); 3768 __ Push(x0, x10);
3767 3769
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 AccumulatorValueContext context(this); 3929 AccumulatorValueContext context(this);
3928 EmitVariableLoad(expr->expression()->AsVariableProxy()); 3930 EmitVariableLoad(expr->expression()->AsVariableProxy());
3929 } else { 3931 } else {
3930 // Reserve space for result of postfix operation. 3932 // Reserve space for result of postfix operation.
3931 if (expr->is_postfix() && !context()->IsEffect()) { 3933 if (expr->is_postfix() && !context()->IsEffect()) {
3932 __ Push(xzr); 3934 __ Push(xzr);
3933 } 3935 }
3934 if (assign_type == NAMED_PROPERTY) { 3936 if (assign_type == NAMED_PROPERTY) {
3935 // Put the object both on the stack and in the register. 3937 // Put the object both on the stack and in the register.
3936 VisitForStackValue(prop->obj()); 3938 VisitForStackValue(prop->obj());
3937 __ Peek(LoadIC::ReceiverRegister(), 0); 3939 __ Peek(LoadConvention::ReceiverRegister(), 0);
3938 EmitNamedPropertyLoad(prop); 3940 EmitNamedPropertyLoad(prop);
3939 } else { 3941 } else {
3940 // KEYED_PROPERTY 3942 // KEYED_PROPERTY
3941 VisitForStackValue(prop->obj()); 3943 VisitForStackValue(prop->obj());
3942 VisitForStackValue(prop->key()); 3944 VisitForStackValue(prop->key());
3943 __ Peek(LoadIC::ReceiverRegister(), 1 * kPointerSize); 3945 __ Peek(LoadConvention::ReceiverRegister(), 1 * kPointerSize);
3944 __ Peek(LoadIC::NameRegister(), 0); 3946 __ Peek(LoadConvention::NameRegister(), 0);
3945 EmitKeyedPropertyLoad(prop); 3947 EmitKeyedPropertyLoad(prop);
3946 } 3948 }
3947 } 3949 }
3948 3950
3949 // We need a second deoptimization point after loading the value 3951 // We need a second deoptimization point after loading the value
3950 // in case evaluating the property load my have a side effect. 3952 // in case evaluating the property load my have a side effect.
3951 if (assign_type == VARIABLE) { 3953 if (assign_type == VARIABLE) {
3952 PrepareForBailout(expr->expression(), TOS_REG); 3954 PrepareForBailout(expr->expression(), TOS_REG);
3953 } else { 3955 } else {
3954 PrepareForBailoutForId(prop->LoadId(), TOS_REG); 3956 PrepareForBailoutForId(prop->LoadId(), TOS_REG);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
4044 context()->PlugTOS(); 4046 context()->PlugTOS();
4045 } 4047 }
4046 } else { 4048 } else {
4047 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 4049 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
4048 Token::ASSIGN); 4050 Token::ASSIGN);
4049 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4051 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4050 context()->Plug(x0); 4052 context()->Plug(x0);
4051 } 4053 }
4052 break; 4054 break;
4053 case NAMED_PROPERTY: { 4055 case NAMED_PROPERTY: {
4054 __ Mov(StoreIC::NameRegister(), 4056 __ Mov(StoreConvention::NameRegister(),
4055 Operand(prop->key()->AsLiteral()->value())); 4057 Operand(prop->key()->AsLiteral()->value()));
4056 __ Pop(StoreIC::ReceiverRegister()); 4058 __ Pop(StoreConvention::ReceiverRegister());
4057 CallStoreIC(expr->CountStoreFeedbackId()); 4059 CallStoreIC(expr->CountStoreFeedbackId());
4058 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4060 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4059 if (expr->is_postfix()) { 4061 if (expr->is_postfix()) {
4060 if (!context()->IsEffect()) { 4062 if (!context()->IsEffect()) {
4061 context()->PlugTOS(); 4063 context()->PlugTOS();
4062 } 4064 }
4063 } else { 4065 } else {
4064 context()->Plug(x0); 4066 context()->Plug(x0);
4065 } 4067 }
4066 break; 4068 break;
4067 } 4069 }
4068 case KEYED_PROPERTY: { 4070 case KEYED_PROPERTY: {
4069 __ Pop(KeyedStoreIC::NameRegister()); 4071 __ Pop(StoreConvention::NameRegister());
4070 __ Pop(KeyedStoreIC::ReceiverRegister()); 4072 __ Pop(StoreConvention::ReceiverRegister());
4071 Handle<Code> ic = strict_mode() == SLOPPY 4073 Handle<Code> ic = strict_mode() == SLOPPY
4072 ? isolate()->builtins()->KeyedStoreIC_Initialize() 4074 ? isolate()->builtins()->KeyedStoreIC_Initialize()
4073 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 4075 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
4074 CallIC(ic, expr->CountStoreFeedbackId()); 4076 CallIC(ic, expr->CountStoreFeedbackId());
4075 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4077 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4076 if (expr->is_postfix()) { 4078 if (expr->is_postfix()) {
4077 if (!context()->IsEffect()) { 4079 if (!context()->IsEffect()) {
4078 context()->PlugTOS(); 4080 context()->PlugTOS();
4079 } 4081 }
4080 } else { 4082 } else {
4081 context()->Plug(x0); 4083 context()->Plug(x0);
4082 } 4084 }
4083 break; 4085 break;
4084 } 4086 }
4085 } 4087 }
4086 } 4088 }
4087 4089
4088 4090
4089 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { 4091 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
4090 DCHECK(!context()->IsEffect()); 4092 DCHECK(!context()->IsEffect());
4091 DCHECK(!context()->IsTest()); 4093 DCHECK(!context()->IsTest());
4092 VariableProxy* proxy = expr->AsVariableProxy(); 4094 VariableProxy* proxy = expr->AsVariableProxy();
4093 if (proxy != NULL && proxy->var()->IsUnallocated()) { 4095 if (proxy != NULL && proxy->var()->IsUnallocated()) {
4094 Comment cmnt(masm_, "Global variable"); 4096 Comment cmnt(masm_, "Global variable");
4095 __ Ldr(LoadIC::ReceiverRegister(), GlobalObjectMemOperand()); 4097 __ Ldr(LoadConvention::ReceiverRegister(), GlobalObjectMemOperand());
4096 __ Mov(LoadIC::NameRegister(), Operand(proxy->name())); 4098 __ Mov(LoadConvention::NameRegister(), Operand(proxy->name()));
4097 if (FLAG_vector_ics) { 4099 if (FLAG_vector_ics) {
4098 __ Mov(LoadIC::SlotRegister(), 4100 __ Mov(VectorLoadConvention::SlotRegister(),
4099 Smi::FromInt(proxy->VariableFeedbackSlot())); 4101 Smi::FromInt(proxy->VariableFeedbackSlot()));
4100 } 4102 }
4101 // Use a regular load, not a contextual load, to avoid a reference 4103 // Use a regular load, not a contextual load, to avoid a reference
4102 // error. 4104 // error.
4103 CallLoadIC(NOT_CONTEXTUAL); 4105 CallLoadIC(NOT_CONTEXTUAL);
4104 PrepareForBailout(expr, TOS_REG); 4106 PrepareForBailout(expr, TOS_REG);
4105 context()->Plug(x0); 4107 context()->Plug(x0);
4106 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { 4108 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
4107 Label done, slow; 4109 Label done, slow;
4108 4110
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
4383 4385
4384 case Yield::DELEGATING: { 4386 case Yield::DELEGATING: {
4385 VisitForStackValue(expr->generator_object()); 4387 VisitForStackValue(expr->generator_object());
4386 4388
4387 // Initial stack layout is as follows: 4389 // Initial stack layout is as follows:
4388 // [sp + 1 * kPointerSize] iter 4390 // [sp + 1 * kPointerSize] iter
4389 // [sp + 0 * kPointerSize] g 4391 // [sp + 0 * kPointerSize] g
4390 4392
4391 Label l_catch, l_try, l_suspend, l_continuation, l_resume; 4393 Label l_catch, l_try, l_suspend, l_continuation, l_resume;
4392 Label l_next, l_call, l_loop; 4394 Label l_next, l_call, l_loop;
4393 Register load_receiver = LoadIC::ReceiverRegister(); 4395 Register load_receiver = LoadConvention::ReceiverRegister();
4394 Register load_name = LoadIC::NameRegister(); 4396 Register load_name = LoadConvention::NameRegister();
4395 4397
4396 // Initial send value is undefined. 4398 // Initial send value is undefined.
4397 __ LoadRoot(x0, Heap::kUndefinedValueRootIndex); 4399 __ LoadRoot(x0, Heap::kUndefinedValueRootIndex);
4398 __ B(&l_next); 4400 __ B(&l_next);
4399 4401
4400 // catch (e) { receiver = iter; f = 'throw'; arg = e; goto l_call; } 4402 // catch (e) { receiver = iter; f = 'throw'; arg = e; goto l_call; }
4401 __ Bind(&l_catch); 4403 __ Bind(&l_catch);
4402 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos())); 4404 handler_table()->set(expr->index(), Smi::FromInt(l_catch.pos()));
4403 __ LoadRoot(load_name, Heap::kthrow_stringRootIndex); // "throw" 4405 __ LoadRoot(load_name, Heap::kthrow_stringRootIndex); // "throw"
4404 __ Peek(x3, 1 * kPointerSize); // iter 4406 __ Peek(x3, 1 * kPointerSize); // iter
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4444 4446
4445 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" 4447 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next"
4446 __ Peek(x3, 1 * kPointerSize); // iter 4448 __ Peek(x3, 1 * kPointerSize); // iter
4447 __ Push(load_name, x3, x0); // "next", iter, received 4449 __ Push(load_name, x3, x0); // "next", iter, received
4448 4450
4449 // result = receiver[f](arg); 4451 // result = receiver[f](arg);
4450 __ Bind(&l_call); 4452 __ Bind(&l_call);
4451 __ Peek(load_receiver, 1 * kPointerSize); 4453 __ Peek(load_receiver, 1 * kPointerSize);
4452 __ Peek(load_name, 2 * kPointerSize); 4454 __ Peek(load_name, 2 * kPointerSize);
4453 if (FLAG_vector_ics) { 4455 if (FLAG_vector_ics) {
4454 __ Mov(LoadIC::SlotRegister(), 4456 __ Mov(VectorLoadConvention::SlotRegister(),
4455 Smi::FromInt(expr->KeyedLoadFeedbackSlot())); 4457 Smi::FromInt(expr->KeyedLoadFeedbackSlot()));
4456 } 4458 }
4457 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); 4459 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
4458 CallIC(ic, TypeFeedbackId::None()); 4460 CallIC(ic, TypeFeedbackId::None());
4459 __ Mov(x1, x0); 4461 __ Mov(x1, x0);
4460 __ Poke(x1, 2 * kPointerSize); 4462 __ Poke(x1, 2 * kPointerSize);
4461 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); 4463 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD);
4462 __ CallStub(&stub); 4464 __ CallStub(&stub);
4463 4465
4464 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 4466 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4465 __ Drop(1); // The function is still on the stack; drop it. 4467 __ Drop(1); // The function is still on the stack; drop it.
4466 4468
4467 // if (!result.done) goto l_try; 4469 // if (!result.done) goto l_try;
4468 __ Bind(&l_loop); 4470 __ Bind(&l_loop);
4469 __ Move(load_receiver, x0); 4471 __ Move(load_receiver, x0);
4470 4472
4471 __ Push(load_receiver); // save result 4473 __ Push(load_receiver); // save result
4472 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" 4474 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done"
4473 if (FLAG_vector_ics) { 4475 if (FLAG_vector_ics) {
4474 __ Mov(LoadIC::SlotRegister(), 4476 __ Mov(VectorLoadConvention::SlotRegister(),
4475 Smi::FromInt(expr->DoneFeedbackSlot())); 4477 Smi::FromInt(expr->DoneFeedbackSlot()));
4476 } 4478 }
4477 CallLoadIC(NOT_CONTEXTUAL); // x0=result.done 4479 CallLoadIC(NOT_CONTEXTUAL); // x0=result.done
4478 // The ToBooleanStub argument (result.done) is in x0. 4480 // The ToBooleanStub argument (result.done) is in x0.
4479 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); 4481 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate());
4480 CallIC(bool_ic); 4482 CallIC(bool_ic);
4481 __ Cbz(x0, &l_try); 4483 __ Cbz(x0, &l_try);
4482 4484
4483 // result.value 4485 // result.value
4484 __ Pop(load_receiver); // result 4486 __ Pop(load_receiver); // result
4485 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" 4487 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value"
4486 if (FLAG_vector_ics) { 4488 if (FLAG_vector_ics) {
4487 __ Mov(LoadIC::SlotRegister(), 4489 __ Mov(VectorLoadConvention::SlotRegister(),
4488 Smi::FromInt(expr->ValueFeedbackSlot())); 4490 Smi::FromInt(expr->ValueFeedbackSlot()));
4489 } 4491 }
4490 CallLoadIC(NOT_CONTEXTUAL); // x0=result.value 4492 CallLoadIC(NOT_CONTEXTUAL); // x0=result.value
4491 context()->DropAndPlug(2, x0); // drop iter and g 4493 context()->DropAndPlug(2, x0); // drop iter and g
4492 break; 4494 break;
4493 } 4495 }
4494 } 4496 }
4495 } 4497 }
4496 4498
4497 4499
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
4909 return previous_; 4911 return previous_;
4910 } 4912 }
4911 4913
4912 4914
4913 #undef __ 4915 #undef __
4914 4916
4915 4917
4916 } } // namespace v8::internal 4918 } } // namespace v8::internal
4917 4919
4918 #endif // V8_TARGET_ARCH_ARM64 4920 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/debug-arm64.cc ('k') | src/arm64/lithium-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698