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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "src/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
9 #include "src/base/atomic-utils.h" | 9 #include "src/base/atomic-utils.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 os << "?"; | 821 os << "?"; |
822 } | 822 } |
823 return os; | 823 return os; |
824 } | 824 } |
825 | 825 |
826 WasmInstanceObject* wasm::GetOwningWasmInstance(Code* code) { | 826 WasmInstanceObject* wasm::GetOwningWasmInstance(Code* code) { |
827 DisallowHeapAllocation no_gc; | 827 DisallowHeapAllocation no_gc; |
828 DCHECK(code->kind() == Code::WASM_FUNCTION || | 828 DCHECK(code->kind() == Code::WASM_FUNCTION || |
829 code->kind() == Code::WASM_INTERPRETER_ENTRY); | 829 code->kind() == Code::WASM_INTERPRETER_ENTRY); |
830 FixedArray* deopt_data = code->deoptimization_data(); | 830 FixedArray* deopt_data = code->deoptimization_data(); |
831 DCHECK_NOT_NULL(deopt_data); | |
832 DCHECK_EQ(code->kind() == Code::WASM_INTERPRETER_ENTRY ? 1 : 2, | 831 DCHECK_EQ(code->kind() == Code::WASM_INTERPRETER_ENTRY ? 1 : 2, |
833 deopt_data->length()); | 832 deopt_data->length()); |
834 Object* weak_link = deopt_data->get(0); | 833 Object* weak_link = deopt_data->get(0); |
835 DCHECK(weak_link->IsWeakCell()); | 834 DCHECK(weak_link->IsWeakCell()); |
836 WeakCell* cell = WeakCell::cast(weak_link); | 835 WeakCell* cell = WeakCell::cast(weak_link); |
837 if (cell->cleared()) return nullptr; | 836 if (cell->cleared()) return nullptr; |
838 return WasmInstanceObject::cast(cell->value()); | 837 return WasmInstanceObject::cast(cell->value()); |
839 } | 838 } |
840 | 839 |
841 int wasm::GetFunctionCodeOffset(Handle<WasmCompiledModule> compiled_module, | 840 int wasm::GetFunctionCodeOffset(Handle<WasmCompiledModule> compiled_module, |
842 int func_index) { | 841 int func_index) { |
843 return GetFunctionOffsetAndLength(compiled_module, func_index).first; | 842 return GetFunctionOffsetAndLength(compiled_module, func_index).first; |
844 } | 843 } |
845 | 844 |
846 WasmModule::WasmModule(Zone* owned) | 845 WasmModule::WasmModule(Zone* owned) |
847 : owned_zone(owned), pending_tasks(new base::Semaphore(0)) {} | 846 : owned_zone(owned), pending_tasks(new base::Semaphore(0)) {} |
848 | 847 |
849 static WasmFunction* GetWasmFunctionForImportWrapper(Isolate* isolate, | 848 namespace { |
850 Handle<Object> target) { | 849 |
| 850 WasmFunction* GetWasmFunctionForImportWrapper(Isolate* isolate, |
| 851 Handle<Object> target) { |
851 if (target->IsJSFunction()) { | 852 if (target->IsJSFunction()) { |
852 Handle<JSFunction> func = Handle<JSFunction>::cast(target); | 853 Handle<JSFunction> func = Handle<JSFunction>::cast(target); |
853 if (func->code()->kind() == Code::JS_TO_WASM_FUNCTION) { | 854 if (func->code()->kind() == Code::JS_TO_WASM_FUNCTION) { |
854 auto exported = Handle<WasmExportedFunction>::cast(func); | 855 auto exported = Handle<WasmExportedFunction>::cast(func); |
855 Handle<WasmInstanceObject> other_instance(exported->instance(), isolate); | 856 Handle<WasmInstanceObject> other_instance(exported->instance(), isolate); |
856 int func_index = exported->function_index(); | 857 int func_index = exported->function_index(); |
857 return &other_instance->module()->functions[func_index]; | 858 return &other_instance->module()->functions[func_index]; |
858 } | 859 } |
859 } | 860 } |
860 return nullptr; | 861 return nullptr; |
(...skipping 16 matching lines...) Expand all Loading... |
877 DCHECK(code->kind() != Code::WASM_FUNCTION && | 878 DCHECK(code->kind() != Code::WASM_FUNCTION && |
878 code->kind() != Code::WASM_TO_JS_FUNCTION); | 879 code->kind() != Code::WASM_TO_JS_FUNCTION); |
879 } | 880 } |
880 #endif | 881 #endif |
881 return handle(target); | 882 return handle(target); |
882 } | 883 } |
883 UNREACHABLE(); | 884 UNREACHABLE(); |
884 return Handle<Code>::null(); | 885 return Handle<Code>::null(); |
885 } | 886 } |
886 | 887 |
887 static Handle<Code> CompileImportWrapper(Isolate* isolate, int index, | 888 Handle<Code> CompileImportWrapper(Isolate* isolate, int index, FunctionSig* sig, |
888 FunctionSig* sig, | 889 Handle<JSReceiver> target, |
889 Handle<JSReceiver> target, | 890 Handle<String> module_name, |
890 Handle<String> module_name, | 891 MaybeHandle<String> import_name, |
891 MaybeHandle<String> import_name, | 892 ModuleOrigin origin) { |
892 ModuleOrigin origin) { | |
893 WasmFunction* other_func = GetWasmFunctionForImportWrapper(isolate, target); | 893 WasmFunction* other_func = GetWasmFunctionForImportWrapper(isolate, target); |
894 if (other_func) { | 894 if (other_func) { |
895 if (sig->Equals(other_func->sig)) { | 895 if (sig->Equals(other_func->sig)) { |
896 // Signature matched. Unwrap the JS->WASM wrapper and return the raw | 896 // Signature matched. Unwrap the JS->WASM wrapper and return the raw |
897 // WASM function code. | 897 // WASM function code. |
898 return UnwrapImportWrapper(target); | 898 return UnwrapImportWrapper(target); |
899 } else { | 899 } else { |
900 return Handle<Code>::null(); | 900 return Handle<Code>::null(); |
901 } | 901 } |
902 } else { | 902 } else { |
903 // Signature mismatch. Compile a new wrapper for the new signature. | 903 // Signature mismatch. Compile a new wrapper for the new signature. |
904 return compiler::CompileWasmToJSWrapper(isolate, target, sig, index, | 904 return compiler::CompileWasmToJSWrapper(isolate, target, sig, index, |
905 module_name, import_name, origin); | 905 module_name, import_name, origin); |
906 } | 906 } |
907 } | 907 } |
908 | 908 |
909 static void UpdateDispatchTablesInternal(Isolate* isolate, | 909 void UpdateDispatchTablesInternal(Isolate* isolate, |
910 Handle<FixedArray> dispatch_tables, | 910 Handle<FixedArray> dispatch_tables, int index, |
911 int index, WasmFunction* function, | 911 WasmFunction* function, Handle<Code> code) { |
912 Handle<Code> code) { | |
913 DCHECK_EQ(0, dispatch_tables->length() % 4); | 912 DCHECK_EQ(0, dispatch_tables->length() % 4); |
914 for (int i = 0; i < dispatch_tables->length(); i += 4) { | 913 for (int i = 0; i < dispatch_tables->length(); i += 4) { |
915 int table_index = Smi::cast(dispatch_tables->get(i + 1))->value(); | 914 int table_index = Smi::cast(dispatch_tables->get(i + 1))->value(); |
916 Handle<FixedArray> function_table( | 915 Handle<FixedArray> function_table( |
917 FixedArray::cast(dispatch_tables->get(i + 2)), isolate); | 916 FixedArray::cast(dispatch_tables->get(i + 2)), isolate); |
918 Handle<FixedArray> signature_table( | 917 Handle<FixedArray> signature_table( |
919 FixedArray::cast(dispatch_tables->get(i + 3)), isolate); | 918 FixedArray::cast(dispatch_tables->get(i + 3)), isolate); |
920 if (function) { | 919 if (function) { |
921 // TODO(titzer): the signature might need to be copied to avoid | 920 // TODO(titzer): the signature might need to be copied to avoid |
922 // a dangling pointer in the signature map. | 921 // a dangling pointer in the signature map. |
923 Handle<WasmInstanceObject> instance( | 922 Handle<WasmInstanceObject> instance( |
924 WasmInstanceObject::cast(dispatch_tables->get(i)), isolate); | 923 WasmInstanceObject::cast(dispatch_tables->get(i)), isolate); |
925 int sig_index = static_cast<int>( | 924 auto func_table = instance->module()->function_tables[table_index]; |
926 instance->module()->function_tables[table_index].map.FindOrInsert( | 925 uint32_t sig_index = func_table.map.FindOrInsert(function->sig); |
927 function->sig)); | 926 signature_table->set(index, Smi::FromInt(static_cast<int>(sig_index))); |
928 signature_table->set(index, Smi::FromInt(sig_index)); | |
929 function_table->set(index, *code); | 927 function_table->set(index, *code); |
930 } else { | 928 } else { |
931 Code* code = nullptr; | |
932 signature_table->set(index, Smi::FromInt(-1)); | 929 signature_table->set(index, Smi::FromInt(-1)); |
933 function_table->set(index, code); | 930 function_table->set(index, Smi::kZero); |
934 } | 931 } |
935 } | 932 } |
936 } | 933 } |
937 | 934 |
| 935 } // namespace |
| 936 |
938 void wasm::UpdateDispatchTables(Isolate* isolate, | 937 void wasm::UpdateDispatchTables(Isolate* isolate, |
939 Handle<FixedArray> dispatch_tables, int index, | 938 Handle<FixedArray> dispatch_tables, int index, |
940 Handle<JSFunction> function) { | 939 Handle<JSFunction> function) { |
941 if (function.is_null()) { | 940 if (function.is_null()) { |
942 UpdateDispatchTablesInternal(isolate, dispatch_tables, index, nullptr, | 941 UpdateDispatchTablesInternal(isolate, dispatch_tables, index, nullptr, |
943 Handle<Code>::null()); | 942 Handle<Code>::null()); |
944 } else { | 943 } else { |
945 UpdateDispatchTablesInternal( | 944 UpdateDispatchTablesInternal( |
946 isolate, dispatch_tables, index, | 945 isolate, dispatch_tables, index, |
947 GetWasmFunctionForImportWrapper(isolate, function), | 946 GetWasmFunctionForImportWrapper(isolate, function), |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 // the owner + original state used for cloning and patching | 1016 // the owner + original state used for cloning and patching |
1018 // won't be mutated by possible finalizer runs. | 1017 // won't be mutated by possible finalizer runs. |
1019 DCHECK(!owner.is_null()); | 1018 DCHECK(!owner.is_null()); |
1020 TRACE("Cloning from %d\n", original->instance_id()); | 1019 TRACE("Cloning from %d\n", original->instance_id()); |
1021 compiled_module_ = WasmCompiledModule::Clone(isolate_, original); | 1020 compiled_module_ = WasmCompiledModule::Clone(isolate_, original); |
1022 // Avoid creating too many handles in the outer scope. | 1021 // Avoid creating too many handles in the outer scope. |
1023 HandleScope scope(isolate_); | 1022 HandleScope scope(isolate_); |
1024 | 1023 |
1025 // Clone the code for WASM functions and exports. | 1024 // Clone the code for WASM functions and exports. |
1026 for (int i = 0; i < code_table->length(); ++i) { | 1025 for (int i = 0; i < code_table->length(); ++i) { |
1027 Handle<Code> orig_code = | 1026 Handle<Code> orig_code(Code::cast(code_table->get(i)), isolate_); |
1028 code_table->GetValueChecked<Code>(isolate_, i); | |
1029 switch (orig_code->kind()) { | 1027 switch (orig_code->kind()) { |
1030 case Code::WASM_TO_JS_FUNCTION: | 1028 case Code::WASM_TO_JS_FUNCTION: |
1031 // Imports will be overwritten with newly compiled wrappers. | 1029 // Imports will be overwritten with newly compiled wrappers. |
1032 break; | 1030 break; |
1033 case Code::JS_TO_WASM_FUNCTION: | 1031 case Code::JS_TO_WASM_FUNCTION: |
1034 case Code::WASM_FUNCTION: { | 1032 case Code::WASM_FUNCTION: { |
1035 Handle<Code> code = factory->CopyCode(orig_code); | 1033 Handle<Code> code = factory->CopyCode(orig_code); |
1036 code_table->set(i, *code); | 1034 code_table->set(i, *code); |
1037 break; | 1035 break; |
1038 } | 1036 } |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 code_specialization.RelocateMemoryReferences(old_mem_start, old_mem_size, | 1178 code_specialization.RelocateMemoryReferences(old_mem_start, old_mem_size, |
1181 mem_start, mem_size); | 1179 mem_start, mem_size); |
1182 compiled_module_->set_memory(memory_); | 1180 compiled_module_->set_memory(memory_); |
1183 } | 1181 } |
1184 | 1182 |
1185 //-------------------------------------------------------------------------- | 1183 //-------------------------------------------------------------------------- |
1186 // Set up the runtime support for the new instance. | 1184 // Set up the runtime support for the new instance. |
1187 //-------------------------------------------------------------------------- | 1185 //-------------------------------------------------------------------------- |
1188 Handle<WeakCell> weak_link = factory->NewWeakCell(instance); | 1186 Handle<WeakCell> weak_link = factory->NewWeakCell(instance); |
1189 | 1187 |
1190 for (int i = num_imported_functions + FLAG_skip_compiling_wasm_funcs; | 1188 for (int i = num_imported_functions + FLAG_skip_compiling_wasm_funcs, |
1191 i < code_table->length(); ++i) { | 1189 num_functions = code_table->length(); |
1192 Handle<Code> code = code_table->GetValueChecked<Code>(isolate_, i); | 1190 i < num_functions; ++i) { |
| 1191 Handle<Code> code = handle(Code::cast(code_table->get(i)), isolate_); |
1193 if (code->kind() == Code::WASM_FUNCTION) { | 1192 if (code->kind() == Code::WASM_FUNCTION) { |
1194 Handle<FixedArray> deopt_data = factory->NewFixedArray(2, TENURED); | 1193 Handle<FixedArray> deopt_data = factory->NewFixedArray(2, TENURED); |
1195 deopt_data->set(0, *weak_link); | 1194 deopt_data->set(0, *weak_link); |
1196 deopt_data->set(1, Smi::FromInt(static_cast<int>(i))); | 1195 deopt_data->set(1, Smi::FromInt(i)); |
1197 deopt_data->set_length(2); | |
1198 code->set_deoptimization_data(*deopt_data); | 1196 code->set_deoptimization_data(*deopt_data); |
1199 } | 1197 } |
1200 } | 1198 } |
1201 | 1199 |
1202 //-------------------------------------------------------------------------- | 1200 //-------------------------------------------------------------------------- |
1203 // Set up the exports object for the new instance. | 1201 // Set up the exports object for the new instance. |
1204 //-------------------------------------------------------------------------- | 1202 //-------------------------------------------------------------------------- |
1205 ProcessExports(code_table, instance, compiled_module_); | 1203 ProcessExports(code_table, instance, compiled_module_); |
1206 | 1204 |
1207 //-------------------------------------------------------------------------- | 1205 //-------------------------------------------------------------------------- |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 //-------------------------------------------------------------------------- | 1294 //-------------------------------------------------------------------------- |
1297 WasmSharedModuleData::SetBreakpointsOnNewInstance( | 1295 WasmSharedModuleData::SetBreakpointsOnNewInstance( |
1298 compiled_module_->shared(), instance); | 1296 compiled_module_->shared(), instance); |
1299 | 1297 |
1300 //-------------------------------------------------------------------------- | 1298 //-------------------------------------------------------------------------- |
1301 // Run the start function if one was specified. | 1299 // Run the start function if one was specified. |
1302 //-------------------------------------------------------------------------- | 1300 //-------------------------------------------------------------------------- |
1303 if (module_->start_function_index >= 0) { | 1301 if (module_->start_function_index >= 0) { |
1304 HandleScope scope(isolate_); | 1302 HandleScope scope(isolate_); |
1305 int start_index = module_->start_function_index; | 1303 int start_index = module_->start_function_index; |
1306 Handle<Code> startup_code = | 1304 Handle<Code> startup_code(Code::cast(code_table->get(start_index)), |
1307 code_table->GetValueChecked<Code>(isolate_, start_index); | 1305 isolate_); |
1308 FunctionSig* sig = module_->functions[start_index].sig; | 1306 FunctionSig* sig = module_->functions[start_index].sig; |
1309 Handle<Code> wrapper_code = | 1307 Handle<Code> wrapper_code = |
1310 js_to_wasm_cache_.CloneOrCompileJSToWasmWrapper( | 1308 js_to_wasm_cache_.CloneOrCompileJSToWasmWrapper( |
1311 isolate_, module_, startup_code, start_index); | 1309 isolate_, module_, startup_code, start_index); |
1312 Handle<WasmExportedFunction> startup_fct = WasmExportedFunction::New( | 1310 Handle<WasmExportedFunction> startup_fct = WasmExportedFunction::New( |
1313 isolate_, instance, MaybeHandle<String>(), start_index, | 1311 isolate_, instance, MaybeHandle<String>(), start_index, |
1314 static_cast<int>(sig->parameter_count()), wrapper_code); | 1312 static_cast<int>(sig->parameter_count()), wrapper_code); |
1315 RecordStats(isolate_, *startup_code); | 1313 RecordStats(isolate_, *startup_code); |
1316 // Call the JS function. | 1314 // Call the JS function. |
1317 Handle<Object> undefined = factory->undefined_value(); | 1315 Handle<Object> undefined = factory->undefined_value(); |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1995 Handle<WasmInstanceObject>::null(), index, | 1993 Handle<WasmInstanceObject>::null(), index, |
1996 Handle<FixedArray>::null(), Handle<FixedArray>::null()); | 1994 Handle<FixedArray>::null(), Handle<FixedArray>::null()); |
1997 } | 1995 } |
1998 | 1996 |
1999 // TODO(titzer): this does redundant work if there are multiple tables, | 1997 // TODO(titzer): this does redundant work if there are multiple tables, |
2000 // since initializations are not sorted by table index. | 1998 // since initializations are not sorted by table index. |
2001 for (auto table_init : module_->table_inits) { | 1999 for (auto table_init : module_->table_inits) { |
2002 uint32_t base = EvalUint32InitExpr(table_init.offset); | 2000 uint32_t base = EvalUint32InitExpr(table_init.offset); |
2003 DCHECK(in_bounds(base, static_cast<uint32_t>(table_init.entries.size()), | 2001 DCHECK(in_bounds(base, static_cast<uint32_t>(table_init.entries.size()), |
2004 table_instance.function_table->length())); | 2002 table_instance.function_table->length())); |
2005 for (int i = 0; i < static_cast<int>(table_init.entries.size()); ++i) { | 2003 for (int i = 0, e = static_cast<int>(table_init.entries.size()); i < e; |
| 2004 ++i) { |
2006 uint32_t func_index = table_init.entries[i]; | 2005 uint32_t func_index = table_init.entries[i]; |
2007 WasmFunction* function = &module_->functions[func_index]; | 2006 WasmFunction* function = &module_->functions[func_index]; |
2008 int table_index = static_cast<int>(i + base); | 2007 int table_index = static_cast<int>(i + base); |
2009 int32_t sig_index = table.map.Find(function->sig); | 2008 int32_t sig_index = table.map.Find(function->sig); |
2010 DCHECK_GE(sig_index, 0); | 2009 DCHECK_GE(sig_index, 0); |
2011 table_instance.signature_table->set(table_index, | 2010 table_instance.signature_table->set(table_index, |
2012 Smi::FromInt(sig_index)); | 2011 Smi::FromInt(sig_index)); |
2013 table_instance.function_table->set(table_index, | 2012 table_instance.function_table->set(table_index, |
2014 code_table->get(func_index)); | 2013 code_table->get(func_index)); |
2015 | 2014 |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2635 } | 2634 } |
2636 | 2635 |
2637 MaybeHandle<WasmInstanceObject> wasm::SyncInstantiate( | 2636 MaybeHandle<WasmInstanceObject> wasm::SyncInstantiate( |
2638 Isolate* isolate, ErrorThrower* thrower, | 2637 Isolate* isolate, ErrorThrower* thrower, |
2639 Handle<WasmModuleObject> module_object, MaybeHandle<JSReceiver> imports, | 2638 Handle<WasmModuleObject> module_object, MaybeHandle<JSReceiver> imports, |
2640 MaybeHandle<JSArrayBuffer> memory) { | 2639 MaybeHandle<JSArrayBuffer> memory) { |
2641 InstantiationHelper helper(isolate, thrower, module_object, imports, memory); | 2640 InstantiationHelper helper(isolate, thrower, module_object, imports, memory); |
2642 return helper.Build(); | 2641 return helper.Build(); |
2643 } | 2642 } |
2644 | 2643 |
| 2644 namespace { |
| 2645 |
2645 void RejectPromise(Isolate* isolate, ErrorThrower* thrower, | 2646 void RejectPromise(Isolate* isolate, ErrorThrower* thrower, |
2646 Handle<JSPromise> promise) { | 2647 Handle<JSPromise> promise) { |
2647 v8::Local<v8::Promise::Resolver> resolver = | 2648 v8::Local<v8::Promise::Resolver> resolver = |
2648 v8::Utils::PromiseToLocal(promise).As<v8::Promise::Resolver>(); | 2649 v8::Utils::PromiseToLocal(promise).As<v8::Promise::Resolver>(); |
2649 Handle<Context> context(isolate->context(), isolate); | 2650 Handle<Context> context(isolate->context(), isolate); |
2650 resolver->Reject(v8::Utils::ToLocal(context), | 2651 resolver->Reject(v8::Utils::ToLocal(context), |
2651 v8::Utils::ToLocal(thrower->Reify())); | 2652 v8::Utils::ToLocal(thrower->Reify())); |
2652 } | 2653 } |
2653 | 2654 |
2654 void ResolvePromise(Isolate* isolate, Handle<JSPromise> promise, | 2655 void ResolvePromise(Isolate* isolate, Handle<JSPromise> promise, |
2655 Handle<Object> result) { | 2656 Handle<Object> result) { |
2656 v8::Local<v8::Promise::Resolver> resolver = | 2657 v8::Local<v8::Promise::Resolver> resolver = |
2657 v8::Utils::PromiseToLocal(promise).As<v8::Promise::Resolver>(); | 2658 v8::Utils::PromiseToLocal(promise).As<v8::Promise::Resolver>(); |
2658 Handle<Context> context(isolate->context(), isolate); | 2659 Handle<Context> context(isolate->context(), isolate); |
2659 resolver->Resolve(v8::Utils::ToLocal(context), v8::Utils::ToLocal(result)); | 2660 resolver->Resolve(v8::Utils::ToLocal(context), v8::Utils::ToLocal(result)); |
2660 } | 2661 } |
2661 | 2662 |
| 2663 } // namespace |
| 2664 |
2662 void wasm::AsyncCompile(Isolate* isolate, Handle<JSPromise> promise, | 2665 void wasm::AsyncCompile(Isolate* isolate, Handle<JSPromise> promise, |
2663 const ModuleWireBytes& bytes) { | 2666 const ModuleWireBytes& bytes) { |
2664 ErrorThrower thrower(isolate, nullptr); | 2667 ErrorThrower thrower(isolate, nullptr); |
2665 MaybeHandle<WasmModuleObject> module_object = | 2668 MaybeHandle<WasmModuleObject> module_object = |
2666 SyncCompile(isolate, &thrower, bytes); | 2669 SyncCompile(isolate, &thrower, bytes); |
2667 if (thrower.error()) { | 2670 if (thrower.error()) { |
2668 RejectPromise(isolate, &thrower, promise); | 2671 RejectPromise(isolate, &thrower, promise); |
2669 return; | 2672 return; |
2670 } | 2673 } |
2671 ResolvePromise(isolate, promise, module_object.ToHandleChecked()); | 2674 ResolvePromise(isolate, promise, module_object.ToHandleChecked()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2714 Handle<String> module_property_name = | 2717 Handle<String> module_property_name = |
2715 isolate->factory()->InternalizeUtf8String("module"); | 2718 isolate->factory()->InternalizeUtf8String("module"); |
2716 Handle<String> instance_property_name = | 2719 Handle<String> instance_property_name = |
2717 isolate->factory()->InternalizeUtf8String("instance"); | 2720 isolate->factory()->InternalizeUtf8String("instance"); |
2718 JSObject::AddProperty(ret, module_property_name, module, NONE); | 2721 JSObject::AddProperty(ret, module_property_name, module, NONE); |
2719 JSObject::AddProperty(ret, instance_property_name, | 2722 JSObject::AddProperty(ret, instance_property_name, |
2720 instance_object.ToHandleChecked(), NONE); | 2723 instance_object.ToHandleChecked(), NONE); |
2721 | 2724 |
2722 ResolvePromise(isolate, promise, ret); | 2725 ResolvePromise(isolate, promise, ret); |
2723 } | 2726 } |
OLD | NEW |