Chromium Code Reviews| 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()) |
|
Yang
2016/05/18 13:38:48
brackets around the if-body.
Clemens Hammacher
2016/05/18 17:44:07
Done.
| |
| 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 if (name.is_null()) return isolate_->factory()->null_value(); |
| 213 wasm_func_index_); | 213 return name.ToHandleChecked(); |
| 214 } | 214 } |
| 215 Handle<String> result = JSFunction::GetName(fun_); | 215 Handle<String> result = JSFunction::GetName(fun_); |
| 216 if (result->length() != 0) return result; | 216 if (result->length() != 0) return result; |
| 217 | 217 |
| 218 Handle<Object> script(fun_->shared()->script(), isolate_); | 218 Handle<Object> script(fun_->shared()->script(), isolate_); |
| 219 if (script->IsScript() && | 219 if (script->IsScript() && |
| 220 Handle<Script>::cast(script)->compilation_type() == | 220 Handle<Script>::cast(script)->compilation_type() == |
| 221 Script::COMPILATION_TYPE_EVAL) { | 221 Script::COMPILATION_TYPE_EVAL) { |
| 222 return isolate_->factory()->eval_string(); | 222 return isolate_->factory()->eval_string(); |
| 223 } | 223 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 builder.AppendCharacter(*c); | 445 builder.AppendCharacter(*c); |
| 446 } | 446 } |
| 447 } | 447 } |
| 448 | 448 |
| 449 return builder.Finish(); | 449 return builder.Finish(); |
| 450 } | 450 } |
| 451 | 451 |
| 452 | 452 |
| 453 } // namespace internal | 453 } // namespace internal |
| 454 } // namespace v8 | 454 } // namespace v8 |
| OLD | NEW |