OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/lithium.h" | 5 #include "src/lithium.h" |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/scopes.h" | 9 #include "src/scopes.h" |
10 | 10 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 } | 266 } |
267 | 267 |
268 | 268 |
269 LChunk::LChunk(CompilationInfo* info, HGraph* graph) | 269 LChunk::LChunk(CompilationInfo* info, HGraph* graph) |
270 : spill_slot_count_(0), | 270 : spill_slot_count_(0), |
271 info_(info), | 271 info_(info), |
272 graph_(graph), | 272 graph_(graph), |
273 instructions_(32, info->zone()), | 273 instructions_(32, info->zone()), |
274 pointer_maps_(8, info->zone()), | 274 pointer_maps_(8, info->zone()), |
275 inlined_functions_(1, info->zone()), | 275 inlined_functions_(1, info->zone()), |
276 deprecation_dependencies_(MapLess(), MapAllocator(info->zone())), | 276 deprecation_dependencies_(32, info->zone()), |
277 stability_dependencies_(MapLess(), MapAllocator(info->zone())) {} | 277 stability_dependencies_(8, info->zone()) {} |
278 | 278 |
279 | 279 |
280 LLabel* LChunk::GetLabel(int block_id) const { | 280 LLabel* LChunk::GetLabel(int block_id) const { |
281 HBasicBlock* block = graph_->blocks()->at(block_id); | 281 HBasicBlock* block = graph_->blocks()->at(block_id); |
282 int first_instruction = block->first_instruction_index(); | 282 int first_instruction = block->first_instruction_index(); |
283 return LLabel::cast(instructions_[first_instruction]); | 283 return LLabel::cast(instructions_[first_instruction]); |
284 } | 284 } |
285 | 285 |
286 | 286 |
287 int LChunk::LookupDestination(int block_id) const { | 287 int LChunk::LookupDestination(int block_id) const { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 AddWeakObjectToCodeDependency(isolate(), objects.at(i), code); | 457 AddWeakObjectToCodeDependency(isolate(), objects.at(i), code); |
458 } | 458 } |
459 code->set_can_have_weak_objects(true); | 459 code->set_can_have_weak_objects(true); |
460 } | 460 } |
461 | 461 |
462 | 462 |
463 void LChunk::CommitDependencies(Handle<Code> code) const { | 463 void LChunk::CommitDependencies(Handle<Code> code) const { |
464 if (!code->is_optimized_code()) return; | 464 if (!code->is_optimized_code()) return; |
465 HandleScope scope(isolate()); | 465 HandleScope scope(isolate()); |
466 | 466 |
467 for (MapSet::const_iterator it = deprecation_dependencies_.begin(), | 467 for (Handle<Map> map : deprecation_dependencies_) { |
468 iend = deprecation_dependencies_.end(); it != iend; ++it) { | |
469 Handle<Map> map = *it; | |
470 DCHECK(!map->is_deprecated()); | 468 DCHECK(!map->is_deprecated()); |
471 DCHECK(map->CanBeDeprecated()); | 469 DCHECK(map->CanBeDeprecated()); |
472 Map::AddDependentCode(map, DependentCode::kTransitionGroup, code); | 470 Map::AddDependentCode(map, DependentCode::kTransitionGroup, code); |
473 } | 471 } |
474 | 472 |
475 for (MapSet::const_iterator it = stability_dependencies_.begin(), | 473 for (Handle<Map> map : stability_dependencies_) { |
476 iend = stability_dependencies_.end(); it != iend; ++it) { | |
477 Handle<Map> map = *it; | |
478 DCHECK(map->is_stable()); | 474 DCHECK(map->is_stable()); |
479 DCHECK(map->CanTransition()); | 475 DCHECK(map->CanTransition()); |
480 Map::AddDependentCode(map, DependentCode::kPrototypeCheckGroup, code); | 476 Map::AddDependentCode(map, DependentCode::kPrototypeCheckGroup, code); |
481 } | 477 } |
482 | 478 |
483 info_->dependencies()->Commit(code); | 479 info_->dependencies()->Commit(code); |
484 RegisterWeakObjectsInOptimizedCode(code); | 480 RegisterWeakObjectsInOptimizedCode(code); |
485 } | 481 } |
486 | 482 |
487 | 483 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 713 |
718 LPhase::~LPhase() { | 714 LPhase::~LPhase() { |
719 if (ShouldProduceTraceOutput()) { | 715 if (ShouldProduceTraceOutput()) { |
720 isolate()->GetHTracer()->TraceLithium(name(), chunk_); | 716 isolate()->GetHTracer()->TraceLithium(name(), chunk_); |
721 } | 717 } |
722 } | 718 } |
723 | 719 |
724 | 720 |
725 } // namespace internal | 721 } // namespace internal |
726 } // namespace v8 | 722 } // namespace v8 |
OLD | NEW |