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

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

Issue 381633002: Use a register spec for StoreIC and KeyedStoreIC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code comments. Created 6 years, 5 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/ic-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 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 switch (property->kind()) { 1675 switch (property->kind()) {
1676 case ObjectLiteral::Property::CONSTANT: 1676 case ObjectLiteral::Property::CONSTANT:
1677 UNREACHABLE(); 1677 UNREACHABLE();
1678 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 1678 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1679 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); 1679 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value()));
1680 // Fall through. 1680 // Fall through.
1681 case ObjectLiteral::Property::COMPUTED: 1681 case ObjectLiteral::Property::COMPUTED:
1682 if (key->value()->IsInternalizedString()) { 1682 if (key->value()->IsInternalizedString()) {
1683 if (property->emit_store()) { 1683 if (property->emit_store()) {
1684 VisitForAccumulatorValue(value); 1684 VisitForAccumulatorValue(value);
1685 __ Mov(x2, Operand(key->value())); 1685 ASSERT(StoreIC::ValueRegister().is(x0));
1686 __ Peek(x1, 0); 1686 __ Mov(StoreIC::NameRegister(), Operand(key->value()));
1687 __ Peek(StoreIC::ReceiverRegister(), 0);
1687 CallStoreIC(key->LiteralFeedbackId()); 1688 CallStoreIC(key->LiteralFeedbackId());
1688 PrepareForBailoutForId(key->id(), NO_REGISTERS); 1689 PrepareForBailoutForId(key->id(), NO_REGISTERS);
1689 } else { 1690 } else {
1690 VisitForEffect(value); 1691 VisitForEffect(value);
1691 } 1692 }
1692 break; 1693 break;
1693 } 1694 }
1694 if (property->emit_store()) { 1695 if (property->emit_store()) {
1695 // Duplicate receiver on stack. 1696 // Duplicate receiver on stack.
1696 __ Peek(x0, 0); 1697 __ Peek(x0, 0);
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 Variable* var = expr->AsVariableProxy()->var(); 2098 Variable* var = expr->AsVariableProxy()->var();
2098 EffectContext context(this); 2099 EffectContext context(this);
2099 EmitVariableAssignment(var, Token::ASSIGN); 2100 EmitVariableAssignment(var, Token::ASSIGN);
2100 break; 2101 break;
2101 } 2102 }
2102 case NAMED_PROPERTY: { 2103 case NAMED_PROPERTY: {
2103 __ Push(x0); // Preserve value. 2104 __ Push(x0); // Preserve value.
2104 VisitForAccumulatorValue(prop->obj()); 2105 VisitForAccumulatorValue(prop->obj());
2105 // TODO(all): We could introduce a VisitForRegValue(reg, expr) to avoid 2106 // TODO(all): We could introduce a VisitForRegValue(reg, expr) to avoid
2106 // this copy. 2107 // this copy.
2107 __ Mov(x1, x0); 2108 __ Mov(StoreIC::ReceiverRegister(), x0);
2108 __ Pop(x0); // Restore value. 2109 __ Pop(StoreIC::ValueRegister()); // Restore value.
2109 __ Mov(x2, Operand(prop->key()->AsLiteral()->value())); 2110 __ Mov(StoreIC::NameRegister(),
2111 Operand(prop->key()->AsLiteral()->value()));
2110 CallStoreIC(); 2112 CallStoreIC();
2111 break; 2113 break;
2112 } 2114 }
2113 case KEYED_PROPERTY: { 2115 case KEYED_PROPERTY: {
2114 __ Push(x0); // Preserve value. 2116 __ Push(x0); // Preserve value.
2115 VisitForStackValue(prop->obj()); 2117 VisitForStackValue(prop->obj());
2116 VisitForAccumulatorValue(prop->key()); 2118 VisitForAccumulatorValue(prop->key());
2117 __ Mov(x1, x0); 2119 __ Mov(KeyedStoreIC::NameRegister(), x0);
2118 __ Pop(x2, x0); 2120 __ Pop(KeyedStoreIC::ReceiverRegister(), KeyedStoreIC::ValueRegister());
2119 Handle<Code> ic = strict_mode() == SLOPPY 2121 Handle<Code> ic = strict_mode() == SLOPPY
2120 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2122 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2121 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2123 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2122 CallIC(ic); 2124 CallIC(ic);
2123 break; 2125 break;
2124 } 2126 }
2125 } 2127 }
2126 context()->Plug(x0); 2128 context()->Plug(x0);
2127 } 2129 }
2128 2130
(...skipping 22 matching lines...) Expand all
2151 __ Push(x0, cp, x11, x10); 2153 __ Push(x0, cp, x11, x10);
2152 __ CallRuntime(Runtime::kStoreContextSlot, 4); 2154 __ CallRuntime(Runtime::kStoreContextSlot, 4);
2153 } 2155 }
2154 2156
2155 2157
2156 void FullCodeGenerator::EmitVariableAssignment(Variable* var, 2158 void FullCodeGenerator::EmitVariableAssignment(Variable* var,
2157 Token::Value op) { 2159 Token::Value op) {
2158 ASM_LOCATION("FullCodeGenerator::EmitVariableAssignment"); 2160 ASM_LOCATION("FullCodeGenerator::EmitVariableAssignment");
2159 if (var->IsUnallocated()) { 2161 if (var->IsUnallocated()) {
2160 // Global var, const, or let. 2162 // Global var, const, or let.
2161 __ Mov(x2, Operand(var->name())); 2163 __ Mov(StoreIC::NameRegister(), Operand(var->name()));
2162 __ Ldr(x1, GlobalObjectMemOperand()); 2164 __ Ldr(StoreIC::ReceiverRegister(), GlobalObjectMemOperand());
2163 CallStoreIC(); 2165 CallStoreIC();
2164 2166
2165 } else if (op == Token::INIT_CONST_LEGACY) { 2167 } else if (op == Token::INIT_CONST_LEGACY) {
2166 // Const initializers need a write barrier. 2168 // Const initializers need a write barrier.
2167 ASSERT(!var->IsParameter()); // No const parameters. 2169 ASSERT(!var->IsParameter()); // No const parameters.
2168 if (var->IsLookupSlot()) { 2170 if (var->IsLookupSlot()) {
2169 __ Mov(x1, Operand(var->name())); 2171 __ Mov(x1, Operand(var->name()));
2170 __ Push(x0, cp, x1); 2172 __ Push(x0, cp, x1);
2171 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); 2173 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3);
2172 } else { 2174 } else {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2219 2221
2220 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2222 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2221 ASM_LOCATION("FullCodeGenerator::EmitNamedPropertyAssignment"); 2223 ASM_LOCATION("FullCodeGenerator::EmitNamedPropertyAssignment");
2222 // Assignment to a property, using a named store IC. 2224 // Assignment to a property, using a named store IC.
2223 Property* prop = expr->target()->AsProperty(); 2225 Property* prop = expr->target()->AsProperty();
2224 ASSERT(prop != NULL); 2226 ASSERT(prop != NULL);
2225 ASSERT(prop->key()->IsLiteral()); 2227 ASSERT(prop->key()->IsLiteral());
2226 2228
2227 // Record source code position before IC call. 2229 // Record source code position before IC call.
2228 SetSourcePosition(expr->position()); 2230 SetSourcePosition(expr->position());
2229 __ Mov(x2, Operand(prop->key()->AsLiteral()->value())); 2231 __ Mov(StoreIC::NameRegister(), Operand(prop->key()->AsLiteral()->value()));
2230 __ Pop(x1); 2232 __ Pop(StoreIC::ReceiverRegister());
2231
2232 CallStoreIC(expr->AssignmentFeedbackId()); 2233 CallStoreIC(expr->AssignmentFeedbackId());
2233 2234
2234 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2235 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2235 context()->Plug(x0); 2236 context()->Plug(x0);
2236 } 2237 }
2237 2238
2238 2239
2239 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 2240 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
2240 ASM_LOCATION("FullCodeGenerator::EmitKeyedPropertyAssignment"); 2241 ASM_LOCATION("FullCodeGenerator::EmitKeyedPropertyAssignment");
2241 // Assignment to a property, using a keyed store IC. 2242 // Assignment to a property, using a keyed store IC.
2242 2243
2243 // Record source code position before IC call. 2244 // Record source code position before IC call.
2244 SetSourcePosition(expr->position()); 2245 SetSourcePosition(expr->position());
2245 // TODO(all): Could we pass this in registers rather than on the stack? 2246 // TODO(all): Could we pass this in registers rather than on the stack?
2246 __ Pop(x1, x2); // Key and object holding the property. 2247 __ Pop(KeyedStoreIC::NameRegister(), KeyedStoreIC::ReceiverRegister());
2248 ASSERT(KeyedStoreIC::ValueRegister().is(x0));
2247 2249
2248 Handle<Code> ic = strict_mode() == SLOPPY 2250 Handle<Code> ic = strict_mode() == SLOPPY
2249 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2251 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2250 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2252 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2251 CallIC(ic, expr->AssignmentFeedbackId()); 2253 CallIC(ic, expr->AssignmentFeedbackId());
2252 2254
2253 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2255 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2254 context()->Plug(x0); 2256 context()->Plug(x0);
2255 } 2257 }
2256 2258
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
4036 context()->PlugTOS(); 4038 context()->PlugTOS();
4037 } 4039 }
4038 } else { 4040 } else {
4039 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 4041 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
4040 Token::ASSIGN); 4042 Token::ASSIGN);
4041 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4043 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4042 context()->Plug(x0); 4044 context()->Plug(x0);
4043 } 4045 }
4044 break; 4046 break;
4045 case NAMED_PROPERTY: { 4047 case NAMED_PROPERTY: {
4046 __ Mov(x2, Operand(prop->key()->AsLiteral()->value())); 4048 __ Mov(StoreIC::NameRegister(),
4047 __ Pop(x1); 4049 Operand(prop->key()->AsLiteral()->value()));
4050 __ Pop(StoreIC::ReceiverRegister());
4048 CallStoreIC(expr->CountStoreFeedbackId()); 4051 CallStoreIC(expr->CountStoreFeedbackId());
4049 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4052 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4050 if (expr->is_postfix()) { 4053 if (expr->is_postfix()) {
4051 if (!context()->IsEffect()) { 4054 if (!context()->IsEffect()) {
4052 context()->PlugTOS(); 4055 context()->PlugTOS();
4053 } 4056 }
4054 } else { 4057 } else {
4055 context()->Plug(x0); 4058 context()->Plug(x0);
4056 } 4059 }
4057 break; 4060 break;
4058 } 4061 }
4059 case KEYED_PROPERTY: { 4062 case KEYED_PROPERTY: {
4060 __ Pop(x1); // Key. 4063 __ Pop(KeyedStoreIC::NameRegister());
4061 __ Pop(x2); // Receiver. 4064 __ Pop(KeyedStoreIC::ReceiverRegister());
4062 Handle<Code> ic = strict_mode() == SLOPPY 4065 Handle<Code> ic = strict_mode() == SLOPPY
4063 ? isolate()->builtins()->KeyedStoreIC_Initialize() 4066 ? isolate()->builtins()->KeyedStoreIC_Initialize()
4064 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 4067 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
4065 CallIC(ic, expr->CountStoreFeedbackId()); 4068 CallIC(ic, expr->CountStoreFeedbackId());
4066 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4069 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4067 if (expr->is_postfix()) { 4070 if (expr->is_postfix()) {
4068 if (!context()->IsEffect()) { 4071 if (!context()->IsEffect()) {
4069 context()->PlugTOS(); 4072 context()->PlugTOS();
4070 } 4073 }
4071 } else { 4074 } else {
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
4891 return previous_; 4894 return previous_;
4892 } 4895 }
4893 4896
4894 4897
4895 #undef __ 4898 #undef __
4896 4899
4897 4900
4898 } } // namespace v8::internal 4901 } } // namespace v8::internal
4899 4902
4900 #endif // V8_TARGET_ARCH_ARM64 4903 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/debug-arm64.cc ('k') | src/arm64/ic-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698