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

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

Issue 7172030: Revert "Merge arguments branch to bleeding merge." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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/full-codegen.h ('k') | src/handles.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 434
435 void FullCodeGenerator::StackValueContext::Plug(Register reg) const { 435 void FullCodeGenerator::StackValueContext::Plug(Register reg) const {
436 __ push(reg); 436 __ push(reg);
437 } 437 }
438 438
439 439
440 void FullCodeGenerator::TestContext::Plug(Register reg) const { 440 void FullCodeGenerator::TestContext::Plug(Register reg) const {
441 // For simplicity we always test the accumulator register. 441 // For simplicity we always test the accumulator register.
442 __ Move(result_register(), reg); 442 __ Move(result_register(), reg);
443 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); 443 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
444 codegen()->DoTest(true_label_, false_label_, fall_through_); 444 codegen()->DoTest(this);
445 } 445 }
446 446
447 447
448 void FullCodeGenerator::EffectContext::PlugTOS() const { 448 void FullCodeGenerator::EffectContext::PlugTOS() const {
449 __ Drop(1); 449 __ Drop(1);
450 } 450 }
451 451
452 452
453 void FullCodeGenerator::AccumulatorValueContext::PlugTOS() const { 453 void FullCodeGenerator::AccumulatorValueContext::PlugTOS() const {
454 __ pop(result_register()); 454 __ pop(result_register());
455 } 455 }
456 456
457 457
458 void FullCodeGenerator::StackValueContext::PlugTOS() const { 458 void FullCodeGenerator::StackValueContext::PlugTOS() const {
459 } 459 }
460 460
461 461
462 void FullCodeGenerator::TestContext::PlugTOS() const { 462 void FullCodeGenerator::TestContext::PlugTOS() const {
463 // For simplicity we always test the accumulator register. 463 // For simplicity we always test the accumulator register.
464 __ pop(result_register()); 464 __ pop(result_register());
465 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); 465 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
466 codegen()->DoTest(true_label_, false_label_, fall_through_); 466 codegen()->DoTest(this);
467 } 467 }
468 468
469 469
470 void FullCodeGenerator::EffectContext::PrepareTest( 470 void FullCodeGenerator::EffectContext::PrepareTest(
471 Label* materialize_true, 471 Label* materialize_true,
472 Label* materialize_false, 472 Label* materialize_false,
473 Label** if_true, 473 Label** if_true,
474 Label** if_false, 474 Label** if_false,
475 Label** fall_through) const { 475 Label** fall_through) const {
476 // In an effect context, the true and the false case branch to the 476 // In an effect context, the true and the false case branch to the
(...skipping 29 matching lines...) Expand all
506 Label* materialize_false, 506 Label* materialize_false,
507 Label** if_true, 507 Label** if_true,
508 Label** if_false, 508 Label** if_false,
509 Label** fall_through) const { 509 Label** fall_through) const {
510 *if_true = true_label_; 510 *if_true = true_label_;
511 *if_false = false_label_; 511 *if_false = false_label_;
512 *fall_through = fall_through_; 512 *fall_through = fall_through_;
513 } 513 }
514 514
515 515
516 void FullCodeGenerator::DoTest(const TestContext* context) {
517 DoTest(context->condition(),
518 context->true_label(),
519 context->false_label(),
520 context->fall_through());
521 }
522
523
516 void FullCodeGenerator::VisitDeclarations( 524 void FullCodeGenerator::VisitDeclarations(
517 ZoneList<Declaration*>* declarations) { 525 ZoneList<Declaration*>* declarations) {
518 int length = declarations->length(); 526 int length = declarations->length();
519 int globals = 0; 527 int globals = 0;
520 for (int i = 0; i < length; i++) { 528 for (int i = 0; i < length; i++) {
521 Declaration* decl = declarations->at(i); 529 Declaration* decl = declarations->at(i);
522 Variable* var = decl->proxy()->var(); 530 Variable* var = decl->proxy()->var();
523 Slot* slot = var->AsSlot(); 531 Slot* slot = var->AsSlot();
524 532
525 // If it was not possible to allocate the variable at compile 533 // If it was not possible to allocate the variable at compile
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 ForwardBailoutToChild(expr); 735 ForwardBailoutToChild(expr);
728 736
729 } else if (context()->IsAccumulatorValue()) { 737 } else if (context()->IsAccumulatorValue()) {
730 VisitForAccumulatorValue(left); 738 VisitForAccumulatorValue(left);
731 // We want the value in the accumulator for the test, and on the stack in 739 // We want the value in the accumulator for the test, and on the stack in
732 // case we need it. 740 // case we need it.
733 __ push(result_register()); 741 __ push(result_register());
734 Label discard, restore; 742 Label discard, restore;
735 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); 743 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
736 if (is_logical_and) { 744 if (is_logical_and) {
737 DoTest(&discard, &restore, &restore); 745 DoTest(left, &discard, &restore, &restore);
738 } else { 746 } else {
739 DoTest(&restore, &discard, &restore); 747 DoTest(left, &restore, &discard, &restore);
740 } 748 }
741 __ bind(&restore); 749 __ bind(&restore);
742 __ pop(result_register()); 750 __ pop(result_register());
743 __ jmp(&done); 751 __ jmp(&done);
744 __ bind(&discard); 752 __ bind(&discard);
745 __ Drop(1); 753 __ Drop(1);
746 PrepareForBailoutForId(right_id, NO_REGISTERS); 754 PrepareForBailoutForId(right_id, NO_REGISTERS);
747 755
748 } else if (context()->IsStackValue()) { 756 } else if (context()->IsStackValue()) {
749 VisitForAccumulatorValue(left); 757 VisitForAccumulatorValue(left);
750 // We want the value in the accumulator for the test, and on the stack in 758 // We want the value in the accumulator for the test, and on the stack in
751 // case we need it. 759 // case we need it.
752 __ push(result_register()); 760 __ push(result_register());
753 Label discard; 761 Label discard;
754 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); 762 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
755 if (is_logical_and) { 763 if (is_logical_and) {
756 DoTest(&discard, &done, &discard); 764 DoTest(left, &discard, &done, &discard);
757 } else { 765 } else {
758 DoTest(&done, &discard, &discard); 766 DoTest(left, &done, &discard, &discard);
759 } 767 }
760 __ bind(&discard); 768 __ bind(&discard);
761 __ Drop(1); 769 __ Drop(1);
762 PrepareForBailoutForId(right_id, NO_REGISTERS); 770 PrepareForBailoutForId(right_id, NO_REGISTERS);
763 771
764 } else { 772 } else {
765 ASSERT(context()->IsEffect()); 773 ASSERT(context()->IsEffect());
766 Label eval_right; 774 Label eval_right;
767 if (is_logical_and) { 775 if (is_logical_and) {
768 VisitForControl(left, &eval_right, &done, &eval_right); 776 VisitForControl(left, &eval_right, &done, &eval_right);
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 // that scope again afterwards. 1100 // that scope again afterwards.
1093 1101
1094 Label try_handler_setup, catch_entry, done; 1102 Label try_handler_setup, catch_entry, done;
1095 __ Call(&try_handler_setup); 1103 __ Call(&try_handler_setup);
1096 // Try handler code, exception in result register. 1104 // Try handler code, exception in result register.
1097 1105
1098 // Extend the context before executing the catch block. 1106 // Extend the context before executing the catch block.
1099 { Comment cmnt(masm_, "[ Extend catch context"); 1107 { Comment cmnt(masm_, "[ Extend catch context");
1100 __ Push(stmt->name()); 1108 __ Push(stmt->name());
1101 __ push(result_register()); 1109 __ push(result_register());
1102 __ CallRuntime(Runtime::kCreateCatchExtensionObject, 2); 1110 __ CallRuntime(Runtime::kPushCatchContext, 2);
1103 __ push(result_register());
1104 __ CallRuntime(Runtime::kPushCatchContext, 1);
1105 StoreToFrameField(StandardFrameConstants::kContextOffset, 1111 StoreToFrameField(StandardFrameConstants::kContextOffset,
1106 context_register()); 1112 context_register());
1107 } 1113 }
1108 1114
1109 Visit(stmt->catch_block()); 1115 Visit(stmt->catch_block());
1110 __ jmp(&done); 1116 __ jmp(&done);
1111 1117
1112 // Try block code. Sets up the exception handler chain. 1118 // Try block code. Sets up the exception handler chain.
1113 __ bind(&try_handler_setup); 1119 __ bind(&try_handler_setup);
1114 { 1120 {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 __ Drop(stack_depth); 1287 __ Drop(stack_depth);
1282 __ PopTryHandler(); 1288 __ PopTryHandler();
1283 return 0; 1289 return 0;
1284 } 1290 }
1285 1291
1286 1292
1287 #undef __ 1293 #undef __
1288 1294
1289 1295
1290 } } // namespace v8::internal 1296 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.h ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698