OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
961 PrintF(trace_scope_->file(), | 961 PrintF(trace_scope_->file(), |
962 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 962 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
963 V8PRIxPTR " ; caller's fp\n", | 963 V8PRIxPTR " ; caller's fp\n", |
964 fp_value, output_offset, value); | 964 fp_value, output_offset, value); |
965 } | 965 } |
966 ASSERT(!is_bottommost || !has_alignment_padding_ || | 966 ASSERT(!is_bottommost || !has_alignment_padding_ || |
967 (fp_value & kPointerSize) != 0); | 967 (fp_value & kPointerSize) != 0); |
968 | 968 |
969 if (FLAG_enable_ool_constant_pool) { | 969 if (FLAG_enable_ool_constant_pool) { |
970 // For the bottommost output frame the constant pool pointer can be gotten | 970 // For the bottommost output frame the constant pool pointer can be gotten |
971 // from the input frame. For subsequent output frames, it can be gotten from | 971 // from the input frame. For subsequent output frames, it can be read from |
972 // the function's code. | 972 // the previous frame. |
973 Register constant_pool_reg = | |
974 JavaScriptFrame::constant_pool_pointer_register(); | |
975 output_offset -= kPointerSize; | 973 output_offset -= kPointerSize; |
976 input_offset -= kPointerSize; | 974 input_offset -= kPointerSize; |
977 if (is_bottommost) { | 975 if (is_bottommost) { |
978 value = input_->GetFrameSlot(input_offset); | 976 value = input_->GetFrameSlot(input_offset); |
979 } else { | 977 } else { |
980 value = reinterpret_cast<intptr_t>( | 978 value = output_[frame_index - 1]->GetConstantPool(); |
981 function->shared()->code()->constant_pool()); | |
982 } | 979 } |
983 output_frame->SetFrameSlot(output_offset, value); | 980 output_frame->SetCallerConstantPool(output_offset, value); |
984 output_frame->SetConstantPool(value); | |
985 if (is_topmost) output_frame->SetRegister(constant_pool_reg.code(), value); | |
986 if (trace_scope_) { | 981 if (trace_scope_) { |
987 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 982 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
988 V8PRIxPTR "; constant_pool\n", | 983 V8PRIxPTR "; caller's constant_pool\n", |
989 top_address + output_offset, output_offset, value); | 984 top_address + output_offset, output_offset, value); |
990 } | 985 } |
991 } | 986 } |
992 | 987 |
993 // For the bottommost output frame the context can be gotten from the input | 988 // For the bottommost output frame the context can be gotten from the input |
994 // frame. For all subsequent output frames it can be gotten from the function | 989 // frame. For all subsequent output frames it can be gotten from the function |
995 // so long as we don't inline functions that need local contexts. | 990 // so long as we don't inline functions that need local contexts. |
996 Register context_reg = JavaScriptFrame::context_register(); | 991 Register context_reg = JavaScriptFrame::context_register(); |
997 output_offset -= kPointerSize; | 992 output_offset -= kPointerSize; |
998 input_offset -= kPointerSize; | 993 input_offset -= kPointerSize; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1036 // Compute this frame's PC, state, and continuation. | 1031 // Compute this frame's PC, state, and continuation. |
1037 Code* non_optimized_code = function->shared()->code(); | 1032 Code* non_optimized_code = function->shared()->code(); |
1038 FixedArray* raw_data = non_optimized_code->deoptimization_data(); | 1033 FixedArray* raw_data = non_optimized_code->deoptimization_data(); |
1039 DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data); | 1034 DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data); |
1040 Address start = non_optimized_code->instruction_start(); | 1035 Address start = non_optimized_code->instruction_start(); |
1041 unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared()); | 1036 unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared()); |
1042 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state); | 1037 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state); |
1043 intptr_t pc_value = reinterpret_cast<intptr_t>(start + pc_offset); | 1038 intptr_t pc_value = reinterpret_cast<intptr_t>(start + pc_offset); |
1044 output_frame->SetPc(pc_value); | 1039 output_frame->SetPc(pc_value); |
1045 | 1040 |
1041 // Update constant pool. | |
1042 if (FLAG_enable_ool_constant_pool) { | |
1043 intptr_t constant_pool_value = | |
1044 reinterpret_cast<intptr_t>(non_optimized_code->constant_pool()); | |
1045 output_frame->SetConstantPool(constant_pool_value); | |
1046 if (is_topmost) { | |
1047 Register constant_pool_reg = | |
1048 JavaScriptFrame::constant_pool_pointer_register(); | |
1049 output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value); | |
1050 } | |
1051 } | |
1052 | |
1046 FullCodeGenerator::State state = | 1053 FullCodeGenerator::State state = |
1047 FullCodeGenerator::StateField::decode(pc_and_state); | 1054 FullCodeGenerator::StateField::decode(pc_and_state); |
1048 output_frame->SetState(Smi::FromInt(state)); | 1055 output_frame->SetState(Smi::FromInt(state)); |
1049 | 1056 |
1050 // Set the continuation for the topmost frame. | 1057 // Set the continuation for the topmost frame. |
1051 if (is_topmost && bailout_type_ != DEBUGGER) { | 1058 if (is_topmost && bailout_type_ != DEBUGGER) { |
1052 Builtins* builtins = isolate_->builtins(); | 1059 Builtins* builtins = isolate_->builtins(); |
1053 Code* continuation = builtins->builtin(Builtins::kNotifyDeoptimized); | 1060 Code* continuation = builtins->builtin(Builtins::kNotifyDeoptimized); |
1054 if (bailout_type_ == LAZY) { | 1061 if (bailout_type_ == LAZY) { |
1055 continuation = builtins->builtin(Builtins::kNotifyLazyDeoptimized); | 1062 continuation = builtins->builtin(Builtins::kNotifyLazyDeoptimized); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1119 intptr_t fp_value = top_address + output_offset; | 1126 intptr_t fp_value = top_address + output_offset; |
1120 output_frame->SetFp(fp_value); | 1127 output_frame->SetFp(fp_value); |
1121 if (trace_scope_ != NULL) { | 1128 if (trace_scope_ != NULL) { |
1122 PrintF(trace_scope_->file(), | 1129 PrintF(trace_scope_->file(), |
1123 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1130 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1124 V8PRIxPTR " ; caller's fp\n", | 1131 V8PRIxPTR " ; caller's fp\n", |
1125 fp_value, output_offset, value); | 1132 fp_value, output_offset, value); |
1126 } | 1133 } |
1127 | 1134 |
1128 if (FLAG_enable_ool_constant_pool) { | 1135 if (FLAG_enable_ool_constant_pool) { |
1129 // A marker value is used in place of the constant pool. | 1136 // Our constant pool is the same as our caller's, get it from the previous |
ulan
2014/03/13 13:35:22
Why ArgumentsAdaptorTrampoline and other stubs bel
rmcilroy
2014/03/14 12:35:57
You are right - originally stubs didn't load the c
| |
1137 // frame's constant pool. | |
1130 output_offset -= kPointerSize; | 1138 output_offset -= kPointerSize; |
1131 intptr_t constant_pool = reinterpret_cast<intptr_t>( | 1139 value = output_[frame_index - 1]->GetConstantPool(); |
1132 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 1140 output_frame->SetCallerConstantPool(output_offset, value); |
1133 output_frame->SetFrameSlot(output_offset, constant_pool); | 1141 output_frame->SetConstantPool(value); |
1134 if (trace_scope_) { | 1142 if (trace_scope_) { |
1135 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1143 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1136 V8PRIxPTR " ; constant_pool (adaptor sentinel)\n", | 1144 V8PRIxPTR "; caller's constant_pool\n", |
1137 top_address + output_offset, output_offset, constant_pool); | 1145 top_address + output_offset, output_offset, value); |
1138 } | 1146 } |
1139 } | 1147 } |
1140 | 1148 |
1141 // A marker value is used in place of the context. | 1149 // A marker value is used in place of the context. |
1142 output_offset -= kPointerSize; | 1150 output_offset -= kPointerSize; |
1143 intptr_t context = reinterpret_cast<intptr_t>( | 1151 intptr_t context = reinterpret_cast<intptr_t>( |
1144 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 1152 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
1145 output_frame->SetFrameSlot(output_offset, context); | 1153 output_frame->SetFrameSlot(output_offset, context); |
1146 if (trace_scope_ != NULL) { | 1154 if (trace_scope_ != NULL) { |
1147 PrintF(trace_scope_->file(), | 1155 PrintF(trace_scope_->file(), |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1252 PrintF(trace_scope_->file(), | 1260 PrintF(trace_scope_->file(), |
1253 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1261 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1254 V8PRIxPTR " ; caller's fp\n", | 1262 V8PRIxPTR " ; caller's fp\n", |
1255 fp_value, output_offset, value); | 1263 fp_value, output_offset, value); |
1256 } | 1264 } |
1257 | 1265 |
1258 if (FLAG_enable_ool_constant_pool) { | 1266 if (FLAG_enable_ool_constant_pool) { |
1259 // The constant pool pointer can be gotten from the previous frame. | 1267 // The constant pool pointer can be gotten from the previous frame. |
1260 output_offset -= kPointerSize; | 1268 output_offset -= kPointerSize; |
1261 value = output_[frame_index - 1]->GetConstantPool(); | 1269 value = output_[frame_index - 1]->GetConstantPool(); |
1262 output_frame->SetFrameSlot(output_offset, value); | 1270 output_frame->SetConstantPool(value); |
1271 output_frame->SetCallerConstantPool(output_offset, value); | |
1263 if (trace_scope_) { | 1272 if (trace_scope_) { |
1264 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1273 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1265 V8PRIxPTR " ; constant pool\n", | 1274 V8PRIxPTR " ; caller's constant pool\n", |
1266 top_address + output_offset, output_offset, value); | 1275 top_address + output_offset, output_offset, value); |
1267 } | 1276 } |
1268 } | 1277 } |
1269 | 1278 |
1270 // The context can be gotten from the previous frame. | 1279 // The context can be gotten from the previous frame. |
1271 output_offset -= kPointerSize; | 1280 output_offset -= kPointerSize; |
1272 value = output_[frame_index - 1]->GetContext(); | 1281 value = output_[frame_index - 1]->GetContext(); |
1273 output_frame->SetFrameSlot(output_offset, value); | 1282 output_frame->SetFrameSlot(output_offset, value); |
1274 if (trace_scope_ != NULL) { | 1283 if (trace_scope_ != NULL) { |
1275 PrintF(trace_scope_->file(), | 1284 PrintF(trace_scope_->file(), |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1410 PrintF(trace_scope_->file(), | 1419 PrintF(trace_scope_->file(), |
1411 " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR | 1420 " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR |
1412 " ; caller's fp\n", | 1421 " ; caller's fp\n", |
1413 fp_value, output_offset, value); | 1422 fp_value, output_offset, value); |
1414 } | 1423 } |
1415 | 1424 |
1416 if (FLAG_enable_ool_constant_pool) { | 1425 if (FLAG_enable_ool_constant_pool) { |
1417 // The constant pool pointer can be gotten from the previous frame. | 1426 // The constant pool pointer can be gotten from the previous frame. |
1418 output_offset -= kPointerSize; | 1427 output_offset -= kPointerSize; |
1419 value = output_[frame_index - 1]->GetConstantPool(); | 1428 value = output_[frame_index - 1]->GetConstantPool(); |
1420 output_frame->SetFrameSlot(output_offset, value); | 1429 output_frame->SetConstantPool(value); |
1430 output_frame->SetCallerConstantPool(output_offset, value); | |
1421 if (trace_scope_) { | 1431 if (trace_scope_) { |
1422 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1432 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1423 V8PRIxPTR " ; constant pool\n", | 1433 V8PRIxPTR " ; caller's constant pool\n", |
1424 top_address + output_offset, output_offset, value); | 1434 top_address + output_offset, output_offset, value); |
1425 } | 1435 } |
1426 } | 1436 } |
1427 | 1437 |
1428 // The context can be gotten from the previous frame. | 1438 // The context can be gotten from the previous frame. |
1429 output_offset -= kPointerSize; | 1439 output_offset -= kPointerSize; |
1430 value = output_[frame_index - 1]->GetContext(); | 1440 value = output_[frame_index - 1]->GetContext(); |
1431 output_frame->SetFrameSlot(output_offset, value); | 1441 output_frame->SetFrameSlot(output_offset, value); |
1432 if (trace_scope_ != NULL) { | 1442 if (trace_scope_ != NULL) { |
1433 PrintF(trace_scope_->file(), | 1443 PrintF(trace_scope_->file(), |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1578 output_frame->SetRegister(fp_reg.code(), frame_ptr); | 1588 output_frame->SetRegister(fp_reg.code(), frame_ptr); |
1579 output_frame->SetFp(frame_ptr); | 1589 output_frame->SetFp(frame_ptr); |
1580 if (trace_scope_ != NULL) { | 1590 if (trace_scope_ != NULL) { |
1581 PrintF(trace_scope_->file(), | 1591 PrintF(trace_scope_->file(), |
1582 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1592 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1583 V8PRIxPTR " ; caller's fp\n", | 1593 V8PRIxPTR " ; caller's fp\n", |
1584 top_address + output_frame_offset, output_frame_offset, value); | 1594 top_address + output_frame_offset, output_frame_offset, value); |
1585 } | 1595 } |
1586 | 1596 |
1587 if (FLAG_enable_ool_constant_pool) { | 1597 if (FLAG_enable_ool_constant_pool) { |
1588 // The constant pool pointer can be gotten from the input frame. | 1598 // Read the caller's constant pool from the input frame. |
1589 Register constant_pool_pointer_register = | |
1590 StubFailureTrampolineFrame::constant_pool_pointer_register(); | |
1591 input_frame_offset -= kPointerSize; | 1599 input_frame_offset -= kPointerSize; |
1592 value = input_->GetFrameSlot(input_frame_offset); | 1600 value = input_->GetFrameSlot(input_frame_offset); |
1593 output_frame->SetRegister(constant_pool_pointer_register.code(), value); | |
1594 output_frame_offset -= kPointerSize; | 1601 output_frame_offset -= kPointerSize; |
1595 output_frame->SetFrameSlot(output_frame_offset, value); | 1602 output_frame->SetCallerConstantPool(output_frame_offset, value); |
1596 if (trace_scope_) { | 1603 if (trace_scope_) { |
1597 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1604 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
1598 V8PRIxPTR " ; constant_pool_pointer\n", | 1605 V8PRIxPTR " ; caller's constant_pool\n", |
1599 top_address + output_frame_offset, output_frame_offset, value); | 1606 top_address + output_frame_offset, output_frame_offset, value); |
1600 } | 1607 } |
1601 } | 1608 } |
1602 | 1609 |
1603 // The context can be gotten from the input frame. | 1610 // The context can be gotten from the input frame. |
1604 Register context_reg = StubFailureTrampolineFrame::context_register(); | 1611 Register context_reg = StubFailureTrampolineFrame::context_register(); |
1605 input_frame_offset -= kPointerSize; | 1612 input_frame_offset -= kPointerSize; |
1606 value = input_->GetFrameSlot(input_frame_offset); | 1613 value = input_->GetFrameSlot(input_frame_offset); |
1607 output_frame->SetRegister(context_reg.code(), value); | 1614 output_frame->SetRegister(context_reg.code(), value); |
1608 output_frame_offset -= kPointerSize; | 1615 output_frame_offset -= kPointerSize; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1722 SetPlatformCompiledStubRegisters(output_frame, descriptor); | 1729 SetPlatformCompiledStubRegisters(output_frame, descriptor); |
1723 | 1730 |
1724 // Compute this frame's PC, state, and continuation. | 1731 // Compute this frame's PC, state, and continuation. |
1725 Code* trampoline = NULL; | 1732 Code* trampoline = NULL; |
1726 StubFunctionMode function_mode = descriptor->function_mode_; | 1733 StubFunctionMode function_mode = descriptor->function_mode_; |
1727 StubFailureTrampolineStub(function_mode).FindCodeInCache(&trampoline, | 1734 StubFailureTrampolineStub(function_mode).FindCodeInCache(&trampoline, |
1728 isolate_); | 1735 isolate_); |
1729 ASSERT(trampoline != NULL); | 1736 ASSERT(trampoline != NULL); |
1730 output_frame->SetPc(reinterpret_cast<intptr_t>( | 1737 output_frame->SetPc(reinterpret_cast<intptr_t>( |
1731 trampoline->instruction_start())); | 1738 trampoline->instruction_start())); |
1739 if (FLAG_enable_ool_constant_pool) { | |
1740 Register constant_pool_reg = | |
1741 StubFailureTrampolineFrame::constant_pool_pointer_register(); | |
1742 intptr_t constant_pool_value = | |
1743 reinterpret_cast<intptr_t>(trampoline->constant_pool()); | |
1744 output_frame->SetConstantPool(constant_pool_value); | |
1745 output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value); | |
1746 } | |
1732 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS)); | 1747 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS)); |
1733 Code* notify_failure = NotifyStubFailureBuiltin(); | 1748 Code* notify_failure = NotifyStubFailureBuiltin(); |
1734 output_frame->SetContinuation( | 1749 output_frame->SetContinuation( |
1735 reinterpret_cast<intptr_t>(notify_failure->entry())); | 1750 reinterpret_cast<intptr_t>(notify_failure->entry())); |
1736 } | 1751 } |
1737 | 1752 |
1738 | 1753 |
1739 Handle<Object> Deoptimizer::MaterializeNextHeapObject() { | 1754 Handle<Object> Deoptimizer::MaterializeNextHeapObject() { |
1740 int object_index = materialization_object_index_++; | 1755 int object_index = materialization_object_index_++; |
1741 ObjectMaterializationDescriptor desc = deferred_objects_[object_index]; | 1756 ObjectMaterializationDescriptor desc = deferred_objects_[object_index]; |
(...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3471 | 3486 |
3472 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3487 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
3473 v->VisitPointer(BitCast<Object**>(&function_)); | 3488 v->VisitPointer(BitCast<Object**>(&function_)); |
3474 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3489 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
3475 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3490 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
3476 } | 3491 } |
3477 | 3492 |
3478 #endif // ENABLE_DEBUGGER_SUPPORT | 3493 #endif // ENABLE_DEBUGGER_SUPPORT |
3479 | 3494 |
3480 } } // namespace v8::internal | 3495 } } // namespace v8::internal |
OLD | NEW |