OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/compiler/wasm-compiler.h" | 9 #include "src/compiler/wasm-compiler.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 HandleScope scope(isolate); | 145 HandleScope scope(isolate); |
146 DCHECK_EQ(1, args.length()); | 146 DCHECK_EQ(1, args.length()); |
147 Object* exception = args[0]; | 147 Object* exception = args[0]; |
148 // The unwinder will only deliver exceptions to wasm if the exception is a | 148 // The unwinder will only deliver exceptions to wasm if the exception is a |
149 // Number or a Smi (which we have just converted to a Number.) This logic | 149 // Number or a Smi (which we have just converted to a Number.) This logic |
150 // lives in Isolate::is_catchable_by_wasm(Object*). | 150 // lives in Isolate::is_catchable_by_wasm(Object*). |
151 CHECK(exception->IsNumber()); | 151 CHECK(exception->IsNumber()); |
152 return exception; | 152 return exception; |
153 } | 153 } |
154 | 154 |
| 155 RUNTIME_FUNCTION(Runtime_GetWasmInterpreterBuffer) { |
| 156 DCHECK(args.length() == 2); |
| 157 HandleScope scope(isolate); |
| 158 CONVERT_NUMBER_CHECKED(int32_t, func_index, Int32, args[0]); |
| 159 CONVERT_ARG_HANDLE_CHECKED(JSObject, instance_obj, 1); |
| 160 CHECK(WasmInstanceObject::IsWasmInstanceObject(*instance_obj)); |
| 161 |
| 162 Handle<WasmInstanceObject> instance = |
| 163 Handle<WasmInstanceObject>::cast(instance_obj); |
| 164 Handle<WasmDebugInfo> debug_info = |
| 165 WasmInstanceObject::GetOrCreateDebugInfo(instance); |
| 166 return WasmDebugInfo::GetInterpreterArgBuffer(debug_info, func_index); |
| 167 } |
| 168 |
| 169 RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) { |
| 170 DCHECK(args.length() == 2); |
| 171 HandleScope scope(isolate); |
| 172 CONVERT_NUMBER_CHECKED(int32_t, func_index, Int32, args[0]); |
| 173 CONVERT_ARG_HANDLE_CHECKED(JSObject, instance_obj, 1); |
| 174 CHECK(WasmInstanceObject::IsWasmInstanceObject(*instance_obj)); |
| 175 |
| 176 Handle<WasmInstanceObject> instance = |
| 177 Handle<WasmInstanceObject>::cast(instance_obj); |
| 178 Handle<WasmDebugInfo> debug_info = |
| 179 WasmInstanceObject::GetOrCreateDebugInfo(instance); |
| 180 WasmDebugInfo::RunInterpreter(debug_info, func_index); |
| 181 return isolate->heap()->undefined_value(); |
| 182 } |
| 183 |
155 } // namespace internal | 184 } // namespace internal |
156 } // namespace v8 | 185 } // namespace v8 |
OLD | NEW |