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

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

Issue 444001: Fix bug in the fast compiler's object literal code... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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/flag-definitions.h ('k') | src/x64/fast-codegen-x64.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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 __ bind(&exists); 658 __ bind(&exists);
659 // eax contains boilerplate. 659 // eax contains boilerplate.
660 // Clone boilerplate. 660 // Clone boilerplate.
661 __ push(eax); 661 __ push(eax);
662 if (expr->depth() == 1) { 662 if (expr->depth() == 1) {
663 __ CallRuntime(Runtime::kCloneShallowLiteralBoilerplate, 1); 663 __ CallRuntime(Runtime::kCloneShallowLiteralBoilerplate, 1);
664 } else { 664 } else {
665 __ CallRuntime(Runtime::kCloneLiteralBoilerplate, 1); 665 __ CallRuntime(Runtime::kCloneLiteralBoilerplate, 1);
666 } 666 }
667 667
668 // If result_saved == true: the result is saved on top of the stack. 668 // If result_saved == true: The result is saved on top of the
669 // If result_saved == false: the result not on the stack, just is in eax. 669 // stack and in eax.
670 // If result_saved == false: The result not on the stack, just in eax.
670 bool result_saved = false; 671 bool result_saved = false;
671 672
672 for (int i = 0; i < expr->properties()->length(); i++) { 673 for (int i = 0; i < expr->properties()->length(); i++) {
673 ObjectLiteral::Property* property = expr->properties()->at(i); 674 ObjectLiteral::Property* property = expr->properties()->at(i);
674 if (property->IsCompileTimeValue()) continue; 675 if (property->IsCompileTimeValue()) continue;
675 676
676 Literal* key = property->key(); 677 Literal* key = property->key();
677 Expression* value = property->value(); 678 Expression* value = property->value();
678 if (!result_saved) { 679 if (!result_saved) {
679 __ push(eax); // Save result on the stack 680 __ push(eax); // Save result on the stack
680 result_saved = true; 681 result_saved = true;
681 } 682 }
682 switch (property->kind()) { 683 switch (property->kind()) {
683 case ObjectLiteral::Property::MATERIALIZED_LITERAL: // fall through 684 case ObjectLiteral::Property::MATERIALIZED_LITERAL: // fall through
684 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); 685 ASSERT(!CompileTimeValue::IsCompileTimeValue(value));
685 case ObjectLiteral::Property::COMPUTED: 686 case ObjectLiteral::Property::COMPUTED:
686 if (key->handle()->IsSymbol()) { 687 if (key->handle()->IsSymbol()) {
687 Visit(value); 688 Visit(value);
688 ASSERT_EQ(Expression::kValue, value->context()); 689 ASSERT_EQ(Expression::kValue, value->context());
689 __ pop(eax); 690 __ pop(eax);
690 __ mov(ecx, Immediate(key->handle())); 691 __ mov(ecx, Immediate(key->handle()));
691 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 692 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
692 __ call(ic, RelocInfo::CODE_TARGET); 693 __ call(ic, RelocInfo::CODE_TARGET);
693 // StoreIC leaves the receiver on the stack. 694 // StoreIC leaves the receiver on the stack.
695 __ mov(eax, Operand(esp, 0)); // Restore result into eax.
694 break; 696 break;
695 } 697 }
696 // fall through 698 // fall through
697 case ObjectLiteral::Property::PROTOTYPE: 699 case ObjectLiteral::Property::PROTOTYPE:
698 __ push(eax); 700 __ push(eax);
699 Visit(key); 701 Visit(key);
700 ASSERT_EQ(Expression::kValue, key->context()); 702 ASSERT_EQ(Expression::kValue, key->context());
701 Visit(value); 703 Visit(value);
702 ASSERT_EQ(Expression::kValue, value->context()); 704 ASSERT_EQ(Expression::kValue, value->context());
703 __ CallRuntime(Runtime::kSetProperty, 3); 705 __ CallRuntime(Runtime::kSetProperty, 3);
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 true_label_ = saved_true; 1666 true_label_ = saved_true;
1665 false_label_ = saved_false; 1667 false_label_ = saved_false;
1666 // Convert current context to test context: End post-test code. 1668 // Convert current context to test context: End post-test code.
1667 } 1669 }
1668 1670
1669 1671
1670 #undef __ 1672 #undef __
1671 1673
1672 1674
1673 } } // namespace v8::internal 1675 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/x64/fast-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698