| 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" |
| 11 #include "src/debug/debug.h" | 11 #include "src/debug/debug.h" |
| 12 #include "src/factory.h" | 12 #include "src/factory.h" |
| 13 #include "src/frames-inl.h" | 13 #include "src/frames-inl.h" |
| 14 #include "src/objects-inl.h" | 14 #include "src/objects-inl.h" |
| 15 #include "src/trap-handler/trap-handler.h" | |
| 16 #include "src/v8memory.h" | 15 #include "src/v8memory.h" |
| 17 #include "src/wasm/wasm-module.h" | 16 #include "src/wasm/wasm-module.h" |
| 18 #include "src/wasm/wasm-objects.h" | 17 #include "src/wasm/wasm-objects.h" |
| 19 #include "src/wasm/wasm-opcodes.h" | 18 #include "src/wasm/wasm-opcodes.h" |
| 20 | 19 |
| 21 namespace v8 { | 20 namespace v8 { |
| 22 namespace internal { | 21 namespace internal { |
| 23 | 22 |
| 24 namespace { | 23 namespace { |
| 25 WasmInstanceObject* GetWasmInstanceOnStackTop(Isolate* isolate) { | 24 WasmInstanceObject* GetWasmInstanceOnStackTop(Isolate* isolate) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 HandleScope scope(isolate); | 161 HandleScope scope(isolate); |
| 163 DCHECK_EQ(1, args.length()); | 162 DCHECK_EQ(1, args.length()); |
| 164 Object* exception = args[0]; | 163 Object* exception = args[0]; |
| 165 // The unwinder will only deliver exceptions to wasm if the exception is a | 164 // The unwinder will only deliver exceptions to wasm if the exception is a |
| 166 // Number or a Smi (which we have just converted to a Number.) This logic | 165 // Number or a Smi (which we have just converted to a Number.) This logic |
| 167 // lives in Isolate::is_catchable_by_wasm(Object*). | 166 // lives in Isolate::is_catchable_by_wasm(Object*). |
| 168 CHECK(exception->IsNumber()); | 167 CHECK(exception->IsNumber()); |
| 169 return exception; | 168 return exception; |
| 170 } | 169 } |
| 171 | 170 |
| 172 RUNTIME_FUNCTION(Runtime_SetThreadInWasm) { | |
| 173 trap_handler::SetThreadInWasm(); | |
| 174 return isolate->heap()->undefined_value(); | |
| 175 } | |
| 176 | |
| 177 RUNTIME_FUNCTION(Runtime_ClearThreadInWasm) { | |
| 178 trap_handler::ClearThreadInWasm(); | |
| 179 return isolate->heap()->undefined_value(); | |
| 180 } | |
| 181 | |
| 182 RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) { | 171 RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) { |
| 183 DCHECK_EQ(3, args.length()); | 172 DCHECK_EQ(3, args.length()); |
| 184 HandleScope scope(isolate); | 173 HandleScope scope(isolate); |
| 185 CONVERT_ARG_HANDLE_CHECKED(JSObject, instance_obj, 0); | 174 CONVERT_ARG_HANDLE_CHECKED(JSObject, instance_obj, 0); |
| 186 CONVERT_NUMBER_CHECKED(int32_t, func_index, Int32, args[1]); | 175 CONVERT_NUMBER_CHECKED(int32_t, func_index, Int32, args[1]); |
| 187 CONVERT_ARG_HANDLE_CHECKED(Object, arg_buffer_obj, 2); | 176 CONVERT_ARG_HANDLE_CHECKED(Object, arg_buffer_obj, 2); |
| 188 CHECK(WasmInstanceObject::IsWasmInstanceObject(*instance_obj)); | 177 CHECK(WasmInstanceObject::IsWasmInstanceObject(*instance_obj)); |
| 189 Handle<WasmInstanceObject> instance = | 178 Handle<WasmInstanceObject> instance = |
| 190 Handle<WasmInstanceObject>::cast(instance_obj); | 179 Handle<WasmInstanceObject>::cast(instance_obj); |
| 191 | 180 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 214 | 203 |
| 215 // Check if this is a real stack overflow. | 204 // Check if this is a real stack overflow. |
| 216 StackLimitCheck check(isolate); | 205 StackLimitCheck check(isolate); |
| 217 if (check.JsHasOverflowed()) return isolate->StackOverflow(); | 206 if (check.JsHasOverflowed()) return isolate->StackOverflow(); |
| 218 | 207 |
| 219 return isolate->stack_guard()->HandleInterrupts(); | 208 return isolate->stack_guard()->HandleInterrupts(); |
| 220 } | 209 } |
| 221 | 210 |
| 222 } // namespace internal | 211 } // namespace internal |
| 223 } // namespace v8 | 212 } // namespace v8 |
| OLD | NEW |