| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/messages.h" | 5 #include "src/messages.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/execution.h" | 10 #include "src/execution.h" |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 receiver->IsJSObject() && wasm::IsWasmObject(JSObject::cast(*receiver)); | 909 receiver->IsJSObject() && wasm::IsWasmObject(JSObject::cast(*receiver)); |
| 910 if (!fun->IsJSFunction() && !is_wasm_object) { | 910 if (!fun->IsJSFunction() && !is_wasm_object) { |
| 911 THROW_NEW_ERROR(isolate, | 911 THROW_NEW_ERROR(isolate, |
| 912 NewTypeError(MessageTemplate::kCallSiteExpectsFunction, | 912 NewTypeError(MessageTemplate::kCallSiteExpectsFunction, |
| 913 Object::TypeOf(isolate, receiver), | 913 Object::TypeOf(isolate, receiver), |
| 914 Object::TypeOf(isolate, fun)), | 914 Object::TypeOf(isolate, fun)), |
| 915 Object); | 915 Object); |
| 916 } | 916 } |
| 917 | 917 |
| 918 if (is_wasm_object) { | 918 if (is_wasm_object) { |
| 919 DCHECK(fun->IsSmi()); | 919 // TODO(jgruber): Convert back to DCHECK once the callsite constructor is |
| 920 DCHECK(wasm::GetNumberOfFunctions(JSObject::cast(*receiver)) > | 920 // inaccessible from JS. |
| 921 Smi::cast(*fun)->value()); | 921 CHECK(fun->IsSmi() && (wasm::GetNumberOfFunctions(JSObject::cast( |
| 922 *receiver)) > Smi::cast(*fun)->value())); |
| 922 | 923 |
| 923 SET_CALLSITE_PROPERTY(obj, call_site_wasm_obj_symbol, receiver); | 924 SET_CALLSITE_PROPERTY(obj, call_site_wasm_obj_symbol, receiver); |
| 924 SET_CALLSITE_PROPERTY(obj, call_site_wasm_func_index_symbol, fun); | 925 SET_CALLSITE_PROPERTY(obj, call_site_wasm_func_index_symbol, fun); |
| 925 } else { | 926 } else { |
| 926 DCHECK(fun->IsJSFunction()); | 927 DCHECK(fun->IsJSFunction()); |
| 927 SET_CALLSITE_PROPERTY(obj, call_site_receiver_symbol, receiver); | 928 SET_CALLSITE_PROPERTY(obj, call_site_receiver_symbol, receiver); |
| 928 SET_CALLSITE_PROPERTY(obj, call_site_function_symbol, fun); | 929 SET_CALLSITE_PROPERTY(obj, call_site_function_symbol, fun); |
| 929 } | 930 } |
| 930 | 931 |
| 931 DCHECK(pos->IsSmi()); | 932 // TODO(jgruber): Convert back to DCHECK once the callsite constructor is |
| 933 // inaccessible from JS. |
| 934 CHECK(pos->IsSmi()); |
| 935 |
| 932 SET_CALLSITE_PROPERTY(obj, call_site_position_symbol, pos); | 936 SET_CALLSITE_PROPERTY(obj, call_site_position_symbol, pos); |
| 933 SET_CALLSITE_PROPERTY( | 937 SET_CALLSITE_PROPERTY( |
| 934 obj, call_site_strict_symbol, | 938 obj, call_site_strict_symbol, |
| 935 isolate->factory()->ToBoolean(strict_mode->BooleanValue())); | 939 isolate->factory()->ToBoolean(strict_mode->BooleanValue())); |
| 936 | 940 |
| 937 return obj; | 941 return obj; |
| 938 } | 942 } |
| 939 | 943 |
| 940 #undef SET_CALLSITE_PROPERTY | 944 #undef SET_CALLSITE_PROPERTY |
| 941 | 945 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 builder.AppendCString(" ("); | 1167 builder.AppendCString(" ("); |
| 1164 RETURN_ON_EXCEPTION( | 1168 RETURN_ON_EXCEPTION( |
| 1165 isolate, AppendFileLocation(isolate, recv, &call_site, &builder), String); | 1169 isolate, AppendFileLocation(isolate, recv, &call_site, &builder), String); |
| 1166 builder.AppendCString(")"); | 1170 builder.AppendCString(")"); |
| 1167 | 1171 |
| 1168 RETURN_RESULT(isolate, builder.Finish(), String); | 1172 RETURN_RESULT(isolate, builder.Finish(), String); |
| 1169 } | 1173 } |
| 1170 | 1174 |
| 1171 } // namespace internal | 1175 } // namespace internal |
| 1172 } // namespace v8 | 1176 } // namespace v8 |
| OLD | NEW |