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

Side by Side Diff: src/hydrogen.cc

Issue 8054008: Improve our simple elimination of hole checks. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 2 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3150 matching lines...) Expand 10 before | Expand all | Expand 10 after
3161 LookupGlobalProperty(variable, &lookup, false); 3161 LookupGlobalProperty(variable, &lookup, false);
3162 3162
3163 if (type == kUseCell && 3163 if (type == kUseCell &&
3164 info()->global_object()->IsAccessCheckNeeded()) { 3164 info()->global_object()->IsAccessCheckNeeded()) {
3165 type = kUseGeneric; 3165 type = kUseGeneric;
3166 } 3166 }
3167 3167
3168 if (type == kUseCell) { 3168 if (type == kUseCell) {
3169 Handle<GlobalObject> global(info()->global_object()); 3169 Handle<GlobalObject> global(info()->global_object());
3170 Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(&lookup)); 3170 Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(&lookup));
3171 bool check_hole = !lookup.IsDontDelete() || lookup.IsReadOnly(); 3171 bool deleteable_or_const =
3172 HLoadGlobalCell* instr = new(zone()) HLoadGlobalCell(cell, check_hole); 3172 !lookup.IsDontDelete() || lookup.IsReadOnly();
3173 HLoadGlobalCell* instr =
3174 new(zone()) HLoadGlobalCell(cell, deleteable_or_const);
3173 return ast_context()->ReturnInstruction(instr, expr->id()); 3175 return ast_context()->ReturnInstruction(instr, expr->id());
3174 } else { 3176 } else {
3175 HValue* context = environment()->LookupContext(); 3177 HValue* context = environment()->LookupContext();
3176 HGlobalObject* global_object = new(zone()) HGlobalObject(context); 3178 HGlobalObject* global_object = new(zone()) HGlobalObject(context);
3177 AddInstruction(global_object); 3179 AddInstruction(global_object);
3178 HLoadGlobalGeneric* instr = 3180 HLoadGlobalGeneric* instr =
3179 new(zone()) HLoadGlobalGeneric(context, 3181 new(zone()) HLoadGlobalGeneric(context,
3180 global_object, 3182 global_object,
3181 variable->name(), 3183 variable->name(),
3182 ast_context()->is_for_typeof()); 3184 ast_context()->is_for_typeof());
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
3623 // Because not every expression has a position and there is not common 3625 // Because not every expression has a position and there is not common
3624 // superclass of Assignment and CountOperation, we cannot just pass the 3626 // superclass of Assignment and CountOperation, we cannot just pass the
3625 // owning expression instead of position and ast_id separately. 3627 // owning expression instead of position and ast_id separately.
3626 void HGraphBuilder::HandleGlobalVariableAssignment(Variable* var, 3628 void HGraphBuilder::HandleGlobalVariableAssignment(Variable* var,
3627 HValue* value, 3629 HValue* value,
3628 int position, 3630 int position,
3629 int ast_id) { 3631 int ast_id) {
3630 LookupResult lookup; 3632 LookupResult lookup;
3631 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, true); 3633 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, true);
3632 if (type == kUseCell) { 3634 if (type == kUseCell) {
3633 bool check_hole = !lookup.IsDontDelete() || lookup.IsReadOnly(); 3635 bool deleteable_or_const = !lookup.IsDontDelete() || lookup.IsReadOnly();
3634 Handle<GlobalObject> global(info()->global_object()); 3636 Handle<GlobalObject> global(info()->global_object());
3635 Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(&lookup)); 3637 Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(&lookup));
3636 HInstruction* instr = new(zone()) HStoreGlobalCell(value, cell, check_hole); 3638 HInstruction* instr =
3639 new(zone()) HStoreGlobalCell(value, cell, deleteable_or_const);
3637 instr->set_position(position); 3640 instr->set_position(position);
3638 AddInstruction(instr); 3641 AddInstruction(instr);
3639 if (instr->HasSideEffects()) AddSimulate(ast_id); 3642 if (instr->HasSideEffects()) AddSimulate(ast_id);
3640 } else { 3643 } else {
3641 HValue* context = environment()->LookupContext(); 3644 HValue* context = environment()->LookupContext();
3642 HGlobalObject* global_object = new(zone()) HGlobalObject(context); 3645 HGlobalObject* global_object = new(zone()) HGlobalObject(context);
3643 AddInstruction(global_object); 3646 AddInstruction(global_object);
3644 HStoreGlobalGeneric* instr = 3647 HStoreGlobalGeneric* instr =
3645 new(zone()) HStoreGlobalGeneric(context, 3648 new(zone()) HStoreGlobalGeneric(context,
3646 global_object, 3649 global_object,
(...skipping 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after
6899 } 6902 }
6900 } 6903 }
6901 6904
6902 #ifdef DEBUG 6905 #ifdef DEBUG
6903 if (graph_ != NULL) graph_->Verify(false); // No full verify. 6906 if (graph_ != NULL) graph_->Verify(false); // No full verify.
6904 if (allocator_ != NULL) allocator_->Verify(); 6907 if (allocator_ != NULL) allocator_->Verify();
6905 #endif 6908 #endif
6906 } 6909 }
6907 6910
6908 } } // namespace v8::internal 6911 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698