| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 | 
| 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 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2423   JumpPatchSite patch_site(masm_);    // unbound, signals no inlined smi code. | 2423   JumpPatchSite patch_site(masm_);    // unbound, signals no inlined smi code. | 
| 2424   CallIC(code, expr->BinaryOperationFeedbackId()); | 2424   CallIC(code, expr->BinaryOperationFeedbackId()); | 
| 2425   patch_site.EmitPatchInfo(); | 2425   patch_site.EmitPatchInfo(); | 
| 2426   context()->Plug(eax); | 2426   context()->Plug(eax); | 
| 2427 } | 2427 } | 
| 2428 | 2428 | 
| 2429 | 2429 | 
| 2430 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2430 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 
| 2431   DCHECK(expr->IsValidReferenceExpression()); | 2431   DCHECK(expr->IsValidReferenceExpression()); | 
| 2432 | 2432 | 
| 2433   // Left-hand side can only be a property, a global or a (parameter or local) |  | 
| 2434   // slot. |  | 
| 2435   enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |  | 
| 2436   LhsKind assign_type = VARIABLE; |  | 
| 2437   Property* prop = expr->AsProperty(); | 2433   Property* prop = expr->AsProperty(); | 
| 2438   if (prop != NULL) { | 2434   LhsKind assign_type = GetAssignType(prop); | 
| 2439     assign_type = (prop->key()->IsPropertyName()) |  | 
| 2440         ? NAMED_PROPERTY |  | 
| 2441         : KEYED_PROPERTY; |  | 
| 2442   } |  | 
| 2443 | 2435 | 
| 2444   switch (assign_type) { | 2436   switch (assign_type) { | 
| 2445     case VARIABLE: { | 2437     case VARIABLE: { | 
| 2446       Variable* var = expr->AsVariableProxy()->var(); | 2438       Variable* var = expr->AsVariableProxy()->var(); | 
| 2447       EffectContext context(this); | 2439       EffectContext context(this); | 
| 2448       EmitVariableAssignment(var, Token::ASSIGN); | 2440       EmitVariableAssignment(var, Token::ASSIGN); | 
| 2449       break; | 2441       break; | 
| 2450     } | 2442     } | 
| 2451     case NAMED_PROPERTY: { | 2443     case NAMED_PROPERTY: { | 
| 2452       __ push(eax);  // Preserve value. | 2444       __ push(eax);  // Preserve value. | 
| 2453       VisitForAccumulatorValue(prop->obj()); | 2445       VisitForAccumulatorValue(prop->obj()); | 
| 2454       __ Move(StoreDescriptor::ReceiverRegister(), eax); | 2446       __ Move(StoreDescriptor::ReceiverRegister(), eax); | 
| 2455       __ pop(StoreDescriptor::ValueRegister());  // Restore value. | 2447       __ pop(StoreDescriptor::ValueRegister());  // Restore value. | 
| 2456       __ mov(StoreDescriptor::NameRegister(), | 2448       __ mov(StoreDescriptor::NameRegister(), | 
| 2457              prop->key()->AsLiteral()->value()); | 2449              prop->key()->AsLiteral()->value()); | 
| 2458       CallStoreIC(); | 2450       CallStoreIC(); | 
| 2459       break; | 2451       break; | 
| 2460     } | 2452     } | 
|  | 2453     case NAMED_SUPER_PROPERTY: { | 
|  | 2454       __ push(eax); | 
|  | 2455       VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); | 
|  | 2456       EmitLoadHomeObject(prop->obj()->AsSuperReference()); | 
|  | 2457       // stack: value, this; eax: home_object | 
|  | 2458       Register scratch = ecx; | 
|  | 2459       Register scratch2 = edx; | 
|  | 2460       __ mov(scratch, result_register());               // home_object | 
|  | 2461       __ mov(eax, MemOperand(esp, kPointerSize));       // value | 
|  | 2462       __ mov(scratch2, MemOperand(esp, 0));             // this | 
|  | 2463       __ mov(MemOperand(esp, kPointerSize), scratch2);  // this | 
|  | 2464       __ mov(MemOperand(esp, 0), scratch);              // home_object | 
|  | 2465       // stack: this, home_object. eax: value | 
|  | 2466       EmitNamedSuperPropertyStore(prop); | 
|  | 2467       break; | 
|  | 2468     } | 
|  | 2469     case KEYED_SUPER_PROPERTY: { | 
|  | 2470       __ push(eax); | 
|  | 2471       VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); | 
|  | 2472       EmitLoadHomeObject(prop->obj()->AsSuperReference()); | 
|  | 2473       __ push(result_register()); | 
|  | 2474       VisitForAccumulatorValue(prop->key()); | 
|  | 2475       Register scratch = ecx; | 
|  | 2476       Register scratch2 = edx; | 
|  | 2477       __ mov(scratch2, MemOperand(esp, 2 * kPointerSize));  // value | 
|  | 2478       // stack: value, this, home_object; eax: key, edx: value | 
|  | 2479       __ mov(scratch, MemOperand(esp, kPointerSize));  // this | 
|  | 2480       __ mov(MemOperand(esp, 2 * kPointerSize), scratch); | 
|  | 2481       __ mov(scratch, MemOperand(esp, 0));  // home_object | 
|  | 2482       __ mov(MemOperand(esp, kPointerSize), scratch); | 
|  | 2483       __ mov(MemOperand(esp, 0), eax); | 
|  | 2484       __ mov(eax, scratch2); | 
|  | 2485       // stack: this, home_object, key; eax: value. | 
|  | 2486       EmitKeyedSuperPropertyStore(prop); | 
|  | 2487       break; | 
|  | 2488     } | 
| 2461     case KEYED_PROPERTY: { | 2489     case KEYED_PROPERTY: { | 
| 2462       __ push(eax);  // Preserve value. | 2490       __ push(eax);  // Preserve value. | 
| 2463       VisitForStackValue(prop->obj()); | 2491       VisitForStackValue(prop->obj()); | 
| 2464       VisitForAccumulatorValue(prop->key()); | 2492       VisitForAccumulatorValue(prop->key()); | 
| 2465       __ Move(StoreDescriptor::NameRegister(), eax); | 2493       __ Move(StoreDescriptor::NameRegister(), eax); | 
| 2466       __ pop(StoreDescriptor::ReceiverRegister());  // Receiver. | 2494       __ pop(StoreDescriptor::ReceiverRegister());  // Receiver. | 
| 2467       __ pop(StoreDescriptor::ValueRegister());     // Restore value. | 2495       __ pop(StoreDescriptor::ValueRegister());     // Restore value. | 
| 2468       Handle<Code> ic = | 2496       Handle<Code> ic = | 
| 2469           CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); | 2497           CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); | 
| 2470       CallIC(ic); | 2498       CallIC(ic); | 
| (...skipping 2611 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5082   DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5110   DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 
| 5083             Assembler::target_address_at(call_target_address, | 5111             Assembler::target_address_at(call_target_address, | 
| 5084                                          unoptimized_code)); | 5112                                          unoptimized_code)); | 
| 5085   return OSR_AFTER_STACK_CHECK; | 5113   return OSR_AFTER_STACK_CHECK; | 
| 5086 } | 5114 } | 
| 5087 | 5115 | 
| 5088 | 5116 | 
| 5089 } }  // namespace v8::internal | 5117 } }  // namespace v8::internal | 
| 5090 | 5118 | 
| 5091 #endif  // V8_TARGET_ARCH_IA32 | 5119 #endif  // V8_TARGET_ARCH_IA32 | 
| OLD | NEW | 
|---|