| 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 7243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7254 previous_representation)) { | 7254 previous_representation)) { |
| 7255 break; | 7255 break; |
| 7256 } | 7256 } |
| 7257 } | 7257 } |
| 7258 | 7258 |
| 7259 if (types->length() == count) { | 7259 if (types->length() == count) { |
| 7260 AddInstruction(new(zone()) HCheckNonSmi(object)); | 7260 AddInstruction(new(zone()) HCheckNonSmi(object)); |
| 7261 AddInstruction(HCheckMaps::New(object, types, zone())); | 7261 AddInstruction(HCheckMaps::New(object, types, zone())); |
| 7262 HInstruction* instr = BuildStoreNamedField( | 7262 HInstruction* instr = BuildStoreNamedField( |
| 7263 object, name, value, map, &lookup); | 7263 object, name, value, map, &lookup); |
| 7264 AddInstruction(instr); |
| 7264 instr->set_position(expr->position()); | 7265 instr->set_position(expr->position()); |
| 7265 return ast_context()->ReturnInstruction(instr, expr->id()); | 7266 // The HSimulate for the store should not see the stored value in |
| 7267 // effect contexts (it is not materialized at expr->id() in the |
| 7268 // unoptimized code). |
| 7269 if (instr->HasObservableSideEffects()) { |
| 7270 if (ast_context()->IsEffect()) { |
| 7271 AddSimulate(expr->id(), REMOVABLE_SIMULATE); |
| 7272 } else { |
| 7273 Push(value); |
| 7274 AddSimulate(expr->id(), REMOVABLE_SIMULATE); |
| 7275 Drop(1); |
| 7276 } |
| 7277 } |
| 7278 return ast_context()->ReturnValue(value); |
| 7266 } | 7279 } |
| 7267 } | 7280 } |
| 7268 | 7281 |
| 7269 // TODO(ager): We should recognize when the prototype chains for different | 7282 // TODO(ager): We should recognize when the prototype chains for different |
| 7270 // maps are identical. In that case we can avoid repeatedly generating the | 7283 // maps are identical. In that case we can avoid repeatedly generating the |
| 7271 // same prototype map checks. | 7284 // same prototype map checks. |
| 7272 int count = 0; | 7285 int count = 0; |
| 7273 HBasicBlock* join = NULL; | 7286 HBasicBlock* join = NULL; |
| 7274 for (int i = 0; i < types->length() && count < kMaxStorePolymorphism; ++i) { | 7287 for (int i = 0; i < types->length() && count < kMaxStorePolymorphism; ++i) { |
| 7275 Handle<Map> map = types->at(i); | 7288 Handle<Map> map = types->at(i); |
| (...skipping 5076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12352 } | 12365 } |
| 12353 } | 12366 } |
| 12354 | 12367 |
| 12355 #ifdef DEBUG | 12368 #ifdef DEBUG |
| 12356 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 12369 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 12357 if (allocator_ != NULL) allocator_->Verify(); | 12370 if (allocator_ != NULL) allocator_->Verify(); |
| 12358 #endif | 12371 #endif |
| 12359 } | 12372 } |
| 12360 | 12373 |
| 12361 } } // namespace v8::internal | 12374 } } // namespace v8::internal |
| OLD | NEW |