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

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

Issue 456024: Refactor code for generating assignments in the fast compiler.... (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 | « no previous file | src/compiler.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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 __ jmp(true_label_); 856 __ jmp(true_label_);
857 break; 857 break;
858 } 858 }
859 } 859 }
860 } 860 }
861 861
862 862
863 void FastCodeGenerator::EmitVariableAssignment(Assignment* expr) { 863 void FastCodeGenerator::EmitVariableAssignment(Assignment* expr) {
864 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); 864 Variable* var = expr->target()->AsVariableProxy()->AsVariable();
865 ASSERT(var != NULL); 865 ASSERT(var != NULL);
866 866 ASSERT(var->is_global() || var->slot() != NULL);
867 if (var->is_global()) { 867 if (var->is_global()) {
868 // Assignment to a global variable. Use inline caching for the 868 // Assignment to a global variable. Use inline caching for the
869 // assignment. Right-hand-side value is passed in r0, variable name in 869 // assignment. Right-hand-side value is passed in r0, variable name in
870 // r2, and the global object on the stack. 870 // r2, and the global object on the stack.
871 __ pop(r0); 871 __ pop(r0);
872 __ mov(r2, Operand(var->name())); 872 __ mov(r2, Operand(var->name()));
873 __ ldr(ip, CodeGenerator::GlobalObject()); 873 __ ldr(ip, CodeGenerator::GlobalObject());
874 __ push(ip); 874 __ push(ip);
875 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 875 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
876 __ Call(ic, RelocInfo::CODE_TARGET); 876 __ Call(ic, RelocInfo::CODE_TARGET);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 expr->context() != Expression::kValue) { 969 expr->context() != Expression::kValue) {
970 Move(expr->context(), r3); 970 Move(expr->context(), r3);
971 } 971 }
972 break; 972 break;
973 } 973 }
974 974
975 case Slot::LOOKUP: 975 case Slot::LOOKUP:
976 UNREACHABLE(); 976 UNREACHABLE();
977 break; 977 break;
978 } 978 }
979 } else {
980 Property* property = var->rewrite()->AsProperty();
981 ASSERT_NOT_NULL(property);
982
983 // Load object and key onto the stack.
984 Slot* object_slot = property->obj()->AsSlot();
985 ASSERT_NOT_NULL(object_slot);
986 Move(Expression::kValue, object_slot, r0);
987
988 Literal* key_literal = property->key()->AsLiteral();
989 ASSERT_NOT_NULL(key_literal);
990 Move(Expression::kValue, key_literal);
991
992 // Value to store was pushed before object and key on the stack.
993 __ ldr(r0, MemOperand(sp, 2 * kPointerSize));
994
995 // Arguments to ic is value in r0, object and key on stack.
996 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize));
997 __ Call(ic, RelocInfo::CODE_TARGET);
998
999 if (expr->context() == Expression::kEffect) {
1000 __ add(sp, sp, Operand(3 * kPointerSize));
1001 } else if (expr->context() == Expression::kValue) {
1002 // Value is still on the stack in esp[2 * kPointerSize]
1003 __ add(sp, sp, Operand(2 * kPointerSize));
1004 } else {
1005 __ ldr(r0, MemOperand(sp, 2 * kPointerSize));
1006 DropAndMove(expr->context(), r0, 3);
1007 }
1008 } 979 }
1009 } 980 }
1010 981
1011 982
1012 void FastCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 983 void FastCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
1013 // Assignment to a property, using a named store IC. 984 // Assignment to a property, using a named store IC.
1014 Property* prop = expr->target()->AsProperty(); 985 Property* prop = expr->target()->AsProperty();
1015 ASSERT(prop != NULL); 986 ASSERT(prop != NULL);
1016 ASSERT(prop->key()->AsLiteral() != NULL); 987 ASSERT(prop->key()->AsLiteral() != NULL);
1017 988
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 true_label_ = saved_true; 1674 true_label_ = saved_true;
1704 false_label_ = saved_false; 1675 false_label_ = saved_false;
1705 // Convert current context to test context: End post-test code. 1676 // Convert current context to test context: End post-test code.
1706 } 1677 }
1707 1678
1708 1679
1709 #undef __ 1680 #undef __
1710 1681
1711 1682
1712 } } // namespace v8::internal 1683 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698