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 "v8.h" | 5 #include "v8.h" |
6 #include "lithium.h" | 6 #include "lithium.h" |
7 #include "scopes.h" | 7 #include "scopes.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
10 #include "ia32/lithium-ia32.h" | 10 #include "ia32/lithium-ia32.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 | 229 |
230 LChunk::LChunk(CompilationInfo* info, HGraph* graph) | 230 LChunk::LChunk(CompilationInfo* info, HGraph* graph) |
231 : spill_slot_count_(0), | 231 : spill_slot_count_(0), |
232 info_(info), | 232 info_(info), |
233 graph_(graph), | 233 graph_(graph), |
234 instructions_(32, graph->zone()), | 234 instructions_(32, graph->zone()), |
235 pointer_maps_(8, graph->zone()), | 235 pointer_maps_(8, graph->zone()), |
236 inlined_closures_(1, graph->zone()) { | 236 inlined_closures_(1, graph->zone()), |
| 237 deprecation_dependencies_(MapLess(), MapAllocator(graph->zone())) { |
237 } | 238 } |
238 | 239 |
239 | 240 |
240 LLabel* LChunk::GetLabel(int block_id) const { | 241 LLabel* LChunk::GetLabel(int block_id) const { |
241 HBasicBlock* block = graph_->blocks()->at(block_id); | 242 HBasicBlock* block = graph_->blocks()->at(block_id); |
242 int first_instruction = block->first_instruction_index(); | 243 int first_instruction = block->first_instruction_index(); |
243 return LLabel::cast(instructions_[first_instruction]); | 244 return LLabel::cast(instructions_[first_instruction]); |
244 } | 245 } |
245 | 246 |
246 | 247 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 return HConstant::cast(graph_->LookupValue(operand->index())); | 366 return HConstant::cast(graph_->LookupValue(operand->index())); |
366 } | 367 } |
367 | 368 |
368 | 369 |
369 Representation LChunk::LookupLiteralRepresentation( | 370 Representation LChunk::LookupLiteralRepresentation( |
370 LConstantOperand* operand) const { | 371 LConstantOperand* operand) const { |
371 return graph_->LookupValue(operand->index())->representation(); | 372 return graph_->LookupValue(operand->index())->representation(); |
372 } | 373 } |
373 | 374 |
374 | 375 |
| 376 void LChunk::CommitDependencies(Handle<Code> code) const { |
| 377 for (MapSet::const_iterator it = deprecation_dependencies_.begin(), |
| 378 iend = deprecation_dependencies_.end(); it != iend; ++it) { |
| 379 Handle<Map> map = *it; |
| 380 ASSERT(!map->is_deprecated()); |
| 381 ASSERT(map->CanBeDeprecated()); |
| 382 Map::AddDependentCode(map, DependentCode::kTransitionGroup, code); |
| 383 } |
| 384 |
| 385 info_->CommitDependencies(code); |
| 386 } |
| 387 |
| 388 |
375 LChunk* LChunk::NewChunk(HGraph* graph) { | 389 LChunk* LChunk::NewChunk(HGraph* graph) { |
376 DisallowHandleAllocation no_handles; | 390 DisallowHandleAllocation no_handles; |
377 DisallowHeapAllocation no_gc; | 391 DisallowHeapAllocation no_gc; |
378 graph->DisallowAddingNewValues(); | 392 graph->DisallowAddingNewValues(); |
379 int values = graph->GetMaximumValueID(); | 393 int values = graph->GetMaximumValueID(); |
380 CompilationInfo* info = graph->info(); | 394 CompilationInfo* info = graph->info(); |
381 if (values > LUnallocated::kMaxVirtualRegisters) { | 395 if (values > LUnallocated::kMaxVirtualRegisters) { |
382 info->set_bailout_reason(kNotEnoughVirtualRegistersForValues); | 396 info->set_bailout_reason(kNotEnoughVirtualRegistersForValues); |
383 return NULL; | 397 return NULL; |
384 } | 398 } |
(...skipping 23 matching lines...) Expand all Loading... |
408 | 422 |
409 MarkEmptyBlocks(); | 423 MarkEmptyBlocks(); |
410 | 424 |
411 if (generator.GenerateCode()) { | 425 if (generator.GenerateCode()) { |
412 generator.CheckEnvironmentUsage(); | 426 generator.CheckEnvironmentUsage(); |
413 CodeGenerator::MakeCodePrologue(info(), "optimized"); | 427 CodeGenerator::MakeCodePrologue(info(), "optimized"); |
414 Code::Flags flags = info()->flags(); | 428 Code::Flags flags = info()->flags(); |
415 Handle<Code> code = | 429 Handle<Code> code = |
416 CodeGenerator::MakeCodeEpilogue(&assembler, flags, info()); | 430 CodeGenerator::MakeCodeEpilogue(&assembler, flags, info()); |
417 generator.FinishCode(code); | 431 generator.FinishCode(code); |
| 432 CommitDependencies(code); |
418 code->set_is_crankshafted(true); | 433 code->set_is_crankshafted(true); |
419 void* jit_handler_data = | 434 void* jit_handler_data = |
420 assembler.positions_recorder()->DetachJITHandlerData(); | 435 assembler.positions_recorder()->DetachJITHandlerData(); |
421 LOG_CODE_EVENT(info()->isolate(), | 436 LOG_CODE_EVENT(info()->isolate(), |
422 CodeEndLinePosInfoRecordEvent(*code, jit_handler_data)); | 437 CodeEndLinePosInfoRecordEvent(*code, jit_handler_data)); |
423 | 438 |
424 CodeGenerator::PrintCode(code, info()); | 439 CodeGenerator::PrintCode(code, info()); |
425 return code; | 440 return code; |
426 } | 441 } |
427 assembler.AbortedCodeGeneration(); | 442 assembler.AbortedCodeGeneration(); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 602 |
588 | 603 |
589 LPhase::~LPhase() { | 604 LPhase::~LPhase() { |
590 if (ShouldProduceTraceOutput()) { | 605 if (ShouldProduceTraceOutput()) { |
591 isolate()->GetHTracer()->TraceLithium(name(), chunk_); | 606 isolate()->GetHTracer()->TraceLithium(name(), chunk_); |
592 } | 607 } |
593 } | 608 } |
594 | 609 |
595 | 610 |
596 } } // namespace v8::internal | 611 } } // namespace v8::internal |
OLD | NEW |