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_WasmRunInterpreter) { |
| 156 DCHECK(args.length() == 3); |
| 157 HandleScope scope(isolate); |
| 158 CONVERT_ARG_HANDLE_CHECKED(JSObject, instance_obj, 0); |
| 159 CONVERT_NUMBER_CHECKED(int32_t, func_index, Int32, args[1]); |
| 160 CONVERT_ARG_HANDLE_CHECKED(Object, arg_buffer_obj, 2); |
| 161 CHECK(WasmInstanceObject::IsWasmInstanceObject(*instance_obj)); |
| 162 |
| 163 // The arg buffer is the raw pointer to the caller's stack. It looks like a |
| 164 // Smi (lowest bit not set, as checked by IsSmi), but is no valid Smi. We just |
| 165 // cast it back to the raw pointer. |
| 166 CHECK(!arg_buffer_obj->IsHeapObject()); |
| 167 CHECK(arg_buffer_obj->IsSmi()); |
| 168 uint8_t* arg_buffer = reinterpret_cast<uint8_t*>(*arg_buffer_obj); |
| 169 |
| 170 Handle<WasmInstanceObject> instance = |
| 171 Handle<WasmInstanceObject>::cast(instance_obj); |
| 172 Handle<WasmDebugInfo> debug_info = |
| 173 WasmInstanceObject::GetOrCreateDebugInfo(instance); |
| 174 WasmDebugInfo::RunInterpreter(debug_info, func_index, arg_buffer); |
| 175 return isolate->heap()->undefined_value(); |
| 176 } |
| 177 |
155 } // namespace internal | 178 } // namespace internal |
156 } // namespace v8 | 179 } // namespace v8 |
OLD | NEW |