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 3278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3289 void HGraphBuilder::HandleGlobalVariableAssignment(Variable* var, | 3289 void HGraphBuilder::HandleGlobalVariableAssignment(Variable* var, |
3290 HValue* value, | 3290 HValue* value, |
3291 int position, | 3291 int position, |
3292 int ast_id) { | 3292 int ast_id) { |
3293 LookupResult lookup; | 3293 LookupResult lookup; |
3294 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, true); | 3294 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, true); |
3295 if (type == kUseCell) { | 3295 if (type == kUseCell) { |
3296 bool check_hole = !lookup.IsDontDelete() || lookup.IsReadOnly(); | 3296 bool check_hole = !lookup.IsDontDelete() || lookup.IsReadOnly(); |
3297 Handle<GlobalObject> global(info()->global_object()); | 3297 Handle<GlobalObject> global(info()->global_object()); |
3298 Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(&lookup)); | 3298 Handle<JSGlobalPropertyCell> cell(global->GetPropertyCell(&lookup)); |
3299 HInstruction* instr = new HStoreGlobal(value, cell, check_hole); | 3299 HInstruction* instr = new HStoreGlobalCell(value, cell, check_hole); |
3300 instr->set_position(position); | 3300 instr->set_position(position); |
3301 AddInstruction(instr); | 3301 AddInstruction(instr); |
3302 if (instr->HasSideEffects()) AddSimulate(ast_id); | 3302 if (instr->HasSideEffects()) AddSimulate(ast_id); |
3303 } else { | 3303 } else { |
3304 BAILOUT("global store only supported for cells"); | 3304 HContext* context = new HContext; |
| 3305 AddInstruction(context); |
| 3306 HGlobalObject* global_object = new HGlobalObject(context); |
| 3307 AddInstruction(global_object); |
| 3308 HStoreGlobalGeneric* instr = |
| 3309 new HStoreGlobalGeneric(context, |
| 3310 global_object, |
| 3311 var->name(), |
| 3312 value); |
| 3313 instr->set_position(position); |
| 3314 AddInstruction(instr); |
| 3315 ASSERT(instr->HasSideEffects()); |
| 3316 if (instr->HasSideEffects()) AddSimulate(ast_id); |
3305 } | 3317 } |
3306 } | 3318 } |
3307 | 3319 |
3308 | 3320 |
3309 void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) { | 3321 void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) { |
3310 Expression* target = expr->target(); | 3322 Expression* target = expr->target(); |
3311 VariableProxy* proxy = target->AsVariableProxy(); | 3323 VariableProxy* proxy = target->AsVariableProxy(); |
3312 Variable* var = proxy->AsVariable(); | 3324 Variable* var = proxy->AsVariable(); |
3313 Property* prop = target->AsProperty(); | 3325 Property* prop = target->AsProperty(); |
3314 ASSERT(var == NULL || prop == NULL); | 3326 ASSERT(var == NULL || prop == NULL); |
(...skipping 2636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5951 } | 5963 } |
5952 } | 5964 } |
5953 | 5965 |
5954 #ifdef DEBUG | 5966 #ifdef DEBUG |
5955 if (graph_ != NULL) graph_->Verify(); | 5967 if (graph_ != NULL) graph_->Verify(); |
5956 if (allocator_ != NULL) allocator_->Verify(); | 5968 if (allocator_ != NULL) allocator_->Verify(); |
5957 #endif | 5969 #endif |
5958 } | 5970 } |
5959 | 5971 |
5960 } } // namespace v8::internal | 5972 } } // namespace v8::internal |
OLD | NEW |