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 "src/frames.h" | 5 #include "src/frames.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); | 1278 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); |
1279 | 1279 |
1280 SafepointEntry safepoint_entry = code->GetSafepointEntry(pc()); | 1280 SafepointEntry safepoint_entry = code->GetSafepointEntry(pc()); |
1281 *deopt_index = safepoint_entry.deoptimization_index(); | 1281 *deopt_index = safepoint_entry.deoptimization_index(); |
1282 if (*deopt_index != Safepoint::kNoDeoptimizationIndex) { | 1282 if (*deopt_index != Safepoint::kNoDeoptimizationIndex) { |
1283 return DeoptimizationInputData::cast(code->deoptimization_data()); | 1283 return DeoptimizationInputData::cast(code->deoptimization_data()); |
1284 } | 1284 } |
1285 return nullptr; | 1285 return nullptr; |
1286 } | 1286 } |
1287 | 1287 |
| 1288 Object* OptimizedFrame::receiver() const { |
| 1289 Code* code = LookupCode(); |
| 1290 if (code->kind() == Code::BUILTIN) { |
| 1291 Address argc_ptr = fp() + OptimizedBuiltinFrameConstants::kArgCOffset; |
| 1292 intptr_t argc = *reinterpret_cast<intptr_t*>(argc_ptr); |
| 1293 intptr_t args_size = |
| 1294 (StandardFrameConstants::kFixedSlotCountAboveFp + argc) * kPointerSize; |
| 1295 Address receiver_ptr = fp() + args_size; |
| 1296 return *reinterpret_cast<Object**>(receiver_ptr); |
| 1297 } else { |
| 1298 return JavaScriptFrame::receiver(); |
| 1299 } |
| 1300 } |
1288 | 1301 |
1289 void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) const { | 1302 void OptimizedFrame::GetFunctions(List<JSFunction*>* functions) const { |
1290 DCHECK(functions->length() == 0); | 1303 DCHECK(functions->length() == 0); |
1291 DCHECK(is_optimized()); | 1304 DCHECK(is_optimized()); |
1292 | 1305 |
1293 // Delegate to JS frame in absence of turbofan deoptimization. | 1306 // Delegate to JS frame in absence of turbofan deoptimization. |
1294 // TODO(turbofan): Revisit once we support deoptimization across the board. | 1307 // TODO(turbofan): Revisit once we support deoptimization across the board. |
1295 Code* code = LookupCode(); | 1308 Code* code = LookupCode(); |
1296 if (code->kind() == Code::BUILTIN || | 1309 if (code->kind() == Code::BUILTIN || |
1297 CannotDeoptFromAsmCode(code, function())) { | 1310 CannotDeoptFromAsmCode(code, function())) { |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1976 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1964 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1977 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1965 list.Add(frame, zone); | 1978 list.Add(frame, zone); |
1966 } | 1979 } |
1967 return list.ToVector(); | 1980 return list.ToVector(); |
1968 } | 1981 } |
1969 | 1982 |
1970 | 1983 |
1971 } // namespace internal | 1984 } // namespace internal |
1972 } // namespace v8 | 1985 } // namespace v8 |
OLD | NEW |