OLD | NEW |
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); | 97 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); |
98 ErrorThrower thrower(isolate, "Wasm.verifyModule()"); | 98 ErrorThrower thrower(isolate, "Wasm.verifyModule()"); |
99 | 99 |
100 if (args.Length() < 1) { | 100 if (args.Length() < 1) { |
101 thrower.TypeError("Argument 0 must be a buffer source"); | 101 thrower.TypeError("Argument 0 must be a buffer source"); |
102 return; | 102 return; |
103 } | 103 } |
104 RawBuffer buffer = GetRawBufferSource(args[0], &thrower); | 104 RawBuffer buffer = GetRawBufferSource(args[0], &thrower); |
105 if (thrower.error()) return; | 105 if (thrower.error()) return; |
106 | 106 |
107 i::Zone zone(isolate->allocator(), ZONE_NAME); | 107 internal::wasm::ModuleResult result = internal::wasm::DecodeWasmModule( |
108 internal::wasm::ModuleResult result = | 108 isolate, buffer.start, buffer.end, true, internal::wasm::kWasmOrigin); |
109 internal::wasm::DecodeWasmModule(isolate, &zone, buffer.start, buffer.end, | |
110 true, internal::wasm::kWasmOrigin); | |
111 | 109 |
112 if (result.failed()) { | 110 if (result.failed()) { |
113 thrower.CompileFailed("", result); | 111 thrower.CompileFailed("", result); |
114 } | 112 } |
115 | 113 |
116 if (result.val) delete result.val; | 114 if (result.val) delete result.val; |
117 } | 115 } |
118 | 116 |
119 void VerifyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) { | 117 void VerifyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) { |
120 HandleScope scope(args.GetIsolate()); | 118 HandleScope scope(args.GetIsolate()); |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 if (!memory_object->IsUndefined(isolate)) { | 972 if (!memory_object->IsUndefined(isolate)) { |
975 DCHECK(IsWasmMemoryObject(isolate, memory_object)); | 973 DCHECK(IsWasmMemoryObject(isolate, memory_object)); |
976 // TODO(gdeepti): This should be a weak list of instance objects | 974 // TODO(gdeepti): This should be a weak list of instance objects |
977 // for instances that share memory. | 975 // for instances that share memory. |
978 JSObject::cast(*memory_object) | 976 JSObject::cast(*memory_object) |
979 ->SetInternalField(kWasmMemoryInstanceObject, *instance); | 977 ->SetInternalField(kWasmMemoryInstanceObject, *instance); |
980 } | 978 } |
981 } | 979 } |
982 } // namespace internal | 980 } // namespace internal |
983 } // namespace v8 | 981 } // namespace v8 |
OLD | NEW |