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 "src/api.h" | 7 #include "src/api.h" |
8 #include "src/execution.h" | 8 #include "src/execution.h" |
9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
10 #include "src/keys.h" | 10 #include "src/keys.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 Handle<Object> CallSite::GetFileName() { | 198 Handle<Object> CallSite::GetFileName() { |
199 if (!IsJavaScript()) return isolate_->factory()->null_value(); | 199 if (!IsJavaScript()) return isolate_->factory()->null_value(); |
200 Object* script = fun_->shared()->script(); | 200 Object* script = fun_->shared()->script(); |
201 if (!script->IsScript()) return isolate_->factory()->null_value(); | 201 if (!script->IsScript()) return isolate_->factory()->null_value(); |
202 return Handle<Object>(Script::cast(script)->name(), isolate_); | 202 return Handle<Object>(Script::cast(script)->name(), isolate_); |
203 } | 203 } |
204 | 204 |
205 | 205 |
206 Handle<Object> CallSite::GetFunctionName() { | 206 Handle<Object> CallSite::GetFunctionName() { |
207 if (IsWasm()) { | 207 if (IsWasm()) { |
208 if (wasm_obj_->IsUndefined()) return isolate_->factory()->null_value(); | 208 MaybeHandle<String> name; |
209 // wasm_obj_ can be a String if we generate WASM code directly in a test | 209 if (!wasm_obj_->IsUndefined()) { |
210 // case. | 210 name = wasm::GetWasmFunctionName(Handle<JSObject>::cast(wasm_obj_), |
211 if (wasm_obj_->IsString()) return wasm_obj_; | 211 wasm_func_index_); |
212 return wasm::GetWasmFunctionName(Handle<JSObject>::cast(wasm_obj_), | 212 } |
213 wasm_func_index_); | 213 if (name.is_null()) return isolate_->factory()->null_value(); |
| 214 return name.ToHandleChecked(); |
214 } | 215 } |
215 Handle<String> result = JSFunction::GetName(fun_); | 216 Handle<String> result = JSFunction::GetName(fun_); |
216 if (result->length() != 0) return result; | 217 if (result->length() != 0) return result; |
217 | 218 |
218 Handle<Object> script(fun_->shared()->script(), isolate_); | 219 Handle<Object> script(fun_->shared()->script(), isolate_); |
219 if (script->IsScript() && | 220 if (script->IsScript() && |
220 Handle<Script>::cast(script)->compilation_type() == | 221 Handle<Script>::cast(script)->compilation_type() == |
221 Script::COMPILATION_TYPE_EVAL) { | 222 Script::COMPILATION_TYPE_EVAL) { |
222 return isolate_->factory()->eval_string(); | 223 return isolate_->factory()->eval_string(); |
223 } | 224 } |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 builder.AppendCharacter(*c); | 446 builder.AppendCharacter(*c); |
446 } | 447 } |
447 } | 448 } |
448 | 449 |
449 return builder.Finish(); | 450 return builder.Finish(); |
450 } | 451 } |
451 | 452 |
452 | 453 |
453 } // namespace internal | 454 } // namespace internal |
454 } // namespace v8 | 455 } // namespace v8 |
OLD | NEW |