| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include <iomanip> | 7 #include <iomanip> |
| 8 | 8 |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
| 11 #include "src/interpreter/bytecode-array-iterator.h" | 11 #include "src/interpreter/bytecode-array-iterator.h" |
| 12 #include "src/interpreter/bytecode-decoder.h" | 12 #include "src/interpreter/bytecode-decoder.h" |
| 13 #include "src/interpreter/bytecode-flags.h" | 13 #include "src/interpreter/bytecode-flags.h" |
| 14 #include "src/interpreter/bytecode-register.h" | 14 #include "src/interpreter/bytecode-register.h" |
| 15 #include "src/interpreter/bytecodes.h" | 15 #include "src/interpreter/bytecodes.h" |
| 16 #include "src/isolate-inl.h" | 16 #include "src/isolate-inl.h" |
| 17 #include "src/ostreams.h" | 17 #include "src/ostreams.h" |
| 18 | 18 |
| 19 namespace v8 { | 19 namespace v8 { |
| 20 namespace internal { | 20 namespace internal { |
| 21 | 21 |
| 22 RUNTIME_FUNCTION(Runtime_InterpreterNewClosure) { | 22 RUNTIME_FUNCTION(Runtime_InterpreterNewClosure) { |
| 23 HandleScope scope(isolate); | 23 HandleScope scope(isolate); |
| 24 DCHECK_EQ(4, args.length()); | 24 DCHECK_EQ(4, args.length()); |
| 25 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); | 25 CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0); |
| 26 CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1); |
| 27 CONVERT_SMI_ARG_CHECKED(index, 2); |
| 26 CONVERT_SMI_ARG_CHECKED(pretenured_flag, 3); | 28 CONVERT_SMI_ARG_CHECKED(pretenured_flag, 3); |
| 27 Handle<Context> context(isolate->context(), isolate); | 29 Handle<Context> context(isolate->context(), isolate); |
| 30 FeedbackVectorSlot slot = TypeFeedbackVector::ToSlot(index); |
| 31 Handle<LiteralsArray> literals(LiteralsArray::cast(vector->Get(slot)), |
| 32 isolate); |
| 28 return *isolate->factory()->NewFunctionFromSharedFunctionInfo( | 33 return *isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 29 shared, context, static_cast<PretenureFlag>(pretenured_flag)); | 34 shared, context, literals, static_cast<PretenureFlag>(pretenured_flag)); |
| 30 } | 35 } |
| 31 | 36 |
| 32 namespace { | 37 namespace { |
| 33 | 38 |
| 34 void AdvanceToOffsetForTracing( | 39 void AdvanceToOffsetForTracing( |
| 35 interpreter::BytecodeArrayIterator& bytecode_iterator, int offset) { | 40 interpreter::BytecodeArrayIterator& bytecode_iterator, int offset) { |
| 36 while (bytecode_iterator.current_offset() + | 41 while (bytecode_iterator.current_offset() + |
| 37 bytecode_iterator.current_bytecode_size() <= | 42 bytecode_iterator.current_bytecode_size() <= |
| 38 offset) { | 43 offset) { |
| 39 bytecode_iterator.Advance(); | 44 bytecode_iterator.Advance(); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 int offset = bytecode_offset - BytecodeArray::kHeaderSize + kHeapObjectTag; | 169 int offset = bytecode_offset - BytecodeArray::kHeaderSize + kHeapObjectTag; |
| 165 while (it.current_offset() < offset) it.Advance(); | 170 while (it.current_offset() < offset) it.Advance(); |
| 166 DCHECK_EQ(offset, it.current_offset()); | 171 DCHECK_EQ(offset, it.current_offset()); |
| 167 it.Advance(); // Advance by one bytecode. | 172 it.Advance(); // Advance by one bytecode. |
| 168 offset = it.current_offset() + BytecodeArray::kHeaderSize - kHeapObjectTag; | 173 offset = it.current_offset() + BytecodeArray::kHeaderSize - kHeapObjectTag; |
| 169 return Smi::FromInt(offset); | 174 return Smi::FromInt(offset); |
| 170 } | 175 } |
| 171 | 176 |
| 172 } // namespace internal | 177 } // namespace internal |
| 173 } // namespace v8 | 178 } // namespace v8 |
| OLD | NEW |