OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3731 Literal* key = property->key(); | 3731 Literal* key = property->key(); |
3732 Expression* value = property->value(); | 3732 Expression* value = property->value(); |
3733 | 3733 |
3734 switch (property->kind()) { | 3734 switch (property->kind()) { |
3735 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 3735 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
3736 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); | 3736 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); |
3737 // Fall through. | 3737 // Fall through. |
3738 case ObjectLiteral::Property::COMPUTED: | 3738 case ObjectLiteral::Property::COMPUTED: |
3739 if (key->handle()->IsSymbol()) { | 3739 if (key->handle()->IsSymbol()) { |
3740 if (property->emit_store()) { | 3740 if (property->emit_store()) { |
| 3741 property->RecordTypeFeedback(oracle()); |
3741 CHECK_ALIVE(VisitForValue(value)); | 3742 CHECK_ALIVE(VisitForValue(value)); |
3742 HValue* value = Pop(); | 3743 HValue* value = Pop(); |
3743 Handle<String> name = Handle<String>::cast(key->handle()); | 3744 Handle<String> name = Handle<String>::cast(key->handle()); |
3744 HStoreNamedGeneric* store = | 3745 HInstruction* store = BuildStoreNamed(literal, value, property); |
3745 new(zone()) HStoreNamedGeneric( | |
3746 context, | |
3747 literal, | |
3748 name, | |
3749 value, | |
3750 function_strict_mode_flag()); | |
3751 AddInstruction(store); | 3746 AddInstruction(store); |
3752 AddSimulate(key->id()); | 3747 if (store->HasObservableSideEffects()) AddSimulate(key->id()); |
3753 } else { | 3748 } else { |
3754 CHECK_ALIVE(VisitForEffect(value)); | 3749 CHECK_ALIVE(VisitForEffect(value)); |
3755 } | 3750 } |
3756 break; | 3751 break; |
3757 } | 3752 } |
3758 // Fall through. | 3753 // Fall through. |
3759 case ObjectLiteral::Property::PROTOTYPE: | 3754 case ObjectLiteral::Property::PROTOTYPE: |
3760 case ObjectLiteral::Property::SETTER: | 3755 case ObjectLiteral::Property::SETTER: |
3761 case ObjectLiteral::Property::GETTER: | 3756 case ObjectLiteral::Property::GETTER: |
3762 return Bailout("Object literal with complex property"); | 3757 return Bailout("Object literal with complex property"); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3947 context, | 3942 context, |
3948 object, | 3943 object, |
3949 name, | 3944 name, |
3950 value, | 3945 value, |
3951 function_strict_mode_flag()); | 3946 function_strict_mode_flag()); |
3952 } | 3947 } |
3953 | 3948 |
3954 | 3949 |
3955 HInstruction* HGraphBuilder::BuildStoreNamed(HValue* object, | 3950 HInstruction* HGraphBuilder::BuildStoreNamed(HValue* object, |
3956 HValue* value, | 3951 HValue* value, |
| 3952 ObjectLiteral::Property* prop) { |
| 3953 Literal* key = prop->key()->AsLiteral(); |
| 3954 Handle<String> name = Handle<String>::cast(key->handle()); |
| 3955 ASSERT(!name.is_null()); |
| 3956 |
| 3957 LookupResult lookup(isolate()); |
| 3958 Handle<Map> type = prop->GetReceiverType(); |
| 3959 bool is_monomorphic = prop->IsMonomorphic() && |
| 3960 ComputeStoredField(type, name, &lookup); |
| 3961 |
| 3962 return is_monomorphic |
| 3963 ? BuildStoreNamedField(object, name, value, type, &lookup, |
| 3964 true) // Needs smi and map check. |
| 3965 : BuildStoreNamedGeneric(object, name, value); |
| 3966 } |
| 3967 |
| 3968 |
| 3969 HInstruction* HGraphBuilder::BuildStoreNamed(HValue* object, |
| 3970 HValue* value, |
3957 Expression* expr) { | 3971 Expression* expr) { |
3958 Property* prop = (expr->AsProperty() != NULL) | 3972 Property* prop = (expr->AsProperty() != NULL) |
3959 ? expr->AsProperty() | 3973 ? expr->AsProperty() |
3960 : expr->AsAssignment()->target()->AsProperty(); | 3974 : expr->AsAssignment()->target()->AsProperty(); |
3961 Literal* key = prop->key()->AsLiteral(); | 3975 Literal* key = prop->key()->AsLiteral(); |
3962 Handle<String> name = Handle<String>::cast(key->handle()); | 3976 Handle<String> name = Handle<String>::cast(key->handle()); |
3963 ASSERT(!name.is_null()); | 3977 ASSERT(!name.is_null()); |
3964 | 3978 |
3965 LookupResult lookup(isolate()); | 3979 LookupResult lookup(isolate()); |
3966 SmallMapList* types = expr->GetReceiverTypes(); | 3980 SmallMapList* types = expr->GetReceiverTypes(); |
(...skipping 4139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8106 } | 8120 } |
8107 } | 8121 } |
8108 | 8122 |
8109 #ifdef DEBUG | 8123 #ifdef DEBUG |
8110 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 8124 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
8111 if (allocator_ != NULL) allocator_->Verify(); | 8125 if (allocator_ != NULL) allocator_->Verify(); |
8112 #endif | 8126 #endif |
8113 } | 8127 } |
8114 | 8128 |
8115 } } // namespace v8::internal | 8129 } } // namespace v8::internal |
OLD | NEW |