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/v8memory.h" | 15 #include "src/v8memory.h" |
16 #include "src/wasm/wasm-module.h" | 16 #include "src/wasm/wasm-module.h" |
17 | 17 |
18 namespace v8 { | 18 namespace v8 { |
19 namespace internal { | 19 namespace internal { |
20 | 20 |
21 RUNTIME_FUNCTION(Runtime_WasmGrowMemory) { | 21 RUNTIME_FUNCTION(Runtime_WasmGrowMemory) { |
22 HandleScope scope(isolate); | 22 HandleScope scope(isolate); |
23 DCHECK_EQ(1, args.length()); | 23 DCHECK_EQ(1, args.length()); |
24 uint32_t delta_pages = 0; | 24 CONVERT_UINT32_ARG_CHECKED(delta_pages, 0); |
25 CHECK(args[0]->ToUint32(&delta_pages)); | |
26 Handle<JSObject> module_instance; | 25 Handle<JSObject> module_instance; |
27 | 26 |
28 { | 27 { |
29 // Get the module JSObject | 28 // Get the module JSObject |
30 DisallowHeapAllocation no_allocation; | 29 DisallowHeapAllocation no_allocation; |
31 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top()); | 30 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top()); |
32 Address pc = | 31 Address pc = |
33 Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset); | 32 Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset); |
34 Code* code = | 33 Code* code = |
35 isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; | 34 isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 return *isolate->factory()->NewNumberFromInt(old_size / | 110 return *isolate->factory()->NewNumberFromInt(old_size / |
112 wasm::WasmModule::kPageSize); | 111 wasm::WasmModule::kPageSize); |
113 } | 112 } |
114 | 113 |
115 RUNTIME_FUNCTION(Runtime_WasmThrowTypeError) { | 114 RUNTIME_FUNCTION(Runtime_WasmThrowTypeError) { |
116 HandleScope scope(isolate); | 115 HandleScope scope(isolate); |
117 DCHECK_EQ(0, args.length()); | 116 DCHECK_EQ(0, args.length()); |
118 THROW_NEW_ERROR_RETURN_FAILURE( | 117 THROW_NEW_ERROR_RETURN_FAILURE( |
119 isolate, NewTypeError(MessageTemplate::kWasmTrapTypeError)); | 118 isolate, NewTypeError(MessageTemplate::kWasmTrapTypeError)); |
120 } | 119 } |
| 120 |
| 121 RUNTIME_FUNCTION(Runtime_WasmThrow) { |
| 122 HandleScope scope(isolate); |
| 123 DCHECK_EQ(2, args.length()); |
| 124 CONVERT_SMI_ARG_CHECKED(lower, 0); |
| 125 CONVERT_SMI_ARG_CHECKED(upper, 1); |
| 126 |
| 127 const int32_t thrown_value = (upper << 16) | lower; |
| 128 |
| 129 return isolate->Throw(*isolate->factory()->NewNumberFromInt(thrown_value)); |
| 130 } |
| 131 |
121 } // namespace internal | 132 } // namespace internal |
122 } // namespace v8 | 133 } // namespace v8 |
OLD | NEW |