| 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 5822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5833 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( | 5833 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( |
| 5834 Variable* var, | 5834 Variable* var, |
| 5835 HValue* value, | 5835 HValue* value, |
| 5836 BailoutId ast_id) { | 5836 BailoutId ast_id) { |
| 5837 LookupResult lookup(isolate()); | 5837 LookupResult lookup(isolate()); |
| 5838 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, true); | 5838 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, true); |
| 5839 if (type == kUseCell) { | 5839 if (type == kUseCell) { |
| 5840 Handle<GlobalObject> global(current_info()->global_object()); | 5840 Handle<GlobalObject> global(current_info()->global_object()); |
| 5841 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); | 5841 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); |
| 5842 if (cell->type()->IsConstant()) { | 5842 if (cell->type()->IsConstant()) { |
| 5843 IfBuilder builder(this); | 5843 Handle<Object> constant = cell->type()->AsConstant(); |
| 5844 HValue* constant = Add<HConstant>(cell->type()->AsConstant()); | 5844 if (value->IsConstant()) { |
| 5845 if (cell->type()->AsConstant()->IsNumber()) { | 5845 HConstant* c_value = HConstant::cast(value); |
| 5846 builder.If<HCompareNumericAndBranch>(value, constant, Token::EQ); | 5846 if (!constant.is_identical_to(c_value->handle(isolate()))) { |
| 5847 Add<HDeoptimize>("Constant global variable assignment", |
| 5848 Deoptimizer::EAGER); |
| 5849 } |
| 5847 } else { | 5850 } else { |
| 5848 builder.If<HCompareObjectEqAndBranch>(value, constant); | 5851 HValue* c_constant = Add<HConstant>(constant); |
| 5852 IfBuilder builder(this); |
| 5853 if (constant->IsNumber()) { |
| 5854 builder.If<HCompareNumericAndBranch>(value, c_constant, Token::EQ); |
| 5855 } else { |
| 5856 builder.If<HCompareObjectEqAndBranch>(value, c_constant); |
| 5857 } |
| 5858 builder.Then(); |
| 5859 builder.Else(); |
| 5860 Add<HDeoptimize>("Constant global variable assignment", |
| 5861 Deoptimizer::EAGER); |
| 5862 builder.End(); |
| 5849 } | 5863 } |
| 5850 builder.Then(); | |
| 5851 builder.Else(); | |
| 5852 Add<HDeoptimize>("Constant global variable assignment", | |
| 5853 Deoptimizer::EAGER); | |
| 5854 builder.End(); | |
| 5855 } | 5864 } |
| 5856 HInstruction* instr = | 5865 HInstruction* instr = |
| 5857 Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails()); | 5866 Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails()); |
| 5858 if (instr->HasObservableSideEffects()) { | 5867 if (instr->HasObservableSideEffects()) { |
| 5859 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 5868 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
| 5860 } | 5869 } |
| 5861 } else { | 5870 } else { |
| 5862 HValue* global_object = Add<HLoadNamedField>( | 5871 HValue* global_object = Add<HLoadNamedField>( |
| 5863 context(), static_cast<HValue*>(NULL), | 5872 context(), static_cast<HValue*>(NULL), |
| 5864 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); | 5873 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
| (...skipping 5377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11242 if (ShouldProduceTraceOutput()) { | 11251 if (ShouldProduceTraceOutput()) { |
| 11243 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11252 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 11244 } | 11253 } |
| 11245 | 11254 |
| 11246 #ifdef DEBUG | 11255 #ifdef DEBUG |
| 11247 graph_->Verify(false); // No full verify. | 11256 graph_->Verify(false); // No full verify. |
| 11248 #endif | 11257 #endif |
| 11249 } | 11258 } |
| 11250 | 11259 |
| 11251 } } // namespace v8::internal | 11260 } } // namespace v8::internal |
| OLD | NEW |