OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 4811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4822 if (count != types->length()) return false; | 4822 if (count != types->length()) return false; |
4823 | 4823 |
4824 // Everything matched; can use monomorphic store. | 4824 // Everything matched; can use monomorphic store. |
4825 BuildCheckHeapObject(object); | 4825 BuildCheckHeapObject(object); |
4826 AddInstruction(HCheckMaps::New(object, types, zone())); | 4826 AddInstruction(HCheckMaps::New(object, types, zone())); |
4827 HInstruction* store; | 4827 HInstruction* store; |
4828 CHECK_ALIVE_OR_RETURN( | 4828 CHECK_ALIVE_OR_RETURN( |
4829 store = BuildStoreNamedField( | 4829 store = BuildStoreNamedField( |
4830 object, name, store_value, types->at(count - 1), &lookup), | 4830 object, name, store_value, types->at(count - 1), &lookup), |
4831 true); | 4831 true); |
4832 Push(result_value); | 4832 if (!ast_context()->IsEffect()) Push(result_value); |
4833 store->set_position(position); | 4833 store->set_position(position); |
4834 AddInstruction(store); | 4834 AddInstruction(store); |
4835 AddSimulate(assignment_id); | 4835 AddSimulate(assignment_id); |
4836 ast_context()->ReturnValue(Pop()); | 4836 if (!ast_context()->IsEffect()) Drop(1); |
| 4837 ast_context()->ReturnValue(result_value); |
4837 return true; | 4838 return true; |
4838 } | 4839 } |
4839 | 4840 |
4840 | 4841 |
4841 void HOptimizedGraphBuilder::HandlePolymorphicStoreNamedField( | 4842 void HOptimizedGraphBuilder::HandlePolymorphicStoreNamedField( |
4842 int position, | 4843 int position, |
4843 BailoutId assignment_id, | 4844 BailoutId assignment_id, |
4844 HValue* object, | 4845 HValue* object, |
4845 HValue* store_value, | 4846 HValue* store_value, |
4846 HValue* result_value, | 4847 HValue* result_value, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5052 } else if (types != NULL && types->length() > 1) { | 5053 } else if (types != NULL && types->length() > 1) { |
5053 Drop(2); | 5054 Drop(2); |
5054 return HandlePolymorphicStoreNamedField( | 5055 return HandlePolymorphicStoreNamedField( |
5055 position, id, object, | 5056 position, id, object, |
5056 store_value, result_value, types, name); | 5057 store_value, result_value, types, name); |
5057 } else { | 5058 } else { |
5058 Drop(2); | 5059 Drop(2); |
5059 instr = BuildStoreNamedGeneric(object, name, store_value); | 5060 instr = BuildStoreNamedGeneric(object, name, store_value); |
5060 } | 5061 } |
5061 | 5062 |
5062 Push(result_value); | 5063 if (!ast_context()->IsEffect()) Push(result_value); |
5063 instr->set_position(position); | 5064 instr->set_position(position); |
5064 AddInstruction(instr); | 5065 AddInstruction(instr); |
5065 if (instr->HasObservableSideEffects()) { | 5066 if (instr->HasObservableSideEffects()) { |
5066 AddSimulate(id, REMOVABLE_SIMULATE); | 5067 AddSimulate(id, REMOVABLE_SIMULATE); |
5067 } | 5068 } |
5068 return ast_context()->ReturnValue(Pop()); | 5069 if (!ast_context()->IsEffect()) Drop(1); |
| 5070 return ast_context()->ReturnValue(result_value); |
5069 } | 5071 } |
5070 | 5072 |
5071 | 5073 |
5072 void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) { | 5074 void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) { |
5073 Expression* target = expr->target(); | 5075 Expression* target = expr->target(); |
5074 VariableProxy* proxy = target->AsVariableProxy(); | 5076 VariableProxy* proxy = target->AsVariableProxy(); |
5075 Property* prop = target->AsProperty(); | 5077 Property* prop = target->AsProperty(); |
5076 ASSERT(proxy == NULL || prop == NULL); | 5078 ASSERT(proxy == NULL || prop == NULL); |
5077 | 5079 |
5078 // We have a second position recorded in the FullCodeGenerator to have | 5080 // We have a second position recorded in the FullCodeGenerator to have |
(...skipping 4833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9912 if (ShouldProduceTraceOutput()) { | 9914 if (ShouldProduceTraceOutput()) { |
9913 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9915 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9914 } | 9916 } |
9915 | 9917 |
9916 #ifdef DEBUG | 9918 #ifdef DEBUG |
9917 graph_->Verify(false); // No full verify. | 9919 graph_->Verify(false); // No full verify. |
9918 #endif | 9920 #endif |
9919 } | 9921 } |
9920 | 9922 |
9921 } } // namespace v8::internal | 9923 } } // namespace v8::internal |
OLD | NEW |