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

Side by Side Diff: src/fast-codegen.cc

Issue 342073: Refactor the somewhat complicated code generation for assignments into... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month 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/fast-codegen.h ('k') | src/ia32/fast-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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 // Slots do not appear directly in the AST. 417 // Slots do not appear directly in the AST.
418 UNREACHABLE(); 418 UNREACHABLE();
419 } 419 }
420 420
421 421
422 void FastCodeGenerator::VisitLiteral(Literal* expr) { 422 void FastCodeGenerator::VisitLiteral(Literal* expr) {
423 Move(expr->context(), expr); 423 Move(expr->context(), expr);
424 } 424 }
425 425
426 426
427 void FastCodeGenerator::VisitAssignment(Assignment* expr) {
428 Comment cmnt(masm_, "[ Assignment");
429 ASSERT(expr->op() == Token::ASSIGN || expr->op() == Token::INIT_VAR);
430
431 // Record source code position of the (possible) IC call.
432 SetSourcePosition(expr->position());
433
434 Expression* rhs = expr->value();
435 // Left-hand side can only be a property, a global or a (parameter or
436 // local) slot.
437 Variable* var = expr->target()->AsVariableProxy()->AsVariable();
438 Property* prop = expr->target()->AsProperty();
439 if (var != NULL) {
440 Visit(rhs);
441 ASSERT_EQ(Expression::kValue, rhs->context());
442 EmitVariableAssignment(expr->context(), var);
443 } else if (prop != NULL) {
444 // Assignment to a property.
445 Visit(prop->obj());
446 ASSERT_EQ(Expression::kValue, prop->obj()->context());
447 // Use the expression context of the key subexpression to detect whether
448 // we have decided to us a named or keyed IC.
449 if (prop->key()->context() == Expression::kUninitialized) {
450 ASSERT(prop->key()->AsLiteral() != NULL);
451 Visit(rhs);
452 ASSERT_EQ(Expression::kValue, rhs->context());
453 EmitNamedPropertyAssignment(expr->context(),
454 prop->key()->AsLiteral()->handle());
455 } else {
456 Visit(prop->key());
457 ASSERT_EQ(Expression::kValue, prop->key()->context());
458 Visit(rhs);
459 ASSERT_EQ(Expression::kValue, rhs->context());
460 EmitKeyedPropertyAssignment(expr->context());
461 }
462 } else {
463 UNREACHABLE();
464 }
465 }
466
467
427 void FastCodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* expr) { 468 void FastCodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* expr) {
428 UNREACHABLE(); 469 UNREACHABLE();
429 } 470 }
430 471
431 472
432 void FastCodeGenerator::VisitThrow(Throw* expr) { 473 void FastCodeGenerator::VisitThrow(Throw* expr) {
433 UNREACHABLE(); 474 UNREACHABLE();
434 } 475 }
435 476
436 477
437 void FastCodeGenerator::VisitCountOperation(CountOperation* expr) { 478 void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
438 UNREACHABLE(); 479 UNREACHABLE();
439 } 480 }
440 481
441 482
442 void FastCodeGenerator::VisitCompareOperation(CompareOperation* expr) { 483 void FastCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
443 UNREACHABLE(); 484 UNREACHABLE();
444 } 485 }
445 486
446 487
447 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { 488 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) {
448 UNREACHABLE(); 489 UNREACHABLE();
449 } 490 }
450 491
451 492
452 #undef __ 493 #undef __
453 494
454 495
455 } } // namespace v8::internal 496 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/fast-codegen.h ('k') | src/ia32/fast-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698