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

Side by Side Diff: src/messages.cc

Issue 2162853003: Simplify and correct logic in CallSite::GetMethodName (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 return isolate_->factory()->null_value(); 254 return isolate_->factory()->null_value();
255 } 255 }
256 Handle<JSReceiver> receiver = 256 Handle<JSReceiver> receiver =
257 Object::ToObject(isolate_, receiver_).ToHandleChecked(); 257 Object::ToObject(isolate_, receiver_).ToHandleChecked();
258 if (!receiver->IsJSObject()) { 258 if (!receiver->IsJSObject()) {
259 return isolate_->factory()->null_value(); 259 return isolate_->factory()->null_value();
260 } 260 }
261 261
262 Handle<JSObject> obj = Handle<JSObject>::cast(receiver); 262 Handle<JSObject> obj = Handle<JSObject>::cast(receiver);
263 Handle<Object> function_name(fun_->shared()->name(), isolate_); 263 Handle<Object> function_name(fun_->shared()->name(), isolate_);
264 if (function_name->IsName()) { 264 if (function_name->IsString()) {
265 Handle<Name> name = Handle<Name>::cast(function_name); 265 Handle<String> name = Handle<String>::cast(function_name);
266 // ES2015 gives getters and setters name prefixes which must 266 // ES2015 gives getters and setters name prefixes which must
267 // be stripped to find the property name. 267 // be stripped to find the property name.
268 Handle<String> name_string = Handle<String>::cast(name); 268 if (name->IsUtf8EqualTo(CStrVector("get "), true) ||
269 if (name_string->IsUtf8EqualTo(CStrVector("get "), true) || 269 name->IsUtf8EqualTo(CStrVector("set "), true)) {
270 name_string->IsUtf8EqualTo(CStrVector("set "), true)) { 270 name = isolate_->factory()->NewProperSubString(name, 4, name->length());
271 name = isolate_->factory()->NewProperSubString(name_string, 4,
272 name_string->length());
273 } 271 }
274 if (CheckMethodName(isolate_, obj, name, fun_, 272 if (CheckMethodName(isolate_, obj, name, fun_,
275 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR)) { 273 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR)) {
276 return name; 274 return name;
277 } 275 }
278 } 276 }
279 277
280 HandleScope outer_scope(isolate_); 278 HandleScope outer_scope(isolate_);
281 Handle<Object> result; 279 Handle<Object> result;
282 for (PrototypeIterator iter(isolate_, obj, kStartAtReceiver); !iter.IsAtEnd(); 280 for (PrototypeIterator iter(isolate_, obj, kStartAtReceiver); !iter.IsAtEnd();
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 builder.AppendCharacter(*c); 441 builder.AppendCharacter(*c);
444 } 442 }
445 } 443 }
446 444
447 return builder.Finish(); 445 return builder.Finish();
448 } 446 }
449 447
450 448
451 } // namespace internal 449 } // namespace internal
452 } // namespace v8 450 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698