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

Unified Diff: src/objects.cc

Issue 1988023004: Speed up common ObjectProtoToString cases (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: restore bootstrapper Created 4 years, 7 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 | « src/heap-symbols.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 47285b117aecbbc6365edb9c634ec8705c119d93..2fcdcc8e334f45c7581b15047772a81de3c10572 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -15246,8 +15246,12 @@ bool JSObject::WasConstructedFromApiFunction() {
MaybeHandle<String> Object::ObjectProtoToString(Isolate* isolate,
Handle<Object> object) {
- if (object->IsUndefined()) return isolate->factory()->undefined_to_string();
- if (object->IsNull()) return isolate->factory()->null_to_string();
+ if (*object == isolate->heap()->undefined_value()) {
+ return isolate->factory()->undefined_to_string();
+ }
+ if (*object == isolate->heap()->null_value()) {
+ return isolate->factory()->null_to_string();
+ }
Handle<JSReceiver> receiver =
Object::ToObject(isolate, object).ToHandleChecked();
@@ -15268,6 +15272,18 @@ MaybeHandle<String> Object::ObjectProtoToString(Isolate* isolate,
JSReceiver::BuiltinStringTag(receiver), String);
}
+ if (*tag == isolate->heap()->Object_string()) {
+ return isolate->factory()->object_to_string();
+ }
+ if (*tag == isolate->heap()->String_string()) {
+ return isolate->factory()->string_to_string();
+ }
+ if (*tag == isolate->heap()->Array_string()) {
+ return isolate->factory()->array_to_string();
+ }
+ if (*tag == isolate->heap()->Function_string()) {
+ return isolate->factory()->function_to_string();
+ }
IncrementalStringBuilder builder(isolate);
builder.AppendCString("[object ");
builder.AppendString(tag);
« no previous file with comments | « src/heap-symbols.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698