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

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

Issue 554152: Change StoreIC interface on ARM platform (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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/arm/debug-arm.cc ('k') | src/arm/ic-arm.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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 switch (property->kind()) { 809 switch (property->kind()) {
810 case ObjectLiteral::Property::CONSTANT: 810 case ObjectLiteral::Property::CONSTANT:
811 UNREACHABLE(); 811 UNREACHABLE();
812 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 812 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
813 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); 813 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value()));
814 // Fall through. 814 // Fall through.
815 case ObjectLiteral::Property::COMPUTED: 815 case ObjectLiteral::Property::COMPUTED:
816 if (key->handle()->IsSymbol()) { 816 if (key->handle()->IsSymbol()) {
817 VisitForValue(value, kAccumulator); 817 VisitForValue(value, kAccumulator);
818 __ mov(r2, Operand(key->handle())); 818 __ mov(r2, Operand(key->handle()));
819 __ ldr(r1, MemOperand(sp));
819 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 820 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
820 __ Call(ic, RelocInfo::CODE_TARGET); 821 __ Call(ic, RelocInfo::CODE_TARGET);
821 // StoreIC leaves the receiver on the stack.
822 break; 822 break;
823 } 823 }
824 // Fall through. 824 // Fall through.
825 case ObjectLiteral::Property::PROTOTYPE: 825 case ObjectLiteral::Property::PROTOTYPE:
826 // Duplicate receiver on stack. 826 // Duplicate receiver on stack.
827 __ ldr(r0, MemOperand(sp)); 827 __ ldr(r0, MemOperand(sp));
828 __ push(r0); 828 __ push(r0);
829 VisitForValue(key, kStack); 829 VisitForValue(key, kStack);
830 VisitForValue(value, kStack); 830 VisitForValue(value, kStack);
831 __ CallRuntime(Runtime::kSetProperty, 3); 831 __ CallRuntime(Runtime::kSetProperty, 3);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 // types of slots. Left-hand-side parameters that rewrite to 938 // types of slots. Left-hand-side parameters that rewrite to
939 // explicit property accesses do not reach here. 939 // explicit property accesses do not reach here.
940 ASSERT(var != NULL); 940 ASSERT(var != NULL);
941 ASSERT(var->is_global() || var->slot() != NULL); 941 ASSERT(var->is_global() || var->slot() != NULL);
942 942
943 Slot* slot = var->slot(); 943 Slot* slot = var->slot();
944 if (var->is_global()) { 944 if (var->is_global()) {
945 ASSERT(!var->is_this()); 945 ASSERT(!var->is_this());
946 // Assignment to a global variable. Use inline caching for the 946 // Assignment to a global variable. Use inline caching for the
947 // assignment. Right-hand-side value is passed in r0, variable name in 947 // assignment. Right-hand-side value is passed in r0, variable name in
948 // r2, and the global object on the stack. 948 // r2, and the global object in r1.
949 __ mov(r2, Operand(var->name())); 949 __ mov(r2, Operand(var->name()));
950 __ ldr(ip, CodeGenerator::GlobalObject()); 950 __ ldr(r1, CodeGenerator::GlobalObject());
951 __ push(ip);
952 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 951 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
953 __ Call(ic, RelocInfo::CODE_TARGET); 952 __ Call(ic, RelocInfo::CODE_TARGET);
954 // Overwrite the global object on the stack with the result if needed.
955 DropAndApply(1, context, r0);
956 953
957 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { 954 } else if (slot != NULL && slot->type() == Slot::LOOKUP) {
958 __ push(result_register()); // Value. 955 __ push(result_register()); // Value.
959 __ mov(r1, Operand(var->name())); 956 __ mov(r1, Operand(var->name()));
960 __ stm(db_w, sp, cp.bit() | r1.bit()); // Context and name. 957 __ stm(db_w, sp, cp.bit() | r1.bit()); // Context and name.
961 __ CallRuntime(Runtime::kStoreContextSlot, 3); 958 __ CallRuntime(Runtime::kStoreContextSlot, 3);
962 Apply(context, r0);
963 959
964 } else if (var->slot() != NULL) { 960 } else if (var->slot() != NULL) {
965 Slot* slot = var->slot(); 961 Slot* slot = var->slot();
966 switch (slot->type()) { 962 switch (slot->type()) {
967 case Slot::LOCAL: 963 case Slot::LOCAL:
968 case Slot::PARAMETER: 964 case Slot::PARAMETER:
969 __ str(result_register(), MemOperand(fp, SlotOffset(slot))); 965 __ str(result_register(), MemOperand(fp, SlotOffset(slot)));
970 break; 966 break;
971 967
972 case Slot::CONTEXT: { 968 case Slot::CONTEXT: {
973 MemOperand target = EmitSlotSearch(slot, r1); 969 MemOperand target = EmitSlotSearch(slot, r1);
974 __ str(result_register(), target); 970 __ str(result_register(), target);
975 971
976 // RecordWrite may destroy all its register arguments. 972 // RecordWrite may destroy all its register arguments.
977 __ mov(r3, result_register()); 973 __ mov(r3, result_register());
978 int offset = FixedArray::kHeaderSize + slot->index() * kPointerSize; 974 int offset = FixedArray::kHeaderSize + slot->index() * kPointerSize;
979 975
980 __ mov(r2, Operand(offset)); 976 __ mov(r2, Operand(offset));
981 __ RecordWrite(r1, r2, r3); 977 __ RecordWrite(r1, r2, r3);
982 break; 978 break;
983 } 979 }
984 980
985 case Slot::LOOKUP: 981 case Slot::LOOKUP:
986 UNREACHABLE(); 982 UNREACHABLE();
987 break; 983 break;
988 } 984 }
989 Apply(context, result_register());
990 985
991 } else { 986 } else {
992 // Variables rewritten as properties are not treated as variables in 987 // Variables rewritten as properties are not treated as variables in
993 // assignments. 988 // assignments.
994 UNREACHABLE(); 989 UNREACHABLE();
995 } 990 }
991 Apply(context, result_register());
996 } 992 }
997 993
998 994
999 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 995 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
1000 // Assignment to a property, using a named store IC. 996 // Assignment to a property, using a named store IC.
1001 Property* prop = expr->target()->AsProperty(); 997 Property* prop = expr->target()->AsProperty();
1002 ASSERT(prop != NULL); 998 ASSERT(prop != NULL);
1003 ASSERT(prop->key()->AsLiteral() != NULL); 999 ASSERT(prop->key()->AsLiteral() != NULL);
1004 1000
1005 // If the assignment starts a block of assignments to the same object, 1001 // If the assignment starts a block of assignments to the same object,
1006 // change to slow case to avoid the quadratic behavior of repeatedly 1002 // change to slow case to avoid the quadratic behavior of repeatedly
1007 // adding fast properties. 1003 // adding fast properties.
1008 if (expr->starts_initialization_block()) { 1004 if (expr->starts_initialization_block()) {
1009 __ push(result_register()); 1005 __ push(result_register());
1010 __ ldr(ip, MemOperand(sp, kPointerSize)); // Receiver is now under value. 1006 __ ldr(ip, MemOperand(sp, kPointerSize)); // Receiver is now under value.
1011 __ push(ip); 1007 __ push(ip);
1012 __ CallRuntime(Runtime::kToSlowProperties, 1); 1008 __ CallRuntime(Runtime::kToSlowProperties, 1);
1013 __ pop(result_register()); 1009 __ pop(result_register());
1014 } 1010 }
1015 1011
1016 // Record source code position before IC call. 1012 // Record source code position before IC call.
1017 SetSourcePosition(expr->position()); 1013 SetSourcePosition(expr->position());
1018 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); 1014 __ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
1015 if (expr->ends_initialization_block()) {
1016 __ ldr(r1, MemOperand(sp));
1017 } else {
1018 __ pop(r1);
1019 }
1020
1019 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 1021 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
1020 __ Call(ic, RelocInfo::CODE_TARGET); 1022 __ Call(ic, RelocInfo::CODE_TARGET);
1021 1023
1022 // If the assignment ends an initialization block, revert to fast case. 1024 // If the assignment ends an initialization block, revert to fast case.
1023 if (expr->ends_initialization_block()) { 1025 if (expr->ends_initialization_block()) {
1024 __ push(r0); // Result of assignment, saved even if not needed. 1026 __ push(r0); // Result of assignment, saved even if not needed.
1025 __ ldr(ip, MemOperand(sp, kPointerSize)); // Receiver is under value. 1027 __ ldr(ip, MemOperand(sp, kPointerSize)); // Receiver is under value.
1026 __ push(ip); 1028 __ push(ip);
1027 __ CallRuntime(Runtime::kToFastProperties, 1); 1029 __ CallRuntime(Runtime::kToFastProperties, 1);
1028 __ pop(r0); 1030 __ pop(r0);
1031 DropAndApply(1, context_, r0);
1032 } else {
1033 Apply(context_, r0);
1029 } 1034 }
1030
1031 DropAndApply(1, context_, r0);
1032 } 1035 }
1033 1036
1034 1037
1035 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 1038 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
1036 // Assignment to a property, using a keyed store IC. 1039 // Assignment to a property, using a keyed store IC.
1037 1040
1038 // If the assignment starts a block of assignments to the same object, 1041 // If the assignment starts a block of assignments to the same object,
1039 // change to slow case to avoid the quadratic behavior of repeatedly 1042 // change to slow case to avoid the quadratic behavior of repeatedly
1040 // adding fast properties. 1043 // adding fast properties.
1041 if (expr->starts_initialization_block()) { 1044 if (expr->starts_initialization_block()) {
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 if (context_ != Expression::kEffect) { 1544 if (context_ != Expression::kEffect) {
1542 ApplyTOS(context_); 1545 ApplyTOS(context_);
1543 } 1546 }
1544 } else { 1547 } else {
1545 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 1548 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
1546 context_); 1549 context_);
1547 } 1550 }
1548 break; 1551 break;
1549 case NAMED_PROPERTY: { 1552 case NAMED_PROPERTY: {
1550 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); 1553 __ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
1554 __ pop(r1);
1551 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 1555 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
1552 __ Call(ic, RelocInfo::CODE_TARGET); 1556 __ Call(ic, RelocInfo::CODE_TARGET);
1553 if (expr->is_postfix()) { 1557 if (expr->is_postfix()) {
1554 __ Drop(1); // Result is on the stack under the receiver.
1555 if (context_ != Expression::kEffect) { 1558 if (context_ != Expression::kEffect) {
1556 ApplyTOS(context_); 1559 ApplyTOS(context_);
1557 } 1560 }
1558 } else { 1561 } else {
1559 DropAndApply(1, context_, r0); 1562 Apply(context_, r0);
1560 } 1563 }
1561 break; 1564 break;
1562 } 1565 }
1563 case KEYED_PROPERTY: { 1566 case KEYED_PROPERTY: {
1564 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); 1567 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize));
1565 __ Call(ic, RelocInfo::CODE_TARGET); 1568 __ Call(ic, RelocInfo::CODE_TARGET);
1566 if (expr->is_postfix()) { 1569 if (expr->is_postfix()) {
1567 __ Drop(2); // Result is on the stack under the key and the receiver. 1570 __ Drop(2); // Result is on the stack under the key and the receiver.
1568 if (context_ != Expression::kEffect) { 1571 if (context_ != Expression::kEffect) {
1569 ApplyTOS(context_); 1572 ApplyTOS(context_);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 __ pop(result_register()); 1777 __ pop(result_register());
1775 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); 1778 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize);
1776 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 1779 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
1777 __ add(pc, r1, Operand(masm_->CodeObject())); 1780 __ add(pc, r1, Operand(masm_->CodeObject()));
1778 } 1781 }
1779 1782
1780 1783
1781 #undef __ 1784 #undef __
1782 1785
1783 } } // namespace v8::internal 1786 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/debug-arm.cc ('k') | src/arm/ic-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698