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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 969 matching lines...) Loading... |
980 if (is_topmost) output_frame->SetRegister(fp_reg.code(), fp_value); | 980 if (is_topmost) output_frame->SetRegister(fp_reg.code(), fp_value); |
981 if (trace_scope_ != NULL) { | 981 if (trace_scope_ != NULL) { |
982 PrintF(trace_scope_->file(), | 982 PrintF(trace_scope_->file(), |
983 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 983 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
984 V8PRIxPTR " ; caller's fp\n", | 984 V8PRIxPTR " ; caller's fp\n", |
985 fp_value, output_offset, value); | 985 fp_value, output_offset, value); |
986 } | 986 } |
987 DCHECK(!is_bottommost || !has_alignment_padding_ || | 987 DCHECK(!is_bottommost || !has_alignment_padding_ || |
988 (fp_value & kPointerSize) != 0); | 988 (fp_value & kPointerSize) != 0); |
989 | 989 |
990 if (FLAG_enable_ool_constant_pool) { | 990 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
991 // For the bottommost output frame the constant pool pointer can be gotten | 991 // For the bottommost output frame the constant pool pointer can be gotten |
992 // from the input frame. For subsequent output frames, it can be read from | 992 // from the input frame. For subsequent output frames, it can be read from |
993 // the previous frame. | 993 // the previous frame. |
994 output_offset -= kPointerSize; | 994 output_offset -= kPointerSize; |
995 input_offset -= kPointerSize; | 995 input_offset -= kPointerSize; |
996 if (is_bottommost) { | 996 if (is_bottommost) { |
997 value = input_->GetFrameSlot(input_offset); | 997 value = input_->GetFrameSlot(input_offset); |
998 } else { | 998 } else { |
999 value = output_[frame_index - 1]->GetConstantPool(); | 999 value = output_[frame_index - 1]->GetConstantPool(); |
1000 } | 1000 } |
(...skipping 64 matching lines...) Loading... |
1065 Code* non_optimized_code = function->shared()->code(); | 1065 Code* non_optimized_code = function->shared()->code(); |
1066 FixedArray* raw_data = non_optimized_code->deoptimization_data(); | 1066 FixedArray* raw_data = non_optimized_code->deoptimization_data(); |
1067 DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data); | 1067 DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data); |
1068 Address start = non_optimized_code->instruction_start(); | 1068 Address start = non_optimized_code->instruction_start(); |
1069 unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared()); | 1069 unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared()); |
1070 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state); | 1070 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state); |
1071 intptr_t pc_value = reinterpret_cast<intptr_t>(start + pc_offset); | 1071 intptr_t pc_value = reinterpret_cast<intptr_t>(start + pc_offset); |
1072 output_frame->SetPc(pc_value); | 1072 output_frame->SetPc(pc_value); |
1073 | 1073 |
1074 // Update constant pool. | 1074 // Update constant pool. |
1075 if (FLAG_enable_ool_constant_pool) { | 1075 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
1076 intptr_t constant_pool_value = | 1076 intptr_t constant_pool_value = |
1077 reinterpret_cast<intptr_t>(non_optimized_code->constant_pool()); | 1077 reinterpret_cast<intptr_t>(non_optimized_code->constant_pool()); |
1078 output_frame->SetConstantPool(constant_pool_value); | 1078 output_frame->SetConstantPool(constant_pool_value); |
1079 if (is_topmost) { | 1079 if (is_topmost) { |
1080 Register constant_pool_reg = | 1080 Register constant_pool_reg = |
1081 JavaScriptFrame::constant_pool_pointer_register(); | 1081 JavaScriptFrame::constant_pool_pointer_register(); |
1082 output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value); | 1082 output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value); |
1083 } | 1083 } |
1084 } | 1084 } |
1085 | 1085 |
(...skipping 72 matching lines...) Loading... |
1158 output_frame->SetCallerFp(output_offset, value); | 1158 output_frame->SetCallerFp(output_offset, value); |
1159 intptr_t fp_value = top_address + output_offset; | 1159 intptr_t fp_value = top_address + output_offset; |
1160 output_frame->SetFp(fp_value); | 1160 output_frame->SetFp(fp_value); |
1161 if (trace_scope_ != NULL) { | 1161 if (trace_scope_ != NULL) { |
1162 PrintF(trace_scope_->file(), | 1162 PrintF(trace_scope_->file(), |
1163 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1163 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1164 V8PRIxPTR " ; caller's fp\n", | 1164 V8PRIxPTR " ; caller's fp\n", |
1165 fp_value, output_offset, value); | 1165 fp_value, output_offset, value); |
1166 } | 1166 } |
1167 | 1167 |
1168 if (FLAG_enable_ool_constant_pool) { | 1168 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
1169 // Read the caller's constant pool from the previous frame. | 1169 // Read the caller's constant pool from the previous frame. |
1170 output_offset -= kPointerSize; | 1170 output_offset -= kPointerSize; |
1171 value = output_[frame_index - 1]->GetConstantPool(); | 1171 value = output_[frame_index - 1]->GetConstantPool(); |
1172 output_frame->SetCallerConstantPool(output_offset, value); | 1172 output_frame->SetCallerConstantPool(output_offset, value); |
1173 if (trace_scope_) { | 1173 if (trace_scope_) { |
1174 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1174 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1175 V8PRIxPTR "; caller's constant_pool\n", | 1175 V8PRIxPTR "; caller's constant_pool\n", |
1176 top_address + output_offset, output_offset, value); | 1176 top_address + output_offset, output_offset, value); |
1177 } | 1177 } |
1178 } | 1178 } |
(...skipping 34 matching lines...) Loading... |
1213 | 1213 |
1214 DCHECK(0 == output_offset); | 1214 DCHECK(0 == output_offset); |
1215 | 1215 |
1216 Builtins* builtins = isolate_->builtins(); | 1216 Builtins* builtins = isolate_->builtins(); |
1217 Code* adaptor_trampoline = | 1217 Code* adaptor_trampoline = |
1218 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); | 1218 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); |
1219 intptr_t pc_value = reinterpret_cast<intptr_t>( | 1219 intptr_t pc_value = reinterpret_cast<intptr_t>( |
1220 adaptor_trampoline->instruction_start() + | 1220 adaptor_trampoline->instruction_start() + |
1221 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); | 1221 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); |
1222 output_frame->SetPc(pc_value); | 1222 output_frame->SetPc(pc_value); |
1223 if (FLAG_enable_ool_constant_pool) { | 1223 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
1224 intptr_t constant_pool_value = | 1224 intptr_t constant_pool_value = |
1225 reinterpret_cast<intptr_t>(adaptor_trampoline->constant_pool()); | 1225 reinterpret_cast<intptr_t>(adaptor_trampoline->constant_pool()); |
1226 output_frame->SetConstantPool(constant_pool_value); | 1226 output_frame->SetConstantPool(constant_pool_value); |
1227 } | 1227 } |
1228 } | 1228 } |
1229 | 1229 |
1230 | 1230 |
1231 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, | 1231 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, |
1232 int frame_index) { | 1232 int frame_index) { |
1233 Builtins* builtins = isolate_->builtins(); | 1233 Builtins* builtins = isolate_->builtins(); |
(...skipping 58 matching lines...) Loading... |
1292 output_frame->SetCallerFp(output_offset, value); | 1292 output_frame->SetCallerFp(output_offset, value); |
1293 intptr_t fp_value = top_address + output_offset; | 1293 intptr_t fp_value = top_address + output_offset; |
1294 output_frame->SetFp(fp_value); | 1294 output_frame->SetFp(fp_value); |
1295 if (trace_scope_ != NULL) { | 1295 if (trace_scope_ != NULL) { |
1296 PrintF(trace_scope_->file(), | 1296 PrintF(trace_scope_->file(), |
1297 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1297 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1298 V8PRIxPTR " ; caller's fp\n", | 1298 V8PRIxPTR " ; caller's fp\n", |
1299 fp_value, output_offset, value); | 1299 fp_value, output_offset, value); |
1300 } | 1300 } |
1301 | 1301 |
1302 if (FLAG_enable_ool_constant_pool) { | 1302 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
1303 // Read the caller's constant pool from the previous frame. | 1303 // Read the caller's constant pool from the previous frame. |
1304 output_offset -= kPointerSize; | 1304 output_offset -= kPointerSize; |
1305 value = output_[frame_index - 1]->GetConstantPool(); | 1305 value = output_[frame_index - 1]->GetConstantPool(); |
1306 output_frame->SetCallerConstantPool(output_offset, value); | 1306 output_frame->SetCallerConstantPool(output_offset, value); |
1307 if (trace_scope_) { | 1307 if (trace_scope_) { |
1308 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1308 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1309 V8PRIxPTR " ; caller's constant pool\n", | 1309 V8PRIxPTR " ; caller's constant pool\n", |
1310 top_address + output_offset, output_offset, value); | 1310 top_address + output_offset, output_offset, value); |
1311 } | 1311 } |
1312 } | 1312 } |
(...skipping 67 matching lines...) Loading... |
1380 V8PRIxPTR " ; allocated receiver\n", | 1380 V8PRIxPTR " ; allocated receiver\n", |
1381 top_address + output_offset, output_offset, value); | 1381 top_address + output_offset, output_offset, value); |
1382 } | 1382 } |
1383 | 1383 |
1384 CHECK_EQ(0u, output_offset); | 1384 CHECK_EQ(0u, output_offset); |
1385 | 1385 |
1386 intptr_t pc = reinterpret_cast<intptr_t>( | 1386 intptr_t pc = reinterpret_cast<intptr_t>( |
1387 construct_stub->instruction_start() + | 1387 construct_stub->instruction_start() + |
1388 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); | 1388 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); |
1389 output_frame->SetPc(pc); | 1389 output_frame->SetPc(pc); |
1390 if (FLAG_enable_ool_constant_pool) { | 1390 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
1391 intptr_t constant_pool_value = | 1391 intptr_t constant_pool_value = |
1392 reinterpret_cast<intptr_t>(construct_stub->constant_pool()); | 1392 reinterpret_cast<intptr_t>(construct_stub->constant_pool()); |
1393 output_frame->SetConstantPool(constant_pool_value); | 1393 output_frame->SetConstantPool(constant_pool_value); |
1394 } | 1394 } |
1395 } | 1395 } |
1396 | 1396 |
1397 | 1397 |
1398 void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, | 1398 void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, |
1399 int frame_index, | 1399 int frame_index, |
1400 bool is_setter_stub_frame) { | 1400 bool is_setter_stub_frame) { |
(...skipping 54 matching lines...) Loading... |
1455 output_frame->SetCallerFp(output_offset, value); | 1455 output_frame->SetCallerFp(output_offset, value); |
1456 intptr_t fp_value = top_address + output_offset; | 1456 intptr_t fp_value = top_address + output_offset; |
1457 output_frame->SetFp(fp_value); | 1457 output_frame->SetFp(fp_value); |
1458 if (trace_scope_ != NULL) { | 1458 if (trace_scope_ != NULL) { |
1459 PrintF(trace_scope_->file(), | 1459 PrintF(trace_scope_->file(), |
1460 " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR | 1460 " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR |
1461 " ; caller's fp\n", | 1461 " ; caller's fp\n", |
1462 fp_value, output_offset, value); | 1462 fp_value, output_offset, value); |
1463 } | 1463 } |
1464 | 1464 |
1465 if (FLAG_enable_ool_constant_pool) { | 1465 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
1466 // Read the caller's constant pool from the previous frame. | 1466 // Read the caller's constant pool from the previous frame. |
1467 output_offset -= kPointerSize; | 1467 output_offset -= kPointerSize; |
1468 value = output_[frame_index - 1]->GetConstantPool(); | 1468 value = output_[frame_index - 1]->GetConstantPool(); |
1469 output_frame->SetCallerConstantPool(output_offset, value); | 1469 output_frame->SetCallerConstantPool(output_offset, value); |
1470 if (trace_scope_) { | 1470 if (trace_scope_) { |
1471 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1471 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1472 V8PRIxPTR " ; caller's constant pool\n", | 1472 V8PRIxPTR " ; caller's constant pool\n", |
1473 top_address + output_offset, output_offset, value); | 1473 top_address + output_offset, output_offset, value); |
1474 } | 1474 } |
1475 } | 1475 } |
(...skipping 46 matching lines...) Loading... |
1522 } | 1522 } |
1523 | 1523 |
1524 CHECK_EQ(0u, output_offset); | 1524 CHECK_EQ(0u, output_offset); |
1525 | 1525 |
1526 Smi* offset = is_setter_stub_frame ? | 1526 Smi* offset = is_setter_stub_frame ? |
1527 isolate_->heap()->setter_stub_deopt_pc_offset() : | 1527 isolate_->heap()->setter_stub_deopt_pc_offset() : |
1528 isolate_->heap()->getter_stub_deopt_pc_offset(); | 1528 isolate_->heap()->getter_stub_deopt_pc_offset(); |
1529 intptr_t pc = reinterpret_cast<intptr_t>( | 1529 intptr_t pc = reinterpret_cast<intptr_t>( |
1530 accessor_stub->instruction_start() + offset->value()); | 1530 accessor_stub->instruction_start() + offset->value()); |
1531 output_frame->SetPc(pc); | 1531 output_frame->SetPc(pc); |
1532 if (FLAG_enable_ool_constant_pool) { | 1532 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
1533 intptr_t constant_pool_value = | 1533 intptr_t constant_pool_value = |
1534 reinterpret_cast<intptr_t>(accessor_stub->constant_pool()); | 1534 reinterpret_cast<intptr_t>(accessor_stub->constant_pool()); |
1535 output_frame->SetConstantPool(constant_pool_value); | 1535 output_frame->SetConstantPool(constant_pool_value); |
1536 } | 1536 } |
1537 } | 1537 } |
1538 | 1538 |
1539 | 1539 |
1540 void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator, | 1540 void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator, |
1541 int frame_index) { | 1541 int frame_index) { |
1542 // | 1542 // |
(...skipping 86 matching lines...) Loading... |
1629 intptr_t frame_ptr = input_->GetRegister(fp_reg.code()); | 1629 intptr_t frame_ptr = input_->GetRegister(fp_reg.code()); |
1630 output_frame->SetRegister(fp_reg.code(), frame_ptr); | 1630 output_frame->SetRegister(fp_reg.code(), frame_ptr); |
1631 output_frame->SetFp(frame_ptr); | 1631 output_frame->SetFp(frame_ptr); |
1632 if (trace_scope_ != NULL) { | 1632 if (trace_scope_ != NULL) { |
1633 PrintF(trace_scope_->file(), | 1633 PrintF(trace_scope_->file(), |
1634 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1634 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1635 V8PRIxPTR " ; caller's fp\n", | 1635 V8PRIxPTR " ; caller's fp\n", |
1636 top_address + output_frame_offset, output_frame_offset, value); | 1636 top_address + output_frame_offset, output_frame_offset, value); |
1637 } | 1637 } |
1638 | 1638 |
1639 if (FLAG_enable_ool_constant_pool) { | 1639 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
1640 // Read the caller's constant pool from the input frame. | 1640 // Read the caller's constant pool from the input frame. |
1641 input_frame_offset -= kPointerSize; | 1641 input_frame_offset -= kPointerSize; |
1642 value = input_->GetFrameSlot(input_frame_offset); | 1642 value = input_->GetFrameSlot(input_frame_offset); |
1643 output_frame_offset -= kPointerSize; | 1643 output_frame_offset -= kPointerSize; |
1644 output_frame->SetCallerConstantPool(output_frame_offset, value); | 1644 output_frame->SetCallerConstantPool(output_frame_offset, value); |
1645 if (trace_scope_) { | 1645 if (trace_scope_) { |
1646 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1646 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1647 V8PRIxPTR " ; caller's constant_pool\n", | 1647 V8PRIxPTR " ; caller's constant_pool\n", |
1648 top_address + output_frame_offset, output_frame_offset, value); | 1648 top_address + output_frame_offset, output_frame_offset, value); |
1649 } | 1649 } |
(...skipping 121 matching lines...) Loading... |
1771 SetPlatformCompiledStubRegisters(output_frame, &descriptor); | 1771 SetPlatformCompiledStubRegisters(output_frame, &descriptor); |
1772 | 1772 |
1773 // Compute this frame's PC, state, and continuation. | 1773 // Compute this frame's PC, state, and continuation. |
1774 Code* trampoline = NULL; | 1774 Code* trampoline = NULL; |
1775 StubFunctionMode function_mode = descriptor.function_mode(); | 1775 StubFunctionMode function_mode = descriptor.function_mode(); |
1776 StubFailureTrampolineStub(isolate_, | 1776 StubFailureTrampolineStub(isolate_, |
1777 function_mode).FindCodeInCache(&trampoline); | 1777 function_mode).FindCodeInCache(&trampoline); |
1778 DCHECK(trampoline != NULL); | 1778 DCHECK(trampoline != NULL); |
1779 output_frame->SetPc(reinterpret_cast<intptr_t>( | 1779 output_frame->SetPc(reinterpret_cast<intptr_t>( |
1780 trampoline->instruction_start())); | 1780 trampoline->instruction_start())); |
1781 if (FLAG_enable_ool_constant_pool) { | 1781 if (FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool) { |
1782 Register constant_pool_reg = | 1782 Register constant_pool_reg = |
1783 StubFailureTrampolineFrame::constant_pool_pointer_register(); | 1783 StubFailureTrampolineFrame::constant_pool_pointer_register(); |
1784 intptr_t constant_pool_value = | 1784 intptr_t constant_pool_value = |
1785 reinterpret_cast<intptr_t>(trampoline->constant_pool()); | 1785 reinterpret_cast<intptr_t>(trampoline->constant_pool()); |
1786 output_frame->SetConstantPool(constant_pool_value); | 1786 output_frame->SetConstantPool(constant_pool_value); |
1787 output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value); | 1787 output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value); |
1788 } | 1788 } |
1789 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS)); | 1789 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS)); |
1790 Code* notify_failure = | 1790 Code* notify_failure = |
1791 isolate_->builtins()->builtin(Builtins::kNotifyStubFailureSaveDoubles); | 1791 isolate_->builtins()->builtin(Builtins::kNotifyStubFailureSaveDoubles); |
(...skipping 1868 matching lines...) Loading... |
3660 int raw_position = static_cast<int>(info->data()); | 3660 int raw_position = static_cast<int>(info->data()); |
3661 last_position = raw_position ? SourcePosition::FromRaw(raw_position) | 3661 last_position = raw_position ? SourcePosition::FromRaw(raw_position) |
3662 : SourcePosition::Unknown(); | 3662 : SourcePosition::Unknown(); |
3663 } else if (info->rmode() == RelocInfo::DEOPT_REASON) { | 3663 } else if (info->rmode() == RelocInfo::DEOPT_REASON) { |
3664 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); | 3664 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); |
3665 } | 3665 } |
3666 } | 3666 } |
3667 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason); | 3667 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason); |
3668 } | 3668 } |
3669 } } // namespace v8::internal | 3669 } } // namespace v8::internal |
OLD | NEW |