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 uint32_t delta_pages = 0; |
25 CHECK(args[0]->ToUint32(&delta_pages)); | 25 CHECK(args[0]->ToUint32(&delta_pages)); |
Michael Starzinger
2016/09/15 12:33:36
nit: I know this is not your code, but for bonus p
John
2016/09/15 12:42:05
CONVERT_UINT32_ARG_CHECKED is not available. I cha
Michael Starzinger
2016/09/15 12:51:08
https://cs.chromium.org/chromium/src/v8/src/runtim
John
2016/09/15 14:03:08
Done.
| |
26 Handle<JSObject> module_instance; | 26 Handle<JSObject> module_instance; |
27 | 27 |
28 { | 28 { |
29 // Get the module JSObject | 29 // Get the module JSObject |
30 DisallowHeapAllocation no_allocation; | 30 DisallowHeapAllocation no_allocation; |
31 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top()); | 31 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top()); |
32 Address pc = | 32 Address pc = |
33 Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset); | 33 Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset); |
34 Code* code = | 34 Code* code = |
35 isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; | 35 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 / | 111 return *isolate->factory()->NewNumberFromInt(old_size / |
112 wasm::WasmModule::kPageSize); | 112 wasm::WasmModule::kPageSize); |
113 } | 113 } |
114 | 114 |
115 RUNTIME_FUNCTION(Runtime_WasmThrowTypeError) { | 115 RUNTIME_FUNCTION(Runtime_WasmThrowTypeError) { |
116 HandleScope scope(isolate); | 116 HandleScope scope(isolate); |
117 DCHECK_EQ(0, args.length()); | 117 DCHECK_EQ(0, args.length()); |
118 THROW_NEW_ERROR_RETURN_FAILURE( | 118 THROW_NEW_ERROR_RETURN_FAILURE( |
119 isolate, NewTypeError(MessageTemplate::kWasmTrapTypeError)); | 119 isolate, NewTypeError(MessageTemplate::kWasmTrapTypeError)); |
120 } | 120 } |
121 | |
122 RUNTIME_FUNCTION(Runtime_WasmThrow) { | |
123 HandleScope scope(isolate); | |
124 DCHECK_EQ(2, args.length()); | |
125 Object* upper = args[1]; | |
126 Object* lower = args[0]; | |
Michael Starzinger
2016/09/15 12:33:36
nit: Please use CONVERT_SMI_ARG_CHECKED here.
John
2016/09/15 12:42:05
Done.
| |
127 | |
128 const int32_t thrown_value = | |
129 (Smi::cast(upper)->value() << 16) | Smi::cast(lower)->value(); | |
130 | |
131 return isolate->Throw(*isolate->factory()->NewNumberFromInt(thrown_value)); | |
132 } | |
133 | |
121 } // namespace internal | 134 } // namespace internal |
122 } // namespace v8 | 135 } // namespace v8 |
OLD | NEW |