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

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

Issue 639243003: Support for super assignments in for..in. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback Created 6 years, 2 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/arm/full-codegen-arm.cc ('k') | src/ia32/full-codegen-ia32.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-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 CallIC(code, expr->BinaryOperationFeedbackId()); 2165 CallIC(code, expr->BinaryOperationFeedbackId());
2166 patch_site.EmitPatchInfo(); 2166 patch_site.EmitPatchInfo();
2167 } 2167 }
2168 context()->Plug(x0); 2168 context()->Plug(x0);
2169 } 2169 }
2170 2170
2171 2171
2172 void FullCodeGenerator::EmitAssignment(Expression* expr) { 2172 void FullCodeGenerator::EmitAssignment(Expression* expr) {
2173 DCHECK(expr->IsValidReferenceExpression()); 2173 DCHECK(expr->IsValidReferenceExpression());
2174 2174
2175 // Left-hand side can only be a property, a global or a (parameter or local)
2176 // slot.
2177 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };
2178 LhsKind assign_type = VARIABLE;
2179 Property* prop = expr->AsProperty(); 2175 Property* prop = expr->AsProperty();
2180 if (prop != NULL) { 2176 LhsKind assign_type = GetAssignType(prop);
2181 assign_type = (prop->key()->IsPropertyName())
2182 ? NAMED_PROPERTY
2183 : KEYED_PROPERTY;
2184 }
2185 2177
2186 switch (assign_type) { 2178 switch (assign_type) {
2187 case VARIABLE: { 2179 case VARIABLE: {
2188 Variable* var = expr->AsVariableProxy()->var(); 2180 Variable* var = expr->AsVariableProxy()->var();
2189 EffectContext context(this); 2181 EffectContext context(this);
2190 EmitVariableAssignment(var, Token::ASSIGN); 2182 EmitVariableAssignment(var, Token::ASSIGN);
2191 break; 2183 break;
2192 } 2184 }
2193 case NAMED_PROPERTY: { 2185 case NAMED_PROPERTY: {
2194 __ Push(x0); // Preserve value. 2186 __ Push(x0); // Preserve value.
2195 VisitForAccumulatorValue(prop->obj()); 2187 VisitForAccumulatorValue(prop->obj());
2196 // TODO(all): We could introduce a VisitForRegValue(reg, expr) to avoid 2188 // TODO(all): We could introduce a VisitForRegValue(reg, expr) to avoid
2197 // this copy. 2189 // this copy.
2198 __ Mov(StoreDescriptor::ReceiverRegister(), x0); 2190 __ Mov(StoreDescriptor::ReceiverRegister(), x0);
2199 __ Pop(StoreDescriptor::ValueRegister()); // Restore value. 2191 __ Pop(StoreDescriptor::ValueRegister()); // Restore value.
2200 __ Mov(StoreDescriptor::NameRegister(), 2192 __ Mov(StoreDescriptor::NameRegister(),
2201 Operand(prop->key()->AsLiteral()->value())); 2193 Operand(prop->key()->AsLiteral()->value()));
2202 CallStoreIC(); 2194 CallStoreIC();
2203 break; 2195 break;
2204 } 2196 }
2197 case NAMED_SUPER_PROPERTY: {
2198 __ Push(x0);
2199 VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
2200 EmitLoadHomeObject(prop->obj()->AsSuperReference());
2201 // stack: value, this; x0: home_object
2202 Register scratch = x10;
2203 Register scratch2 = x11;
2204 __ mov(scratch, result_register()); // home_object
2205 __ Peek(x0, kPointerSize); // value
2206 __ Peek(scratch2, 0); // this
2207 __ Poke(scratch2, kPointerSize); // this
2208 __ Poke(scratch, 0); // home_object
2209 // stack: this, home_object; x0: value
2210 EmitNamedSuperPropertyStore(prop);
2211 break;
2212 }
2213 case KEYED_SUPER_PROPERTY: {
2214 __ Push(x0);
2215 VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
2216 EmitLoadHomeObject(prop->obj()->AsSuperReference());
2217 __ Push(result_register());
2218 VisitForAccumulatorValue(prop->key());
2219 Register scratch = x10;
2220 Register scratch2 = x11;
2221 __ Peek(scratch2, 2 * kPointerSize); // value
2222 // stack: value, this, home_object; x0: key, x11: value
2223 __ Peek(scratch, kPointerSize); // this
2224 __ Poke(scratch, 2 * kPointerSize);
2225 __ Peek(scratch, 0); // home_object
2226 __ Poke(scratch, kPointerSize);
2227 __ Poke(x0, 0);
2228 __ Move(x0, scratch2);
2229 // stack: this, home_object, key; x0: value.
2230 EmitKeyedSuperPropertyStore(prop);
2231 break;
2232 }
2205 case KEYED_PROPERTY: { 2233 case KEYED_PROPERTY: {
2206 __ Push(x0); // Preserve value. 2234 __ Push(x0); // Preserve value.
2207 VisitForStackValue(prop->obj()); 2235 VisitForStackValue(prop->obj());
2208 VisitForAccumulatorValue(prop->key()); 2236 VisitForAccumulatorValue(prop->key());
2209 __ Mov(StoreDescriptor::NameRegister(), x0); 2237 __ Mov(StoreDescriptor::NameRegister(), x0);
2210 __ Pop(StoreDescriptor::ReceiverRegister(), 2238 __ Pop(StoreDescriptor::ReceiverRegister(),
2211 StoreDescriptor::ValueRegister()); 2239 StoreDescriptor::ValueRegister());
2212 Handle<Code> ic = 2240 Handle<Code> ic =
2213 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); 2241 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
2214 CallIC(ic); 2242 CallIC(ic);
(...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after
5181 return previous_; 5209 return previous_;
5182 } 5210 }
5183 5211
5184 5212
5185 #undef __ 5213 #undef __
5186 5214
5187 5215
5188 } } // namespace v8::internal 5216 } } // namespace v8::internal
5189 5217
5190 #endif // V8_TARGET_ARCH_ARM64 5218 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698