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

Side by Side Diff: src/wasm/wasm-js.cc

Issue 2404253002: [wasm] Provide better stack traces for asm.js code (Closed)
Patch Set: Address titzer's comments Created 4 years, 2 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/wasm/wasm-debug.cc ('k') | src/wasm/wasm-module.h » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/api-natives.h" 5 #include "src/api-natives.h"
6 #include "src/api.h" 6 #include "src/api.h"
7 #include "src/asmjs/asm-js.h" 7 #include "src/asmjs/asm-js.h"
8 #include "src/asmjs/asm-typer.h" 8 #include "src/asmjs/asm-typer.h"
9 #include "src/asmjs/asm-wasm-builder.h" 9 #include "src/asmjs/asm-wasm-builder.h"
10 #include "src/assert-scope.h" 10 #include "src/assert-scope.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 if (result.failed()) { 128 if (result.failed()) {
129 thrower.Failed("", result); 129 thrower.Failed("", result);
130 } 130 }
131 131
132 if (result.val) delete result.val; 132 if (result.val) delete result.val;
133 } 133 }
134 134
135 i::MaybeHandle<i::JSObject> InstantiateModule( 135 i::MaybeHandle<i::JSObject> InstantiateModule(
136 const v8::FunctionCallbackInfo<v8::Value>& args, const byte* start, 136 const v8::FunctionCallbackInfo<v8::Value>& args, const byte* start,
137 const byte* end, ErrorThrower* thrower, 137 const byte* end, ErrorThrower* thrower) {
138 internal::wasm::ModuleOrigin origin = i::wasm::kWasmOrigin) {
139 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); 138 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
140 139
141 // Decode but avoid a redundant pass over function bodies for verification. 140 // Decode but avoid a redundant pass over function bodies for verification.
142 // Verification will happen during compilation. 141 // Verification will happen during compilation.
143 i::Zone zone(isolate->allocator()); 142 i::Zone zone(isolate->allocator());
144 i::MaybeHandle<i::JSObject> module_object = 143 i::MaybeHandle<i::JSObject> module_object =
145 i::wasm::CreateModuleObjectFromBytes(isolate, start, end, thrower, 144 i::wasm::CreateModuleObjectFromBytes(
146 origin); 145 isolate, start, end, thrower, i::wasm::kWasmOrigin,
146 i::Handle<i::Script>::null(), nullptr, nullptr);
147 i::MaybeHandle<i::JSObject> object; 147 i::MaybeHandle<i::JSObject> object;
148 if (!module_object.is_null()) { 148 if (!module_object.is_null()) {
149 // Success. Instantiate the module and return the object. 149 // Success. Instantiate the module and return the object.
150 i::Handle<i::JSObject> ffi = i::Handle<i::JSObject>::null(); 150 i::Handle<i::JSObject> ffi = i::Handle<i::JSObject>::null();
151 if (args.Length() > 1 && args[1]->IsObject()) { 151 if (args.Length() > 1 && args[1]->IsObject()) {
152 Local<Object> obj = Local<Object>::Cast(args[1]); 152 Local<Object> obj = Local<Object>::Cast(args[1]);
153 ffi = i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj)); 153 ffi = i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj));
154 } 154 }
155 155
156 i::Handle<i::JSArrayBuffer> memory = i::Handle<i::JSArrayBuffer>::null(); 156 i::Handle<i::JSArrayBuffer> memory = i::Handle<i::JSArrayBuffer>::null();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 v8::Isolate* isolate, const v8::Local<v8::Value> source, 188 v8::Isolate* isolate, const v8::Local<v8::Value> source,
189 ErrorThrower* thrower) { 189 ErrorThrower* thrower) {
190 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 190 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
191 i::MaybeHandle<i::JSObject> nothing; 191 i::MaybeHandle<i::JSObject> nothing;
192 192
193 RawBuffer buffer = GetRawBufferSource(source, thrower); 193 RawBuffer buffer = GetRawBufferSource(source, thrower);
194 if (buffer.start == nullptr) return i::MaybeHandle<i::JSObject>(); 194 if (buffer.start == nullptr) return i::MaybeHandle<i::JSObject>();
195 195
196 DCHECK(source->IsArrayBuffer() || source->IsTypedArray()); 196 DCHECK(source->IsArrayBuffer() || source->IsTypedArray());
197 return i::wasm::CreateModuleObjectFromBytes( 197 return i::wasm::CreateModuleObjectFromBytes(
198 i_isolate, buffer.start, buffer.end, thrower, 198 i_isolate, buffer.start, buffer.end, thrower, i::wasm::kWasmOrigin,
199 i::wasm::ModuleOrigin::kWasmOrigin); 199 i::Handle<i::Script>::null(), nullptr, nullptr);
200 } 200 }
201 201
202 static bool ValidateModule(v8::Isolate* isolate, 202 static bool ValidateModule(v8::Isolate* isolate,
203 const v8::Local<v8::Value> source, 203 const v8::Local<v8::Value> source,
204 ErrorThrower* thrower) { 204 ErrorThrower* thrower) {
205 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 205 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
206 i::MaybeHandle<i::JSObject> nothing; 206 i::MaybeHandle<i::JSObject> nothing;
207 207
208 RawBuffer buffer = GetRawBufferSource(source, thrower); 208 RawBuffer buffer = GetRawBufferSource(source, thrower);
209 if (buffer.start == nullptr) return false; 209 if (buffer.start == nullptr) return false;
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 Handle<JSArrayBuffer> WasmJs::GetWasmMemoryArrayBuffer(Isolate* isolate, 754 Handle<JSArrayBuffer> WasmJs::GetWasmMemoryArrayBuffer(Isolate* isolate,
755 Handle<Object> value) { 755 Handle<Object> value) {
756 DCHECK(IsWasmMemoryObject(isolate, value)); 756 DCHECK(IsWasmMemoryObject(isolate, value));
757 Handle<Object> buf( 757 Handle<Object> buf(
758 JSObject::cast(*value)->GetInternalField(kWasmMemoryBufferFieldIndex), 758 JSObject::cast(*value)->GetInternalField(kWasmMemoryBufferFieldIndex),
759 isolate); 759 isolate);
760 return Handle<JSArrayBuffer>::cast(buf); 760 return Handle<JSArrayBuffer>::cast(buf);
761 } 761 }
762 } // namespace internal 762 } // namespace internal
763 } // namespace v8 763 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/wasm-debug.cc ('k') | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698