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

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

Issue 609403002: MIPS: Support count operations on super named properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « no previous file | src/mips64/full-codegen-mips64.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 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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 case VARIABLE: 1985 case VARIABLE:
1986 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(), 1986 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(),
1987 expr->op()); 1987 expr->op());
1988 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 1988 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
1989 context()->Plug(v0); 1989 context()->Plug(v0);
1990 break; 1990 break;
1991 case NAMED_PROPERTY: 1991 case NAMED_PROPERTY:
1992 EmitNamedPropertyAssignment(expr); 1992 EmitNamedPropertyAssignment(expr);
1993 break; 1993 break;
1994 case NAMED_SUPER_PROPERTY: 1994 case NAMED_SUPER_PROPERTY:
1995 EmitNamedSuperPropertyAssignment(expr); 1995 EmitNamedSuperPropertyStore(property);
1996 context()->Plug(v0);
1996 break; 1997 break;
1997 case KEYED_PROPERTY: 1998 case KEYED_PROPERTY:
1998 EmitKeyedPropertyAssignment(expr); 1999 EmitKeyedPropertyAssignment(expr);
1999 break; 2000 break;
2000 } 2001 }
2001 } 2002 }
2002 2003
2003 2004
2004 void FullCodeGenerator::VisitYield(Yield* expr) { 2005 void FullCodeGenerator::VisitYield(Yield* expr) {
2005 Comment cmnt(masm_, "[ Yield"); 2006 Comment cmnt(masm_, "[ Yield");
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 __ li(StoreDescriptor::NameRegister(), 2607 __ li(StoreDescriptor::NameRegister(),
2607 Operand(prop->key()->AsLiteral()->value())); 2608 Operand(prop->key()->AsLiteral()->value()));
2608 __ pop(StoreDescriptor::ReceiverRegister()); 2609 __ pop(StoreDescriptor::ReceiverRegister());
2609 CallStoreIC(expr->AssignmentFeedbackId()); 2610 CallStoreIC(expr->AssignmentFeedbackId());
2610 2611
2611 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2612 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2612 context()->Plug(v0); 2613 context()->Plug(v0);
2613 } 2614 }
2614 2615
2615 2616
2616 void FullCodeGenerator::EmitNamedSuperPropertyAssignment(Assignment* expr) { 2617 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) {
2617 // Assignment to named property of super. 2618 // Assignment to named property of super.
2618 // v0 : value 2619 // v0 : value
2619 // stack : receiver ('this'), home_object 2620 // stack : receiver ('this'), home_object
2620 Property* prop = expr->target()->AsProperty();
2621 DCHECK(prop != NULL); 2621 DCHECK(prop != NULL);
2622 Literal* key = prop->key()->AsLiteral(); 2622 Literal* key = prop->key()->AsLiteral();
2623 DCHECK(key != NULL); 2623 DCHECK(key != NULL);
2624 2624
2625 __ Push(v0); 2625 __ Push(v0);
2626 __ Push(key->value()); 2626 __ Push(key->value());
2627 __ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict 2627 __ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict
2628 : Runtime::kStoreToSuper_Sloppy), 2628 : Runtime::kStoreToSuper_Sloppy),
2629 4); 2629 4);
2630 context()->Plug(v0);
2631 } 2630 }
2632 2631
2633 2632
2634 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 2633 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
2635 // Assignment to a property, using a keyed store IC. 2634 // Assignment to a property, using a keyed store IC.
2636 2635
2637 // Record source code position before IC call. 2636 // Record source code position before IC call.
2638 SetSourcePosition(expr->position()); 2637 SetSourcePosition(expr->position());
2639 // Call keyed store IC. 2638 // Call keyed store IC.
2640 // The arguments are: 2639 // The arguments are:
(...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after
4378 4377
4379 4378
4380 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { 4379 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
4381 DCHECK(expr->expression()->IsValidReferenceExpression()); 4380 DCHECK(expr->expression()->IsValidReferenceExpression());
4382 4381
4383 Comment cmnt(masm_, "[ CountOperation"); 4382 Comment cmnt(masm_, "[ CountOperation");
4384 SetSourcePosition(expr->position()); 4383 SetSourcePosition(expr->position());
4385 4384
4386 // Expression can only be a property, a global or a (parameter or local) 4385 // Expression can only be a property, a global or a (parameter or local)
4387 // slot. 4386 // slot.
4388 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; 4387 enum LhsKind {
4388 VARIABLE,
4389 NAMED_PROPERTY,
4390 KEYED_PROPERTY,
4391 NAMED_SUPER_PROPERTY
4392 };
4389 LhsKind assign_type = VARIABLE; 4393 LhsKind assign_type = VARIABLE;
4390 Property* prop = expr->expression()->AsProperty(); 4394 Property* prop = expr->expression()->AsProperty();
4391 // In case of a property we use the uninitialized expression context 4395 // In case of a property we use the uninitialized expression context
4392 // of the key to detect a named property. 4396 // of the key to detect a named property.
4393 if (prop != NULL) { 4397 if (prop != NULL) {
4394 assign_type = 4398 assign_type =
4395 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; 4399 (prop->key()->IsPropertyName())
4396 if (prop->IsSuperAccess()) { 4400 ? (prop->IsSuperAccess() ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY)
4397 // throw exception. 4401 : KEYED_PROPERTY;
4398 VisitSuperReference(prop->obj()->AsSuperReference());
4399 return;
4400 }
4401 } 4402 }
4402 4403
4403 // Evaluate expression and get value. 4404 // Evaluate expression and get value.
4404 if (assign_type == VARIABLE) { 4405 if (assign_type == VARIABLE) {
4405 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); 4406 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL);
4406 AccumulatorValueContext context(this); 4407 AccumulatorValueContext context(this);
4407 EmitVariableLoad(expr->expression()->AsVariableProxy()); 4408 EmitVariableLoad(expr->expression()->AsVariableProxy());
4408 } else { 4409 } else {
4409 // Reserve space for result of postfix operation. 4410 // Reserve space for result of postfix operation.
4410 if (expr->is_postfix() && !context()->IsEffect()) { 4411 if (expr->is_postfix() && !context()->IsEffect()) {
4411 __ li(at, Operand(Smi::FromInt(0))); 4412 __ li(at, Operand(Smi::FromInt(0)));
4412 __ push(at); 4413 __ push(at);
4413 } 4414 }
4414 if (assign_type == NAMED_PROPERTY) { 4415 if (assign_type == NAMED_PROPERTY) {
4415 // Put the object both on the stack and in the register. 4416 // Put the object both on the stack and in the register.
4416 VisitForStackValue(prop->obj()); 4417 VisitForStackValue(prop->obj());
4417 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 4418 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
4418 EmitNamedPropertyLoad(prop); 4419 EmitNamedPropertyLoad(prop);
4420 } else if (assign_type == NAMED_SUPER_PROPERTY) {
4421 VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
4422 EmitLoadHomeObject(prop->obj()->AsSuperReference());
4423 __ Push(result_register());
4424 const Register scratch = a1;
4425 __ lw(scratch, MemOperand(sp, kPointerSize));
4426 __ Push(scratch, result_register());
4427 EmitNamedSuperPropertyLoad(prop);
4419 } else { 4428 } else {
4420 VisitForStackValue(prop->obj()); 4429 VisitForStackValue(prop->obj());
4421 VisitForStackValue(prop->key()); 4430 VisitForStackValue(prop->key());
4422 __ lw(LoadDescriptor::ReceiverRegister(), 4431 __ lw(LoadDescriptor::ReceiverRegister(),
4423 MemOperand(sp, 1 * kPointerSize)); 4432 MemOperand(sp, 1 * kPointerSize));
4424 __ lw(LoadDescriptor::NameRegister(), MemOperand(sp, 0)); 4433 __ lw(LoadDescriptor::NameRegister(), MemOperand(sp, 0));
4425 EmitKeyedPropertyLoad(prop); 4434 EmitKeyedPropertyLoad(prop);
4426 } 4435 }
4427 } 4436 }
4428 4437
(...skipping 21 matching lines...) Expand all
4450 // Save the result on the stack. If we have a named or keyed property 4459 // Save the result on the stack. If we have a named or keyed property
4451 // we store the result under the receiver that is currently on top 4460 // we store the result under the receiver that is currently on top
4452 // of the stack. 4461 // of the stack.
4453 switch (assign_type) { 4462 switch (assign_type) {
4454 case VARIABLE: 4463 case VARIABLE:
4455 __ push(v0); 4464 __ push(v0);
4456 break; 4465 break;
4457 case NAMED_PROPERTY: 4466 case NAMED_PROPERTY:
4458 __ sw(v0, MemOperand(sp, kPointerSize)); 4467 __ sw(v0, MemOperand(sp, kPointerSize));
4459 break; 4468 break;
4469 case NAMED_SUPER_PROPERTY:
4470 __ sw(v0, MemOperand(sp, 2 * kPointerSize));
4471 break;
4460 case KEYED_PROPERTY: 4472 case KEYED_PROPERTY:
4461 __ sw(v0, MemOperand(sp, 2 * kPointerSize)); 4473 __ sw(v0, MemOperand(sp, 2 * kPointerSize));
4462 break; 4474 break;
4463 } 4475 }
4464 } 4476 }
4465 } 4477 }
4466 4478
4467 Register scratch1 = a1; 4479 Register scratch1 = a1;
4468 Register scratch2 = t0; 4480 Register scratch2 = t0;
4469 __ li(scratch1, Operand(Smi::FromInt(count_value))); 4481 __ li(scratch1, Operand(Smi::FromInt(count_value)));
(...skipping 13 matching lines...) Expand all
4483 // Save the result on the stack. If we have a named or keyed property 4495 // Save the result on the stack. If we have a named or keyed property
4484 // we store the result under the receiver that is currently on top 4496 // we store the result under the receiver that is currently on top
4485 // of the stack. 4497 // of the stack.
4486 switch (assign_type) { 4498 switch (assign_type) {
4487 case VARIABLE: 4499 case VARIABLE:
4488 __ push(v0); 4500 __ push(v0);
4489 break; 4501 break;
4490 case NAMED_PROPERTY: 4502 case NAMED_PROPERTY:
4491 __ sw(v0, MemOperand(sp, kPointerSize)); 4503 __ sw(v0, MemOperand(sp, kPointerSize));
4492 break; 4504 break;
4505 case NAMED_SUPER_PROPERTY:
4506 __ sw(v0, MemOperand(sp, 2 * kPointerSize));
4507 break;
4493 case KEYED_PROPERTY: 4508 case KEYED_PROPERTY:
4494 __ sw(v0, MemOperand(sp, 2 * kPointerSize)); 4509 __ sw(v0, MemOperand(sp, 2 * kPointerSize));
4495 break; 4510 break;
4496 } 4511 }
4497 } 4512 }
4498 } 4513 }
4499 4514
4500 __ bind(&stub_call); 4515 __ bind(&stub_call);
4501 __ mov(a1, v0); 4516 __ mov(a1, v0);
4502 __ li(a0, Operand(Smi::FromInt(count_value))); 4517 __ li(a0, Operand(Smi::FromInt(count_value)));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
4541 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4556 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4542 if (expr->is_postfix()) { 4557 if (expr->is_postfix()) {
4543 if (!context()->IsEffect()) { 4558 if (!context()->IsEffect()) {
4544 context()->PlugTOS(); 4559 context()->PlugTOS();
4545 } 4560 }
4546 } else { 4561 } else {
4547 context()->Plug(v0); 4562 context()->Plug(v0);
4548 } 4563 }
4549 break; 4564 break;
4550 } 4565 }
4566 case NAMED_SUPER_PROPERTY: {
4567 EmitNamedSuperPropertyStore(prop);
4568 if (expr->is_postfix()) {
4569 if (!context()->IsEffect()) {
4570 context()->PlugTOS();
4571 }
4572 } else {
4573 context()->Plug(v0);
4574 }
4575 break;
4576 }
4551 case KEYED_PROPERTY: { 4577 case KEYED_PROPERTY: {
4552 __ mov(StoreDescriptor::ValueRegister(), result_register()); 4578 __ mov(StoreDescriptor::ValueRegister(), result_register());
4553 __ Pop(StoreDescriptor::ReceiverRegister(), 4579 __ Pop(StoreDescriptor::ReceiverRegister(),
4554 StoreDescriptor::NameRegister()); 4580 StoreDescriptor::NameRegister());
4555 Handle<Code> ic = 4581 Handle<Code> ic =
4556 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); 4582 CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code();
4557 CallIC(ic, expr->CountStoreFeedbackId()); 4583 CallIC(ic, expr->CountStoreFeedbackId());
4558 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4584 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4559 if (expr->is_postfix()) { 4585 if (expr->is_postfix()) {
4560 if (!context()->IsEffect()) { 4586 if (!context()->IsEffect()) {
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
5004 Assembler::target_address_at(pc_immediate_load_address)) == 5030 Assembler::target_address_at(pc_immediate_load_address)) ==
5005 reinterpret_cast<uint32_t>( 5031 reinterpret_cast<uint32_t>(
5006 isolate->builtins()->OsrAfterStackCheck()->entry())); 5032 isolate->builtins()->OsrAfterStackCheck()->entry()));
5007 return OSR_AFTER_STACK_CHECK; 5033 return OSR_AFTER_STACK_CHECK;
5008 } 5034 }
5009 5035
5010 5036
5011 } } // namespace v8::internal 5037 } } // namespace v8::internal
5012 5038
5013 #endif // V8_TARGET_ARCH_MIPS 5039 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698