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

Side by Side 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, 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
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | src/ia32/full-codegen-ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 3578 matching lines...) Expand 10 before | Expand all | Expand 10 after
3589 // Constant properties. 3589 // Constant properties.
3590 frame_->EmitPush(Operand(node->constant_properties())); 3590 frame_->EmitPush(Operand(node->constant_properties()));
3591 // Should the object literal have fast elements? 3591 // Should the object literal have fast elements?
3592 frame_->EmitPush(Operand(Smi::FromInt(node->fast_elements() ? 1 : 0))); 3592 frame_->EmitPush(Operand(Smi::FromInt(node->fast_elements() ? 1 : 0)));
3593 if (node->depth() > 1) { 3593 if (node->depth() > 1) {
3594 frame_->CallRuntime(Runtime::kCreateObjectLiteral, 4); 3594 frame_->CallRuntime(Runtime::kCreateObjectLiteral, 4);
3595 } else { 3595 } else {
3596 frame_->CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); 3596 frame_->CallRuntime(Runtime::kCreateObjectLiteralShallow, 4);
3597 } 3597 }
3598 frame_->EmitPush(r0); // save the result 3598 frame_->EmitPush(r0); // save the result
3599
3600 // Mark all computed expressions that are bound to a key that
3601 // is shadowed by a later occurrence of the same key. For the
3602 // marked expressions, no store code is emitted.
3603 node->CalculateEmitStore();
3604
3599 for (int i = 0; i < node->properties()->length(); i++) { 3605 for (int i = 0; i < node->properties()->length(); i++) {
3600 // At the start of each iteration, the top of stack contains 3606 // At the start of each iteration, the top of stack contains
3601 // the newly created object literal. 3607 // the newly created object literal.
3602 ObjectLiteral::Property* property = node->properties()->at(i); 3608 ObjectLiteral::Property* property = node->properties()->at(i);
3603 Literal* key = property->key(); 3609 Literal* key = property->key();
3604 Expression* value = property->value(); 3610 Expression* value = property->value();
3605 switch (property->kind()) { 3611 switch (property->kind()) {
3606 case ObjectLiteral::Property::CONSTANT: 3612 case ObjectLiteral::Property::CONSTANT:
3607 break; 3613 break;
3608 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 3614 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
3609 if (CompileTimeValue::IsCompileTimeValue(property->value())) break; 3615 if (CompileTimeValue::IsCompileTimeValue(property->value())) break;
3610 // else fall through 3616 // else fall through
3611 case ObjectLiteral::Property::COMPUTED: 3617 case ObjectLiteral::Property::COMPUTED:
3612 if (key->handle()->IsSymbol()) { 3618 if (key->handle()->IsSymbol()) {
3613 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 3619 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
3614 Load(value); 3620 Load(value);
3615 frame_->PopToR0(); 3621 if (property->emit_store()) {
3616 // Fetch the object literal. 3622 frame_->PopToR0();
3617 frame_->SpillAllButCopyTOSToR1(); 3623 // Fetch the object literal.
3618 __ mov(r2, Operand(key->handle())); 3624 frame_->SpillAllButCopyTOSToR1();
3619 frame_->CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); 3625 __ mov(r2, Operand(key->handle()));
3626 frame_->CallCodeObject(ic, RelocInfo::CODE_TARGET, 0);
3627 } else {
3628 frame_->Drop();
3629 }
3620 break; 3630 break;
3621 } 3631 }
3622 // else fall through 3632 // else fall through
3623 case ObjectLiteral::Property::PROTOTYPE: { 3633 case ObjectLiteral::Property::PROTOTYPE: {
3624 frame_->Dup(); 3634 frame_->Dup();
3625 Load(key); 3635 Load(key);
3626 Load(value); 3636 Load(value);
3627 frame_->CallRuntime(Runtime::kSetProperty, 3); 3637 if (property->emit_store()) {
3638 frame_->CallRuntime(Runtime::kSetProperty, 3);
3639 } else {
3640 frame_->Drop(3);
3641 }
3628 break; 3642 break;
3629 } 3643 }
3630 case ObjectLiteral::Property::SETTER: { 3644 case ObjectLiteral::Property::SETTER: {
3631 frame_->Dup(); 3645 frame_->Dup();
3632 Load(key); 3646 Load(key);
3633 frame_->EmitPush(Operand(Smi::FromInt(1))); 3647 frame_->EmitPush(Operand(Smi::FromInt(1)));
3634 Load(value); 3648 Load(value);
3635 frame_->CallRuntime(Runtime::kDefineAccessor, 4); 3649 frame_->CallRuntime(Runtime::kDefineAccessor, 4);
3636 break; 3650 break;
3637 } 3651 }
(...skipping 3671 matching lines...) Expand 10 before | Expand all | Expand 10 after
7309 BinaryOpIC::GetName(runtime_operands_type_)); 7323 BinaryOpIC::GetName(runtime_operands_type_));
7310 return name_; 7324 return name_;
7311 } 7325 }
7312 7326
7313 7327
7314 #undef __ 7328 #undef __
7315 7329
7316 } } // namespace v8::internal 7330 } } // namespace v8::internal
7317 7331
7318 #endif // V8_TARGET_ARCH_ARM 7332 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« 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