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 4988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4999 Handle<Map> map; | 4999 Handle<Map> map; |
5000 if (monomorphic) { | 5000 if (monomorphic) { |
5001 map = types->first(); | 5001 map = types->first(); |
5002 monomorphic = CanInlinePropertyAccess(*map); | 5002 monomorphic = CanInlinePropertyAccess(*map); |
5003 } | 5003 } |
5004 if (monomorphic) { | 5004 if (monomorphic) { |
5005 Handle<JSFunction> setter; | 5005 Handle<JSFunction> setter; |
5006 Handle<JSObject> holder; | 5006 Handle<JSObject> holder; |
5007 if (LookupSetter(map, name, &setter, &holder)) { | 5007 if (LookupSetter(map, name, &setter, &holder)) { |
5008 AddCheckConstantFunction(holder, object, map); | 5008 AddCheckConstantFunction(holder, object, map); |
5009 // Don't try to inline if the result_value is different from the | 5009 if (FLAG_inline_accessors) { |
5010 // store_value. That case isn't handled yet by the inlining. | 5010 if (result_value != store_value) { |
5011 if (result_value == store_value && | 5011 // The result_value and object are already pushed by CountOperation. |
5012 FLAG_inline_accessors && | 5012 // Push(store_value) to complete the arguments to the setter. |
5013 TryInlineSetter(setter, id, assignment_id, store_value)) { | 5013 Push(store_value); |
5014 return; | 5014 bool check = TryInlineSetter(setter, id, assignment_id, store_value); |
| 5015 // Drop the result of the setter to return result_value that's on the |
| 5016 // stack already. |
| 5017 Drop(1); |
| 5018 if (check) return; |
| 5019 } else if (TryInlineSetter(setter, id, assignment_id, store_value)) { |
| 5020 return; |
| 5021 } |
5015 } | 5022 } |
5016 Drop(2); | 5023 Drop(2); |
5017 Add<HPushArgument>(object); | 5024 Add<HPushArgument>(object); |
5018 Add<HPushArgument>(store_value); | 5025 Add<HPushArgument>(store_value); |
5019 instr = new(zone()) HCallConstantFunction(setter, 2); | 5026 instr = new(zone()) HCallConstantFunction(setter, 2); |
5020 } else { | 5027 } else { |
5021 Drop(2); | 5028 Drop(2); |
5022 CHECK_ALIVE(instr = BuildStoreNamedMonomorphic(object, | 5029 CHECK_ALIVE(instr = BuildStoreNamedMonomorphic(object, |
5023 name, | 5030 name, |
5024 store_value, | 5031 store_value, |
(...skipping 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7565 if (prop->key()->IsPropertyName()) { | 7572 if (prop->key()->IsPropertyName()) { |
7566 // Named property. | 7573 // Named property. |
7567 if (returns_original_input) Push(graph()->GetConstantUndefined()); | 7574 if (returns_original_input) Push(graph()->GetConstantUndefined()); |
7568 | 7575 |
7569 CHECK_ALIVE(VisitForValue(prop->obj())); | 7576 CHECK_ALIVE(VisitForValue(prop->obj())); |
7570 HValue* object = Top(); | 7577 HValue* object = Top(); |
7571 PushLoad(prop, object, expr->position(), expr->id(), prop->LoadId()); | 7578 PushLoad(prop, object, expr->position(), expr->id(), prop->LoadId()); |
7572 | 7579 |
7573 after = BuildIncrement(returns_original_input, expr); | 7580 after = BuildIncrement(returns_original_input, expr); |
7574 HValue* result = returns_original_input ? Pop() : after; | 7581 HValue* result = returns_original_input ? Pop() : after; |
| 7582 if (returns_original_input) { |
| 7583 environment()->SetExpressionStackAt(1, result); |
| 7584 } |
7575 | 7585 |
7576 return BuildStoreNamed(expr, expr->id(), expr->position(), | 7586 return BuildStoreNamed(expr, expr->id(), expr->position(), |
7577 expr->AssignmentId(), prop, object, after, result); | 7587 expr->AssignmentId(), prop, object, after, result); |
7578 } else { | 7588 } else { |
7579 // Keyed property. | 7589 // Keyed property. |
7580 if (returns_original_input) Push(graph()->GetConstantUndefined()); | 7590 if (returns_original_input) Push(graph()->GetConstantUndefined()); |
7581 | 7591 |
7582 CHECK_ALIVE(VisitForValue(prop->obj())); | 7592 CHECK_ALIVE(VisitForValue(prop->obj())); |
7583 CHECK_ALIVE(VisitForValue(prop->key())); | 7593 CHECK_ALIVE(VisitForValue(prop->key())); |
7584 HValue* obj = environment()->ExpressionStackAt(1); | 7594 HValue* obj = environment()->ExpressionStackAt(1); |
(...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9708 if (ShouldProduceTraceOutput()) { | 9718 if (ShouldProduceTraceOutput()) { |
9709 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9719 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9710 } | 9720 } |
9711 | 9721 |
9712 #ifdef DEBUG | 9722 #ifdef DEBUG |
9713 graph_->Verify(false); // No full verify. | 9723 graph_->Verify(false); // No full verify. |
9714 #endif | 9724 #endif |
9715 } | 9725 } |
9716 | 9726 |
9717 } } // namespace v8::internal | 9727 } } // namespace v8::internal |
OLD | NEW |