OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/address-map.h" | 7 #include "src/address-map.h" |
8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 translations_.CreateByteArray(isolate()->factory()); | 528 translations_.CreateByteArray(isolate()->factory()); |
529 | 529 |
530 data->SetTranslationByteArray(*translation_array); | 530 data->SetTranslationByteArray(*translation_array); |
531 data->SetInlinedFunctionCount( | 531 data->SetInlinedFunctionCount( |
532 Smi::FromInt(static_cast<int>(inlined_function_count_))); | 532 Smi::FromInt(static_cast<int>(inlined_function_count_))); |
533 data->SetOptimizationId(Smi::FromInt(info->optimization_id())); | 533 data->SetOptimizationId(Smi::FromInt(info->optimization_id())); |
534 | 534 |
535 if (info->has_shared_info()) { | 535 if (info->has_shared_info()) { |
536 data->SetSharedFunctionInfo(*info->shared_info()); | 536 data->SetSharedFunctionInfo(*info->shared_info()); |
537 } else { | 537 } else { |
538 data->SetSharedFunctionInfo(Smi::FromInt(0)); | 538 data->SetSharedFunctionInfo(Smi::kZero); |
539 } | 539 } |
540 | 540 |
541 Handle<FixedArray> literals = isolate()->factory()->NewFixedArray( | 541 Handle<FixedArray> literals = isolate()->factory()->NewFixedArray( |
542 static_cast<int>(deoptimization_literals_.size()), TENURED); | 542 static_cast<int>(deoptimization_literals_.size()), TENURED); |
543 { | 543 { |
544 AllowDeferredHandleDereference copy_handles; | 544 AllowDeferredHandleDereference copy_handles; |
545 for (unsigned i = 0; i < deoptimization_literals_.size(); i++) { | 545 for (unsigned i = 0; i < deoptimization_literals_.size(); i++) { |
546 literals->set(i, *deoptimization_literals_[i]); | 546 literals->set(i, *deoptimization_literals_[i]); |
547 } | 547 } |
548 data->SetLiteralArray(*literals); | 548 data->SetLiteralArray(*literals); |
549 } | 549 } |
550 | 550 |
551 if (info->is_osr()) { | 551 if (info->is_osr()) { |
552 DCHECK(osr_pc_offset_ >= 0); | 552 DCHECK(osr_pc_offset_ >= 0); |
553 data->SetOsrAstId(Smi::FromInt(info_->osr_ast_id().ToInt())); | 553 data->SetOsrAstId(Smi::FromInt(info_->osr_ast_id().ToInt())); |
554 data->SetOsrPcOffset(Smi::FromInt(osr_pc_offset_)); | 554 data->SetOsrPcOffset(Smi::FromInt(osr_pc_offset_)); |
555 } else { | 555 } else { |
556 BailoutId osr_ast_id = BailoutId::None(); | 556 BailoutId osr_ast_id = BailoutId::None(); |
557 data->SetOsrAstId(Smi::FromInt(osr_ast_id.ToInt())); | 557 data->SetOsrAstId(Smi::FromInt(osr_ast_id.ToInt())); |
558 data->SetOsrPcOffset(Smi::FromInt(-1)); | 558 data->SetOsrPcOffset(Smi::FromInt(-1)); |
559 } | 559 } |
560 | 560 |
561 // Populate deoptimization entries. | 561 // Populate deoptimization entries. |
562 for (int i = 0; i < deopt_count; i++) { | 562 for (int i = 0; i < deopt_count; i++) { |
563 DeoptimizationState* deoptimization_state = deoptimization_states_[i]; | 563 DeoptimizationState* deoptimization_state = deoptimization_states_[i]; |
564 data->SetAstId(i, deoptimization_state->bailout_id()); | 564 data->SetAstId(i, deoptimization_state->bailout_id()); |
565 CHECK(deoptimization_states_[i]); | 565 CHECK(deoptimization_states_[i]); |
566 data->SetTranslationIndex( | 566 data->SetTranslationIndex( |
567 i, Smi::FromInt(deoptimization_states_[i]->translation_id())); | 567 i, Smi::FromInt(deoptimization_states_[i]->translation_id())); |
568 data->SetArgumentsStackHeight(i, Smi::FromInt(0)); | 568 data->SetArgumentsStackHeight(i, Smi::kZero); |
569 data->SetPc(i, Smi::FromInt(deoptimization_state->pc_offset())); | 569 data->SetPc(i, Smi::FromInt(deoptimization_state->pc_offset())); |
570 } | 570 } |
571 | 571 |
572 code_object->set_deoptimization_data(*data); | 572 code_object->set_deoptimization_data(*data); |
573 } | 573 } |
574 | 574 |
575 | 575 |
576 Label* CodeGenerator::AddJumpTable(Label** targets, size_t target_count) { | 576 Label* CodeGenerator::AddJumpTable(Label** targets, size_t target_count) { |
577 jump_tables_ = new (zone()) JumpTable(jump_tables_, targets, target_count); | 577 jump_tables_ = new (zone()) JumpTable(jump_tables_, targets, target_count); |
578 return jump_tables_->label(); | 578 return jump_tables_->label(); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { | 935 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
936 gen->ools_ = this; | 936 gen->ools_ = this; |
937 } | 937 } |
938 | 938 |
939 | 939 |
940 OutOfLineCode::~OutOfLineCode() {} | 940 OutOfLineCode::~OutOfLineCode() {} |
941 | 941 |
942 } // namespace compiler | 942 } // namespace compiler |
943 } // namespace internal | 943 } // namespace internal |
944 } // namespace v8 | 944 } // namespace v8 |
OLD | NEW |