| 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 #include "src/serialize.h" | 10 #include "src/serialize.h" |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 | 409 |
| 410 Representation LChunk::LookupLiteralRepresentation( | 410 Representation LChunk::LookupLiteralRepresentation( |
| 411 LConstantOperand* operand) const { | 411 LConstantOperand* operand) const { |
| 412 return graph_->LookupValue(operand->index())->representation(); | 412 return graph_->LookupValue(operand->index())->representation(); |
| 413 } | 413 } |
| 414 | 414 |
| 415 | 415 |
| 416 static void AddWeakObjectToCodeDependency(Isolate* isolate, | 416 static void AddWeakObjectToCodeDependency(Isolate* isolate, |
| 417 Handle<Object> object, | 417 Handle<Object> object, |
| 418 Handle<Code> code) { | 418 Handle<Code> code) { |
| 419 Handle<WeakCell> cell = Code::WeakCellFor(code); |
| 419 Heap* heap = isolate->heap(); | 420 Heap* heap = isolate->heap(); |
| 420 heap->EnsureWeakObjectToCodeTable(); | 421 heap->EnsureWeakObjectToCodeTable(); |
| 421 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(object)); | 422 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(object)); |
| 422 dep = DependentCode::Insert(dep, DependentCode::kWeakCodeGroup, code); | 423 dep = DependentCode::InsertWeakCode(dep, DependentCode::kWeakCodeGroup, cell); |
| 423 heap->AddWeakObjectToCodeDependency(object, dep); | 424 heap->AddWeakObjectToCodeDependency(object, dep); |
| 424 } | 425 } |
| 425 | 426 |
| 426 | 427 |
| 427 void LChunk::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) const { | 428 void LChunk::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) const { |
| 428 DCHECK(code->is_optimized_code()); | 429 DCHECK(code->is_optimized_code()); |
| 429 ZoneList<Handle<Map> > maps(1, zone()); | 430 ZoneList<Handle<Map> > maps(1, zone()); |
| 430 ZoneList<Handle<JSObject> > objects(1, zone()); | 431 ZoneList<Handle<JSObject> > objects(1, zone()); |
| 431 ZoneList<Handle<Cell> > cells(1, zone()); | 432 ZoneList<Handle<Cell> > cells(1, zone()); |
| 432 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 433 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| (...skipping 29 matching lines...) Expand all Loading... |
| 462 } | 463 } |
| 463 if (FLAG_enable_ool_constant_pool) { | 464 if (FLAG_enable_ool_constant_pool) { |
| 464 code->constant_pool()->set_weak_object_state( | 465 code->constant_pool()->set_weak_object_state( |
| 465 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE); | 466 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE); |
| 466 } | 467 } |
| 467 code->set_can_have_weak_objects(true); | 468 code->set_can_have_weak_objects(true); |
| 468 } | 469 } |
| 469 | 470 |
| 470 | 471 |
| 471 void LChunk::CommitDependencies(Handle<Code> code) const { | 472 void LChunk::CommitDependencies(Handle<Code> code) const { |
| 473 if (!code->is_optimized_code()) return; |
| 474 HandleScope scope(isolate()); |
| 475 |
| 472 for (MapSet::const_iterator it = deprecation_dependencies_.begin(), | 476 for (MapSet::const_iterator it = deprecation_dependencies_.begin(), |
| 473 iend = deprecation_dependencies_.end(); it != iend; ++it) { | 477 iend = deprecation_dependencies_.end(); it != iend; ++it) { |
| 474 Handle<Map> map = *it; | 478 Handle<Map> map = *it; |
| 475 DCHECK(!map->is_deprecated()); | 479 DCHECK(!map->is_deprecated()); |
| 476 DCHECK(map->CanBeDeprecated()); | 480 DCHECK(map->CanBeDeprecated()); |
| 477 Map::AddDependentCode(map, DependentCode::kTransitionGroup, code); | 481 Map::AddDependentCode(map, DependentCode::kTransitionGroup, code); |
| 478 } | 482 } |
| 479 | 483 |
| 480 for (MapSet::const_iterator it = stability_dependencies_.begin(), | 484 for (MapSet::const_iterator it = stability_dependencies_.begin(), |
| 481 iend = stability_dependencies_.end(); it != iend; ++it) { | 485 iend = stability_dependencies_.end(); it != iend; ++it) { |
| 482 Handle<Map> map = *it; | 486 Handle<Map> map = *it; |
| 483 DCHECK(map->is_stable()); | 487 DCHECK(map->is_stable()); |
| 484 DCHECK(map->CanTransition()); | 488 DCHECK(map->CanTransition()); |
| 485 Map::AddDependentCode(map, DependentCode::kPrototypeCheckGroup, code); | 489 Map::AddDependentCode(map, DependentCode::kPrototypeCheckGroup, code); |
| 486 } | 490 } |
| 487 | 491 |
| 488 info_->CommitDependencies(code); | 492 info_->CommitDependencies(code); |
| 489 if (code->is_optimized_code()) RegisterWeakObjectsInOptimizedCode(code); | 493 RegisterWeakObjectsInOptimizedCode(code); |
| 490 } | 494 } |
| 491 | 495 |
| 492 | 496 |
| 493 LChunk* LChunk::NewChunk(HGraph* graph) { | 497 LChunk* LChunk::NewChunk(HGraph* graph) { |
| 494 DisallowHandleAllocation no_handles; | 498 DisallowHandleAllocation no_handles; |
| 495 DisallowHeapAllocation no_gc; | 499 DisallowHeapAllocation no_gc; |
| 496 graph->DisallowAddingNewValues(); | 500 graph->DisallowAddingNewValues(); |
| 497 int values = graph->GetMaximumValueID(); | 501 int values = graph->GetMaximumValueID(); |
| 498 CompilationInfo* info = graph->info(); | 502 CompilationInfo* info = graph->info(); |
| 499 if (values > LUnallocated::kMaxVirtualRegisters) { | 503 if (values > LUnallocated::kMaxVirtualRegisters) { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 | 725 |
| 722 | 726 |
| 723 LPhase::~LPhase() { | 727 LPhase::~LPhase() { |
| 724 if (ShouldProduceTraceOutput()) { | 728 if (ShouldProduceTraceOutput()) { |
| 725 isolate()->GetHTracer()->TraceLithium(name(), chunk_); | 729 isolate()->GetHTracer()->TraceLithium(name(), chunk_); |
| 726 } | 730 } |
| 727 } | 731 } |
| 728 | 732 |
| 729 | 733 |
| 730 } } // namespace v8::internal | 734 } } // namespace v8::internal |
| OLD | NEW |