OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 case FAST_HOLEY_ELEMENTS: | 250 case FAST_HOLEY_ELEMENTS: |
251 case DICTIONARY_ELEMENTS: | 251 case DICTIONARY_ELEMENTS: |
252 case NON_STRICT_ARGUMENTS_ELEMENTS: | 252 case NON_STRICT_ARGUMENTS_ELEMENTS: |
253 return kPointerSizeLog2; | 253 return kPointerSizeLog2; |
254 } | 254 } |
255 UNREACHABLE(); | 255 UNREACHABLE(); |
256 return 0; | 256 return 0; |
257 } | 257 } |
258 | 258 |
259 | 259 |
| 260 LChunk::LChunk(CompilationInfo* info, HGraph* graph) |
| 261 : spill_slot_count_(0), |
| 262 info_(info), |
| 263 graph_(graph), |
| 264 instructions_(32, graph->zone()), |
| 265 pointer_maps_(8, graph->zone()), |
| 266 inlined_closures_(1, graph->zone()) { |
| 267 } |
| 268 |
| 269 |
260 LLabel* LChunk::GetLabel(int block_id) const { | 270 LLabel* LChunk::GetLabel(int block_id) const { |
261 HBasicBlock* block = graph_->blocks()->at(block_id); | 271 HBasicBlock* block = graph_->blocks()->at(block_id); |
262 int first_instruction = block->first_instruction_index(); | 272 int first_instruction = block->first_instruction_index(); |
263 return LLabel::cast(instructions_[first_instruction]); | 273 return LLabel::cast(instructions_[first_instruction]); |
264 } | 274 } |
265 | 275 |
266 | 276 |
267 int LChunk::LookupDestination(int block_id) const { | 277 int LChunk::LookupDestination(int block_id) const { |
268 LLabel* cur = GetLabel(block_id); | 278 LLabel* cur = GetLabel(block_id); |
269 while (cur->replacement() != NULL) { | 279 while (cur->replacement() != NULL) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 LAllocator allocator(values, graph); | 413 LAllocator allocator(values, graph); |
404 LChunkBuilder builder(info, graph, &allocator); | 414 LChunkBuilder builder(info, graph, &allocator); |
405 LChunk* chunk = builder.Build(); | 415 LChunk* chunk = builder.Build(); |
406 if (chunk == NULL) return NULL; | 416 if (chunk == NULL) return NULL; |
407 | 417 |
408 if (!allocator.Allocate(chunk)) { | 418 if (!allocator.Allocate(chunk)) { |
409 info->set_bailout_reason("not enough virtual registers (regalloc)"); | 419 info->set_bailout_reason("not enough virtual registers (regalloc)"); |
410 return NULL; | 420 return NULL; |
411 } | 421 } |
412 | 422 |
| 423 chunk->set_allocated_double_registers( |
| 424 allocator.assigned_double_registers()); |
| 425 |
413 return chunk; | 426 return chunk; |
414 } | 427 } |
415 | 428 |
416 | 429 |
417 Handle<Code> LChunk::Codegen(Code::Kind kind) { | 430 Handle<Code> LChunk::Codegen(Code::Kind kind) { |
418 MacroAssembler assembler(info()->isolate(), NULL, 0); | 431 MacroAssembler assembler(info()->isolate(), NULL, 0); |
419 LCodeGen generator(this, &assembler, info()); | 432 LCodeGen generator(this, &assembler, info()); |
420 | 433 |
421 MarkEmptyBlocks(); | 434 MarkEmptyBlocks(); |
422 | 435 |
(...skipping 27 matching lines...) Expand all Loading... |
450 if (map->CanTransition()) { | 463 if (map->CanTransition()) { |
451 maps.Add(map, zone()); | 464 maps.Add(map, zone()); |
452 } | 465 } |
453 } | 466 } |
454 } | 467 } |
455 for (int i = 0; i < maps.length(); i++) { | 468 for (int i = 0; i < maps.length(); i++) { |
456 maps.at(i)->AddDependentCode(code); | 469 maps.at(i)->AddDependentCode(code); |
457 } | 470 } |
458 } | 471 } |
459 | 472 |
| 473 |
| 474 void LChunk::set_allocated_double_registers(BitVector* allocated_registers) { |
| 475 allocated_double_registers_ = allocated_registers; |
| 476 BitVector* doubles = allocated_double_registers(); |
| 477 BitVector::Iterator iterator(doubles); |
| 478 while (!iterator.Done()) { |
| 479 if (info()->saves_caller_doubles()) { |
| 480 if (kDoubleSize == kPointerSize * 2) { |
| 481 spill_slot_count_ += 2; |
| 482 } else { |
| 483 spill_slot_count_++; |
| 484 } |
| 485 } |
| 486 iterator.Advance(); |
| 487 } |
| 488 } |
| 489 |
| 490 |
460 } } // namespace v8::internal | 491 } } // namespace v8::internal |
OLD | NEW |