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

Unified Diff: src/arm/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, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | src/ia32/full-codegen-ia32.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/codegen-arm.cc
===================================================================
--- src/arm/codegen-arm.cc (revision 5712)
+++ src/arm/codegen-arm.cc (working copy)
@@ -3596,6 +3596,12 @@
frame_->CallRuntime(Runtime::kCreateObjectLiteralShallow, 4);
}
frame_->EmitPush(r0); // save the result
+
+ // Mark all computed expressions that are bound to a key that
+ // is shadowed by a later occurrence of the same key. For the
+ // marked expressions, no store code is emitted.
+ node->CalculateEmitStore();
+
for (int i = 0; i < node->properties()->length(); i++) {
// At the start of each iteration, the top of stack contains
// the newly created object literal.
@@ -3612,11 +3618,15 @@
if (key->handle()->IsSymbol()) {
Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
Load(value);
- frame_->PopToR0();
- // Fetch the object literal.
- frame_->SpillAllButCopyTOSToR1();
- __ mov(r2, Operand(key->handle()));
- frame_->CallCodeObject(ic, RelocInfo::CODE_TARGET, 0);
+ if (property->emit_store()) {
+ frame_->PopToR0();
+ // Fetch the object literal.
+ frame_->SpillAllButCopyTOSToR1();
+ __ mov(r2, Operand(key->handle()));
+ frame_->CallCodeObject(ic, RelocInfo::CODE_TARGET, 0);
+ } else {
+ frame_->Drop();
+ }
break;
}
// else fall through
@@ -3624,7 +3634,11 @@
frame_->Dup();
Load(key);
Load(value);
- frame_->CallRuntime(Runtime::kSetProperty, 3);
+ if (property->emit_store()) {
+ frame_->CallRuntime(Runtime::kSetProperty, 3);
+ } else {
+ frame_->Drop(3);
+ }
break;
}
case ObjectLiteral::Property::SETTER: {
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | src/ia32/full-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698