OLD | NEW |
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 4848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4859 // Should the object literal have fast elements? | 4859 // Should the object literal have fast elements? |
4860 frame_->Push(Smi::FromInt(node->fast_elements() ? 1 : 0)); | 4860 frame_->Push(Smi::FromInt(node->fast_elements() ? 1 : 0)); |
4861 Result clone; | 4861 Result clone; |
4862 if (node->depth() > 1) { | 4862 if (node->depth() > 1) { |
4863 clone = frame_->CallRuntime(Runtime::kCreateObjectLiteral, 4); | 4863 clone = frame_->CallRuntime(Runtime::kCreateObjectLiteral, 4); |
4864 } else { | 4864 } else { |
4865 clone = frame_->CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 4865 clone = frame_->CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
4866 } | 4866 } |
4867 frame_->Push(&clone); | 4867 frame_->Push(&clone); |
4868 | 4868 |
| 4869 // Mark all computed expressions that are bound to a key that |
| 4870 // is shadowed by a later occurrence of the same key. For the |
| 4871 // marked expressions, no store code is emitted. |
| 4872 node->CalculateEmitStore(); |
| 4873 |
4869 for (int i = 0; i < node->properties()->length(); i++) { | 4874 for (int i = 0; i < node->properties()->length(); i++) { |
4870 ObjectLiteral::Property* property = node->properties()->at(i); | 4875 ObjectLiteral::Property* property = node->properties()->at(i); |
4871 switch (property->kind()) { | 4876 switch (property->kind()) { |
4872 case ObjectLiteral::Property::CONSTANT: | 4877 case ObjectLiteral::Property::CONSTANT: |
4873 break; | 4878 break; |
4874 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 4879 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
4875 if (CompileTimeValue::IsCompileTimeValue(property->value())) break; | 4880 if (CompileTimeValue::IsCompileTimeValue(property->value())) break; |
4876 // else fall through. | 4881 // else fall through. |
4877 case ObjectLiteral::Property::COMPUTED: { | 4882 case ObjectLiteral::Property::COMPUTED: { |
4878 Handle<Object> key(property->key()->handle()); | 4883 Handle<Object> key(property->key()->handle()); |
4879 if (key->IsSymbol()) { | 4884 if (key->IsSymbol()) { |
4880 // Duplicate the object as the IC receiver. | 4885 // Duplicate the object as the IC receiver. |
4881 frame_->Dup(); | 4886 frame_->Dup(); |
4882 Load(property->value()); | 4887 Load(property->value()); |
4883 Result ignored = | 4888 if (property->emit_store()) { |
4884 frame_->CallStoreIC(Handle<String>::cast(key), false); | 4889 Result ignored = |
4885 // A test rax instruction following the store IC call would | 4890 frame_->CallStoreIC(Handle<String>::cast(key), false); |
4886 // indicate the presence of an inlined version of the | 4891 // A test rax instruction following the store IC call would |
4887 // store. Add a nop to indicate that there is no such | 4892 // indicate the presence of an inlined version of the |
4888 // inlined version. | 4893 // store. Add a nop to indicate that there is no such |
4889 __ nop(); | 4894 // inlined version. |
| 4895 __ nop(); |
| 4896 } else { |
| 4897 frame_->Drop(2); |
| 4898 } |
4890 break; | 4899 break; |
4891 } | 4900 } |
4892 // Fall through | 4901 // Fall through |
4893 } | 4902 } |
4894 case ObjectLiteral::Property::PROTOTYPE: { | 4903 case ObjectLiteral::Property::PROTOTYPE: { |
4895 // Duplicate the object as an argument to the runtime call. | 4904 // Duplicate the object as an argument to the runtime call. |
4896 frame_->Dup(); | 4905 frame_->Dup(); |
4897 Load(property->key()); | 4906 Load(property->key()); |
4898 Load(property->value()); | 4907 Load(property->value()); |
4899 Result ignored = frame_->CallRuntime(Runtime::kSetProperty, 3); | 4908 if (property->emit_store()) { |
4900 // Ignore the result. | 4909 // Ignore the result. |
| 4910 Result ignored = frame_->CallRuntime(Runtime::kSetProperty, 3); |
| 4911 } else { |
| 4912 frame_->Drop(3); |
| 4913 } |
4901 break; | 4914 break; |
4902 } | 4915 } |
4903 case ObjectLiteral::Property::SETTER: { | 4916 case ObjectLiteral::Property::SETTER: { |
4904 // Duplicate the object as an argument to the runtime call. | 4917 // Duplicate the object as an argument to the runtime call. |
4905 frame_->Dup(); | 4918 frame_->Dup(); |
4906 Load(property->key()); | 4919 Load(property->key()); |
4907 frame_->Push(Smi::FromInt(1)); | 4920 frame_->Push(Smi::FromInt(1)); |
4908 Load(property->value()); | 4921 Load(property->value()); |
4909 Result ignored = frame_->CallRuntime(Runtime::kDefineAccessor, 4); | 4922 Result ignored = frame_->CallRuntime(Runtime::kDefineAccessor, 4); |
4910 // Ignore the result. | 4923 // Ignore the result. |
(...skipping 4012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8923 #undef __ | 8936 #undef __ |
8924 | 8937 |
8925 void RecordWriteStub::Generate(MacroAssembler* masm) { | 8938 void RecordWriteStub::Generate(MacroAssembler* masm) { |
8926 masm->RecordWriteHelper(object_, addr_, scratch_); | 8939 masm->RecordWriteHelper(object_, addr_, scratch_); |
8927 masm->ret(0); | 8940 masm->ret(0); |
8928 } | 8941 } |
8929 | 8942 |
8930 } } // namespace v8::internal | 8943 } } // namespace v8::internal |
8931 | 8944 |
8932 #endif // V8_TARGET_ARCH_X64 | 8945 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |