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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "src/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
9 #include "src/base/atomic-utils.h" | 9 #include "src/base/atomic-utils.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 3216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3227 bool is_js_to_wasm = caller->kind() == Code::JS_TO_WASM_FUNCTION; | 3227 bool is_js_to_wasm = caller->kind() == Code::JS_TO_WASM_FUNCTION; |
3228 Handle<WasmCompiledModule> compiled_module(instance->compiled_module(), | 3228 Handle<WasmCompiledModule> compiled_module(instance->compiled_module(), |
3229 isolate); | 3229 isolate); |
3230 | 3230 |
3231 if (is_js_to_wasm) { | 3231 if (is_js_to_wasm) { |
3232 non_compiled_functions.push_back({0, exported_func_index}); | 3232 non_compiled_functions.push_back({0, exported_func_index}); |
3233 } else if (patch_caller) { | 3233 } else if (patch_caller) { |
3234 DisallowHeapAllocation no_gc; | 3234 DisallowHeapAllocation no_gc; |
3235 SeqOneByteString* module_bytes = compiled_module->module_bytes(); | 3235 SeqOneByteString* module_bytes = compiled_module->module_bytes(); |
3236 SourcePositionTableIterator source_pos_iterator( | 3236 SourcePositionTableIterator source_pos_iterator( |
3237 caller->source_position_table()); | 3237 caller->SourcePositionTable()); |
3238 DCHECK_EQ(2, caller->deoptimization_data()->length()); | 3238 DCHECK_EQ(2, caller->deoptimization_data()->length()); |
3239 int caller_func_index = | 3239 int caller_func_index = |
3240 Smi::cast(caller->deoptimization_data()->get(1))->value(); | 3240 Smi::cast(caller->deoptimization_data()->get(1))->value(); |
3241 const byte* func_bytes = | 3241 const byte* func_bytes = |
3242 module_bytes->GetChars() + compiled_module->module() | 3242 module_bytes->GetChars() + compiled_module->module() |
3243 ->functions[caller_func_index] | 3243 ->functions[caller_func_index] |
3244 .code_start_offset; | 3244 .code_start_offset; |
3245 for (RelocIterator it(*caller, RelocInfo::kCodeTargetMask); !it.done(); | 3245 for (RelocIterator it(*caller, RelocInfo::kCodeTargetMask); !it.done(); |
3246 it.next()) { | 3246 it.next()) { |
3247 Code* callee = | 3247 Code* callee = |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3303 callee_compiled->instruction_start()); | 3303 callee_compiled->instruction_start()); |
3304 } | 3304 } |
3305 DCHECK_EQ(non_compiled_functions.size(), idx); | 3305 DCHECK_EQ(non_compiled_functions.size(), idx); |
3306 } | 3306 } |
3307 | 3307 |
3308 Code* ret = | 3308 Code* ret = |
3309 Code::cast(compiled_module->code_table()->get(func_to_return_idx)); | 3309 Code::cast(compiled_module->code_table()->get(func_to_return_idx)); |
3310 DCHECK_EQ(Code::WASM_FUNCTION, ret->kind()); | 3310 DCHECK_EQ(Code::WASM_FUNCTION, ret->kind()); |
3311 return handle(ret, isolate); | 3311 return handle(ret, isolate); |
3312 } | 3312 } |
OLD | NEW |