| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->IsName()) { |
| 265 Handle<Name> name = Handle<Name>::cast(function_name); | 265 Handle<Name> name = Handle<Name>::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 if (name->IsString() && FLAG_harmony_function_name) { | 268 Handle<String> name_string = Handle<String>::cast(name); |
| 269 Handle<String> name_string = Handle<String>::cast(name); | 269 if (name_string->IsUtf8EqualTo(CStrVector("get "), true) || |
| 270 if (name_string->IsUtf8EqualTo(CStrVector("get "), true) || | 270 name_string->IsUtf8EqualTo(CStrVector("set "), true)) { |
| 271 name_string->IsUtf8EqualTo(CStrVector("set "), true)) { | 271 name = isolate_->factory()->NewProperSubString(name_string, 4, |
| 272 name = isolate_->factory()->NewProperSubString(name_string, 4, | 272 name_string->length()); |
| 273 name_string->length()); | |
| 274 } | |
| 275 } | 273 } |
| 276 if (CheckMethodName(isolate_, obj, name, fun_, | 274 if (CheckMethodName(isolate_, obj, name, fun_, |
| 277 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR)) { | 275 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR)) { |
| 278 return name; | 276 return name; |
| 279 } | 277 } |
| 280 } | 278 } |
| 281 | 279 |
| 282 HandleScope outer_scope(isolate_); | 280 HandleScope outer_scope(isolate_); |
| 283 Handle<Object> result; | 281 Handle<Object> result; |
| 284 for (PrototypeIterator iter(isolate_, obj, kStartAtReceiver); !iter.IsAtEnd(); | 282 for (PrototypeIterator iter(isolate_, obj, kStartAtReceiver); !iter.IsAtEnd(); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 builder.AppendCharacter(*c); | 439 builder.AppendCharacter(*c); |
| 442 } | 440 } |
| 443 } | 441 } |
| 444 | 442 |
| 445 return builder.Finish(); | 443 return builder.Finish(); |
| 446 } | 444 } |
| 447 | 445 |
| 448 | 446 |
| 449 } // namespace internal | 447 } // namespace internal |
| 450 } // namespace v8 | 448 } // namespace v8 |
| OLD | NEW |