Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(876)

Side by Side Diff: src/hydrogen.cc

Issue 184303003: Fix handling of constant global variable assignments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: HConstant::DataEquals() is unusable due to the Unique mess. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-347904.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5891 matching lines...) Expand 10 before | Expand all | Expand 10 after
5902 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( 5902 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
5903 Variable* var, 5903 Variable* var,
5904 HValue* value, 5904 HValue* value,
5905 BailoutId ast_id) { 5905 BailoutId ast_id) {
5906 LookupResult lookup(isolate()); 5906 LookupResult lookup(isolate());
5907 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, STORE); 5907 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, STORE);
5908 if (type == kUseCell) { 5908 if (type == kUseCell) {
5909 Handle<GlobalObject> global(current_info()->global_object()); 5909 Handle<GlobalObject> global(current_info()->global_object());
5910 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); 5910 Handle<PropertyCell> cell(global->GetPropertyCell(&lookup));
5911 if (cell->type()->IsConstant()) { 5911 if (cell->type()->IsConstant()) {
5912 IfBuilder builder(this); 5912 Handle<Object> constant = cell->type()->AsConstant();
5913 HValue* constant = Add<HConstant>(cell->type()->AsConstant()); 5913 if (value->IsConstant()) {
5914 if (cell->type()->AsConstant()->IsNumber()) { 5914 HConstant* c_value = HConstant::cast(value);
5915 builder.If<HCompareNumericAndBranch>(value, constant, Token::EQ); 5915 if (!constant.is_identical_to(c_value->handle(isolate()))) {
5916 Add<HDeoptimize>("Constant global variable assignment",
5917 Deoptimizer::EAGER);
5918 }
5916 } else { 5919 } else {
5917 builder.If<HCompareObjectEqAndBranch>(value, constant); 5920 HValue* c_constant = Add<HConstant>(constant);
5921 IfBuilder builder(this);
5922 if (constant->IsNumber()) {
5923 builder.If<HCompareNumericAndBranch>(value, c_constant, Token::EQ);
5924 } else {
5925 builder.If<HCompareObjectEqAndBranch>(value, c_constant);
5926 }
5927 builder.Then();
5928 builder.Else();
5929 Add<HDeoptimize>("Constant global variable assignment",
5930 Deoptimizer::EAGER);
5931 builder.End();
5918 } 5932 }
5919 builder.Then();
5920 builder.Else();
5921 Add<HDeoptimize>("Constant global variable assignment",
5922 Deoptimizer::EAGER);
5923 builder.End();
5924 } 5933 }
5925 HInstruction* instr = 5934 HInstruction* instr =
5926 Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails()); 5935 Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails());
5927 if (instr->HasObservableSideEffects()) { 5936 if (instr->HasObservableSideEffects()) {
5928 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); 5937 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
5929 } 5938 }
5930 } else { 5939 } else {
5931 HValue* global_object = Add<HLoadNamedField>( 5940 HValue* global_object = Add<HLoadNamedField>(
5932 context(), static_cast<HValue*>(NULL), 5941 context(), static_cast<HValue*>(NULL),
5933 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); 5942 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
(...skipping 5355 matching lines...) Expand 10 before | Expand all | Expand 10 after
11289 if (ShouldProduceTraceOutput()) { 11298 if (ShouldProduceTraceOutput()) {
11290 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11299 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11291 } 11300 }
11292 11301
11293 #ifdef DEBUG 11302 #ifdef DEBUG
11294 graph_->Verify(false); // No full verify. 11303 graph_->Verify(false); // No full verify.
11295 #endif 11304 #endif
11296 } 11305 }
11297 11306
11298 } } // namespace v8::internal 11307 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-347904.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698