Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/runtime/runtime-internal.cc

Issue 2148743004: WIP: wasm oob trap handling experiments (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Undoing spurious changes Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | src/runtime/runtime-wasm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 <setjmp.h>
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
11 #include "src/bootstrapper.h" 11 #include "src/bootstrapper.h"
12 #include "src/conversions.h" 12 #include "src/conversions.h"
13 #include "src/debug/debug.h" 13 #include "src/debug/debug.h"
14 #include "src/frames-inl.h" 14 #include "src/frames-inl.h"
15 #include "src/isolate-inl.h" 15 #include "src/isolate-inl.h"
16 #include "src/messages.h" 16 #include "src/messages.h"
17 #include "src/parsing/parse-info.h" 17 #include "src/parsing/parse-info.h"
18 #include "src/parsing/parser.h" 18 #include "src/parsing/parser.h"
19 #include "src/runtime/runtime-utils.h"
19 #include "src/wasm/wasm-module.h" 20 #include "src/wasm/wasm-module.h"
20 21
21 namespace v8 { 22 namespace v8 {
22 namespace internal { 23 namespace internal {
23 24
24 RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) { 25 RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) {
25 SealHandleScope shs(isolate); 26 SealHandleScope shs(isolate);
26 DCHECK(args.length() == 0); 27 DCHECK(args.length() == 0);
27 CHECK(isolate->bootstrapper()->IsActive()); 28 CHECK(isolate->bootstrapper()->IsActive());
28 return isolate->heap()->undefined_value(); 29 return isolate->heap()->undefined_value();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return isolate->heap()->undefined_value(); 80 return isolate->heap()->undefined_value();
80 } 81 }
81 82
82 83
83 RUNTIME_FUNCTION(Runtime_Throw) { 84 RUNTIME_FUNCTION(Runtime_Throw) {
84 HandleScope scope(isolate); 85 HandleScope scope(isolate);
85 DCHECK(args.length() == 1); 86 DCHECK(args.length() == 1);
86 return isolate->Throw(args[0]); 87 return isolate->Throw(args[0]);
87 } 88 }
88 89
89
90 RUNTIME_FUNCTION(Runtime_ReThrow) { 90 RUNTIME_FUNCTION(Runtime_ReThrow) {
91 HandleScope scope(isolate); 91 HandleScope scope(isolate);
92 DCHECK(args.length() == 1); 92 DCHECK(args.length() == 1);
93 return isolate->ReThrow(args[0]); 93 return isolate->ReThrow(args[0]);
94 } 94 }
95 95
96
97 RUNTIME_FUNCTION(Runtime_ThrowStackOverflow) { 96 RUNTIME_FUNCTION(Runtime_ThrowStackOverflow) {
98 SealHandleScope shs(isolate); 97 SealHandleScope shs(isolate);
99 DCHECK_LE(0, args.length()); 98 DCHECK_LE(0, args.length());
100 return isolate->StackOverflow(); 99 return isolate->StackOverflow();
101 } 100 }
102 101
103 RUNTIME_FUNCTION(Runtime_ThrowWasmError) { 102 RUNTIME_FUNCTION(Runtime_ThrowWasmError) {
104 HandleScope scope(isolate); 103 HandleScope scope(isolate);
105 DCHECK_EQ(2, args.length()); 104 DCHECK_EQ(2, args.length());
106 CONVERT_SMI_ARG_CHECKED(message_id, 0); 105 CONVERT_SMI_ARG_CHECKED(message_id, 0);
107 CONVERT_SMI_ARG_CHECKED(byte_offset, 1); 106 CONVERT_SMI_ARG_CHECKED(byte_offset, 1);
108 Handle<Object> error_obj = isolate->factory()->NewError( 107 Handle<Object> error_obj = isolate->factory()->NewError(
109 static_cast<MessageTemplate::Template>(message_id)); 108 static_cast<MessageTemplate::Template>(message_id));
110 109
111 // For wasm traps, the byte offset (a.k.a source position) can not be 110 // For wasm traps, the byte offset (a.k.a source position) can not be
112 // determined from relocation info, since the explicit checks for traps 111 // determined from relocation info, since the explicit checks for traps
113 // converge in one singe block which calls this runtime function. 112 // converge in one single block which calls this runtime function.
114 // We hence pass the byte offset explicitely, and patch it into the top-most 113 // We hence pass the byte offset explicitely, and patch it into the top-most
115 // frame (a wasm frame) on the collected stack trace. 114 // frame (a wasm frame) on the collected stack trace.
116 // TODO(wasm): This implementation is temporary, see bug #5007: 115 // TODO(wasm): This implementation is temporary, see bug #5007:
117 // https://bugs.chromium.org/p/v8/issues/detail?id=5007 116 // https://bugs.chromium.org/p/v8/issues/detail?id=5007
118 Handle<JSObject> error = Handle<JSObject>::cast(error_obj); 117 Handle<JSObject> error = Handle<JSObject>::cast(error_obj);
119 Handle<Object> stack_trace_obj = JSReceiver::GetDataProperty( 118 Handle<Object> stack_trace_obj = JSReceiver::GetDataProperty(
120 error, isolate->factory()->stack_trace_symbol()); 119 error, isolate->factory()->stack_trace_symbol());
121 // Patch the stack trace (array of <receiver, function, code, position>). 120 // Patch the stack trace (array of <receiver, function, code, position>).
122 if (stack_trace_obj->IsJSArray()) { 121 if (stack_trace_obj->IsJSArray()) {
123 Handle<FrameArray> stack_elements( 122 Handle<FrameArray> stack_elements(
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 589
591 RUNTIME_FUNCTION(Runtime_Typeof) { 590 RUNTIME_FUNCTION(Runtime_Typeof) {
592 HandleScope scope(isolate); 591 HandleScope scope(isolate);
593 DCHECK_EQ(1, args.length()); 592 DCHECK_EQ(1, args.length());
594 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 593 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
595 return *Object::TypeOf(isolate, object); 594 return *Object::TypeOf(isolate, object);
596 } 595 }
597 596
598 } // namespace internal 597 } // namespace internal
599 } // namespace v8 598 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | src/runtime/runtime-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698