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

Unified Diff: src/messages.cc

Issue 1751403004: Handle ES2015 Function.name in CallSite::GetMethodName (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/stack-traces-custom.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.cc
diff --git a/src/messages.cc b/src/messages.cc
index 072ac1d5a694a41f7d33a21363cf114ee29ca05e..67ab36f6cf0af2f6cc65a17fb3b69589d8eeedd8 100644
--- a/src/messages.cc
+++ b/src/messages.cc
@@ -236,9 +236,20 @@ Handle<Object> CallSite::GetMethodName() {
Handle<Object> function_name(fun_->shared()->name(), isolate_);
if (function_name->IsName()) {
Handle<Name> name = Handle<Name>::cast(function_name);
+ // ES2015 gives getters and setters name prefixes which must
+ // be stripped to find the property name.
+ if (name->IsString() && FLAG_harmony_function_name) {
+ Handle<String> name_string = Handle<String>::cast(name);
+ if (name_string->IsUtf8EqualTo(CStrVector("get "), true) ||
+ name_string->IsUtf8EqualTo(CStrVector("set "), true)) {
+ name = isolate_->factory()->NewProperSubString(name_string, 4,
+ name_string->length());
+ }
+ }
if (CheckMethodName(isolate_, obj, name, fun_,
- LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR))
+ LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR)) {
return name;
+ }
}
HandleScope outer_scope(isolate_);
« no previous file with comments | « no previous file | test/mjsunit/stack-traces-custom.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698