OLD | NEW |
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 Loading... |
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 HLoadGlobalCell* instr = |
3172 HLoadGlobalCell* instr = new(zone()) HLoadGlobalCell(cell, check_hole); | 3172 new(zone()) HLoadGlobalCell(cell, lookup.GetPropertyDetails()); |
3173 return ast_context()->ReturnInstruction(instr, expr->id()); | 3173 return ast_context()->ReturnInstruction(instr, expr->id()); |
3174 } else { | 3174 } else { |
3175 HValue* context = environment()->LookupContext(); | 3175 HValue* context = environment()->LookupContext(); |
3176 HGlobalObject* global_object = new(zone()) HGlobalObject(context); | 3176 HGlobalObject* global_object = new(zone()) HGlobalObject(context); |
3177 AddInstruction(global_object); | 3177 AddInstruction(global_object); |
3178 HLoadGlobalGeneric* instr = | 3178 HLoadGlobalGeneric* instr = |
3179 new(zone()) HLoadGlobalGeneric(context, | 3179 new(zone()) HLoadGlobalGeneric(context, |
3180 global_object, | 3180 global_object, |
3181 variable->name(), | 3181 variable->name(), |
3182 ast_context()->is_for_typeof()); | 3182 ast_context()->is_for_typeof()); |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3623 // Because not every expression has a position and there is not common | 3623 // Because not every expression has a position and there is not common |
3624 // superclass of Assignment and CountOperation, we cannot just pass the | 3624 // superclass of Assignment and CountOperation, we cannot just pass the |
3625 // owning expression instead of position and ast_id separately. | 3625 // owning expression instead of position and ast_id separately. |
3626 void HGraphBuilder::HandleGlobalVariableAssignment(Variable* var, | 3626 void HGraphBuilder::HandleGlobalVariableAssignment(Variable* var, |
3627 HValue* value, | 3627 HValue* value, |
3628 int position, | 3628 int position, |
3629 int ast_id) { | 3629 int ast_id) { |
3630 LookupResult lookup; | 3630 LookupResult lookup; |
3631 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, true); | 3631 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, true); |
3632 if (type == kUseCell) { | 3632 if (type == kUseCell) { |
3633 bool check_hole = !lookup.IsDontDelete() || lookup.IsReadOnly(); | |
3634 Handle<GlobalObject> global(info()->global_object()); | 3633 Handle<GlobalObject> global(info()->global_object()); |
3635 Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(&lookup)); | 3634 Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(&lookup)); |
3636 HInstruction* instr = new(zone()) HStoreGlobalCell(value, cell, check_hole); | 3635 HInstruction* instr = |
| 3636 new(zone()) HStoreGlobalCell(value, cell, lookup.GetPropertyDetails()); |
3637 instr->set_position(position); | 3637 instr->set_position(position); |
3638 AddInstruction(instr); | 3638 AddInstruction(instr); |
3639 if (instr->HasSideEffects()) AddSimulate(ast_id); | 3639 if (instr->HasSideEffects()) AddSimulate(ast_id); |
3640 } else { | 3640 } else { |
3641 HValue* context = environment()->LookupContext(); | 3641 HValue* context = environment()->LookupContext(); |
3642 HGlobalObject* global_object = new(zone()) HGlobalObject(context); | 3642 HGlobalObject* global_object = new(zone()) HGlobalObject(context); |
3643 AddInstruction(global_object); | 3643 AddInstruction(global_object); |
3644 HStoreGlobalGeneric* instr = | 3644 HStoreGlobalGeneric* instr = |
3645 new(zone()) HStoreGlobalGeneric(context, | 3645 new(zone()) HStoreGlobalGeneric(context, |
3646 global_object, | 3646 global_object, |
(...skipping 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6899 } | 6899 } |
6900 } | 6900 } |
6901 | 6901 |
6902 #ifdef DEBUG | 6902 #ifdef DEBUG |
6903 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 6903 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
6904 if (allocator_ != NULL) allocator_->Verify(); | 6904 if (allocator_ != NULL) allocator_->Verify(); |
6905 #endif | 6905 #endif |
6906 } | 6906 } |
6907 | 6907 |
6908 } } // namespace v8::internal | 6908 } } // namespace v8::internal |
OLD | NEW |