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

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

Issue 383913002: MIPS: Use a register spec for StoreIC and KeyedStoreIC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed typo. 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/mips64/debug-mips64.cc ('k') | src/mips64/ic-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_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 switch (property->kind()) { 1679 switch (property->kind()) {
1680 case ObjectLiteral::Property::CONSTANT: 1680 case ObjectLiteral::Property::CONSTANT:
1681 UNREACHABLE(); 1681 UNREACHABLE();
1682 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 1682 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1683 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); 1683 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value()));
1684 // Fall through. 1684 // Fall through.
1685 case ObjectLiteral::Property::COMPUTED: 1685 case ObjectLiteral::Property::COMPUTED:
1686 if (key->value()->IsInternalizedString()) { 1686 if (key->value()->IsInternalizedString()) {
1687 if (property->emit_store()) { 1687 if (property->emit_store()) {
1688 VisitForAccumulatorValue(value); 1688 VisitForAccumulatorValue(value);
1689 __ mov(a0, result_register()); 1689 __ mov(StoreIC::ValueRegister(), result_register());
1690 __ li(a2, Operand(key->value())); 1690 ASSERT(StoreIC::ValueRegister().is(a0));
1691 __ ld(a1, MemOperand(sp)); 1691 __ li(StoreIC::NameRegister(), Operand(key->value()));
1692 __ ld(StoreIC::ReceiverRegister(), MemOperand(sp));
1692 CallStoreIC(key->LiteralFeedbackId()); 1693 CallStoreIC(key->LiteralFeedbackId());
1693 PrepareForBailoutForId(key->id(), NO_REGISTERS); 1694 PrepareForBailoutForId(key->id(), NO_REGISTERS);
1694 } else { 1695 } else {
1695 VisitForEffect(value); 1696 VisitForEffect(value);
1696 } 1697 }
1697 break; 1698 break;
1698 } 1699 }
1699 // Duplicate receiver on stack. 1700 // Duplicate receiver on stack.
1700 __ ld(a0, MemOperand(sp)); 1701 __ ld(a0, MemOperand(sp));
1701 __ push(a0); 1702 __ push(a0);
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 switch (assign_type) { 2403 switch (assign_type) {
2403 case VARIABLE: { 2404 case VARIABLE: {
2404 Variable* var = expr->AsVariableProxy()->var(); 2405 Variable* var = expr->AsVariableProxy()->var();
2405 EffectContext context(this); 2406 EffectContext context(this);
2406 EmitVariableAssignment(var, Token::ASSIGN); 2407 EmitVariableAssignment(var, Token::ASSIGN);
2407 break; 2408 break;
2408 } 2409 }
2409 case NAMED_PROPERTY: { 2410 case NAMED_PROPERTY: {
2410 __ push(result_register()); // Preserve value. 2411 __ push(result_register()); // Preserve value.
2411 VisitForAccumulatorValue(prop->obj()); 2412 VisitForAccumulatorValue(prop->obj());
2412 __ mov(a1, result_register()); 2413 __ mov(StoreIC::ReceiverRegister(), result_register());
2413 __ pop(a0); // Restore value. 2414 __ pop(StoreIC::ValueRegister()); // Restore value.
2414 __ li(a2, Operand(prop->key()->AsLiteral()->value())); 2415 __ li(StoreIC::NameRegister(),
2416 Operand(prop->key()->AsLiteral()->value()));
2415 CallStoreIC(); 2417 CallStoreIC();
2416 break; 2418 break;
2417 } 2419 }
2418 case KEYED_PROPERTY: { 2420 case KEYED_PROPERTY: {
2419 __ push(result_register()); // Preserve value. 2421 __ push(result_register()); // Preserve value.
2420 VisitForStackValue(prop->obj()); 2422 VisitForStackValue(prop->obj());
2421 VisitForAccumulatorValue(prop->key()); 2423 VisitForAccumulatorValue(prop->key());
2422 __ mov(a1, result_register()); 2424 __ Move(KeyedStoreIC::NameRegister(), result_register());
2423 __ Pop(a0, a2); // a0 = restored value. 2425 __ Pop(KeyedStoreIC::ValueRegister(), KeyedStoreIC::ReceiverRegister());
2424 Handle<Code> ic = strict_mode() == SLOPPY 2426 Handle<Code> ic = strict_mode() == SLOPPY
2425 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2427 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2426 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2428 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2427 CallIC(ic); 2429 CallIC(ic);
2428 break; 2430 break;
2429 } 2431 }
2430 } 2432 }
2431 context()->Plug(v0); 2433 context()->Plug(v0);
2432 } 2434 }
2433 2435
(...skipping 16 matching lines...) Expand all
2450 __ li(a1, Operand(name)); 2452 __ li(a1, Operand(name));
2451 __ li(a0, Operand(Smi::FromInt(strict_mode))); 2453 __ li(a0, Operand(Smi::FromInt(strict_mode)));
2452 __ Push(v0, cp, a1, a0); // Value, context, name, strict mode. 2454 __ Push(v0, cp, a1, a0); // Value, context, name, strict mode.
2453 __ CallRuntime(Runtime::kStoreContextSlot, 4); 2455 __ CallRuntime(Runtime::kStoreContextSlot, 4);
2454 } 2456 }
2455 2457
2456 2458
2457 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) { 2459 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) {
2458 if (var->IsUnallocated()) { 2460 if (var->IsUnallocated()) {
2459 // Global var, const, or let. 2461 // Global var, const, or let.
2460 __ mov(a0, result_register()); 2462 __ mov(StoreIC::ValueRegister(), result_register());
2461 __ li(a2, Operand(var->name())); 2463 __ li(StoreIC::NameRegister(), Operand(var->name()));
2462 __ ld(a1, GlobalObjectOperand()); 2464 __ ld(StoreIC::ReceiverRegister(), GlobalObjectOperand());
2463 CallStoreIC(); 2465 CallStoreIC();
2464 } else if (op == Token::INIT_CONST_LEGACY) { 2466 } else if (op == Token::INIT_CONST_LEGACY) {
2465 // Const initializers need a write barrier. 2467 // Const initializers need a write barrier.
2466 ASSERT(!var->IsParameter()); // No const parameters. 2468 ASSERT(!var->IsParameter()); // No const parameters.
2467 if (var->IsLookupSlot()) { 2469 if (var->IsLookupSlot()) {
2468 __ li(a0, Operand(var->name())); 2470 __ li(a0, Operand(var->name()));
2469 __ Push(v0, cp, a0); // Context and name. 2471 __ Push(v0, cp, a0); // Context and name.
2470 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); 2472 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3);
2471 } else { 2473 } else {
2472 ASSERT(var->IsStackAllocated() || var->IsContextSlot()); 2474 ASSERT(var->IsStackAllocated() || var->IsContextSlot());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2520 2522
2521 2523
2522 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2524 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2523 // Assignment to a property, using a named store IC. 2525 // Assignment to a property, using a named store IC.
2524 Property* prop = expr->target()->AsProperty(); 2526 Property* prop = expr->target()->AsProperty();
2525 ASSERT(prop != NULL); 2527 ASSERT(prop != NULL);
2526 ASSERT(prop->key()->IsLiteral()); 2528 ASSERT(prop->key()->IsLiteral());
2527 2529
2528 // Record source code position before IC call. 2530 // Record source code position before IC call.
2529 SetSourcePosition(expr->position()); 2531 SetSourcePosition(expr->position());
2530 __ mov(a0, result_register()); // Load the value. 2532 __ mov(StoreIC::ValueRegister(), result_register());
2531 __ li(a2, Operand(prop->key()->AsLiteral()->value())); 2533 __ li(StoreIC::NameRegister(), Operand(prop->key()->AsLiteral()->value()));
2532 __ pop(a1); 2534 __ pop(StoreIC::ReceiverRegister());
2533
2534 CallStoreIC(expr->AssignmentFeedbackId()); 2535 CallStoreIC(expr->AssignmentFeedbackId());
2535 2536
2536 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2537 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2537 context()->Plug(v0); 2538 context()->Plug(v0);
2538 } 2539 }
2539 2540
2540 2541
2541 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 2542 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
2542 // Assignment to a property, using a keyed store IC. 2543 // Assignment to a property, using a keyed store IC.
2543 2544
2544 // Record source code position before IC call. 2545 // Record source code position before IC call.
2545 SetSourcePosition(expr->position()); 2546 SetSourcePosition(expr->position());
2546 // Call keyed store IC. 2547 // Call keyed store IC.
2547 // The arguments are: 2548 // The arguments are:
2548 // - a0 is the value, 2549 // - a0 is the value,
2549 // - a1 is the key, 2550 // - a1 is the key,
2550 // - a2 is the receiver. 2551 // - a2 is the receiver.
2551 __ mov(a0, result_register()); 2552 __ mov(KeyedStoreIC::ValueRegister(), result_register());
2552 __ Pop(a2, a1); // a1 = key. 2553 __ Pop(KeyedStoreIC::ReceiverRegister(), KeyedStoreIC::NameRegister());
2554 ASSERT(KeyedStoreIC::ValueRegister().is(a0));
2553 2555
2554 Handle<Code> ic = strict_mode() == SLOPPY 2556 Handle<Code> ic = strict_mode() == SLOPPY
2555 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2557 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2556 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2558 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2557 CallIC(ic, expr->AssignmentFeedbackId()); 2559 CallIC(ic, expr->AssignmentFeedbackId());
2558 2560
2559 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2561 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2560 context()->Plug(v0); 2562 context()->Plug(v0);
2561 } 2563 }
2562 2564
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after
4373 context()->PlugTOS(); 4375 context()->PlugTOS();
4374 } 4376 }
4375 } else { 4377 } else {
4376 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 4378 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
4377 Token::ASSIGN); 4379 Token::ASSIGN);
4378 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4380 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4379 context()->Plug(v0); 4381 context()->Plug(v0);
4380 } 4382 }
4381 break; 4383 break;
4382 case NAMED_PROPERTY: { 4384 case NAMED_PROPERTY: {
4383 __ mov(a0, result_register()); // Value. 4385 __ mov(StoreIC::ValueRegister(), result_register());
4384 __ li(a2, Operand(prop->key()->AsLiteral()->value())); // Name. 4386 __ li(StoreIC::NameRegister(),
4385 __ pop(a1); // Receiver. 4387 Operand(prop->key()->AsLiteral()->value()));
4388 __ pop(StoreIC::ReceiverRegister());
4386 CallStoreIC(expr->CountStoreFeedbackId()); 4389 CallStoreIC(expr->CountStoreFeedbackId());
4387 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4390 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4388 if (expr->is_postfix()) { 4391 if (expr->is_postfix()) {
4389 if (!context()->IsEffect()) { 4392 if (!context()->IsEffect()) {
4390 context()->PlugTOS(); 4393 context()->PlugTOS();
4391 } 4394 }
4392 } else { 4395 } else {
4393 context()->Plug(v0); 4396 context()->Plug(v0);
4394 } 4397 }
4395 break; 4398 break;
4396 } 4399 }
4397 case KEYED_PROPERTY: { 4400 case KEYED_PROPERTY: {
4398 __ mov(a0, result_register()); // Value. 4401 __ mov(KeyedStoreIC::ValueRegister(), result_register());
4399 __ Pop(a2, a1); // a1 = key, a2 = receiver. 4402 __ Pop(KeyedStoreIC::ReceiverRegister(), KeyedStoreIC::NameRegister());
4400 Handle<Code> ic = strict_mode() == SLOPPY 4403 Handle<Code> ic = strict_mode() == SLOPPY
4401 ? isolate()->builtins()->KeyedStoreIC_Initialize() 4404 ? isolate()->builtins()->KeyedStoreIC_Initialize()
4402 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 4405 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
4403 CallIC(ic, expr->CountStoreFeedbackId()); 4406 CallIC(ic, expr->CountStoreFeedbackId());
4404 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4407 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4405 if (expr->is_postfix()) { 4408 if (expr->is_postfix()) {
4406 if (!context()->IsEffect()) { 4409 if (!context()->IsEffect()) {
4407 context()->PlugTOS(); 4410 context()->PlugTOS();
4408 } 4411 }
4409 } else { 4412 } else {
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
4856 Assembler::target_address_at(pc_immediate_load_address)) == 4859 Assembler::target_address_at(pc_immediate_load_address)) ==
4857 reinterpret_cast<uint64_t>( 4860 reinterpret_cast<uint64_t>(
4858 isolate->builtins()->OsrAfterStackCheck()->entry())); 4861 isolate->builtins()->OsrAfterStackCheck()->entry()));
4859 return OSR_AFTER_STACK_CHECK; 4862 return OSR_AFTER_STACK_CHECK;
4860 } 4863 }
4861 4864
4862 4865
4863 } } // namespace v8::internal 4866 } } // namespace v8::internal
4864 4867
4865 #endif // V8_TARGET_ARCH_MIPS64 4868 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/debug-mips64.cc ('k') | src/mips64/ic-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698