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

Side by Side Diff: src/ia32/full-codegen-ia32.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/ia32/debug-ia32.cc ('k') | src/ia32/ic-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 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-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 switch (property->kind()) { 1626 switch (property->kind()) {
1627 case ObjectLiteral::Property::CONSTANT: 1627 case ObjectLiteral::Property::CONSTANT:
1628 UNREACHABLE(); 1628 UNREACHABLE();
1629 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 1629 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1630 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); 1630 ASSERT(!CompileTimeValue::IsCompileTimeValue(value));
1631 // Fall through. 1631 // Fall through.
1632 case ObjectLiteral::Property::COMPUTED: 1632 case ObjectLiteral::Property::COMPUTED:
1633 if (key->value()->IsInternalizedString()) { 1633 if (key->value()->IsInternalizedString()) {
1634 if (property->emit_store()) { 1634 if (property->emit_store()) {
1635 VisitForAccumulatorValue(value); 1635 VisitForAccumulatorValue(value);
1636 __ mov(ecx, Immediate(key->value())); 1636 ASSERT(StoreIC::ValueRegister().is(eax));
1637 __ mov(edx, Operand(esp, 0)); 1637 __ mov(StoreIC::NameRegister(), Immediate(key->value()));
1638 __ mov(StoreIC::ReceiverRegister(), Operand(esp, 0));
1638 CallStoreIC(key->LiteralFeedbackId()); 1639 CallStoreIC(key->LiteralFeedbackId());
1639 PrepareForBailoutForId(key->id(), NO_REGISTERS); 1640 PrepareForBailoutForId(key->id(), NO_REGISTERS);
1640 } else { 1641 } else {
1641 VisitForEffect(value); 1642 VisitForEffect(value);
1642 } 1643 }
1643 break; 1644 break;
1644 } 1645 }
1645 __ push(Operand(esp, 0)); // Duplicate receiver. 1646 __ push(Operand(esp, 0)); // Duplicate receiver.
1646 VisitForStackValue(key); 1647 VisitForStackValue(key);
1647 VisitForStackValue(value); 1648 VisitForStackValue(value);
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 switch (assign_type) { 2343 switch (assign_type) {
2343 case VARIABLE: { 2344 case VARIABLE: {
2344 Variable* var = expr->AsVariableProxy()->var(); 2345 Variable* var = expr->AsVariableProxy()->var();
2345 EffectContext context(this); 2346 EffectContext context(this);
2346 EmitVariableAssignment(var, Token::ASSIGN); 2347 EmitVariableAssignment(var, Token::ASSIGN);
2347 break; 2348 break;
2348 } 2349 }
2349 case NAMED_PROPERTY: { 2350 case NAMED_PROPERTY: {
2350 __ push(eax); // Preserve value. 2351 __ push(eax); // Preserve value.
2351 VisitForAccumulatorValue(prop->obj()); 2352 VisitForAccumulatorValue(prop->obj());
2352 __ mov(edx, eax); 2353 __ Move(StoreIC::ReceiverRegister(), eax);
2353 __ pop(eax); // Restore value. 2354 __ pop(StoreIC::ValueRegister()); // Restore value.
2354 __ mov(ecx, prop->key()->AsLiteral()->value()); 2355 __ mov(StoreIC::NameRegister(), prop->key()->AsLiteral()->value());
2355 CallStoreIC(); 2356 CallStoreIC();
2356 break; 2357 break;
2357 } 2358 }
2358 case KEYED_PROPERTY: { 2359 case KEYED_PROPERTY: {
2359 __ push(eax); // Preserve value. 2360 __ push(eax); // Preserve value.
2360 VisitForStackValue(prop->obj()); 2361 VisitForStackValue(prop->obj());
2361 VisitForAccumulatorValue(prop->key()); 2362 VisitForAccumulatorValue(prop->key());
2362 __ mov(ecx, eax); 2363 __ Move(KeyedStoreIC::NameRegister(), eax);
2363 __ pop(edx); // Receiver. 2364 __ pop(KeyedStoreIC::ReceiverRegister()); // Receiver.
2364 __ pop(eax); // Restore value. 2365 __ pop(KeyedStoreIC::ValueRegister()); // Restore value.
2365 Handle<Code> ic = strict_mode() == SLOPPY 2366 Handle<Code> ic = strict_mode() == SLOPPY
2366 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2367 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2367 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2368 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2368 CallIC(ic); 2369 CallIC(ic);
2369 break; 2370 break;
2370 } 2371 }
2371 } 2372 }
2372 context()->Plug(eax); 2373 context()->Plug(eax);
2373 } 2374 }
2374 2375
(...skipping 16 matching lines...) Expand all
2391 __ push(Immediate(name)); 2392 __ push(Immediate(name));
2392 __ push(Immediate(Smi::FromInt(strict_mode))); 2393 __ push(Immediate(Smi::FromInt(strict_mode)));
2393 __ CallRuntime(Runtime::kStoreContextSlot, 4); 2394 __ CallRuntime(Runtime::kStoreContextSlot, 4);
2394 } 2395 }
2395 2396
2396 2397
2397 void FullCodeGenerator::EmitVariableAssignment(Variable* var, 2398 void FullCodeGenerator::EmitVariableAssignment(Variable* var,
2398 Token::Value op) { 2399 Token::Value op) {
2399 if (var->IsUnallocated()) { 2400 if (var->IsUnallocated()) {
2400 // Global var, const, or let. 2401 // Global var, const, or let.
2401 __ mov(ecx, var->name()); 2402 __ mov(StoreIC::NameRegister(), var->name());
2402 __ mov(edx, GlobalObjectOperand()); 2403 __ mov(StoreIC::ReceiverRegister(), GlobalObjectOperand());
2403 CallStoreIC(); 2404 CallStoreIC();
2404 2405
2405 } else if (op == Token::INIT_CONST_LEGACY) { 2406 } else if (op == Token::INIT_CONST_LEGACY) {
2406 // Const initializers need a write barrier. 2407 // Const initializers need a write barrier.
2407 ASSERT(!var->IsParameter()); // No const parameters. 2408 ASSERT(!var->IsParameter()); // No const parameters.
2408 if (var->IsLookupSlot()) { 2409 if (var->IsLookupSlot()) {
2409 __ push(eax); 2410 __ push(eax);
2410 __ push(esi); 2411 __ push(esi);
2411 __ push(Immediate(var->name())); 2412 __ push(Immediate(var->name()));
2412 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); 2413 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2463 // Assignment to a property, using a named store IC. 2464 // Assignment to a property, using a named store IC.
2464 // eax : value 2465 // eax : value
2465 // esp[0] : receiver 2466 // esp[0] : receiver
2466 2467
2467 Property* prop = expr->target()->AsProperty(); 2468 Property* prop = expr->target()->AsProperty();
2468 ASSERT(prop != NULL); 2469 ASSERT(prop != NULL);
2469 ASSERT(prop->key()->IsLiteral()); 2470 ASSERT(prop->key()->IsLiteral());
2470 2471
2471 // Record source code position before IC call. 2472 // Record source code position before IC call.
2472 SetSourcePosition(expr->position()); 2473 SetSourcePosition(expr->position());
2473 __ mov(ecx, prop->key()->AsLiteral()->value()); 2474 __ mov(StoreIC::NameRegister(), prop->key()->AsLiteral()->value());
2474 __ pop(edx); 2475 __ pop(StoreIC::ReceiverRegister());
2475 CallStoreIC(expr->AssignmentFeedbackId()); 2476 CallStoreIC(expr->AssignmentFeedbackId());
2476 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2477 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2477 context()->Plug(eax); 2478 context()->Plug(eax);
2478 } 2479 }
2479 2480
2480 2481
2481 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 2482 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
2482 // Assignment to a property, using a keyed store IC. 2483 // Assignment to a property, using a keyed store IC.
2483 // eax : value 2484 // eax : value
2484 // esp[0] : key 2485 // esp[0] : key
2485 // esp[kPointerSize] : receiver 2486 // esp[kPointerSize] : receiver
2486 2487
2487 __ pop(ecx); // Key. 2488 __ pop(KeyedStoreIC::NameRegister()); // Key.
2488 __ pop(edx); 2489 __ pop(KeyedStoreIC::ReceiverRegister());
2490 ASSERT(KeyedStoreIC::ValueRegister().is(eax));
2489 // Record source code position before IC call. 2491 // Record source code position before IC call.
2490 SetSourcePosition(expr->position()); 2492 SetSourcePosition(expr->position());
2491 Handle<Code> ic = strict_mode() == SLOPPY 2493 Handle<Code> ic = strict_mode() == SLOPPY
2492 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2494 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2493 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2495 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2494 CallIC(ic, expr->AssignmentFeedbackId()); 2496 CallIC(ic, expr->AssignmentFeedbackId());
2495 2497
2496 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2498 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2497 context()->Plug(eax); 2499 context()->Plug(eax);
2498 } 2500 }
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after
4325 } 4327 }
4326 } else { 4328 } else {
4327 // Perform the assignment as if via '='. 4329 // Perform the assignment as if via '='.
4328 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 4330 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
4329 Token::ASSIGN); 4331 Token::ASSIGN);
4330 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4332 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4331 context()->Plug(eax); 4333 context()->Plug(eax);
4332 } 4334 }
4333 break; 4335 break;
4334 case NAMED_PROPERTY: { 4336 case NAMED_PROPERTY: {
4335 __ mov(ecx, prop->key()->AsLiteral()->value()); 4337 __ mov(StoreIC::NameRegister(), prop->key()->AsLiteral()->value());
4336 __ pop(edx); 4338 __ pop(StoreIC::ReceiverRegister());
4337 CallStoreIC(expr->CountStoreFeedbackId()); 4339 CallStoreIC(expr->CountStoreFeedbackId());
4338 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4340 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4339 if (expr->is_postfix()) { 4341 if (expr->is_postfix()) {
4340 if (!context()->IsEffect()) { 4342 if (!context()->IsEffect()) {
4341 context()->PlugTOS(); 4343 context()->PlugTOS();
4342 } 4344 }
4343 } else { 4345 } else {
4344 context()->Plug(eax); 4346 context()->Plug(eax);
4345 } 4347 }
4346 break; 4348 break;
4347 } 4349 }
4348 case KEYED_PROPERTY: { 4350 case KEYED_PROPERTY: {
4349 __ pop(ecx); 4351 __ pop(KeyedStoreIC::NameRegister());
4350 __ pop(edx); 4352 __ pop(KeyedStoreIC::ReceiverRegister());
4351 Handle<Code> ic = strict_mode() == SLOPPY 4353 Handle<Code> ic = strict_mode() == SLOPPY
4352 ? isolate()->builtins()->KeyedStoreIC_Initialize() 4354 ? isolate()->builtins()->KeyedStoreIC_Initialize()
4353 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 4355 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
4354 CallIC(ic, expr->CountStoreFeedbackId()); 4356 CallIC(ic, expr->CountStoreFeedbackId());
4355 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4357 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4356 if (expr->is_postfix()) { 4358 if (expr->is_postfix()) {
4357 // Result is on the stack 4359 // Result is on the stack
4358 if (!context()->IsEffect()) { 4360 if (!context()->IsEffect()) {
4359 context()->PlugTOS(); 4361 context()->PlugTOS();
4360 } 4362 }
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
4802 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4804 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4803 Assembler::target_address_at(call_target_address, 4805 Assembler::target_address_at(call_target_address,
4804 unoptimized_code)); 4806 unoptimized_code));
4805 return OSR_AFTER_STACK_CHECK; 4807 return OSR_AFTER_STACK_CHECK;
4806 } 4808 }
4807 4809
4808 4810
4809 } } // namespace v8::internal 4811 } } // namespace v8::internal
4810 4812
4811 #endif // V8_TARGET_ARCH_IA32 4813 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/debug-ia32.cc ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698