Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/api.cc

Issue 1706823003: Use displayName in Error.stack rendering if present. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/js/messages.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 4443 matching lines...) Expand 10 before | Expand all | Expand 10 after
4454 4454
4455 Local<Value> Function::GetDisplayName() const { 4455 Local<Value> Function::GetDisplayName() const {
4456 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 4456 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4457 ENTER_V8(isolate); 4457 ENTER_V8(isolate);
4458 auto self = Utils::OpenHandle(this); 4458 auto self = Utils::OpenHandle(this);
4459 if (!self->IsJSFunction()) { 4459 if (!self->IsJSFunction()) {
4460 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); 4460 return ToApiHandle<Primitive>(isolate->factory()->undefined_value());
4461 } 4461 }
4462 auto func = i::Handle<i::JSFunction>::cast(self); 4462 auto func = i::Handle<i::JSFunction>::cast(self);
4463 i::Handle<i::String> property_name = 4463 i::Handle<i::String> property_name =
4464 isolate->factory()->NewStringFromStaticChars("displayName"); 4464 isolate->factory()->display_name_string();
4465 i::Handle<i::Object> value = 4465 i::Handle<i::Object> value =
4466 i::JSReceiver::GetDataProperty(func, property_name); 4466 i::JSReceiver::GetDataProperty(func, property_name);
4467 if (value->IsString()) { 4467 if (value->IsString()) {
4468 i::Handle<i::String> name = i::Handle<i::String>::cast(value); 4468 i::Handle<i::String> name = i::Handle<i::String>::cast(value);
4469 if (name->length() > 0) return Utils::ToLocal(name); 4469 if (name->length() > 0) return Utils::ToLocal(name);
4470 } 4470 }
4471 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); 4471 return ToApiHandle<Primitive>(isolate->factory()->undefined_value());
4472 } 4472 }
4473 4473
4474 4474
(...skipping 4087 matching lines...) Expand 10 before | Expand all | Expand 10 after
8562 Address callback_address = 8562 Address callback_address =
8563 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8563 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8564 VMState<EXTERNAL> state(isolate); 8564 VMState<EXTERNAL> state(isolate);
8565 ExternalCallbackScope call_scope(isolate, callback_address); 8565 ExternalCallbackScope call_scope(isolate, callback_address);
8566 callback(info); 8566 callback(info);
8567 } 8567 }
8568 8568
8569 8569
8570 } // namespace internal 8570 } // namespace internal
8571 } // namespace v8 8571 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/js/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698