| 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(2, 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); | 26 CONVERT_SMI_ARG_CHECKED(pretenured_flag, 1); |
| 27 CONVERT_SMI_ARG_CHECKED(index, 2); | |
| 28 CONVERT_SMI_ARG_CHECKED(pretenured_flag, 3); | |
| 29 Handle<Context> context(isolate->context(), isolate); | 27 Handle<Context> context(isolate->context(), isolate); |
| 30 FeedbackVectorSlot slot = TypeFeedbackVector::ToSlot(index); | |
| 31 Handle<LiteralsArray> literals(LiteralsArray::cast(vector->Get(slot)), | |
| 32 isolate); | |
| 33 return *isolate->factory()->NewFunctionFromSharedFunctionInfo( | 28 return *isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 34 shared, context, literals, static_cast<PretenureFlag>(pretenured_flag)); | 29 shared, context, static_cast<PretenureFlag>(pretenured_flag)); |
| 35 } | 30 } |
| 36 | 31 |
| 37 namespace { | 32 namespace { |
| 38 | 33 |
| 39 void AdvanceToOffsetForTracing( | 34 void AdvanceToOffsetForTracing( |
| 40 interpreter::BytecodeArrayIterator& bytecode_iterator, int offset) { | 35 interpreter::BytecodeArrayIterator& bytecode_iterator, int offset) { |
| 41 while (bytecode_iterator.current_offset() + | 36 while (bytecode_iterator.current_offset() + |
| 42 bytecode_iterator.current_bytecode_size() <= | 37 bytecode_iterator.current_bytecode_size() <= |
| 43 offset) { | 38 offset) { |
| 44 bytecode_iterator.Advance(); | 39 bytecode_iterator.Advance(); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 int offset = bytecode_offset - BytecodeArray::kHeaderSize + kHeapObjectTag; | 164 int offset = bytecode_offset - BytecodeArray::kHeaderSize + kHeapObjectTag; |
| 170 while (it.current_offset() < offset) it.Advance(); | 165 while (it.current_offset() < offset) it.Advance(); |
| 171 DCHECK_EQ(offset, it.current_offset()); | 166 DCHECK_EQ(offset, it.current_offset()); |
| 172 it.Advance(); // Advance by one bytecode. | 167 it.Advance(); // Advance by one bytecode. |
| 173 offset = it.current_offset() + BytecodeArray::kHeaderSize - kHeapObjectTag; | 168 offset = it.current_offset() + BytecodeArray::kHeaderSize - kHeapObjectTag; |
| 174 return Smi::FromInt(offset); | 169 return Smi::FromInt(offset); |
| 175 } | 170 } |
| 176 | 171 |
| 177 } // namespace internal | 172 } // namespace internal |
| 178 } // namespace v8 | 173 } // namespace v8 |
| OLD | NEW |