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/asmjs/asm-js.h" | 5 #include "src/asmjs/asm-js.h" |
6 | 6 |
7 #include "src/api-natives.h" | 7 #include "src/api-natives.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/asmjs/asm-typer.h" | 9 #include "src/asmjs/asm-typer.h" |
10 #include "src/asmjs/asm-wasm-builder.h" | 10 #include "src/asmjs/asm-wasm-builder.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 UNREACHABLE(); | 60 UNREACHABLE(); |
61 } | 61 } |
62 switch (member_kind) { | 62 switch (member_kind) { |
63 case wasm::AsmTyper::StandardMember::kNone: | 63 case wasm::AsmTyper::StandardMember::kNone: |
64 case wasm::AsmTyper::StandardMember::kModule: | 64 case wasm::AsmTyper::StandardMember::kModule: |
65 case wasm::AsmTyper::StandardMember::kStdlib: { | 65 case wasm::AsmTyper::StandardMember::kStdlib: { |
66 // Nothing to check for these. | 66 // Nothing to check for these. |
67 return true; | 67 return true; |
68 } | 68 } |
69 case wasm::AsmTyper::StandardMember::kNaN: { | 69 case wasm::AsmTyper::StandardMember::kNaN: { |
| 70 if (stdlib.is_null()) { |
| 71 return false; |
| 72 } |
70 i::Handle<i::Name> name(isolate->factory()->InternalizeOneByteString( | 73 i::Handle<i::Name> name(isolate->factory()->InternalizeOneByteString( |
71 STATIC_CHAR_VECTOR("NaN"))); | 74 STATIC_CHAR_VECTOR("NaN"))); |
72 i::MaybeHandle<i::Object> maybe_value = | 75 i::MaybeHandle<i::Object> maybe_value = |
73 i::Object::GetProperty(stdlib, name); | 76 i::Object::GetProperty(stdlib, name); |
74 if (maybe_value.is_null()) { | 77 if (maybe_value.is_null()) { |
75 return false; | 78 return false; |
76 } | 79 } |
77 i::Handle<i::Object> value = maybe_value.ToHandleChecked(); | 80 i::Handle<i::Object> value = maybe_value.ToHandleChecked(); |
78 if (!value->IsNaN()) { | 81 if (!value->IsNaN()) { |
79 return false; | 82 return false; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 continue; | 208 continue; |
206 } | 209 } |
207 } | 210 } |
208 } | 211 } |
209 foreign_args_array[j] = undefined; | 212 foreign_args_array[j] = undefined; |
210 } | 213 } |
211 i::MaybeHandle<i::Object> retval = i::Execution::Call( | 214 i::MaybeHandle<i::Object> retval = i::Execution::Call( |
212 isolate, init, undefined, foreign_globals->length(), foreign_args_array); | 215 isolate, init, undefined, foreign_globals->length(), foreign_args_array); |
213 delete[] foreign_args_array; | 216 delete[] foreign_args_array; |
214 | 217 |
215 if (retval.is_null()) { | 218 DCHECK(!retval.is_null()); |
216 thrower.Error( | 219 |
217 "WASM.instantiateModuleFromAsm(): foreign init function failed"); | |
218 return MaybeHandle<Object>(); | |
219 } | |
220 return maybe_module_object; | 220 return maybe_module_object; |
221 } | 221 } |
222 | 222 |
223 } // namespace internal | 223 } // namespace internal |
224 } // namespace v8 | 224 } // namespace v8 |
OLD | NEW |