Chromium Code Reviews| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 | 45 |
| 46 RUNTIME_FUNCTION(Runtime_WasmGrowMemory) { | 46 RUNTIME_FUNCTION(Runtime_WasmGrowMemory) { |
| 47 HandleScope scope(isolate); | 47 HandleScope scope(isolate); |
| 48 DCHECK_EQ(1, args.length()); | 48 DCHECK_EQ(1, args.length()); |
| 49 CONVERT_UINT32_ARG_CHECKED(delta_pages, 0); | 49 CONVERT_UINT32_ARG_CHECKED(delta_pages, 0); |
| 50 Handle<WasmInstanceObject> instance = GetWasmInstanceOnStackTop(isolate); | 50 Handle<WasmInstanceObject> instance = GetWasmInstanceOnStackTop(isolate); |
| 51 return *isolate->factory()->NewNumberFromInt( | 51 return *isolate->factory()->NewNumberFromInt( |
| 52 wasm::GrowMemory(isolate, instance, delta_pages)); | 52 wasm::GrowMemory(isolate, instance, delta_pages)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 Object* ThrowRuntimeError(Isolate* isolate, int message_id, int byte_offset, | 55 Object* ThrowRuntimeError(Isolate* isolate, int message_id, int byte_offset, |
|
Michael Starzinger
2017/02/01 11:36:52
We could add a DCHECK_NULL(isolate->context()) her
ahaas
2017/02/01 11:48:51
Done.
| |
| 56 bool patch_source_position) { | 56 bool patch_source_position) { |
| 57 HandleScope scope(isolate); | 57 HandleScope scope(isolate); |
| 58 StackFrameIterator it(isolate); | |
| 59 it.Advance(); | |
| 60 DCHECK(!it.done()); | |
| 61 DCHECK(it.frame()->is_wasm()); | |
|
Clemens Hammacher
2017/01/31 19:20:33
If this is just DCHECKs, we can actually skip them
ahaas
2017/02/01 11:48:51
I removed the DCHECK(!it.done()); and added CHECK(
| |
| 62 isolate->set_context(*WasmCompiledFrame::cast(it.frame()) | |
|
titzer
2017/01/31 19:16:08
We should be careful here. I assume that Throw() b
Clemens Hammacher
2017/01/31 19:20:33
I am still not sure if it's really needed, but to
Michael Starzinger
2017/02/01 11:36:52
AFAICT the {Throw} method itself should not change
| |
| 63 ->wasm_instance() | |
| 64 ->compiled_module() | |
| 65 ->native_context()); | |
| 58 Handle<Object> error_obj = isolate->factory()->NewWasmRuntimeError( | 66 Handle<Object> error_obj = isolate->factory()->NewWasmRuntimeError( |
| 59 static_cast<MessageTemplate::Template>(message_id)); | 67 static_cast<MessageTemplate::Template>(message_id)); |
| 60 | 68 |
| 61 if (!patch_source_position) { | 69 if (!patch_source_position) { |
| 62 return isolate->Throw(*error_obj); | 70 return isolate->Throw(*error_obj); |
| 63 } | 71 } |
| 64 | 72 |
| 65 // For wasm traps, the byte offset (a.k.a source position) can not be | 73 // For wasm traps, the byte offset (a.k.a source position) can not be |
| 66 // determined from relocation info, since the explicit checks for traps | 74 // determined from relocation info, since the explicit checks for traps |
| 67 // converge in one singe block which calls this runtime function. | 75 // converge in one singe block which calls this runtime function. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 // Set the current isolate's context, saving the previous one. | 180 // Set the current isolate's context, saving the previous one. |
| 173 SaveContext save(isolate); | 181 SaveContext save(isolate); |
| 174 isolate->set_context(*instance->compiled_module()->native_context()); | 182 isolate->set_context(*instance->compiled_module()->native_context()); |
| 175 | 183 |
| 176 instance->debug_info()->RunInterpreter(func_index, arg_buffer); | 184 instance->debug_info()->RunInterpreter(func_index, arg_buffer); |
| 177 return isolate->heap()->undefined_value(); | 185 return isolate->heap()->undefined_value(); |
| 178 } | 186 } |
| 179 | 187 |
| 180 } // namespace internal | 188 } // namespace internal |
| 181 } // namespace v8 | 189 } // namespace v8 |
| OLD | NEW |