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

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

Issue 4004006: Fix a bug that prevents constants from overwriting function values in object ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 1 month 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 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 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 if (expr->depth() > 1) { 1162 if (expr->depth() > 1) {
1163 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1163 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1164 } else { 1164 } else {
1165 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); 1165 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4);
1166 } 1166 }
1167 1167
1168 // If result_saved is true the result is on top of the stack. If 1168 // If result_saved is true the result is on top of the stack. If
1169 // result_saved is false the result is in r0. 1169 // result_saved is false the result is in r0.
1170 bool result_saved = false; 1170 bool result_saved = false;
1171 1171
1172 // Mark all computed expressions that are bound to a key that
1173 // is shadowed by a later occurrence of the same key. For the
1174 // marked expressions, no store code is emitted.
1175 expr->CalculateEmitStore();
1176
1172 for (int i = 0; i < expr->properties()->length(); i++) { 1177 for (int i = 0; i < expr->properties()->length(); i++) {
1173 ObjectLiteral::Property* property = expr->properties()->at(i); 1178 ObjectLiteral::Property* property = expr->properties()->at(i);
1174 if (property->IsCompileTimeValue()) continue; 1179 if (property->IsCompileTimeValue()) continue;
1175 1180
1176 Literal* key = property->key(); 1181 Literal* key = property->key();
1177 Expression* value = property->value(); 1182 Expression* value = property->value();
1178 if (!result_saved) { 1183 if (!result_saved) {
1179 __ push(r0); // Save result on stack 1184 __ push(r0); // Save result on stack
1180 result_saved = true; 1185 result_saved = true;
1181 } 1186 }
1182 switch (property->kind()) { 1187 switch (property->kind()) {
1183 case ObjectLiteral::Property::CONSTANT: 1188 case ObjectLiteral::Property::CONSTANT:
1184 UNREACHABLE(); 1189 UNREACHABLE();
1185 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 1190 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1186 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); 1191 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value()));
1187 // Fall through. 1192 // Fall through.
1188 case ObjectLiteral::Property::COMPUTED: 1193 case ObjectLiteral::Property::COMPUTED:
1189 if (key->handle()->IsSymbol()) { 1194 if (key->handle()->IsSymbol()) {
1190 VisitForAccumulatorValue(value); 1195 VisitForAccumulatorValue(value);
1191 __ mov(r2, Operand(key->handle())); 1196 __ mov(r2, Operand(key->handle()));
1192 __ ldr(r1, MemOperand(sp)); 1197 __ ldr(r1, MemOperand(sp));
1193 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 1198 if (property->emit_store()) {
1194 EmitCallIC(ic, RelocInfo::CODE_TARGET); 1199 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
1200 EmitCallIC(ic, RelocInfo::CODE_TARGET);
1201 }
1195 break; 1202 break;
1196 } 1203 }
1197 // Fall through. 1204 // Fall through.
1198 case ObjectLiteral::Property::PROTOTYPE: 1205 case ObjectLiteral::Property::PROTOTYPE:
1199 // Duplicate receiver on stack. 1206 // Duplicate receiver on stack.
1200 __ ldr(r0, MemOperand(sp)); 1207 __ ldr(r0, MemOperand(sp));
1201 __ push(r0); 1208 __ push(r0);
1202 VisitForStackValue(key); 1209 VisitForStackValue(key);
1203 VisitForStackValue(value); 1210 VisitForStackValue(value);
1204 __ CallRuntime(Runtime::kSetProperty, 3); 1211 if (property->emit_store()) {
1212 __ CallRuntime(Runtime::kSetProperty, 3);
1213 } else {
1214 __ Drop(3);
1215 }
1205 break; 1216 break;
1206 case ObjectLiteral::Property::GETTER: 1217 case ObjectLiteral::Property::GETTER:
1207 case ObjectLiteral::Property::SETTER: 1218 case ObjectLiteral::Property::SETTER:
1208 // Duplicate receiver on stack. 1219 // Duplicate receiver on stack.
1209 __ ldr(r0, MemOperand(sp)); 1220 __ ldr(r0, MemOperand(sp));
1210 __ push(r0); 1221 __ push(r0);
1211 VisitForStackValue(key); 1222 VisitForStackValue(key);
1212 __ mov(r1, Operand(property->kind() == ObjectLiteral::Property::SETTER ? 1223 __ mov(r1, Operand(property->kind() == ObjectLiteral::Property::SETTER ?
1213 Smi::FromInt(1) : 1224 Smi::FromInt(1) :
1214 Smi::FromInt(0))); 1225 Smi::FromInt(0)));
(...skipping 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3390 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 3401 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
3391 __ add(pc, r1, Operand(masm_->CodeObject())); 3402 __ add(pc, r1, Operand(masm_->CodeObject()));
3392 } 3403 }
3393 3404
3394 3405
3395 #undef __ 3406 #undef __
3396 3407
3397 } } // namespace v8::internal 3408 } } // namespace v8::internal
3398 3409
3399 #endif // V8_TARGET_ARCH_ARM 3410 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/ast.h » ('j') | src/ia32/full-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698