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

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

Issue 7826009: Support declarations of context allocated locals in Crankshaft. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 3 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
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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 } 677 }
678 678
679 if (should_normalize) { 679 if (should_normalize) {
680 __ cmp(eax, isolate()->factory()->true_value()); 680 __ cmp(eax, isolate()->factory()->true_value());
681 Split(equal, if_true, if_false, NULL); 681 Split(equal, if_true, if_false, NULL);
682 __ bind(&skip); 682 __ bind(&skip);
683 } 683 }
684 } 684 }
685 685
686 686
687 void FullCodeGenerator::EmitDeclaration(Variable* variable, 687 void FullCodeGenerator::EmitDeclaration(VariableProxy* proxy,
688 Variable::Mode mode, 688 Variable::Mode mode,
689 FunctionLiteral* function) { 689 FunctionLiteral* function) {
690 Comment cmnt(masm_, "[ Declaration"); 690 Comment cmnt(masm_, "[ Declaration");
691 Variable* variable = proxy->var();
691 ASSERT(variable != NULL); // Must have been resolved. 692 ASSERT(variable != NULL); // Must have been resolved.
692 Slot* slot = variable->AsSlot(); 693 Slot* slot = variable->AsSlot();
693 ASSERT(slot != NULL); 694 ASSERT(slot != NULL);
694 switch (slot->type()) { 695 switch (slot->type()) {
695 case Slot::PARAMETER: 696 case Slot::PARAMETER:
696 case Slot::LOCAL: 697 case Slot::LOCAL:
697 if (function != NULL) { 698 if (function != NULL) {
698 VisitForAccumulatorValue(function); 699 VisitForAccumulatorValue(function);
699 __ mov(Operand(ebp, SlotOffset(slot)), result_register()); 700 __ mov(Operand(ebp, SlotOffset(slot)), result_register());
700 } else if (mode == Variable::CONST || mode == Variable::LET) { 701 } else if (mode == Variable::CONST || mode == Variable::LET) {
(...skipping 16 matching lines...) Expand all
717 __ Check(not_equal, "Declaration in with context."); 718 __ Check(not_equal, "Declaration in with context.");
718 __ cmp(ebx, isolate()->factory()->catch_context_map()); 719 __ cmp(ebx, isolate()->factory()->catch_context_map());
719 __ Check(not_equal, "Declaration in catch context."); 720 __ Check(not_equal, "Declaration in catch context.");
720 } 721 }
721 if (function != NULL) { 722 if (function != NULL) {
722 VisitForAccumulatorValue(function); 723 VisitForAccumulatorValue(function);
723 __ mov(ContextOperand(esi, slot->index()), result_register()); 724 __ mov(ContextOperand(esi, slot->index()), result_register());
724 int offset = Context::SlotOffset(slot->index()); 725 int offset = Context::SlotOffset(slot->index());
725 __ mov(ebx, esi); 726 __ mov(ebx, esi);
726 __ RecordWrite(ebx, offset, result_register(), ecx); 727 __ RecordWrite(ebx, offset, result_register(), ecx);
728 PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
727 } else if (mode == Variable::CONST || mode == Variable::LET) { 729 } else if (mode == Variable::CONST || mode == Variable::LET) {
728 __ mov(ContextOperand(esi, slot->index()), 730 __ mov(ContextOperand(esi, slot->index()),
729 Immediate(isolate()->factory()->the_hole_value())); 731 Immediate(isolate()->factory()->the_hole_value()));
730 // No write barrier since the hole value is in old space. 732 // No write barrier since the hole value is in old space.
733 PrepareForBailoutForId(proxy->id(), NO_REGISTERS);
731 } 734 }
732 break; 735 break;
733 736
734 case Slot::LOOKUP: { 737 case Slot::LOOKUP: {
735 __ push(esi); 738 __ push(esi);
736 __ push(Immediate(variable->name())); 739 __ push(Immediate(variable->name()));
737 // Declaration nodes are always introduced in one of two modes. 740 // Declaration nodes are always introduced in one of two modes.
738 ASSERT(mode == Variable::VAR || 741 ASSERT(mode == Variable::VAR ||
739 mode == Variable::CONST || 742 mode == Variable::CONST ||
740 mode == Variable::LET); 743 mode == Variable::LET);
(...skipping 15 matching lines...) Expand all
756 } 759 }
757 __ CallRuntime(Runtime::kDeclareContextSlot, 4); 760 __ CallRuntime(Runtime::kDeclareContextSlot, 4);
758 decrement_stack_height(4); 761 decrement_stack_height(4);
759 break; 762 break;
760 } 763 }
761 } 764 }
762 } 765 }
763 766
764 767
765 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { 768 void FullCodeGenerator::VisitDeclaration(Declaration* decl) {
766 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); 769 EmitDeclaration(decl->proxy(), decl->mode(), decl->fun());
767 } 770 }
768 771
769 772
770 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { 773 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
771 // Call the runtime to declare the globals. 774 // Call the runtime to declare the globals.
772 __ push(esi); // The context is the first argument. 775 __ push(esi); // The context is the first argument.
773 __ push(Immediate(pairs)); 776 __ push(Immediate(pairs));
774 __ push(Immediate(Smi::FromInt(DeclareGlobalsFlags()))); 777 __ push(Immediate(Smi::FromInt(DeclareGlobalsFlags())));
775 __ CallRuntime(Runtime::kDeclareGlobals, 3); 778 __ CallRuntime(Runtime::kDeclareGlobals, 3);
776 // Return value is ignored. 779 // Return value is ignored.
(...skipping 3551 matching lines...) Expand 10 before | Expand all | Expand 10 after
4328 __ add(Operand(edx), Immediate(masm_->CodeObject())); 4331 __ add(Operand(edx), Immediate(masm_->CodeObject()));
4329 __ jmp(Operand(edx)); 4332 __ jmp(Operand(edx));
4330 } 4333 }
4331 4334
4332 4335
4333 #undef __ 4336 #undef __
4334 4337
4335 } } // namespace v8::internal 4338 } } // namespace v8::internal
4336 4339
4337 #endif // V8_TARGET_ARCH_IA32 4340 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698