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/objects.cc

Issue 1784033002: Remove --harmony-tostring runtime flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « src/js/symbol.js ('k') | test/cctest/test-api.cc » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 JSFunction* constructor = JSFunction::cast(maybe_constructor); 2456 JSFunction* constructor = JSFunction::cast(maybe_constructor);
2457 String* name = String::cast(constructor->shared()->name()); 2457 String* name = String::cast(constructor->shared()->name());
2458 if (name->length() == 0) name = constructor->shared()->inferred_name(); 2458 if (name->length() == 0) name = constructor->shared()->inferred_name();
2459 if (name->length() != 0 && 2459 if (name->length() != 0 &&
2460 !name->Equals(isolate->heap()->Object_string())) { 2460 !name->Equals(isolate->heap()->Object_string())) {
2461 return handle(name, isolate); 2461 return handle(name, isolate);
2462 } 2462 }
2463 } 2463 }
2464 } 2464 }
2465 2465
2466 if (FLAG_harmony_tostring) { 2466 Handle<Object> maybe_tag = JSReceiver::GetDataProperty(
2467 Handle<Object> maybe_tag = JSReceiver::GetDataProperty( 2467 receiver, isolate->factory()->to_string_tag_symbol());
2468 receiver, isolate->factory()->to_string_tag_symbol()); 2468 if (maybe_tag->IsString()) return Handle<String>::cast(maybe_tag);
2469 if (maybe_tag->IsString()) return Handle<String>::cast(maybe_tag);
2470 }
2471 2469
2472 PrototypeIterator iter(isolate, receiver); 2470 PrototypeIterator iter(isolate, receiver);
2473 if (iter.IsAtEnd()) return handle(receiver->class_name()); 2471 if (iter.IsAtEnd()) return handle(receiver->class_name());
2474 Handle<JSReceiver> start = PrototypeIterator::GetCurrent<JSReceiver>(iter); 2472 Handle<JSReceiver> start = PrototypeIterator::GetCurrent<JSReceiver>(iter);
2475 LookupIterator it(receiver, isolate->factory()->constructor_string(), start, 2473 LookupIterator it(receiver, isolate->factory()->constructor_string(), start,
2476 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); 2474 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
2477 Handle<Object> maybe_constructor = JSReceiver::GetDataProperty(&it); 2475 Handle<Object> maybe_constructor = JSReceiver::GetDataProperty(&it);
2478 Handle<String> result = isolate->factory()->Object_string(); 2476 Handle<String> result = isolate->factory()->Object_string();
2479 if (maybe_constructor->IsJSFunction()) { 2477 if (maybe_constructor->IsJSFunction()) {
2480 JSFunction* constructor = JSFunction::cast(*maybe_constructor); 2478 JSFunction* constructor = JSFunction::cast(*maybe_constructor);
(...skipping 14159 matching lines...) Expand 10 before | Expand all | Expand 10 after
16640 16638
16641 MaybeHandle<String> Object::ObjectProtoToString(Isolate* isolate, 16639 MaybeHandle<String> Object::ObjectProtoToString(Isolate* isolate,
16642 Handle<Object> object) { 16640 Handle<Object> object) {
16643 if (object->IsUndefined()) return isolate->factory()->undefined_to_string(); 16641 if (object->IsUndefined()) return isolate->factory()->undefined_to_string();
16644 if (object->IsNull()) return isolate->factory()->null_to_string(); 16642 if (object->IsNull()) return isolate->factory()->null_to_string();
16645 16643
16646 Handle<JSReceiver> receiver = 16644 Handle<JSReceiver> receiver =
16647 Object::ToObject(isolate, object).ToHandleChecked(); 16645 Object::ToObject(isolate, object).ToHandleChecked();
16648 16646
16649 Handle<String> tag; 16647 Handle<String> tag;
16650 if (FLAG_harmony_tostring) { 16648 Handle<Object> to_string_tag;
16651 Handle<Object> to_string_tag; 16649 ASSIGN_RETURN_ON_EXCEPTION(
16652 ASSIGN_RETURN_ON_EXCEPTION( 16650 isolate, to_string_tag,
16653 isolate, to_string_tag, 16651 JSReceiver::GetProperty(receiver,
16654 JSReceiver::GetProperty(receiver, 16652 isolate->factory()->to_string_tag_symbol()),
16655 isolate->factory()->to_string_tag_symbol()), 16653 String);
16656 String); 16654 if (to_string_tag->IsString()) {
16657 if (to_string_tag->IsString()) { 16655 tag = Handle<String>::cast(to_string_tag);
16658 tag = Handle<String>::cast(to_string_tag);
16659 }
16660 } 16656 }
16661 16657
16662 if (tag.is_null()) { 16658 if (tag.is_null()) {
16663 ASSIGN_RETURN_ON_EXCEPTION(isolate, tag, 16659 ASSIGN_RETURN_ON_EXCEPTION(isolate, tag,
16664 JSReceiver::BuiltinStringTag(receiver), String); 16660 JSReceiver::BuiltinStringTag(receiver), String);
16665 } 16661 }
16666 16662
16667 IncrementalStringBuilder builder(isolate); 16663 IncrementalStringBuilder builder(isolate);
16668 builder.AppendCString("[object "); 16664 builder.AppendCString("[object ");
16669 builder.AppendString(tag); 16665 builder.AppendString(tag);
(...skipping 3124 matching lines...) Expand 10 before | Expand all | Expand 10 after
19794 if (cell->value() != *new_value) { 19790 if (cell->value() != *new_value) {
19795 cell->set_value(*new_value); 19791 cell->set_value(*new_value);
19796 Isolate* isolate = cell->GetIsolate(); 19792 Isolate* isolate = cell->GetIsolate();
19797 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19793 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19798 isolate, DependentCode::kPropertyCellChangedGroup); 19794 isolate, DependentCode::kPropertyCellChangedGroup);
19799 } 19795 }
19800 } 19796 }
19801 19797
19802 } // namespace internal 19798 } // namespace internal
19803 } // namespace v8 19799 } // namespace v8
OLDNEW
« no previous file with comments | « src/js/symbol.js ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698