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" |
15 #include "src/v8memory.h" | 16 #include "src/v8memory.h" |
16 #include "src/wasm/wasm-module.h" | 17 #include "src/wasm/wasm-module.h" |
17 #include "src/wasm/wasm-objects.h" | 18 #include "src/wasm/wasm-objects.h" |
18 #include "src/wasm/wasm-opcodes.h" | 19 #include "src/wasm/wasm-opcodes.h" |
19 | 20 |
20 namespace v8 { | 21 namespace v8 { |
21 namespace internal { | 22 namespace internal { |
22 | 23 |
23 namespace { | 24 namespace { |
24 WasmInstanceObject* GetWasmInstanceOnStackTop(Isolate* isolate) { | 25 WasmInstanceObject* GetWasmInstanceOnStackTop(Isolate* isolate) { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 HandleScope scope(isolate); | 153 HandleScope scope(isolate); |
153 DCHECK_EQ(1, args.length()); | 154 DCHECK_EQ(1, args.length()); |
154 Object* exception = args[0]; | 155 Object* exception = args[0]; |
155 // The unwinder will only deliver exceptions to wasm if the exception is a | 156 // The unwinder will only deliver exceptions to wasm if the exception is a |
156 // Number or a Smi (which we have just converted to a Number.) This logic | 157 // Number or a Smi (which we have just converted to a Number.) This logic |
157 // lives in Isolate::is_catchable_by_wasm(Object*). | 158 // lives in Isolate::is_catchable_by_wasm(Object*). |
158 CHECK(exception->IsNumber()); | 159 CHECK(exception->IsNumber()); |
159 return exception; | 160 return exception; |
160 } | 161 } |
161 | 162 |
| 163 RUNTIME_FUNCTION(Runtime_SetThreadInWasm) { |
| 164 trap_handler::SetThreadInWasm(); |
| 165 return isolate->heap()->undefined_value(); |
| 166 } |
| 167 |
| 168 RUNTIME_FUNCTION(Runtime_ClearThreadInWasm) { |
| 169 trap_handler::ClearThreadInWasm(); |
| 170 return isolate->heap()->undefined_value(); |
| 171 } |
| 172 |
162 RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) { | 173 RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) { |
163 DCHECK_EQ(3, args.length()); | 174 DCHECK_EQ(3, args.length()); |
164 HandleScope scope(isolate); | 175 HandleScope scope(isolate); |
165 CONVERT_ARG_HANDLE_CHECKED(JSObject, instance_obj, 0); | 176 CONVERT_ARG_HANDLE_CHECKED(JSObject, instance_obj, 0); |
166 CONVERT_NUMBER_CHECKED(int32_t, func_index, Int32, args[1]); | 177 CONVERT_NUMBER_CHECKED(int32_t, func_index, Int32, args[1]); |
167 CONVERT_ARG_HANDLE_CHECKED(Object, arg_buffer_obj, 2); | 178 CONVERT_ARG_HANDLE_CHECKED(Object, arg_buffer_obj, 2); |
168 CHECK(WasmInstanceObject::IsWasmInstanceObject(*instance_obj)); | 179 CHECK(WasmInstanceObject::IsWasmInstanceObject(*instance_obj)); |
169 Handle<WasmInstanceObject> instance = | 180 Handle<WasmInstanceObject> instance = |
170 Handle<WasmInstanceObject>::cast(instance_obj); | 181 Handle<WasmInstanceObject>::cast(instance_obj); |
171 | 182 |
(...skipping 21 matching lines...) Expand all Loading... |
193 | 204 |
194 // Check if this is a real stack overflow. | 205 // Check if this is a real stack overflow. |
195 StackLimitCheck check(isolate); | 206 StackLimitCheck check(isolate); |
196 if (check.JsHasOverflowed()) return isolate->StackOverflow(); | 207 if (check.JsHasOverflowed()) return isolate->StackOverflow(); |
197 | 208 |
198 return isolate->stack_guard()->HandleInterrupts(); | 209 return isolate->stack_guard()->HandleInterrupts(); |
199 } | 210 } |
200 | 211 |
201 } // namespace internal | 212 } // namespace internal |
202 } // namespace v8 | 213 } // namespace v8 |
OLD | NEW |